Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: washburn on May 04, 2015, 10:59:10 AM

Title: Changing hook behavior via button
Post by: washburn on May 04, 2015, 10:59:10 AM
Hello,

I've added a GUI element to Roundcube Mail which executes a php function using rcmail.http_post

js:
Code: [Select]
rcmail.addEventListener('init', function(evt) {
    $('#messagetoolbar').append('...
});

php
Code: [Select]
$this->register_action('plugin.test', array($this, 'test'));
The php function sets a Flag. This flag should be evaluated when the hook 'message_outgoing_headers' is executed.

However, I was not able to provide persistent data to the message_outgoing_headers hook. I've tried to use class variables but they only remain between hooks, not between a registered action and a hook. The only think that worked so far was actually writing the flag to the hard drive which is considerarbly the worst solution.

What is the proper way to do that? Basically I need a button wich changes data when sending a message.

Best regards
Title: Re: Changing hook behavior via button
Post by: SKaero on May 04, 2015, 11:41:02 AM
The only other way I can think to do it is set a session variable but someone would need to re-click the button if they logged out.