/**
     * Performs the action; returns true on success, false on error.
     *
     * @param $p_context - the current context object
     * @return bool
     */
    public function takeAction(CampContext &$p_context)
    {
        $p_context->default_url->reset_parameter('f_'.$this->m_name);
        $p_context->url->reset_parameter('f_'.$this->m_name);

        if (!is_null($this->m_error)) {
            return false;
        }

        $user = $p_context->user;

        if ($user->defined) {
            $this->m_properties['user_name'] = '';
            $this->m_properties['user_email'] = '';
        } else {
            switch(SystemPref::Get('PLUGIN_BLOGCOMMENT_MODE')) {
                case 'name':
                    if (!strlen($this->m_properties['user_name'])) {
                        $this->m_error = new PEAR_Error('Name was empty.', ACTION_BLOGCOMMENT_ERR_NO_NAME);
                        return false;
                    }
                break;

                case 'email':
                    if (!strlen($this->m_properties['user_name'])) {
                        $this->m_error = new PEAR_Error('Name was empty.', ACTION_BLOGCOMMENT_ERR_NO_NAME);
                        return false;
                    }
                    if (!CampMail::ValidateAddress($this->m_properties['user_email'])) {
                        $this->m_error = new PEAR_Error('Email was empty or invalid.', ACTION_BLOGCOMMENT_ERR_NO_EMAIL);
                        return false;
                    }
                break;

                case 'registered':
                default:
                    $this->m_error = new PEAR_Error('Only registered users can post comments.', ACTION_BLOGCOMMENT_ERR_NOT_REGISTERED);
                    return false;
                break;
            }
        }

        $BlogEntry = new BlogEntry($this->m_properties['blogentry_id']);

        if ($this->m_blogcomment->create($BlogEntry->getId(),
                                         is_object($p_context->user) && $p_context->user->identifier ? $p_context->user->identifier : 0,
                                         $this->m_properties['user_name'],
                                         $this->m_properties['user_email'],
                                         $this->m_properties['title'],
                                         $this->m_properties['content'],
                                         $this->m_properties['mood_id'])) {
            $this->m_error = ACTION_OK;
            return true;
        }

        return false;
    }