Author Topic: Changing hook behavior via button  (Read 3150 times)

Offline washburn

  • Newbie
  • *
  • Posts: 3
Changing hook behavior via button
« 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
« Last Edit: May 04, 2015, 11:13:05 AM by washburn »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Re: Changing hook behavior via button
« Reply #1 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.