plugin.cpp

Go to the documentation of this file.
00001 /*
00002 #########################################################################
00003 #
00004 #  This file is part of trustyRC.
00005 #
00006 #  trustyRC, fully modular IRC robot 
00007 #  Copyright (C) 2006-2008 Nicoleau Fabien 
00008 #
00009 #  trustyRC is free software: you can redistribute it and/or modify
00010 #  it under the terms of the GNU General Public License as published by
00011 #  the Free Software Foundation, either version 3 of the License, or
00012 #  (at your option) any later version.
00013 #
00014 #  trustyRC is distributed in the hope that it will be useful,
00015 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 #  GNU General Public License for more details.
00018 #
00019 #  You should have received a copy of the GNU General Public License
00020 #  along with trustyRC.  If not, see <http://www.gnu.org/licenses/>.
00021 #
00022 #########################################################################
00023 */
00024 
00029 #include "plugin.h"
00030 
00035 Plugin::Plugin()
00036 {
00037         this->author = "";
00038         this->description = "";
00039         this->version = "";
00040         this->name = "";
00041    this->funcs.clear();
00042    this->requirements.clear();
00043    this->handle = NULL;
00044 }
00045 
00049 Plugin::~Plugin(){
00050 
00051 }
00052 
00057 string Plugin::getAuthor()
00058 {
00059         return this->author;
00060 }
00061 
00066 string Plugin::getDescription()
00067 {
00068         return this->description;
00069 }
00070 
00075 string Plugin::getVersion()
00076 {
00077         return this->version;
00078 }
00079 
00084 string Plugin::getName()
00085 {
00086         return this->name;
00087 }
00088 
00093 vector<StructFunctionStorage> Plugin::getFunctions() 
00094 {
00095    return this->funcs;
00096 }
00097 
00102 bool Plugin::checkMembers()
00103 {
00104         if ( this->getAuthor() == "" )
00105                 return false;
00106         if ( this->getDescription() == "" )
00107                 return false;
00108         if ( this->getVersion() == "" )
00109                 return false;
00110         if ( this->getName() == "" )
00111                 return false;
00112    if ( this->funcs.size() == 0 )
00113       return false;
00114         return true;
00115 }
00116 
00126 void Plugin::bindFunction(string highlightedWord,func_type type,string symbole,time_t lastExec,unsigned int timeout)
00127 {
00128    StructFunctionStorage store;
00129    store.handle = NULL;
00130    store.highlightedWord = highlightedWord;
00131    store.object = this;
00132    store.type = type;
00133    store.symbole = symbole;
00134    store.function = NULL;
00135    store.lastExec = lastExec;
00136    store.timeout = timeout;
00137    this->funcs.push_back(store);
00138 }
00139 
00144 void * Plugin::getHandle()
00145 {
00146    return this->handle;
00147 }
00148 
00153 void Plugin::setHandle(void* handle)
00154 {
00155    this->handle = handle;
00156 }
00157 
00163 void Plugin::addRequirement(string plugin) 
00164 {
00165    this->requirements.push_back(plugin);
00166 }
00167 
00172 vector<string> Plugin::getRequirements() 
00173 {
00174    return this->requirements;
00175 }
00176 
00182 bool Plugin::requires(string plugin)
00183 {
00184    return Tools::isInVector(this->requirements,plugin);
00185 }

Generated on Sun Aug 16 15:28:27 2009 for trustyRC by  doxygen 1.5.8