summaryrefslogtreecommitdiff
path: root/plugins/identity_select/identity_select.php
diff options
context:
space:
mode:
authorHugues Hiegel <root@paranoid>2015-04-21 12:45:58 +0200
committerHugues Hiegel <root@paranoid>2015-04-21 12:45:58 +0200
commitef2e7b3f9d264ec146d4dae257b1e295ab3b462a (patch)
tree76b4a98d7b3b38f691c4fbee1612197ab6615c2b /plugins/identity_select/identity_select.php
parentd09b64c6270c638059b003922db508f95d32d555 (diff)
updates - plugins as a separate git folder
Diffstat (limited to 'plugins/identity_select/identity_select.php')
-rw-r--r--plugins/identity_select/identity_select.php68
1 files changed, 0 insertions, 68 deletions
diff --git a/plugins/identity_select/identity_select.php b/plugins/identity_select/identity_select.php
deleted file mode 100644
index 7973b5dad..000000000
--- a/plugins/identity_select/identity_select.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-/**
- * Identity selection based on additional message headers.
- *
- * On reply to a message user identity selection is based on
- * content of standard headers i.e. From, To, Cc and Return-Path.
- * Here you can add header(s) set by your SMTP server (e.g.
- * Delivered-To, Envelope-To, X-Envelope-To, X-RCPT-TO) to make
- * identity selection more accurate.
- *
- * Enable the plugin in config.inc.php and add your desired headers:
- * $config['identity_select_headers'] = array('Delivered-To');
- *
- * @version @package_version@
- * @author Aleksander Machniak <alec@alec.pl>
- * @license GNU GPLv3+
- */
-class identity_select extends rcube_plugin
-{
- public $task = 'mail';
-
-
- function init()
- {
- $this->add_hook('identity_select', array($this, 'select'));
- $this->add_hook('storage_init', array($this, 'storage_init'));
- }
-
- /**
- * Adds additional headers to supported headers list
- */
- function storage_init($p)
- {
- $rcmail = rcmail::get_instance();
-
- if ($add_headers = (array)$rcmail->config->get('identity_select_headers', array())) {
- $p['fetch_headers'] = trim($p['fetch_headers'] . ' ' . strtoupper(join(' ', $add_headers)));
- }
-
- return $p;
- }
-
- /**
- * Identity selection
- */
- function select($p)
- {
- if ($p['selected'] !== null || !is_object($p['message']->headers)) {
- return $p;
- }
-
- $rcmail = rcmail::get_instance();
-
- foreach ((array)$rcmail->config->get('identity_select_headers', array()) as $header) {
- if ($header = $p['message']->headers->get($header, false)) {
- foreach ($p['identities'] as $idx => $ident) {
- if (in_array($ident['email_ascii'], (array)$header)) {
- $p['selected'] = $idx;
- break 2;
- }
- }
- }
- }
-
- return $p;
- }
-}