Bug #8719: Fix List-Post parsing
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 19 Nov 2009 19:01:48 +0000 (12:01 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 19 Nov 2009 19:01:48 +0000 (12:01 -0700)
imp/docs/CHANGES
imp/lib/UI/Message.php

index 491a2ad..568b209 100644 (file)
@@ -116,6 +116,8 @@ v5.0-git
 v4.3.6-cvs
 ----------
 
+[mms] When replying to list, correctly extract e-mail address if multiple
+      entries exist in the List-Post header (Bug #8719).
 [mms] For messages marked as innocent but not moved to Inbox, don't report
       them as deleted within the current mailbox (Bug #8221).
 [jan] Don't show address book preference group if address books are disabled
index 9d845a6..eb1ed7c 100644 (file)
@@ -190,15 +190,21 @@ class IMP_UI_Message
     }
 
     /**
-     * Parse the information in mailing list headers.
+     * Parse the information in mailing list headers.
      *
      * @param string $data  The header text to process.
-     * @param boolean $raw  Should the raw URL be returned instead of linking
-     *                      the header value?
+     * @param array $opts   Additional options:
+     * <pre>
+     * 'email' - (boolean) Only return e-mail values.
+     *           DEFAULT: false
+     * 'raw' - (boolean) Should the raw URL be returned instead of linking
+     *                   the header value?
+     *                   DEFAULT: false
+     * </pre>
      *
      * @return string  The header value.
      */
-    public function parseListHeaders($data, $raw = false)
+    public function parseListHeaders($data, $opts = array())
     {
         $output = '';
 
@@ -220,7 +226,7 @@ class IMP_UI_Message
              * that appears in a header that we can adequately handle. */
             if (stristr($match, 'mailto:') !== false) {
                 $match = substr($match, strpos($match, ':') + 1);
-                if ($raw) {
+                if (!empty($opts['raw'])) {
                     return $match;
                 }
                 $output = Horde::link(IMP::composeLink($match)) . $match . '</a>';
@@ -228,9 +234,9 @@ class IMP_UI_Message
                     $output .= '&nbsp;' . $comments[1];
                 }
                 break;
-            } else {
+            } elseif (empty($data['email'])) {
                 if ($url = Horde_Text_Filter::filter($match, 'linkurls', array('callback' => 'Horde::externalUrl'))) {
-                    if ($raw) {
+                    if (!empty($opts['raw'])) {
                         return $match;
                     }
                     $output = $url;
@@ -286,7 +292,7 @@ class IMP_UI_Message
              * list. */
             if (($val = $headers->getValue('list-post')) &&
                 ($val != 'NO')) {
-                $ret['reply_list'] = $this->parseListHeaders($val, true);
+                $ret['reply_list'] = $this->parseListHeaders($val, array('email' => true, 'raw' => true));
             }
         }