It looks like we've overseen something when we implemented the API.
To be honest, your use case is not yet respected in the current
version of the API.You're absolutely right, the only way to make use of the handy
$OUTPUT->command('...') command is to add the callback function to
the rcube_webmail prototype. Not a very nice solution.One solution would be to pass the callback function reference to
rcmail.http_post() but then your function gets the entire response
and you cannot use $OUTPUT->command('...') on the server side.Another way to solve this would be to send $OUTPUT-
command('plugin.somecommand') and the client will then trigger an
event. The client part of the plugin will have to register an event
listener for 'plugin.somecommand'. This would be the callback
function for the asynchronous request. To make things easier we
would limit the number of arguments to one. Then it'll perfectly fit
into the event-system of the RoundCube client.What do you think, any other ideas?
I was myself thinking along the lines of your second method was well.
Have the plugin register an event listener for a command (something
like: rcmail.register_callback('plugin.somecommand',
'my_callback_function');
When you say, limit the arguments to one you mean like:
function my_callback_function(e,args) { var status = args.status; var message = args.message; ... }
As long as you can pass back multiple pieces of information i think
thats fine.
Cor _______________________________________________ List info: http://lists.roundcube.net/dev/