From: Michael M Slusarz Date: Fri, 5 Feb 2010 17:24:00 +0000 (-0700) Subject: More complete maillog handling of reply types X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=01a33d171f3f528ad71c3254f8462a0f27778015;p=horde.git More complete maillog handling of reply types --- diff --git a/imp/js/compose-dimp.js b/imp/js/compose-dimp.js index 9f1182f2c..bd57eff59 100644 --- a/imp/js/compose-dimp.js +++ b/imp/js/compose-dimp.js @@ -281,7 +281,7 @@ var DimpCompose = { case 'SendMessage': if (this.is_popup && DIMP.baseWindow.DimpBase) { if (d.reply_type) { - DIMP.baseWindow.DimpBase.flag(d.reply_type == 'reply' ? '\\answered' : '$forwarded', true, { uid: d.uid, mailbox: d.reply_folder, noserver: true }); + DIMP.baseWindow.DimpBase.flag(d.reply_type == 'forward' ? '$forwarded' : '\\answered', true, { uid: d.uid, mailbox: d.reply_folder, noserver: true }); } if (d.mailbox) { diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 9222656de..50668d53a 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -265,7 +265,17 @@ class IMP_Compose 'uidvalidity' => $GLOBALS['imp_imap']->checkUidvalidity($this->_metadata['mailbox']) )); - $draft_headers->addHeader($this->_metadata['reply_type'] == 'reply' ? 'X-IMP-Draft-Reply' : 'X-IMP-Draft-Forward', '<' . $imap_url . '>'); + switch ($this->getMetadata('reply_type')) { + case 'forward': + $draft_headers->addHeader('X-IMP-Draft-Forward', '<' . $imap_url . '>'); + break; + + // 'reply', 'reply_all', 'reply_list' + default: + $draft_headers->addHeader('X-IMP-Draft-Reply', '<' . $imap_url . '>'); + $draft_headers->addHeader('X-IMP-Draft-Reply-Type', $this->getMetadata('reply_type')); + break; + } } catch (Horde_Exception $e) {} } @@ -400,7 +410,9 @@ class IMP_Compose } if ($val = $headers->getValue('x-imp-draft-reply')) { - $reply_type = 'reply'; + if (!($reply_type = $headers->getValue('x-imp-draft-reply-type'))) { + $reply_type = 'reply'; + } } elseif ($val = $headers->getValue('x-imp-draft-forward')) { $reply_type = 'forward'; } @@ -586,7 +598,7 @@ class IMP_Compose /* Unsuccessful send. */ Horde::logMessage($e->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR); if (isset($sentmail)) { - $sentmail->log(empty($this->_metadata['reply_type']) ? 'new' : $this->_metadata['reply_type'], $headers->getValue('message-id'), $val['recipients'], false); + $sentmail->log($this->getMetadata('reply_type') || 'new', $headers->getValue('message-id'), $val['recipients'], false); } throw new IMP_Compose_Exception(sprintf(_("There was an error sending your message: %s"), $e->getMessage())); @@ -610,19 +622,21 @@ class IMP_Compose $imp_message = $GLOBALS['injector']->getInstance('IMP_Message'); $reply_uid = array($this->_metadata['uid'] . IMP::IDX_SEP . $this->_metadata['mailbox']); - switch ($this->_metadata['reply_type']) { - case 'reply': + switch ($this->getMetadata('reply_type')) { + case 'forward': + /* Set the '$Forwarded' flag, if possible, in the mailbox. + * See RFC 5550 [5.9] */ + $imp_message->flag(array('$Forwarded'), $reply_uid); + break; + + // 'reply', 'reply_all', 'reply_list' + default: /* Make sure to set the IMAP reply flag and unset any * 'flagged' flag. */ $imp_message->flag(array('\\answered'), $reply_uid); $imp_message->flag(array('\\flagged'), $reply_uid, false); break; - case 'forward': - /* Set the '$Forwarded' flag, if possible, in the mailbox. - * See RFC 5550 [5.9] */ - $imp_message->flag(array('$Forwarded'), $reply_uid); - break; } } @@ -707,10 +721,9 @@ class IMP_Compose */ protected function _addReferences($headers) { - if (!empty($this->_metadata['reply_type']) && - ($this->_metadata['reply_type'] == 'reply')) { if (!empty($this->_metadata['references'])) { $headers->addHeader('References', implode(' ', preg_split('|\s+|', trim($this->_metadata['references'])))); + if (strpos($this->getMetadata('reply_type'), 'reply') === 0) { } if (!empty($this->_metadata['in_reply_to'])) { $headers->addHeader('In-Reply-To', $this->_metadata['in_reply_to']); @@ -1287,7 +1300,6 @@ class IMP_Compose if (!$this->getMetadata('reply_type')) { $this->_metadata['mailbox'] = $contents->getMailbox(); - $this->_metadata['reply_type'] = 'reply'; $this->_metadata['uid'] = $contents->getUid(); $this->_modified = true; @@ -1419,6 +1431,8 @@ class IMP_Compose $header = $all_headers; } + $this->_metadata['reply_type'] = $reply_type; + if (!$prefs->getValue('reply_quote')) { return array( 'body' => '', diff --git a/imp/lib/Maillog.php b/imp/lib/Maillog.php index 4170a831a..fbd65b174 100644 --- a/imp/lib/Maillog.php +++ b/imp/lib/Maillog.php @@ -166,6 +166,14 @@ class IMP_Maillog case 'reply': $msg = _("You replied to this message on %s."); break; + + case 'reply_all': + $msg = _("You replied to all recipients of this message on %s."); + break; + + case 'reply_list': + $msg = _("You replied to this message via the mailing list on %s."); + break; } }