* $Id$
*/
+/* NOTE: quite some functions in this file are not used anymore. */
+
/* Copies specified messages to specified folder */
/* obsolete */
function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
global $uid_support;
- $read = sqimap_run_command ($imap_stream, "COPY $start:$end \"$mailbox\"", true, $response, $message, $uid_support);
+ $read = sqimap_run_command ($imap_stream, "COPY $start:$end " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support);
}
function sqimap_msgs_list_copy ($imap_stream, $id, $mailbox) {
global $uid_support;
$msgs_id = sqimap_message_list_squisher($id);
- $read = sqimap_run_command ($imap_stream, "COPY $msgs_id \"$mailbox\"", true, $response, $message, $uid_support);
+ $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support);
$read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support);
}
global $move_to_trash, $trash_folder, $uid_support;
$msgs_id = sqimap_message_list_squisher($id);
if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
- $read = sqimap_run_command ($imap_stream, "COPY $msgs_id \"$trash_folder\"", true, $response, $message, $uid_support);
+ $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($trash_folder), true, $response, $message, $uid_support);
}
$read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support);
}
$read = sqimap_run_command ($imap_stream, "STORE $msgs_id ".$set_string."FLAGS ($flag)", $handle_errors, $response, $message, $uid_support);
}
+// obsolete?
function sqimap_get_small_header ($imap_stream, $id, $sent) {
$res = sqimap_get_small_header_list($imap_stream, $id, $sent);
return $res[0];
$query = "THREAD $sort_type ".strtoupper($default_charset)." ALL";
$thread_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, $uid_support);
if (isset($thread_test[0])) {
- if (preg_match("/^\* THREAD (.+)$/", $thread_test[0], $regs)) {
- $thread_list = trim($regs[1]);
- }
+ for ($i=0,$iCnt=count($thread_test);$i<$iCnt;++$i) {
+ if (preg_match("/^\* THREAD (.+)$/", $thread_test[$i], $regs)) {
+ $thread_list = trim($regs[1]);
+ break;
+ }
+ }
}
else {
$thread_list = "";
return $timepassed;
}
+// only used in sqimap_get_small_header_list
function parseString($read,&$i) {
$char = $read{$i};
$s = '';
return $s;
}
-function parseInteger($read,&$i) {
- $s = false;
- $i_pos = strpos($read,' ',$i);
- if (!$i_pos) {
- $i_pos = strpos($read,')',$i);
- }
- if ($i_pos) {
- $s = substr($read,$i,$i_pos-$i);
- $i = $i_pos+1;
- }
- return $s;
-}
-
+// only used in sqimap_get_small_header_list
function parseArray($read,&$i) {
$i = strpos($read,'(',$i);
$i_pos = strpos($read,')',$i);
return $new_messages;
}
+// obsolete?
function sqimap_get_headerfield($imap_stream, $field) {
global $uid_support;
$sid = sqimap_session_id(false);
$flags = array();
$read = sqimap_run_command ($imap_stream, "FETCH $id (FLAGS BODYSTRUCTURE)", true, $response, $message, $uid_support);
if ($read) {
- if (preg_match('/.+FLAGS\s\((.*)\)\s/AUi',$read[0],$regs)) {
- if (trim($regs[1])) {
- $flags = preg_split('/ /', $regs[1],-1,'PREG_SPLIT_NI_EMPTY');
- }
- }
+ if (preg_match('/.+FLAGS\s\((.*)\)\s/AUi',$read[0],$regs)) {
+ if (trim($regs[1])) {
+ $flags = preg_split('/ /', $regs[1],-1,'PREG_SPLIT_NI_EMPTY');
+ }
+ }
} else {
- echo "ERROR Yeah I know, not a very usefull errormessage (id = $id, mailbox = $mailbox sqimap_get_message)";
- exit;
+ /* the message was not found, maybe the mailbox was modified? */
+ global $sort, $startMessage, $color;
+
+ $errmessage = _("The server couldn't find the message you requested.") .
+ '<p>'._("Most probably your message list was out of date and the message has been moved away or deleted (perhaps by another program accessing the same mailbox).");
+ /* this will include a link back to the message list */
+ error_message($errmessage, $mailbox, $sort, $startMessage, $color);
+ exit;
}
$bodystructure = implode('',$read);
$msg = mime_structure($bodystructure,$flags);
}
/* Wrapper function that reformats the header information. */
+// obsolete?
function sqimap_get_message_header ($imap_stream, $id, $mailbox) {
global $uid_support;
$read = sqimap_run_command ($imap_stream, "FETCH $id BODY[HEADER]", true, $response, $message, $uid_support);
}
/* Wrapper function that reformats the entity header information. */
+// obsolete?
function sqimap_get_ent_header ($imap_stream, $id, $mailbox, $ent) {
global $uid_support;
$read = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent.HEADER]", true, $response, $message, $uid_support);
}
/* function to get the mime headers */
+// obsolete?
function sqimap_get_mime_ent_header ($imap_stream, $id, $mailbox, $ent) {
global $uid_support;
$read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.MIME]", true, $response, $message, $uid_support);