[RCD] Need 2 hooks and small patch for auto refresh virtual mailbox

Thomas Bruederli thomas at roundcube.net
Wed Jun 12 15:50:50 CEST 2013


On Wed, Jun 12, 2013 at 1:27 PM, Sergey Sidlyarenko
<roundcube at lefoyer.ru> wrote:
> And this please.
>
> {{{
> diff --git a/program/steps/mail/move_del.inc
> b/program/steps/mail/move_del.inc
> index e21ba2c..827cf67 100644
> --- a/program/steps/mail/move_del.inc
> +++ b/program/steps/mail/move_del.inc
> @@ -146,5 +146,7 @@ else
>    }
>  }
>
> +$RCMAIL->plugins->exec_hook('move_del_success', array());
> +
>  // send response
>  $OUTPUT->send();
>
> }}}

You obviously didn't understand my proposition. Instead of adding
individual hooks for every step, we'd rather want to trigger one
single hook at the end of every step specifying the action as a hook
argument..


> Need for this plugin.
> https://github.com/lefoyer/vmrefresh
>
>> Thomas Bruederli писал 2013-06-12 11:28:
>
>
>>    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.
>
> Used in my plugin to add call to parent from frame, for change virtualbox
> count after preview message with set SEEN flag on message.

That change should not be necessary. $RCMAIL->output->command() should
pass the command to the parent window automatically. If it doesn't for
some reason, the command logic should be fixed and not work-arounded
like this.
>
>>    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.
>
> I need 3 hook (2 - in json (mark, move_del), 1 - in html (show/preview)),
> used to update count in virtual mail boxes. I not understand, why need to
> call my plugin all time at render_page.

Even with a generic hook you can easily filter the calls that actually
should do something in your plugin with if ($args['action'] == 'xxx')

~Thomas


More information about the dev mailing list