Hi!
I'm totally new to Roundcube, so maybe its a noob question...
I would like to get the message-id as well as the imap uid for a mail when it is displayed to the user. I need to store these data to be able to link to a certain message from another software, ideally by opening roundcube directly showing this mail.
I already wrote a simple plugin
PHP:
class my_plugin extends rcube_plugin {
public $task = 'mail';
var $message_id = "no-id";
var $message = 0;
function init() {
$this->add_hook('message_load', array($this, 'message_load'));
$this->register_action('plugin.get_data', array($this, 'request_data'));
$this->include_script('my_plugin.js');
}
function request_data() {
$rcmail = rcmail::get_instance();
$rcmail->output->command('plugin.my_plugin_callback', array('result' => "OK", 'message_id' => $this->message_id));
}
function message_load($args) {
$this->message_id = "message_load_called"; // "$args['object']->get_header( 'message-id', false);
}
}
JS:
if( rcmail.env.action=='preview') {
rcmail.addEventListener('init', function(evt) {
rcmail.addEventListener('plugin.my_plugin_callback', receive_data);
rcmail.http_get('plugin.get_data', '', false);
}
});
function receive_data(response) {
alert(JSON.stringify(response));
}
The callback loop http_get()/receive_data() is working fine, but I never get a result for message-id, it's always the initial "no-id" as if message_load() is not called. Any hints on that?
Btw, is there any doc for the javascript rcmail object available? I already found the stuff on github (plugin/skin API) and the PHP-Documentation but nothing about the javascript object.
Regards,
Oliver