Roundcube Community Forum

 

Changing hook behavior via button

Started by washburn, May 04, 2015, 10:59:10 AM

Previous topic - Next topic

washburn

Hello,

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

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


php
$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

SKaero

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.