Opened 3 years ago

Closed 3 years ago

#1486312 closed Bugs (fixed)

message_compose plugin hook doesn't set proper params

Reported by: pink Owned by:
Priority: 5 Milestone: 0.4-beta
Component: Plugin API Version: git-master
Severity: normal Keywords: plugins hook message_compose
Cc:

Description

Once message_compose plugin hook is executed, it doesn't set proper params using returned value.

It's caused by overwriting

$_SESSION['compose']['param'] = $plugin['param'];

by returned value.

Patch included

Attachments (1)

message_compose.patch (604 bytes) - added by pink 3 years ago.

Download all attachments as: .zip

Change History (4)

Changed 3 years ago by pink

comment:1 Changed 3 years ago by alec

  • Milestone changed from later to 0.4-beta
  • Resolution set to worksforme
  • Status changed from new to closed

I think you're not right. Array_merge() is not needed here.

comment:2 Changed 3 years ago by pink

  • Resolution worksforme deleted
  • Status changed from closed to reopened

It's not needed as long as plugin developer will carry about merging it in plugin, check such plugin:

class reply_params extends rcube_plugin
{
  public $task = 'mail';

  function init()
  {
    $this->add_hook('message_compose', array($this, 'addcc'));
  }

  function addcc($args)
  {
    $params = array(
        'param'       => array(),
        'attachments' => array(),
    );

    if (isset($args['param']['reply_uid']))
    {
        $h = rcmail::get_instance()->imap->get_headers($args['param']['reply_uid'], NULL, true, true);

        if (false !== strpos($h->to,'groupmail@address.com'))
        {
            $params['param']['cc']  = 'groupmail@address.com';
        }
    }

    return $params;
  }
}

It will set only CC, but other params, like body, to, subject are erased. I think you should have more mercy for plugin developers and don't oblige them to inspect sources.

I'm re-opening this bug, because of above explanation. If you still think it's not a problem please close it.

comment:3 Changed 3 years ago by alec

  • Resolution set to fixed
  • Status changed from reopened to closed

Patch applied in [ceeab9ed].

Note: See TracTickets for help on using tickets.