<?php

// -- plugin manager stuff
include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );

// -- for the public side action
include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
include_once( PLOG_CLASS_PATH."class/view/errorview.class.php" );

// -- for the admin side action
include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );

include_once( PLOG_CLASS_PATH."plugins/shoutbox/class/dao/shoutbox.class.php" );

class PluginShoutbox extends PluginBase  {
    var $s;

    function PluginShoutbox()
    {
        $this->PluginBase();

        $this->desc    = "Shoutbox plugin: unleash your visitors";
        $this->author  = "Palantir (radar@netpalantir.it)";
        $this->id      = "shoutbox";
        $this->locales = Array();

        $this->registerAdminAction("shoutbox", "PluginShoutboxAction" );
        $this->registerAdminAction("shoutboxConfig", "PluginShoutboxConfigAction" );
        $this->registerAdminAction( "updateShoutboxConfig", "PluginShoutboxUpdateConfigAction" );
        $this->registerAdminAction( "deleteShouts", "PluginShoutboxDeleteShoutsAction" );
        $this->registerAdminAction( "setupShoutbox", "PluginShoutboxSetupAction" );
        
        $this->addMenuEntry( "/menu/controlCenter/manageSettings", "Shoutbox", "?op=shoutbox", "" );
    }

    function process( $eventType, $params )
    {			
        // return the content as it came, as the caller class probably expected us to do
        // something with it...
        return $params;
    }		

    function sayHello()
    {
        return( "Hello, world!" );
    }

    function thinkAndDo() {
        if(!$this->s)
            $this->s = new Shoutbox($this->blogInfo->getId(), $this->blogSettings, $this->config);
        return $this->s->thinkAndDo();
    }

    function getDefaultNick() {
        if(!$this->s)
            $this->s = new Shoutbox($this->blogInfo->getId(), $this->blogSettings, $this->config);
        return $this->s->default_nick;
    }

    function getDefaultShout() {
        if(!$this->s)
            $this->s = new Shoutbox($this->blogInfo->getId(), $this->blogSettings, $this->config);
        return $this->s->default_shout;
    }
}