Hi Sergey
I don't get the $parent change in your patch because rcmail_send_unread_count() doesn't seem to be called anywhere with that additional argument. The entire command execution should be solved in the output classes anyways and individual steps should not need to care about that.
Then, I rather suggest to add a general 'request_end' hook that takes 'task' and 'action' arguments (similar to the 'startup' hook) rather than the two hooks 'show_success' and 'mark_success' that you suggested. There's already the 'render_page' hook but that is limited to HTML output only. An equivalent for JSON would also be useful.
~Thomas
On Tue, Jun 11, 2013 at 8:05 AM, Sergey Sidlyarenko roundcube@lefoyer.ru wrote:
I am use dovecot virtual mailbox \All, i am write plugin for auto refresh this box if changes in real boxes, but need small patch in core.
{{{ diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 1a687f5..4bedae3 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -539,7 +539,7 @@ function rcmail_get_mailbox_name_text() }
-function rcmail_send_unread_count($mbox_name, $force=false, $count=null, $mark='') +function rcmail_send_unread_count($mbox_name, $force=false, $count=null, $mark='', $parent=false) { global $RCMAIL;
@@ -551,7 +551,7 @@ function rcmail_send_unread_count($mbox_name, $force=false, $count=null, $mark=' $unseen = $count;
if ($unseen != $old_unseen || ($mbox_name == 'INBOX'))
- $RCMAIL->output->command('set_unread_count', $mbox_name, $unseen,
- $RCMAIL->output->command(($parent ? 'parent.' : '').
'set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'), $unseen && $mark ? $mark : '');
rcmail_set_unseen_count($mbox_name, $unseen); diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index dfc892e..7c22ad2 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -130,4 +130,6 @@ else { $OUTPUT->show_message('internalerror', 'error'); }
+$RCMAIL->plugins->exec_hook('mark_success', array());
$OUTPUT->send(); diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index d8d4372..48b13e1 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -305,14 +305,6 @@ $OUTPUT->add_handlers(array( ));
-if ($RCMAIL->action == 'print' && $OUTPUT->template_exists('messageprint'))
- $OUTPUT->send('messageprint', false);
-else if ($RCMAIL->action == 'preview' && $OUTPUT->template_exists('messagepreview'))
- $OUTPUT->send('messagepreview', false);
-else
- $OUTPUT->send('message', false);
// mark message as read if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']) && ($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0))) @@ -324,5 +316,15 @@ if ($MESSAGE && $MESSAGE->headers && empty($MESSAGE->headers->flags['SEEN']) && } }
+$RCMAIL->plugins->exec_hook('show_success', array());
+if ($RCMAIL->action == 'print' && $OUTPUT->template_exists('messageprint'))
- $OUTPUT->send('messageprint', false);
+else if ($RCMAIL->action == 'preview' && $OUTPUT->template_exists('messagepreview'))
- $OUTPUT->send('messagepreview', false);
+else
- $OUTPUT->send('message', false);
exit; }}}
Roundcube Development discussion mailing list dev@lists.roundcube.net http://lists.roundcube.net/mailman/listinfo/dev