deflomu / Roundcube-SMTP-per-Identity-Plugin

Roundcube plugin to setup different SMTP settings per identity
MIT License
44 stars 19 forks source link

Update Plugin Hooks #11

Closed danielmorlock closed 8 years ago

danielmorlock commented 9 years ago

The plugin hook "message_outgoing_headers" is deprecated and should be replaced with "message_before_send". Patch proposal:

@@ -23,7 +23,7 @@
        $this->include_script('identity_smtp.js');
        $this->add_texts('localization/', true);

-       $this->add_hook('message_outgoing_headers', array($this, 'messageOutgoingHeaders'));
+       $this->add_hook('message_before_send', array($this, 'messageBeforeSend'));
        $this->add_hook('smtp_connect', array($this, 'smtpWillConnect'));
        $this->add_hook('identity_form', array($this, 'identityFormWillBeDisplayed'));
        $this->add_hook('identity_create', array($this, 'identityWasCreated'));
@@ -169,15 +167,14 @@
        return false;
    }

-   function messageOutgoingHeaders($args)
+   function messageBeforeSend($args)
    {
        $identities = rcmail::get_instance()->user->list_identities();
        foreach ($identities as $idx => $ident) {
-           if ($identities[$idx]['email'] == $args['headers']['X-Sender']) {
+           if ($identities[$idx]['email'] == $args['from']) {
                $this->from_identity = $identities[$idx]['identity_id'];
            }
        }
-
        return $args;
    }
deflomu commented 9 years ago

Can you open a pull request? And maybe add a link to the deprecation notice.

danielmorlock commented 9 years ago

Here you go: https://github.com/elm/Roundcube-SMTP-per-Identity-Plugin/pull/12

deflomu commented 8 years ago

Closed with #12