From dacd393fefeabafd1306533dd6c5a56e0ab347cc Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 27 Feb 2011 18:48:35 +0100 Subject: Initial commit --- 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 ++++++++++++++++ 10 files changed, 342 insertions(+) create mode 100644 plugins/alt/autoghost.cpp create mode 100644 plugins/alt/bar.cpp create mode 100644 plugins/alt/display.cpp create mode 100644 plugins/alt/display2.cpp create mode 100644 plugins/alt/foo.cpp create mode 100644 plugins/alt/ircsend.cpp create mode 100644 plugins/alt/pong.cpp create mode 100644 plugins/alt/say.cpp create mode 100644 plugins/alt/send.cpp create mode 100644 plugins/alt/test.cpp (limited to 'plugins/alt') diff --git a/plugins/alt/autoghost.cpp b/plugins/alt/autoghost.cpp new file mode 100644 index 0000000..5e57d57 --- /dev/null +++ b/plugins/alt/autoghost.cpp @@ -0,0 +1,28 @@ +#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 new file mode 100644 index 0000000..b89e5ad --- /dev/null +++ b/plugins/alt/bar.cpp @@ -0,0 +1,46 @@ +/* + * 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 new file mode 100644 index 0000000..7bdc477 --- /dev/null +++ b/plugins/alt/display.cpp @@ -0,0 +1,23 @@ +#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 new file mode 100644 index 0000000..257d821 --- /dev/null +++ b/plugins/alt/display2.cpp @@ -0,0 +1,23 @@ +#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 new file mode 100644 index 0000000..a62a6b6 --- /dev/null +++ b/plugins/alt/foo.cpp @@ -0,0 +1,66 @@ +/* + * 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 new file mode 100644 index 0000000..15a4dfd --- /dev/null +++ b/plugins/alt/ircsend.cpp @@ -0,0 +1,23 @@ +#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 new file mode 100644 index 0000000..de28d6b --- /dev/null +++ b/plugins/alt/pong.cpp @@ -0,0 +1,43 @@ +/* + * 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 new file mode 100644 index 0000000..ceb136c --- /dev/null +++ b/plugins/alt/say.cpp @@ -0,0 +1,45 @@ +/* + * 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 new file mode 100644 index 0000000..6704d93 --- /dev/null +++ b/plugins/alt/send.cpp @@ -0,0 +1,23 @@ +#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 new file mode 100644 index 0000000..de77b64 --- /dev/null +++ b/plugins/alt/test.cpp @@ -0,0 +1,22 @@ +#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!")); +} -- cgit v1.2.1