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 "pluginsample.h" 00030 00034 PluginSample::PluginSample(BotKernel*b) 00035 { 00036 this->author = "my nick !"; 00037 this->description = "My first plugin !!!"; 00038 this->version = VERSION; 00039 this->name = "sample"; 00040 this->bindFunction("hello",IN_COMMAND_HANDLER,"myFunction",0,2); 00041 } 00042 00043 extern "C" 00044 { 00045 Plugin *contruct_pluginsample(BotKernel*b) 00046 { 00047 return new PluginSample(b); 00048 } 00049 void destroy_pluginsample(Plugin*p) 00050 { 00051 delete p; 00052 } 00053 bool myFunction (Message*m,Plugin*p,BotKernel*b) 00054 { 00055 if ( m->isPublic()) { 00056 b->send(IRCProtocol::sendMsg(m->getSource(),"Hello "+m->getNickSender())) ; 00057 } 00058 else { 00059 b->send(IRCProtocol::sendMsg(m->getNickSender(),"Hello "+m->getNickSender())) ; 00060 } 00061 return true; 00062 } 00063 }