summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorFlorian Jung <flo@thinkpad.(none)>2011-02-28 18:48:58 +0100
committerFlorian Jung <flo@thinkpad.(none)>2011-02-28 18:48:58 +0100
commit74377ece178e661194a40fa79238b3089bb0d0f2 (patch)
treea1313c5518c5304b90396ef6ed3c04088e8fefe0 /plugins
parentd26ab5f2338aaf07289dd57c7770f85a79cf7b2b (diff)
Cleaned up unneeded files, some bugfixes
ismaster/isuser now gets called with origin_raw
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile2
-rw-r--r--plugins/alt/autoghost.cpp28
-rw-r--r--plugins/alt/bar.cpp46
-rw-r--r--plugins/alt/display.cpp23
-rw-r--r--plugins/alt/display2.cpp23
-rw-r--r--plugins/alt/foo.cpp66
-rw-r--r--plugins/alt/ircsend.cpp23
-rw-r--r--plugins/alt/pong.cpp43
-rw-r--r--plugins/alt/say.cpp45
-rw-r--r--plugins/alt/send.cpp23
-rw-r--r--plugins/alt/test.cpp22
-rw-r--r--plugins/finddoubles.cpp142
-rwxr-xr-xplugins/finddoubles2bin34249 -> 0 bytes
-rw-r--r--plugins/finddoubles2.cpp238
-rw-r--r--plugins/greet.cpp31
-rw-r--r--plugins/ops.cpp.additional1
-rw-r--r--plugins/pass.cpp2
-rw-r--r--plugins/quit.cpp2
-rw-r--r--plugins/rejoin.cpp.stabil154
19 files changed, 120 insertions, 794 deletions
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 <iostream>
-#include <string>
-
-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 <flo@localhost.localdomain>
- *
- * 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 <iostream>
-#include <string>
-
-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 "<<context<<endl;
- cout << "message is: "<<msg.origin<<"|"<<msg.command<<"|"<<msg.params<<"|"<<msg.content<<"|"<<endl;
- parent->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 <iostream>
-#include <string>
-
-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 <iostream>
-#include <string>
-
-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 <flo@localhost.localdomain>
- *
- * 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 <iostream>
-#include <string>
-
-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 "<<context<<endl;
- cout << "message is: "<<msg.origin<<"|"<<msg.command<<"|"<<msg.params<<"|"<<msg.content<<"|"<<endl;
- parent->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 <iostream>
-#include <string>
-
-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 <flo@localhost.localdomain>
- *
- * 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 <iostream>
-#include <string>
-
-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 <flo@localhost.localdomain>
- *
- * 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 <iostream>
-#include <string>
-
-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 <iostream>
-#include <string>
-
-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 <iostream>
-#include <string>
-
-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 <iostream>
#include <string>
-
-using namespace std;
+#include <sstream>
#include "../TConnectionInterface.h"
#include "../TPluginParentLight.h"
-#include "../TUserList.h"
+//#include "../TUserList.h"
+#include <vector>
#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<whoisinfo>::iterator whereinlist(vector<whoisinfo>* l, string s)
+{
+ for (vector<whoisinfo>::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<whoisinfo> *)+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<whoisinfo> **) ( (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<whoisinfo> **lptr= (vector<whoisinfo> **) ((string**)(((char*) context->data+1))+1);
+ *lptr=new vector<whoisinfo>;
+ 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<whoisinfo> **lptr= (vector<whoisinfo> **) ((string**)(((char*) context->data+1))+1);
+ *lptr=new vector<whoisinfo>;
*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<whoisinfo>** lptr= (vector<whoisinfo>**) ((string**)(((char*) context->data+1))+1);
+ vector<whoisinfo>* 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<whoisinfo>::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<string> nicks = liste->give_list();
- list<string> add = liste->give_additional();
+ for (int i=0; i<sz; i++)
+ {
+ saytemp=(*liste)[i].who;
+ cnt=1;
+ if ( (*liste)[i].proc == false )
+ {
+ for (int j=i+1; j<sz; j++)
+ {
+ if ( (*liste)[i].host == (*liste)[j].host )
+ {
+ saytemp+=", "+(*liste)[j].who;
+ cnt++;
+ (*liste)[i].proc=true;
+ }
+ }
+ }
+ if (cnt>1)
+ {
+ parent->say(tostring(cnt)+" people are sharing the hostmask "+(*liste)[i].host+": "+saytemp);
+ shared=true;
+ }
+ }
- list<string>::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<whoisinfo> **lptr= (vector<whoisinfo> **) ((string**)(((char*) context->data+1))+1);
+ *lptr=new vector<whoisinfo>;
+ 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
--- a/plugins/finddoubles2
+++ /dev/null
Binary files 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 <flo@localhost.localdomain>
- *
- * 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 <iostream>
-
-using namespace std;
-
-#include <iostream>
-#include <string>
-#include <sstream>
-
-#include "../TConnectionInterface.h"
-#include "../TPluginParentLight.h"
-//#include "../TUserList.h"
-#include <vector>
-#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<whoisinfo>::iterator whereinlist(vector<whoisinfo>* l, string s)
-{
- for (vector<whoisinfo>::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<whoisinfo> *)+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<whoisinfo> **) ( (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<whoisinfo> **lptr= (vector<whoisinfo> **) ((string**)(((char*) context->data+1))+1);
- *lptr=new vector<whoisinfo>;
- 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<whoisinfo> **lptr= (vector<whoisinfo> **) ((string**)(((char*) context->data+1))+1);
-
- *lptr=new vector<whoisinfo>;
-
- *whoiscnt=0;
- }
- }
- }
- }
-
- if (reason&PFLAGS_EXEC_ONANYEVENT)
- {
- vector<whoisinfo>** lptr= (vector<whoisinfo>**) ((string**)(((char*) context->data+1))+1);
- vector<whoisinfo>* 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<whoisinfo>::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; i<sz; i++)
- {
- saytemp=(*liste)[i].who;
- cnt=1;
- if ( (*liste)[i].proc == false )
- {
- for (int j=i+1; j<sz; j++)
- {
- if ( (*liste)[i].host == (*liste)[j].host )
- {
- saytemp+=", "+(*liste)[j].who;
- cnt++;
- (*liste)[i].proc=true;
- }
- }
- }
- if (cnt>1)
- {
- 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<whoisinfo> **lptr= (vector<whoisinfo> **) ((string**)(((char*) context->data+1))+1);
- *lptr=new vector<whoisinfo>;
- 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 <iostream>
-#include <string>
-
-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<string> foo=parent->get_parent()->get_channel_users(parent->get_name()).give_list();
- for (list<string>::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 <iostream>
-#include <string>
-#include <list>
-
-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<entry_t>*);
- *conndefault=PFLAGS_EXEC_ONEVENT; *chandefault=0; *sessdefault=0;
-}
-
-extern "C" void plugin (plugincontext* context, ircmessage msg, TPluginParentLight* parent, TConfigReadOnly& config, int reason)
-{
- list<entry_t> *liste=*static_cast<list<entry_t> **>(context->data);
- if (liste==0)
- {
- liste=new list<entry_t>;
- *static_cast<list<entry_t> **>(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<entry_t>::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<entry_t>::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;
- }
- }
- }
-
- }
-}