Add an option for showing recipient name instead of default identity. (Default: false...
authoralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 18 Sep 2003 23:03:44 +0000 (23:03 +0000)
committeralex-brainstorm <alex-brainstorm@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 18 Sep 2003 23:03:44 +0000 (23:03 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5729 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php
include/load_prefs.php
include/options/display.php

index f728bac07786449d2966a950c18f15ad7b363b1a..c15e3bea4e5f857cfb42e5038641e7842401914c 100644 (file)
@@ -52,7 +52,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
            $row_count,
            $allow_server_sort,    /* enable/disable server-side sorting */
            $truncate_sender,      /* number of characters for From/To field (<= 0 for unchanged) */
-           $email_address;
+           $email_address,
+           $show_recipient_instead;    /* show recipient name instead of default identity */
 
     $color_string = $color[4];
 
@@ -78,13 +79,17 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     $urlMailbox = urlencode($mailbox);
 
     $bSentFolder = handleAsSent($mailbox);
-    // If the From address is the same as $email_address, then handle as Sent
-    $from_array = parseAddress($msg['FROM'], 1);
-    if (!isset($email_address)) {
-        global $datadir, $username;
-        $email_address = getPref($datadir, $username, 'email_address');
+    if ((!$bSentFolder) && ($show_recipient_instead)) {
+        // If the From address is the same as $email_address, then handle as Sent
+        $from_array = parseAddress($msg['FROM'], 1);
+        if (!isset($email_address)) {
+            global $datadir, $username;
+            $email_address = getPref($datadir, $username, 'email_address');
+        }
+        $bHandleAsSent = ((isset($from_array[0][0])) && ($from_array[0][0] == $email_address));
     }
-    $bHandleAsSent = ($bSentFolder) || ((isset($from_array[0][0])) && ($from_array[0][0] == $email_address));
+    else
+        $bHandleAsSent = $bSentFolder;
     // If this is a Sent message, display To address instead of From
     if ($bHandleAsSent)        
        $msg['FROM'] = $msg['TO'];
@@ -1303,6 +1308,7 @@ function getEndMessage($start_msg, $show_num, $num_msgs) {
     return (array($start_msg,$end_msg));
 }
 
+// This should go in imap_mailbox.php
 function handleAsSent($mailbox) {
     global $handleAsSent_result;
  
index 6e9fb3000b0bd7403ec47b7c54c061cdcbf9df53..61d6dfe51403cdeb9f01a2bda98343ccfb48df9e 100644 (file)
@@ -273,6 +273,8 @@ $show_full_date = getPref($data_dir, $username, 'show_full_date', 0);
 $truncate_sender = getPref($data_dir, $username, 'truncate_sender', 0);
 /* Allow user to customize length of subject field */
 $truncate_subject = getPref($data_dir, $username, 'truncate_subject', 50);
+/* Allow user to show recipient name if the message is from default identity */
+$show_recipient_instead = getPref($data_dir, $username, 'show_recipient_instead', 0);
 
 do_hook('loading_prefs');
 
index 49be36c03a0542d039a9f704e12c909b0c1b27cc..744432887f8b08276eb36258db2c9ca8698f7062 100644 (file)
@@ -172,6 +172,14 @@ function load_optpage_data_display() {
         'size'    => SMOPT_SIZE_TINY
     );
 
+    $optvals[SMOPT_GRP_MAILBOX][] = array(
+        'name'    => 'show_recipient_instead',
+        'caption' => _("Show recipient name if the message is from your default identity"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'size'    => SMOPT_SIZE_TINY
+    );
+
 
     /*** Load the General Options into the array ***/
     $optgrps[SMOPT_GRP_MESSAGE] = _("Message Display and Composition");