From 337e906650cea0648508390de0e6cce6d879b139 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 29 Mar 2024 11:25:41 +0100 Subject: [PATCH] Plugin API: Fix action handlers after registering also a task --- program/lib/Roundcube/rcube_plugin_api.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/program/lib/Roundcube/rcube_plugin_api.php b/program/lib/Roundcube/rcube_plugin_api.php index 864b5dac690..831f5c0ccfe 100644 --- a/program/lib/Roundcube/rcube_plugin_api.php +++ b/program/lib/Roundcube/rcube_plugin_api.php @@ -545,9 +545,13 @@ public function register_action($action, $owner, $callback, $task = null) */ public function exec_action($action) { - if (isset($this->actions[$action])) { + $rcmail = rcmail::get_instance(); + + if (isset($this->actions[$rcmail->task . '.' . $action])) { + call_user_func($this->actions[$rcmail->task . '.' . $action]); + } elseif (isset($this->actions[$action])) { call_user_func($this->actions[$action]); - } elseif (rcmail::get_instance()->action != 'refresh') { + } elseif ($rcmail->action != 'refresh') { rcube::raise_error([ 'code' => 524, 'file' => __FILE__, 'line' => __LINE__, 'message' => "No handler found for action {$action}",