[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[14331] trunk/squirrelmail
From:       pdontthink () users ! sourceforge ! net
Date:       2012-07-01 20:06:18
Message-ID: E1SlQPS-0006Yh-VD () sfp-svn-2 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 14331
          http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=14331&view=rev
Author:   pdontthink
Date:     2012-07-01 20:06:18 +0000 (Sun, 01 Jul 2012)
Log Message:
-----------
Add option that allows users to have replies to their own messages sent to the \
recipient of the previous message (#3520988)

Modified Paths:
--------------
    trunk/squirrelmail/doc/ChangeLog
    trunk/squirrelmail/include/load_prefs.php
    trunk/squirrelmail/include/options/compose.php
    trunk/squirrelmail/src/compose.php

Modified: trunk/squirrelmail/doc/ChangeLog
===================================================================
--- trunk/squirrelmail/doc/ChangeLog	2012-07-01 19:14:29 UTC (rev 14330)
+++ trunk/squirrelmail/doc/ChangeLog	2012-07-01 20:06:18 UTC (rev 14331)
@@ -374,6 +374,8 @@
     search in fields other than first/last name (nickname, email)
   - Made performance improvements in security token handling
   - Improvements for PHP 5.4 compatibility.
+  - Added option that allows users to have replies to their own
+    messages sent to the recipient of the previous message (#3520988).
 
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------

Modified: trunk/squirrelmail/include/load_prefs.php
===================================================================
--- trunk/squirrelmail/include/load_prefs.php	2012-07-01 19:14:29 UTC (rev 14330)
+++ trunk/squirrelmail/include/load_prefs.php	2012-07-01 20:06:18 UTC (rev 14331)
@@ -275,6 +275,9 @@
 /* message disposition notification support setting */
 $mdn_user_support = getPref($data_dir, $username, 'mdn_user_support', SMPREF_ON);
 
+$do_not_reply_to_self =
+    getPref($data_dir, $username, 'do_not_reply_to_self', SMPREF_OFF);
+
 $include_self_reply_all =
     getPref($data_dir, $username, 'include_self_reply_all', SMPREF_ON);
 

Modified: trunk/squirrelmail/include/options/compose.php
===================================================================
--- trunk/squirrelmail/include/options/compose.php	2012-07-01 19:14:29 UTC (rev \
                14330)
+++ trunk/squirrelmail/include/options/compose.php	2012-07-01 20:06:18 UTC (rev \
14331) @@ -119,6 +119,13 @@
     $optvals[SMOPT_GRP_COMPOSE_REPLY] = array();
 
     $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
+        'name'    => 'do_not_reply_to_self',
+        'caption' => _("Send Replies To My Own Messages To Previous Recipient"),
+        'type'    => SMOPT_TYPE_BOOLEAN,
+        'refresh' => SMOPT_REFRESH_NONE
+    );
+
+    $optvals[SMOPT_GRP_COMPOSE_REPLY][] = array(
         'name'    => 'include_self_reply_all',
         'caption' => _("Include Me in CC when I Reply All"),
         'type'    => SMOPT_TYPE_BOOLEAN,

Modified: trunk/squirrelmail/src/compose.php
===================================================================
--- trunk/squirrelmail/src/compose.php	2012-07-01 19:14:29 UTC (rev 14330)
+++ trunk/squirrelmail/src/compose.php	2012-07-01 20:06:18 UTC (rev 14331)
@@ -776,7 +776,7 @@
         $key, $imapServerAddress, $imapPort, 
         $composeMessage, $body_quote, $request_mdn, $request_dr,
         $mdn_user_support, $languages, $squirrelmail_language,
-        $default_charset;
+        $default_charset, $do_not_reply_to_self;
 
     /*
      * Set $default_charset to correspond with the user's selection
@@ -980,6 +980,78 @@
                 }
                 $send_to = decodeHeader($send_to,false,false,true);
                 $send_to = str_replace('""', '"', $send_to);
+
+
+                // If user doesn't want replies to her own messages
+                // going back to herself (instead send again to the
+                // original recipient of the message being replied to),
+                // then iterate through identities, checking if the TO
+                // field is one of them (if the reply is to ourselves)
+                //
+                // Note we don't bother if the original message doesn't
+                // have anything in the TO field itself (because that's
+                // what we use if we change the recipient to be that of
+                // the previous message)
+                //
+                if ($do_not_reply_to_self && !empty($orig_header->to)) {
+
+                    $orig_to = '';
+
+                    foreach($idents as $id) {
+
+                        if (!empty($id['email_address'])
+                         && strpos($send_to, $id['email_address']) !== FALSE) {
+
+                            // if this is a reply-all, the original recipient
+                            // is already in the CC field, so we can just blank
+                            // the recipient (TO field) (as long as the CC field
+                            // isn't empty that is) and we're done
+                            //
+                            if ($action == 'reply_all') {
+                                if (!empty($send_to_cc)) $send_to = '';
+                                break;
+                            }
+
+                            $orig_to = $orig_header->to;
+                            if (is_array($orig_to) && count($orig_to)) {
+                                $orig_to = $orig_header->getAddr_s('to', ',', FALSE, \
TRUE); +                            } else if (is_object($orig_to)) { /* \
unneccesarry, just for failsafe purpose */ +                                $orig_to \
= $orig_header->getAddr_s('to', ',', FALSE, TRUE); +                            } \
else { +                                $orig_to = '';
+                            }
+                            $orig_to = decodeHeader($orig_to,false,false,true);
+                            $orig_to = str_replace('""', '"', $orig_to);
+
+                            break;
+                        }
+                    }
+
+                    // if the reply was addressed back to ourselves,
+                    // we will send it to the TO of the previous message,
+                    // first making sure that that address wasn't also
+                    // one of our identities
+                    //
+                    if (!empty($orig_to)) {
+
+                        foreach($idents as $id) {
+                            if (!empty($id['email_address'])
+                             && strpos($orig_to, $id['email_address']) !== FALSE) {
+                                $orig_to = '';
+                                break;
+                            }
+                        }
+
+                        // if $orig_to still not empty, we can use it
+                        //
+                        if (!empty($orig_to)) {
+                            $send_to = $orig_to;
+                        }
+                    }
+
+                }
+
+
                 $subject = decodeHeader($orig_header->subject,false,false,true);
                 $subject = str_replace('"', "'", $subject);
                 $subject = trim($subject);

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic