Author Topic: message_compose hook not fired  (Read 4824 times)

Offline mgbdk

  • Newbie
  • *
  • Posts: 2
message_compose hook not fired
« on: December 28, 2011, 10:38:51 PM »
Hi all,
I have spend the day writing a little plugin to change 'special folders' per identity.
I have written most of the plugin now, but I can not seem to get my message_compose hook to fire.
I am running rc 0.6 and here is the snippet of code that is keeping me up all night.


<?php
class identity_folders extends rcube_plugin
{
  public 
$task 'settings|mail';
  private 
$rcmail;
  function 
init() {
    
$this->rcmail rcmail::get_instance();
    
$this->load_config();
    
//...
    
$this->add_hook('message_compose', array($this'message_compose'));
  }
//...
  
function message_compose ($args) {
    
$params = array(
      
'param'       => array(),
      
'attachments' => array()
    );
    
$params['param']['body'] = 'blah';
    return 
$params;
  }
}


I am successfully running functions under other hooks only message_compose is giving me problems.

The function is never executed

Looking at this file

<?php
// program/steps/mail/compose.inc
//...
  
if (!is_array($_SESSION['compose']))
    
//...
    
$plugin $RCMAIL->plugins->exec_hook('message_compose'$_SESSION['compose']);
   
//...
  
}
//...

I can not seem to compose a mail in such a manor that $_SESSION['compose'] is not an array.

Can anyone confirm this as a bug or show me the correct way to do this?

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,881
    • SKaero - Custom Roundcube development
message_compose hook not fired
« Reply #1 on: December 28, 2011, 11:46:41 PM »
I believe that is a bug it should work with RoundCube 0.7.

Offline mgbdk

  • Newbie
  • *
  • Posts: 2
message_compose hook not fired
« Reply #2 on: December 29, 2011, 07:19:02 AM »
Thanks. I was relying on my distros package system to inform me of updates.
just did a quick test with 0.7 and it seems to work there - will finish my plugin and release it into the wild for testing soon :)