Skip to content

Commit

Permalink
[jan] Find logged replies in other than default sent-mail folders too.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Sep 20, 2016
1 parent d3ac912 commit 1948781
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 8 deletions.
13 changes: 10 additions & 3 deletions framework/Core/lib/Horde/Core/ActiveSync/Connector.php
Expand Up @@ -1001,15 +1001,22 @@ public function mail_getMaillog($mid)
* 'reply_all'.
* @param string $mid The Message-ID to log.
* @param string $recipients The recipients the mail was forwarded to.
* @param string $folder The sent-mail folder. @since Horde_Core 2.27.0
*/
public function mail_logMaillog($action, $mid, $recipients = null)
public function mail_logMaillog(
$action, $mid, $recipients = null, $folder = null
)
{
$data = array();
if (!empty($recipients)) {
$recipients = array('recipients' => $recipients);
$data['recipients'] = $recipients;
}
if (!empty($folder)) {
$data['folder'] = $folder;
}
if ($this->_registry->hasMethod('logMaillog', $this->_registry->hasInterface('mail'))) {
try {
$this->_registry->mail->logMaillog($action, $mid, $recipients);
$this->_registry->mail->logMaillog($action, $mid, $data);
} catch (Horde_Exception $e) {
$this->_logger->err($e->getMessage());
}
Expand Down
12 changes: 9 additions & 3 deletions framework/Core/lib/Horde/Core/ActiveSync/Driver.php
Expand Up @@ -2265,15 +2265,21 @@ public function sendMail(
'Logging LASTVERBEXECUTED to Maillog: %s, %s, %s',
$mailer->reply ? 'reply' : 'forward',
$mailer->imapMessage->getHeaders()->getValue('Message-ID'),
$mailer->headers->getValue('To')));
$mailer->headers->getValue('To'))
);
$this->_connector->mail_logMaillog(
$mailer->reply ? 'reply' : 'forward',
$mailer->imapMessage->getHeaders()->getValue('Message-ID'),
$mailer->forward ? $mailer->headers->getValue('To') : null);
$mailer->forward ? $mailer->headers->getValue('To') : null,
$save ? $sf : null
);
$this->_imap->setImapFlag(
$mailer->parentFolder,
$mailer->id,
$mailer->reply ? Horde_ActiveSync::IMAP_FLAG_REPLY : Horde_ActiveSync::IMAP_FLAG_FORWARD);
$mailer->reply
? Horde_ActiveSync::IMAP_FLAG_REPLY
: Horde_ActiveSync::IMAP_FLAG_FORWARD
);
}

// Attempt to log the recipient.
Expand Down
1 change: 1 addition & 0 deletions imp/docs/CHANGES
Expand Up @@ -2,6 +2,7 @@
v7.0.0-git
----------

[jan] Find logged replies in other than default sent-mail folders too.
[mjr] Fix SyntaxHighlighter MIME viewer not rendering part after the initial
view of a part (Bug 14337).
[mjr] Display comment attribute in iTip viewer (Request #14407).
Expand Down
2 changes: 2 additions & 0 deletions imp/js/core.js
Expand Up @@ -300,6 +300,7 @@ var ImpCore = {
.wrap('A', {
className: 'imp-maillog-sent'
})
.store('folder', entry.f)
.store('msgid', entry.s)
.store('type', entry.t);
}
Expand Down Expand Up @@ -467,6 +468,7 @@ var ImpCore = {
}
} else if (cnames.indexOf('imp-maillog-sent') !== -1) {
HordeCore.popupWindow(this.conf.URI_MAILLOG, {
folder: elt.retrieve('folder'),
msgid: elt.retrieve('msgid'),
type: elt.retrieve('type')
}, {
Expand Down
2 changes: 2 additions & 0 deletions imp/lib/Ajax/Queue.php
Expand Up @@ -814,6 +814,8 @@ protected function _addMaillogInfo(IMP_Ajax_Application $ajax)

foreach ($l as $v3) {
$tmp[] = array_filter(array(
// 'f' = folder
'f' => $v3->folder,
// 'm' = message
'm' => $v3->message,
// 's' = sent message-id
Expand Down
7 changes: 6 additions & 1 deletion imp/lib/Compose.php
Expand Up @@ -888,7 +888,12 @@ public function buildAndSendMessage(
if ($this->_replytype) {
/* Log the reply. */
if ($indices = $this->getMetadata('indices')) {
$log_data = array('msgid' => $msgid);
$log_data = array(
'msgid' => $msgid,
'folder' => empty($opts['sent_mail'])
? null
: $opts['sent_mail'],
);

switch ($this->_replytype) {
case self::FORWARD:
Expand Down
1 change: 1 addition & 0 deletions imp/lib/Dynamic/Maillog.php
Expand Up @@ -37,6 +37,7 @@ protected function _init()
isset($this->vars->type) &&
isset(IMP_Maillog_Storage_History::$drivers[$this->vars->type])) {
$log = new IMP_Maillog_Storage_History::$drivers[$this->vars->type](array(
'folder' => $this->vars->folder,
'msgid' => $this->vars->msgid
));

Expand Down
20 changes: 19 additions & 1 deletion imp/lib/Maillog/Log/Sentmail.php
Expand Up @@ -25,6 +25,13 @@
abstract class IMP_Maillog_Log_Sentmail
extends IMP_Maillog_Log_Base
{
/**
* Sent-mail folder.
*
* @var string
*/
protected $_folder;

/**
* Message ID.
*
Expand All @@ -43,10 +50,14 @@ abstract class IMP_Maillog_Log_Sentmail
* Constructor.
*
* @param array $params Parameters:
* - folder: (IMP_Mailbox|string) Potential sent-mail folder.
* - msgid: (string) Message ID of the message sent.
*/
public function __construct(array $params = array())
{
if (isset($params['folder'])) {
$this->_folder = strval($params['folder']);
}
if (isset($params['msgid'])) {
$this->_msgId = strval($params['msgid']);
}
Expand All @@ -58,6 +69,8 @@ public function __construct(array $params = array())
public function __get($name)
{
switch ($name) {
case 'folder':
return $this->_folder;
case 'msg_id':
return $this->_msgId;
}
Expand All @@ -73,6 +86,7 @@ public function __get($name)
public function addData()
{
return array_merge(parent::addData(), array_filter(array(
'folder' => $this->folder,
'msgid' => $this->msg_id
)));
}
Expand All @@ -87,7 +101,11 @@ public function searchMailboxes()
$special = IMP_Mailbox::getSpecialMailboxes();

/* Check for sent-mail mailbox(es) first. */
$out = $special[IMP_Mailbox::SPECIAL_SENT];
$out = array();
if ($this->folder) {
$out[] = new IMP_Mailbox($this->folder);
}
$out = array_unique(array_merge($out, $special[IMP_Mailbox::SPECIAL_SENT]));

/* Add trash mailbox as backup. */
if (!empty($special[IMP_Mailbox::SPECIAL_TRASH]) &&
Expand Down
2 changes: 2 additions & 0 deletions imp/package.xml
Expand Up @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [jan] Find logged replies in other than default sent-mail folders too.
* [mjr] Fix SyntaxHighlighter MIME viewer not rendering part after the initial view of a part (Bug 14337).
* [mjr] Display comment attribute in iTip viewer (Request #14407).
* [mjr] Update the user/attendee participation status when accepting/importing an iTip.
Expand Down Expand Up @@ -3973,6 +3974,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [jan] Find logged replies in other than default sent-mail folders too.
* [mjr] Fix SyntaxHighlighter MIME viewer not rendering part after the initial view of a part (Bug 14337).
* [mjr] Display comment attribute in iTip viewer (Request #14407).
* [mjr] Update the user/attendee participation status when accepting/importing an iTip.
Expand Down

0 comments on commit 1948781

Please sign in to comment.