public function register_action($action, $owner, $callback, $task = null)
    {
        // check action name
        if ($task)
            $action = $task.'.'.$action;
        else if (strpos($action, 'plugin.') !== 0)
            $action = 'plugin.'.$action;

        // can register action only if it's not taken or registered by myself
        if (!isset($this->actionmap[$action]) || $this->actionmap[$action] == $owner) {
            $this->actions[$action] = $callback;
            $this->actionmap[$action] = $owner;
        }
        else {
            rcube::raise_error(array('code' => 523, 'type' => 'php',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Cannot register action $action;"
                    ." already taken by another plugin"), true, false);
        }
    }