From 4a959503f801dfe24d6e6a76f228bcacda8b5933 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 17 Nov 2015 16:11:04 +0100 Subject: [PATCH] Force ID command use with name="Roundcube/Kolab" (T847) --- plugins/libkolab/libkolab.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plugins/libkolab/libkolab.php b/plugins/libkolab/libkolab.php index 0e4c8af3..47445198 100644 --- a/plugins/libkolab/libkolab.php +++ b/plugins/libkolab/libkolab.php @@ -43,6 +43,7 @@ class libkolab extends rcube_plugin set_include_path($include_path); $this->add_hook('storage_init', array($this, 'storage_init')); + $this->add_hook('storage_connect', array($this, 'storage_connect')); $this->add_hook('user_delete', array('kolab_storage', 'delete_user_folders')); $rcmail = rcube::get_instance(); @@ -90,6 +91,31 @@ class libkolab extends rcube_plugin return $p; } + /** + * Hook into IMAP connection to replace client identity + */ + function storage_connect($p) + { + $client_name = 'Roundcube/Kolab'; + + if (empty($p['ident'])) { + $p['ident'] = array( + 'name' => $client_name, + 'version' => RCUBE_VERSION, +/* + 'php' => PHP_VERSION, + 'os' => PHP_OS, + 'command' => $_SERVER['REQUEST_URI'], +*/ + ); + } + else { + $p['ident']['name'] = $client_name; + } + + return $p; + } + /** * Getter for a singleton instance of the Bonnie API *