From 74377ece178e661194a40fa79238b3089bb0d0f2 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 28 Feb 2011 18:48:58 +0100 Subject: Cleaned up unneeded files, some bugfixes ismaster/isuser now gets called with origin_raw --- plugins/Makefile | 2 + plugins/alt/autoghost.cpp | 28 ------ plugins/alt/bar.cpp | 46 --------- plugins/alt/display.cpp | 23 ----- plugins/alt/display2.cpp | 23 ----- plugins/alt/foo.cpp | 66 ------------- plugins/alt/ircsend.cpp | 23 ----- plugins/alt/pong.cpp | 43 -------- plugins/alt/say.cpp | 45 --------- plugins/alt/send.cpp | 23 ----- plugins/alt/test.cpp | 22 ----- plugins/finddoubles.cpp | 142 ++++++++++++++++++++++----- plugins/finddoubles2 | Bin 34249 -> 0 bytes plugins/finddoubles2.cpp | 238 --------------------------------------------- plugins/greet.cpp | 31 ------ plugins/ops.cpp.additional | 1 - plugins/pass.cpp | 2 +- plugins/quit.cpp | 2 +- plugins/rejoin.cpp.stabil | 154 ----------------------------- 19 files changed, 120 insertions(+), 794 deletions(-) delete mode 100644 plugins/alt/autoghost.cpp delete mode 100644 plugins/alt/bar.cpp delete mode 100644 plugins/alt/display.cpp delete mode 100644 plugins/alt/display2.cpp delete mode 100644 plugins/alt/foo.cpp delete mode 100644 plugins/alt/ircsend.cpp delete mode 100644 plugins/alt/pong.cpp delete mode 100644 plugins/alt/say.cpp delete mode 100644 plugins/alt/send.cpp delete mode 100644 plugins/alt/test.cpp delete mode 100755 plugins/finddoubles2 delete mode 100644 plugins/finddoubles2.cpp delete mode 100644 plugins/greet.cpp delete mode 100644 plugins/ops.cpp.additional delete mode 100644 plugins/rejoin.cpp.stabil (limited to 'plugins') diff --git a/plugins/Makefile b/plugins/Makefile index c881e08..7b16ded 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -4,6 +4,8 @@ all: %.so: %.cpp $(CXX) $(CXXFLAGS) -shared -o $@ $^ ../myfuncs.cpp +ops.so: ../TUserList.o + clean: rm *.so *.o diff --git a/plugins/alt/autoghost.cpp b/plugins/alt/autoghost.cpp deleted file mode 100644 index 5e57d57..0000000 --- a/plugins/alt/autoghost.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TPluginParentLight.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=PFLAGS_EXEC_ONANYEVENT | PFLAGS_EXEC_ONCREATE; *chandefault=0; *sessdefault=0; -} - -extern "C" void autoghost (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - //if (reason&PFLAGS_EXEC_ONANYEVENT) - // cout << msg.origin << ": " << msg.command << " " << msg.params << ": " << msg.content << endl; - cout << "connect YAY!" << reason << endl; - - if (reason&PFLAGS_EXEC_ONCREATE) - { - if (lcase(parent->get_ournick())!="drunkenman") - { - cout << "hey!" << endl; - } - } -} diff --git a/plugins/alt/bar.cpp b/plugins/alt/bar.cpp deleted file mode 100644 index b89e5ad..0000000 --- a/plugins/alt/bar.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * foo.cpp - * - * Copyright 2009 Florian - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - - -#include -#include - -using namespace std; - -#include "../TPluginParentLight.h" -#include "../mytypes.h" - -extern "C" int init() -{ - return 0; //wir brauchen keinen kontext! -} - -extern "C" void bar (plugincontext* context, ircmessage msg, TPluginParentLight* parent) -{ - cout << "context is "<pluginsend ("hier bin ich!"); - bool temp; - temp=parent->ismaster("flo|linux"); - if (temp) parent->pluginsend ("hallo meister"); - - parent->pluginsend ("und du bist " + parent->get_name() + "..?"); -} diff --git a/plugins/alt/display.cpp b/plugins/alt/display.cpp deleted file mode 100644 index 7bdc477..0000000 --- a/plugins/alt/display.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TPluginParentLight.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=PFLAGS_EXEC_ONANYEVENT | PFLAGS_EXEC_ONCREATE; *chandefault=0; *sessdefault=0; -} - -extern "C" void display (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - //if (ucase(msg.command)=="PRIVMSG") - if (reason&PFLAGS_EXEC_ONANYEVENT) - cout << msg.origin << ": " << msg.command << " " << msg.params << ": " << msg.content << endl; - - if (reason&PFLAGS_EXEC_ONCREATE) - cout << endl << "!!!!!!!!!!!!!!connected.!!!!!!!!!!!!!!" << endl << endl; -} diff --git a/plugins/alt/display2.cpp b/plugins/alt/display2.cpp deleted file mode 100644 index 257d821..0000000 --- a/plugins/alt/display2.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TPluginParentLight.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=PFLAGS_EXEC_ONANYEVENT | PFLAGS_EXEC_ONCREATE; *chandefault=0; *sessdefault=0; -} - -extern "C" void display2 (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - //if (ucase(msg.command)=="PRIVMSG") - if (reason&PFLAGS_EXEC_ONANYEVENT) - cout << msg.origin << ": " << msg.command << " " << msg.params << ": " << msg.content << endl; - - if (reason&PFLAGS_EXEC_ONCREATE) - cout << endl << "!!!!!!!!!!!!!!connected.!!!!!!!!!!!!!!" << endl << endl; -} diff --git a/plugins/alt/foo.cpp b/plugins/alt/foo.cpp deleted file mode 100644 index a62a6b6..0000000 --- a/plugins/alt/foo.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * foo.cpp - * - * Copyright 2009 Florian - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - - -#include -#include - -using namespace std; - -#include "../TPluginParent.h" - -//typedef void (*pluginfunc)(void* context, ircmessage msg); -//typedef int (*plugininitfunc)(); - -struct plugincontext -{ - int flags; //when it is executed, etc - bool exec_now; - void* data; //pointer to an area in the RAM where the plugin can write to - void* functions[10]; //array of pointers to various functions: - // say: (in case of chans: PRIVMSG chan; in case of nicks: PRIVMSG nick) - // send: send plain text to connection -}; - -struct ircmessage -{ - string origin; - string command; - string content; - string params; - - bool operator! () { return ((origin=="")&&(command=="")&&(content=="")&&(params=="")); } - operator bool () { return ((origin!="")||(command!="")||(content!="")||(params!="")); } -}; - - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - - return 0; //wir brauchen keinen kontext! -} - -extern "C" void foo (plugincontext* context, ircmessage msg, TPluginParent* parent) -{ - cout << "context is "<pluginsend ("hier bin ich!"); -} diff --git a/plugins/alt/ircsend.cpp b/plugins/alt/ircsend.cpp deleted file mode 100644 index 15a4dfd..0000000 --- a/plugins/alt/ircsend.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TConnectionInterface.h" -#include "../TPluginParentLight.h" -#include "../TUserList.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND; *sessdefault=PFLAGS_EXEC_ONDEMAND; -} - -extern "C" void ircsend (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - if (reason&PFLAGS_EXEC_ONDEMAND) - if (ucase(msg.command)=="PRIVMSG") - if (parent->get_parent()->ismaster(msg.origin)) - parent->get_parent()->send (msg.content.substr(9)+NEWLINE); -} diff --git a/plugins/alt/pong.cpp b/plugins/alt/pong.cpp deleted file mode 100644 index de28d6b..0000000 --- a/plugins/alt/pong.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * foo.cpp - * - * Copyright 2009 Florian - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - - -#include -#include - -using namespace std; - -#include "../TPluginParentLight.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -int x; - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=PFLAGS_EXEC_ONANYEVENT; *chandefault=0; *sessdefault=0;//return 0; //wir brauchen keinen kontext! -} - -extern "C" void pong (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - if (ucase(msg.command)=="PING") - parent->pluginsend("PONG :" + msg.content); -} diff --git a/plugins/alt/say.cpp b/plugins/alt/say.cpp deleted file mode 100644 index ceb136c..0000000 --- a/plugins/alt/say.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * foo.cpp - * - * Copyright 2009 Florian - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - - -#include -#include - -using namespace std; - -#include "../TPluginParentLight.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND | PFLAGS_EXEC_ONCREATE; *sessdefault=PFLAGS_EXEC_ONDEMAND | PFLAGS_EXEC_ONCREATE; -} - -extern "C" void say (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - //if (ucase(msg.command)=="PRIVMSG") - if (reason&PFLAGS_EXEC_ONDEMAND) - parent->pluginsay (msg.origin+"> "+msg.content+"!"); - - if (reason&PFLAGS_EXEC_ONCREATE) - parent->pluginsay ("welcome!"); -} diff --git a/plugins/alt/send.cpp b/plugins/alt/send.cpp deleted file mode 100644 index 6704d93..0000000 --- a/plugins/alt/send.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TConnectionInterface.h" -#include "../TPluginParentLight.h" -#include "../TUserList.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND; *sessdefault=PFLAGS_EXEC_ONDEMAND; -} - -extern "C" void ircsend (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - if (reason&PFLAGS_EXEC_ONDEMAND) - if (ucase(msg.command)=="PRIVMSG") - if (parent->get_parent()->ismaster(msg.origin)) - parent->say ("."+msg.content.substr(5)+"."); -} diff --git a/plugins/alt/test.cpp b/plugins/alt/test.cpp deleted file mode 100644 index de77b64..0000000 --- a/plugins/alt/test.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TConnectionInterface.h" -#include "../TPluginParentLight.h" -#include "../TUserList.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=0; *chandefault=PFLAGS_EXEC_ONEVENT; *sessdefault=0; -} - -extern "C" void test (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - if (reason&PFLAGS_EXEC_ONEVENT) - if (parent->get_parent()->ismaster(msg.origin)) - parent->say (ucase("hallo meister!")); -} diff --git a/plugins/finddoubles.cpp b/plugins/finddoubles.cpp index f98a18f..642bd9c 100644 --- a/plugins/finddoubles.cpp +++ b/plugins/finddoubles.cpp @@ -26,30 +26,76 @@ using namespace std; #include #include - -using namespace std; +#include #include "../TConnectionInterface.h" #include "../TPluginParentLight.h" -#include "../TUserList.h" +//#include "../TUserList.h" +#include #include "../mytypes.h" #include "../myfuncs.h" +struct whoisinfo +{ + string who; + string host; + bool proc; +}; + +inline std::string tostring(int x) + { + std::ostringstream o; + if (!(o << x)) + throw; + return o.str(); + } + +vector::iterator whereinlist(vector* l, string s) +{ + for (vector::iterator i=l->begin();i!=l->end();i++) + if ( lcase( i->who ) == lcase(s) ) + return i; + + return l->end(); +} + extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) { - *csize=sizeof(char)+sizeof(string *)+sizeof(TUserList *)+sizeof(int); *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND; *sessdefault=PFLAGS_EXEC_ONDEMAND; + *csize=sizeof(char)+sizeof(string *)+sizeof(vector *)+sizeof(int); *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND; *sessdefault=PFLAGS_EXEC_ONDEMAND; } extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) { - int* whoiscnt=(int*) ( (TUserList**) ( (string**) ( (char*) context->data +1) +1) +1); + int* whoiscnt=(int*) ( (vector **) ( (string**) ( (char*) context->data +1) +1) +1); if (reason&PFLAGS_EXEC_ONDEMAND) { if (ucase(msg.command)=="PRIVMSG") { if (*((char*)(context->data)) != 0) { - parent->say("sorry, try again later."); + if (lcase(trim(ntharg(msg.content,2)))=="abort") + { + parent->say ("aborted for channel "+** ((string**)((char*)context->data+1))); + + string ** cptrdest= (string**) ((char*) context->data + 1); + if (*cptrdest) + delete (*cptrdest); + *cptrdest=NULL; + + vector **lptr= (vector **) ((string**)(((char*) context->data+1))+1); + *lptr=new vector; + if (*lptr) + delete (*lptr); + *lptr=NULL; + + *((char*)(context->data))=0; + + context->flags=PFLAGS_EXEC_ONDEMAND; + } + else + { + parent->say("sorry, try again later."); + } } else { @@ -71,16 +117,11 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig *cptrdest=chanptr; - TUserList** lptr= (TUserList**) ((string**)(((char*) context->data+1))+1); - - *lptr=new TUserList; - cout << "lptr=" << lptr <<"/" << *lptr << endl; + vector **lptr= (vector **) ((string**)(((char*) context->data+1))+1); + *lptr=new vector; *whoiscnt=0; -// parent->say ("exiting commandmode"); - //((string**)((char*)context->data+1))=chanptr; - //*((string*) ((char*)context->data + 1))=chanptr; } } } @@ -88,8 +129,9 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig if (reason&PFLAGS_EXEC_ONANYEVENT) { - TUserList** lptr= (TUserList**) ((string**)(((char*) context->data+1))+1); - TUserList* liste=*lptr; + vector** lptr= (vector**) ((string**)(((char*) context->data+1))+1); + vector* liste=*lptr; + string name; name= ** ((string**)((char*)context->data+1)); int numcmd=atoi(msg.command.c_str()); @@ -103,7 +145,14 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig { if ((temp[0]=='+') || (temp[0]=='@')) temp=temp.substr(1); - liste->addtolist(temp); + //liste->addtolist(temp); + + whoisinfo structtemp; + structtemp.who=temp; + structtemp.host=""; + structtemp.proc=false; + liste->push_back(structtemp); + parent->get_parent()->send("whois "+temp+NEWLINE); (*whoiscnt)++; } @@ -111,16 +160,20 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig } if (numcmd==366) { - parent->say ("fertig empfangen..."); +// parent->say ("fertig empfangen..."); *((char*)(context->data)) = 2; } if (numcmd==311) { // parent->say ("whoisantwort für "+ntharg(msg.params,2)+": "+ntharg(msg.params,4)); - if (liste->isinlist(ntharg(msg.params,2))) + + vector::iterator pos; + + if ((pos=whereinlist(liste, ntharg(msg.params,2)))!=liste->end()) { - liste->edit (ntharg(msg.params,2),ntharg(msg.params,4)); + pos->host=ntharg(msg.params,4); + // liste->edit (ntharg(msg.params,2),ntharg(msg.params,4)); (*whoiscnt)--; } } @@ -129,20 +182,57 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig if ((*whoiscnt==0)&&(*((char*)(context->data))==2)) { - parent->say ("fertig! YAY!"); - *((char*)(context->data))=0; + int sz=liste->size(); + int cnt; + + string saytemp; + bool shared=false; -/* list nicks = liste->give_list(); - list add = liste->give_additional(); + for (int i=0; i1) + { + parent->say(tostring(cnt)+" people are sharing the hostmask "+(*liste)[i].host+": "+saytemp); + shared=true; + } + } - list::iterator it1,it2; - it1=nicks.begin(); - it2=add.begin();*/ + if (!shared) + parent->say("there were no people sharing a hostmask in " + (** ((string**)((char*)context->data+1)))+"."); + + + string ** cptrdest= (string**) ((char*) context->data + 1); + if (*cptrdest) + delete (*cptrdest); + *cptrdest=NULL; + vector **lptr= (vector **) ((string**)(((char*) context->data+1))+1); + *lptr=new vector; + if (*lptr) + delete (*lptr); + *lptr=NULL; + + *((char*)(context->data))=0; + context->flags=PFLAGS_EXEC_ONDEMAND; } } } + diff --git a/plugins/finddoubles2 b/plugins/finddoubles2 deleted file mode 100755 index 3b37fa3..0000000 Binary files a/plugins/finddoubles2 and /dev/null differ diff --git a/plugins/finddoubles2.cpp b/plugins/finddoubles2.cpp deleted file mode 100644 index 642bd9c..0000000 --- a/plugins/finddoubles2.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - * say.cpp - * - * Copyright 2009 Florian - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - - -#include - -using namespace std; - -#include -#include -#include - -#include "../TConnectionInterface.h" -#include "../TPluginParentLight.h" -//#include "../TUserList.h" -#include -#include "../mytypes.h" -#include "../myfuncs.h" - -struct whoisinfo -{ - string who; - string host; - bool proc; -}; - -inline std::string tostring(int x) - { - std::ostringstream o; - if (!(o << x)) - throw; - return o.str(); - } - -vector::iterator whereinlist(vector* l, string s) -{ - for (vector::iterator i=l->begin();i!=l->end();i++) - if ( lcase( i->who ) == lcase(s) ) - return i; - - return l->end(); -} - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=sizeof(char)+sizeof(string *)+sizeof(vector *)+sizeof(int); *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND; *sessdefault=PFLAGS_EXEC_ONDEMAND; -} - -extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - int* whoiscnt=(int*) ( (vector **) ( (string**) ( (char*) context->data +1) +1) +1); - if (reason&PFLAGS_EXEC_ONDEMAND) - { - if (ucase(msg.command)=="PRIVMSG") - { - if (*((char*)(context->data)) != 0) - { - if (lcase(trim(ntharg(msg.content,2)))=="abort") - { - parent->say ("aborted for channel "+** ((string**)((char*)context->data+1))); - - string ** cptrdest= (string**) ((char*) context->data + 1); - if (*cptrdest) - delete (*cptrdest); - *cptrdest=NULL; - - vector **lptr= (vector **) ((string**)(((char*) context->data+1))+1); - *lptr=new vector; - if (*lptr) - delete (*lptr); - *lptr=NULL; - - *((char*)(context->data))=0; - - context->flags=PFLAGS_EXEC_ONDEMAND; - } - else - { - parent->say("sorry, try again later."); - } - } - else - { - string chan=ntharg(msg.content,2); - if (trim(chan)=="") - { - parent->say("you have to specify a channel name!"); - } - else - { -// parent->say ("/names "+chan+"..."); - parent->get_parent()->send("names "+chan+NEWLINE); - context->flags|=PFLAGS_EXEC_ONANYEVENT; - *((char*)(context->data)) = 1; - string* chanptr=new string(chan); - - string** cptrdest; - cptrdest= (string**) ((char*) context->data + 1); - - *cptrdest=chanptr; - - vector **lptr= (vector **) ((string**)(((char*) context->data+1))+1); - - *lptr=new vector; - - *whoiscnt=0; - } - } - } - } - - if (reason&PFLAGS_EXEC_ONANYEVENT) - { - vector** lptr= (vector**) ((string**)(((char*) context->data+1))+1); - vector* liste=*lptr; - - string name; - name= ** ((string**)((char*)context->data+1)); - int numcmd=atoi(msg.command.c_str()); - if (numcmd==353) - { - if (lcase(msg.params.substr(msg.params.rfind(' ')+1))==lcase(name)) - { - string temp; - string temp2=msg.content; - while ((temp=split(temp2))!="") - { - if ((temp[0]=='+') || (temp[0]=='@')) - temp=temp.substr(1); - //liste->addtolist(temp); - - whoisinfo structtemp; - structtemp.who=temp; - structtemp.host=""; - structtemp.proc=false; - liste->push_back(structtemp); - - parent->get_parent()->send("whois "+temp+NEWLINE); - (*whoiscnt)++; - } - } - } - if (numcmd==366) - { -// parent->say ("fertig empfangen..."); - *((char*)(context->data)) = 2; - } - - if (numcmd==311) - { -// parent->say ("whoisantwort für "+ntharg(msg.params,2)+": "+ntharg(msg.params,4)); - - vector::iterator pos; - - if ((pos=whereinlist(liste, ntharg(msg.params,2)))!=liste->end()) - { - pos->host=ntharg(msg.params,4); - // liste->edit (ntharg(msg.params,2),ntharg(msg.params,4)); - (*whoiscnt)--; - } - } - - //cout << "DEBUG: " << *whoiscnt << "," << *((char*)(context->data)) << endl; - - if ((*whoiscnt==0)&&(*((char*)(context->data))==2)) - { - int sz=liste->size(); - int cnt; - - string saytemp; - bool shared=false; - - for (int i=0; i1) - { - parent->say(tostring(cnt)+" people are sharing the hostmask "+(*liste)[i].host+": "+saytemp); - shared=true; - } - } - - - if (!shared) - parent->say("there were no people sharing a hostmask in " + (** ((string**)((char*)context->data+1)))+"."); - - - string ** cptrdest= (string**) ((char*) context->data + 1); - if (*cptrdest) - delete (*cptrdest); - *cptrdest=NULL; - - vector **lptr= (vector **) ((string**)(((char*) context->data+1))+1); - *lptr=new vector; - if (*lptr) - delete (*lptr); - *lptr=NULL; - - *((char*)(context->data))=0; - - context->flags=PFLAGS_EXEC_ONDEMAND; - } - - - } -} - diff --git a/plugins/greet.cpp b/plugins/greet.cpp deleted file mode 100644 index 8ac5820..0000000 --- a/plugins/greet.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -using namespace std; - -#include "../TConnectionInterface.h" -#include "../TPluginParentLight.h" -#include "../TUserList.h" -#include "../mytypes.h" -#include "../myfuncs.h" - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=0; *conndefault=0; *chandefault=PFLAGS_EXEC_ONDEMAND; *sessdefault=0; -} - -extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLight* parent, int reason) -{ - if (reason&PFLAGS_EXEC_ONDEMAND) - if (ucase(msg.command)=="PRIVMSG") - if (parent->get_parent()->isuser(msg.origin)) - { - list foo=parent->get_parent()->get_channel_users(parent->get_name()).give_list(); - for (list::iterator it=foo.begin(); it!=foo.end(); it++) - parent->say ("hello, "+*it+"!"); - } - else - { - parent->say ("sorry, you aren't a user, "+msg.origin+"!"); - } -} diff --git a/plugins/ops.cpp.additional b/plugins/ops.cpp.additional deleted file mode 100644 index 9b4ecc3..0000000 --- a/plugins/ops.cpp.additional +++ /dev/null @@ -1 +0,0 @@ -../TUserList.o diff --git a/plugins/pass.cpp b/plugins/pass.cpp index 79db2e1..1429fc5 100644 --- a/plugins/pass.cpp +++ b/plugins/pass.cpp @@ -21,7 +21,7 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig cout << "foo" << endl; if (reason&PFLAGS_EXEC_ONDEMAND) { - if (parent->get_parent()->ismaster(msg.origin)) + if (parent->get_parent()->ismaster(msg.origin_raw)) { cout << "bar" << endl; parent->say("processing..."); diff --git a/plugins/quit.cpp b/plugins/quit.cpp index 9bb410d..71c2a3c 100644 --- a/plugins/quit.cpp +++ b/plugins/quit.cpp @@ -18,7 +18,7 @@ extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLig { if (reason&PFLAGS_EXEC_ONDEMAND) if (ucase(msg.command)=="PRIVMSG") - if (parent->get_parent()->ismaster(msg.origin)) + if (parent->get_parent()->ismaster(msg.origin_raw)) parent->get_parent()->quit(msg.origin+" told me to quit. cya!"); //parent->get_parent()->send (msg.content.substr(6)+NEWLINE); } diff --git a/plugins/rejoin.cpp.stabil b/plugins/rejoin.cpp.stabil deleted file mode 100644 index 3098668..0000000 --- a/plugins/rejoin.cpp.stabil +++ /dev/null @@ -1,154 +0,0 @@ -/* TODO - * 470 forwarding to another channel implementieren - * evtl timeout implementieren - * aus config folgendes lesen: - * rejoinen? - * wie lange warten? - * - */ - -#include -#include -#include - -using namespace std; - -#include "../TConnectionInterface.h" -#include "../TPluginParentLight.h" -#include "../TUserList.h" -#include "../mytypes.h" -#include "../myfuncs.h" -#include "../TConfigReadOnly.h" - -struct entry_t -{ - char state; - int wait; - time_t last; - string name; -}; - -extern "C" void init(int* csize, int* conndefault, int* chandefault, int* sessdefault) -{ - *csize=sizeof(list*); - *conndefault=PFLAGS_EXEC_ONEVENT; *chandefault=0; *sessdefault=0; -} - -extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLight* parent, TConfigReadOnly& config, int reason) -{ - list *liste=*static_cast **>(context->data); - if (liste==0) - { - liste=new list; - *static_cast **>(context->data)=liste; - } - - if (reason&PFLAGS_EXEC_ONEVENT) - { - if ((msg.command=="KICK") && (lcase(ntharg(msg.params,2))==lcase(parent->get_parent()->get_nick()))) //wir wurden gekickt? sauerei! - { - cout << "we got kicked from " << ntharg(msg.params,1) << endl; - if (config.get_valid_boolean(parent->get_parent()->get_networkname() + "." + ntharg(msg.params,1) + ".rejoin", false)) - { - cout << " trying to rejoin" << endl; - - entry_t tmp; - tmp.state=1; - tmp.last=time(NULL)+1; //fake time to wait 1 second ONCE - tmp.wait=0; - tmp.name=ntharg(msg.params,1); - liste->push_back(tmp); - - context->flags |= PFLAGS_EXEC_ALWAYS; - } - } - //evtl aus datei lesen? -// parent->get_parent()->send ("join #DrunkenMan" NEWLINE); - -// if (config.is_string(parent->get_parent()->get_networkname()+".pass")) -// parent->get_parent()->send("PRIVMSG NickServ :identify "+config.get_string(parent->get_parent()->get_networkname()+".nick")+" "+config.get_string(parent->get_parent()->get_networkname()+".pass")); - - } - - if (reason&PFLAGS_EXEC_ALWAYS) - { - for (list::iterator it=liste->begin(); it!=liste->end(); it++) - { - switch (it->state) - { - case 1: - if (time(NULL)>(it->last+it->wait)) - { - cout << "DEBUG: waiting is over" << endl; - parent->get_parent()->send("join "+it->name); - it->state=2; - } - break; - case 2: //waiting for JOIN answer - if ((ucase(msg.command)=="JOIN") && (ucase(msg.origin)==ucase(parent->get_parent()->get_nick()))) - { - it->state=99; - cout << "!!!!!!!SUCCESS" << endl; - } - else - { - if ((lcase(ntharg(msg.params,1))==lcase(parent->get_parent()->get_nick())) && (lcase(ntharg(msg.params, 2))==lcase(it->name))) - { - cout << "!!!!!!!!betrifft uns" << endl; - int numcmd=atoi(msg.command.c_str()); - switch (numcmd) - { - case 471: //channel is full - it->last=time(NULL); - it->state=1; - it->wait++; - break; - case 473: //inviteonly - parent->get_parent()->send("PRIVMSG ChanServ :invite "+it->name); - it->state=3; - break; - case 474: //banned - parent->get_parent()->send("PRIVMSG ChanServ :unban "+it->name); - it->state=3; - break; - case 475: //bad key, no such chan, too many chans. fatal. - case 403: - case 405: - it->state=99; - cout << "!!!!!!!!!FATAL" << endl; - break; - } - } - } - break; - - case 3: //waiting for CHANSERV answer - if ( ((msg.command=="401") && (ucase(ntharg(msg.params,2))=="CHANSERV")) || ((msg.command=="NOTICE") && (ucase(msg.origin)=="CHANSERV")) ) - { - //answer arrived or no chanserv? - it->last=time(NULL); - it->state=1; - } - - break; - } - } - - bool temp=true; - while (temp) - { - temp=false; - for (list::iterator it=liste->begin(); it!=liste->end(); it++) - { - if (it->state==99) - { - cout << "cleanup: removing entry for channel " << it->name << "..." << endl; - liste->erase(it); - temp=true; - break; - } - } - } - - } -} -- cgit v1.2.1