On Wed, May 27, 2009 at 18:42, A.L.E.C alec@alec.pl wrote:
Thomas Bruederli wrote:
So, plugins could bind to one (http_response) event and there just check for which action it's executed. Am I right?
But: what about the arguments? How to pass specific data from the server to a callback method? This is not so easy to solve with this approach.
What data? If we do:
this.triggerEvent('http_response', response);
we could do in plugin:
rcmail.addEventListener('http_response', function(evt, response) { alert(rcmail.env.task); alert(response.action); });
But you can't do $OUTPUT->command('myaction', array('foo' => 'bar, 'code' => 200)); or $OUTOUT->response(array('foo' => 'bar, 'code' => 200));
What people want to do is to pass some sort of data to the callback function. The only way to do this with the current architecture (server-side) is to set env variables which will be accessible using response.env.somevar
It would be nice if we could use $OUTPUT->command() in plugins too. This would make it easy to either call core functions like $OUTPUT->command('move_messages', $junk_mbox) but also custom functions defined by the plugin itself.
~Thomas _______________________________________________ List info: http://lists.roundcube.net/dev/