From: lkehresman Date: Wed, 26 Apr 2000 18:42:08 +0000 (+0000) Subject: sent shows "to" instead of "from" X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=cbdc56211e121e2676782da26828959da364ec52 sent shows "to" instead of "from" git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@462 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index c4dc474b..30e00489 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -71,6 +71,20 @@ ** Unsubscribes to an existing folder ******************************************************************************/ function sqimap_unsubscribe ($imap_stream, $mailbox) { + global $imap_server_type; + + /** This is a hack for UW server + ** Sometimes a folder will have a / at the end. If that's the case, + ** the unsubscribe doesn't work for a box named "mailbox/". We have + ** to strip off the / at the end. There may be a better way of doing + ** this, but this is the best I've found so far. (lme - April 26, 2000) + **/ + if ($imap_server_type == "uw") { + if (substr($mailbox, -1) == "/") { + $mailbox = substr($mailbox, 0, strlen($mailbox)-1); + } + } + fputs ($imap_stream, "a001 UNSUBSCRIBE \"$mailbox\"\r\n"); $read_ary = sqimap_read_data($imap_stream, "a001", true, $response, $message); } @@ -118,12 +132,14 @@ if ($flags) { $boxes[$g]["flags"] = explode(" ", $flags); } + /**** I'm not sure why this was even in here to begin with.. (lme) for ($i=0; $i < count($boxes[$g]["flags"]); $i++) { if ($boxes[$g]["flags"][$i] == "noselect") { $boxes[$g]["unformatted-dm"] = $boxes[$g]["unformatted-dm"].$dm; echo $boxes[$g]["unformatted-dm"]." - debug
"; } } + ****/ } return $boxes; } diff --git a/functions/imap_messages.php b/functions/imap_messages.php index 78c5eb7f..cdd240a8 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -39,7 +39,7 @@ /****************************************************************************** ** Returns some general header information -- FROM, DATE, and SUBJECT ******************************************************************************/ - function sqimap_get_small_header ($imap_stream, $id, &$from, &$subject, &$date) { + function sqimap_get_small_header ($imap_stream, $id, &$from, &$subject, &$date, $sent) { //fputs ($imap_stream, "a001 FETCH $id BODY[HEADER.FIELDS (DATE FROM SUBJECT)]\r\n"); fputs ($imap_stream, "a001 FETCH $id RFC822.HEADER\r\n"); $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message); @@ -47,9 +47,15 @@ $subject = _("(no subject)"); $from = _("Unknown Sender"); for ($i = 0; $i < count($read); $i++) { - if (strtolower(substr($read[$i], 0, 5)) == "from:") { - $from = sqimap_find_displayable_name(substr($read[$i], 5)); - } else if (strtolower(substr($read[$i], 0, 5)) == "date:") { + if ($sent == true) { + if (strtolower(substr($read[$i], 0, 3)) == "to:") + $from = sqimap_find_displayable_name(substr($read[$i], 3)); + } else { + if (strtolower(substr($read[$i], 0, 5)) == "from:") + $from = sqimap_find_displayable_name(substr($read[$i], 5)); + } + + if (strtolower(substr($read[$i], 0, 5)) == "date:") { $date = substr($read[$i], 5); } else if (strtolower(substr($read[$i], 0, 8)) == "subject:") { $subject = htmlspecialchars(substr($read[$i], 8)); diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 678510e0..2decafb7 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -12,6 +12,8 @@ function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage) { global $color, $msgs, $msort; + global $sent_folder; + $msg = $msgs[$key]; $senderName = $msg["FROM"]; @@ -22,9 +24,10 @@ if ($msg["FLAG_FLAGGED"] == true) { $flag = ""; $flag_end = ""; } if ($msg["FLAG_SEEN"] == false) { $bold = ""; $bold_end = ""; } if ($msg["FLAG_ANSWERED"] == true) { $ans = " [A]"; } + if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; } echo " \n"; - echo " $bold$flag$senderName$flag_end$bold_end\n"; + echo " $italic$bold$flag$senderName$flag_end$bold_end$italic_end\n"; echo "
$bold$flag".$msg["DATE_STRING"]."$flag_end$bold_end
\n"; echo " $bold$flag$subject$flag_end$ans$bold_end\n"; @@ -36,12 +39,16 @@ **/ function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) { global $msgs, $msort; - include ("../config/config.php"); + global $sent_folder; if (!$use_cache) { if ($numMessages >= 1) { for ($q = 0; $q < $numMessages; $q++) { - sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d); + if ($mailbox == $sent_folder) + sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d, true); + else + sqimap_get_small_header ($imapConnection, $q+1, $f, $s, $d, false); + $from[$q] = $f; $date[$q] = $d; $subject[$q] = $s; @@ -122,11 +129,12 @@ // generic function to convert the msgs array into an HTML table function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) { - global $folder_prefix; + global $folder_prefix, $sent_folder; + global $imapServerAddress; // do a check to see if the config stuff has already been included or not - if (!isset($imapServerAddress)) - include("../config/config.php"); +// if (!isset($imapServerAddress)) +// include("../config/config.php"); // if cache isn't already set, do it now if (!session_is_registered("msgs")) @@ -205,7 +213,11 @@ echo ""; echo "  "; /** FROM HEADER **/ - echo " ". _("From") .""; + if ($mailbox == $sent_folder) + echo " ". _("To") .""; + else + echo " ". _("From") .""; + if ($sort == 2) echo " \n"; else if ($sort == 3)