[RCD] Plugin API register task

Rosali myroundcube at mail4us.net
Thu Aug 14 15:52:12 CEST 2014


Hello Devs,

I don't understand how I should handle $this->register_task.

I have noticed if a plugin is running on its own task then it behaves 
strange.

I think it is best to give an example:

I inlude a javascript file into each task which triggers an AJAX sync 
request as follows:

{{{
         rcmail.http_post(
           'plugin.carddav-addressbook-sync',
           '',
           rcmail.env.task == 'addressbook' ? 
rcmail.display_message(rcmail.gettext('addressbook_sync_loading', 
'carddav'), 'loading') : false
         );
}}}

If this request is executed f.e. in Kolab's calendar task I get an 
error:

PHP Error: No handler found for action 
calendar.plugin.carddav-addressbook-sync in 
C:\xxxx\program\lib\Roundcube\rcube_plugin_api.php on line 462 (POST 
/?_task=calendar&_action=plugin.carddav-addressbook-sync?_task=&_action=)

The according action is registered in my carddav plugin (this plugin is 
not running on its own registered task):

{{{

$this->register_action('plugin.carddav-addressbook-sync', array($this, 
'carddav_addressbook_sync'));

}}}

So, what am I doing wrong? How do I have to register the action in a 
plugin so that they are properly recognized while staying on a task 
which is registered/owned by another plugin?

Thanks for your clarifications!

Regards,
Rosali



More information about the dev mailing list