X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_messages.php;h=0e140e5ad9a8e0c1d60f9e9378c76ab5e4a78f60;hb=b51a15da60e50d2446136428d383984a33766c46;hp=6dfb53b5807af8886dd8437a6f5ff41b0c0e3380;hpb=8cc8ec794a4111845258794961df8cb093ab2b3f;p=squirrelmail.git diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 6dfb53b5..0e140e5a 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -1,110 +1,101 @@ 0) { @@ -709,16 +722,25 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false, $type = substr($type, 0, $pos); } $type = explode("/", $type); - if(!is_array($type)) { + if(!is_array($type) || count($type) < 2) { $msg['TYPE0'] = 'text'; $msg['TYPE1'] = 'plain'; + } else { + $msg['TYPE0'] = strtolower($type[0]); + $msg['TYPE1'] = strtolower($type[1]); } break; + case 'received': + $aReceived[] = $value; + break; default: break; } } } } + if (count($aReceived)) { + $msg['RECEIVED'] = $aReceived; + } break; default: ++$i; @@ -726,15 +748,19 @@ function sqimap_get_small_header_list ($imap_stream, $msg_list, $show_num=false, } } $msgi ="$unique_id"; - $msg['ID'] = $unique_id; + $msg['UID'] = $unique_id; - $messages[$msgi] = $msg; + $aMessageList[$msgi] = $msg; ++$msgi; } - array_reverse($messages); - return $messages; + return $aMessageList; } +/** + * Work in process + * @private + * @author Marc Groot Koerkamp + */ function sqimap_parse_envelope($read, &$i, &$msg) { $arg_no = 0; $arg_a = array(); @@ -810,6 +836,11 @@ function sqimap_parse_envelope($read, &$i, &$msg) { } } +/** + * Work in process + * @private + * @author Marc Groot Koerkamp + */ function sqimap_parse_address($read, &$i) { $arg_a = array(); for (; $read{$i} != ')'; ++$i) { @@ -843,9 +874,14 @@ function sqimap_parse_address($read, &$i) { } /** -* Returns a message array with all the information about a message. -* See the documentation folder for more information about this array. -*/ + * Returns a message array with all the information about a message. + * See the documentation folder for more information about this array. + * + * @param resource $imap_stream imap connection + * @param integer $id uid of the message + * @param string $mailbox used for error handling, can be removed because we should return an error code and generate the message elsewhere + * @return Message Message object + */ function sqimap_get_message ($imap_stream, $id, $mailbox) { // typecast to int to prohibit 1:* msgs sets $id = (int) $id; @@ -876,4 +912,39 @@ function sqimap_get_message ($imap_stream, $id, $mailbox) { return $msg; } +/** +* Depricated !!!!!!! DO NOT USE THIS, use sqimap_msgs_list_copy instead +*/ +function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) { + $read = sqimap_run_command ($imap_stream, "COPY $start:$end " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, TRUE); +} + +/** +* Depricated !!!!!!! DO NOT USE THIS, use sqimap_msgs_list_delete instead +*/ +function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox, $bypass_trash=false) { + global $move_to_trash, $trash_folder, $auto_expunge; + + if (($move_to_trash == true) && ($bypass_trash != true) && + (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) { + sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder); + } + sqimap_messages_flag ($imap_stream, $start, $end, "Deleted", true); +} + +/** +* Depricated !!!!!!! DO NOT USE THIS, use sqimap_toggle_flag instead +* Set a flag on the provided uid list +* @param resource imap connection +*/ +function sqimap_messages_flag ($imap_stream, $start, $end, $flag, $handle_errors) { + $read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", $handle_errors, $response, $message, TRUE); +} + +/** @deprecated */ +function sqimap_get_small_header ($imap_stream, $id, $sent) { + $res = sqimap_get_small_header_list($imap_stream, $id, $sent); + return $res[0]; +} + ?>