From e3b61cd487fffb802179702a4a9ac553273b0c1e Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 29 Oct 2016 10:59:39 +0200 Subject: [PATCH] Plugin API: Added get_compose_responses hook (#5457) --- CHANGELOG | 1 + program/include/rcmail.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2c5113a2a..5e8939ad0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Plugin API: Added get_compose_responses hook (#5457) - Display error when trying to upload more files than specified in max_file_uploads (#5483) - Add missing sql upgrade file for 'ip' column resize in session table (#5465) - Do not show inline images of unsupported mimetype (#5463) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index a6d07695f..415717cc1 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -380,7 +380,7 @@ class rcmail extends rcube if (!$user_only) { foreach ($this->config->get('compose_responses_static', array()) as $response) { if (empty($response['key'])) { - $response['key'] = substr(md5($response['name']), 0, 16); + $response['key'] = substr(md5($response['name']), 0, 16); } $response['static'] = true; @@ -405,7 +405,15 @@ class rcmail extends rcube ksort($responses, SORT_LOCALE_STRING); } - return array_values($responses); + $responses = array_values($responses); + + $hook = $this->plugins->exec_hook('get_compose_responses', array( + 'list' => $responses, + 'sorted' => $sorted, + 'user_only' => $user_only, + )); + + return $hook['list']; } /**