* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This implements functions that manipulate messages
+ * NOTE: Quite a few functions in this file are obsolete
*
* $Id$
+ * @package squirrelmail
*/
-/* NOTE: quite some functions in this file are not used anymore. */
-
-/* Copies specified messages to specified folder */
-/* obsolete */
+/**
+ * Copies specified messages to specified folder
+ * @param int $imap_stream The resource ID for the IMAP connection
+ * @param string $start Beginning of range to copy
+ * @param string $end End of the range to copy
+ * @param string $mailbox Which box to copy to
+ * @deprecated This function is obsolete and should not be used
+ */
function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
global $uid_support;
$read = sqimap_run_command ($imap_stream, "COPY $start:$end " . sqimap_encode_mailbox_name($mailbox), true, $response, $message, $uid_support);
}
+/**
+* copy a range of messages ($id) to another mailbox ($mailbox)
+* @param int $imap_stream The resource ID for the IMAP socket
+* @param string $id The list of messages to copy
+* @param string $mailbox The destination to copy to
+* @return void
+*/
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 " . 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);
+}
+
+/**
+* move a range of messages ($id) to another mailbox. Deletes the originals.
+* @param int $imap_stream The resource ID for the IMAP socket
+* @param string $id The list of messages to move
+* @param string $mailbox The destination to move to
+* @return void
+*/
+function sqimap_msgs_list_move ($imap_stream, $id, $mailbox) {
+ global $uid_support;
+ $msgs_id = sqimap_message_list_squisher($id);
+ $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);
}
-/* Deletes specified messages and moves them to trash if possible */
-/* obsolete */
+/**
+ * Deletes specified messages and moves them to trash if possible
+ * @deprecated This function is obsolete and should no longer be used
+ * @param int $imap_steam The resource ID for the IMAP connection
+ * @param string $start Start of range
+ * @param string $end End of range
+ * @param string $mailbox Mailbox messages are being deleted from
+ * @return void
+ */
function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
global $move_to_trash, $trash_folder, $auto_expunge, $uid_support;
sqimap_messages_flag ($imap_stream, $start, $end, "Deleted", true);
}
-function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id) {
+function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id, $bypass_trash=false) {
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))) {
+ if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder)) && ($bypass_trash != true)) {
$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);
}
-/* Sets the specified messages with specified flag */
+/**
+ * Sets the specified messages with specified flag
+ */
function sqimap_messages_flag ($imap_stream, $start, $end, $flag, $handle_errors) {
global $uid_support;
$read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", $handle_errors, $response, $message, $uid_support);
$sort_test = sqimap_run_command ($imap_stream, $query, true, $response, $message, $uid_support);
}
if (isset($sort_test[0])) {
- if (preg_match("/^\* SORT (.+)$/", $sort_test[0], $regs)) {
+ for ($i=0,$iCnt=count($sort_test);$i<$iCnt;++$i) {
+ if (preg_match("/^\* SORT (.+)$/", $sort_test[$i], $regs)) {
$server_sort_array = preg_split("/ /", trim($regs[1]));
+ break;
}
+ }
}
if ($sort == 0 || $sort == 2 || $sort == 4) {
$server_sort_array = array_reverse($server_sort_array);
foreach ($read_list as $r) {
$subject = _("(no subject)");
- $from = _("Unknown Sender");
+ $from = _("Unknown sender");
$priority = 0;
$messageid = '<>';
$cc = $to = $date = $type[0] = $type[1] = $inrepto = '';