Skip to content

Commit

Permalink
- Fix fatal error after last commit in rcube_imap (#1485825)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Apr 28, 2009
1 parent 89635b9 commit b20bca7
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions program/include/rcube_imap.php
Expand Up @@ -1124,15 +1124,8 @@ function &get_structure($uid, $structure_str='')
// set message charset from message headers
if ($headers->charset)
$this->struct_charset = $headers->charset;
// ... or from first part headers
else if (is_array($structure[2]) && $structure[2][0] == 'charset')
$this->struct_charset = $structure[2][1];
else if (is_array($structure[0][2]) && $structure[0][2][0] == 'charset')
$this->struct_charset = $structure[0][2][1];
else if (is_array($structure[0][0][2]) && $structure[0][0][2][0] == 'charset')
$this->struct_charset = $structure[0][0][2][1];
else
$this->struct_charset = null;
$this->struct_charset = $this->_structure_charset($structure);

$struct = &$this->_structure_part($structure);
$struct->headers = get_object_vars($headers);
Expand Down Expand Up @@ -1390,8 +1383,25 @@ function _set_part_filename(&$part, $headers=null)
$part->filename = rcube_charset_convert(urldecode($filename_encoded), $filename_charset);
}
}




/**
* Get charset name from message structure (first part)
*
* @access private
* @param array Message structure
* @return string Charset name
*/
function _structure_charset($structure)
{
while (is_array($structure)) {
if (is_array($structure[2]) && $structure[2][0] == 'charset')
return $structure[2][1];
$structure = $structure[0];
}
}


/**
* Fetch message body of a specific message from the server
*
Expand Down

0 comments on commit b20bca7

Please sign in to comment.