summaryrefslogtreecommitdiff
path: root/plugins/alt
diff options
context:
space:
mode:
authorFlorian Jung <flo@thinkpad.(none)>2011-02-27 18:48:35 +0100
committerFlorian Jung <flo@thinkpad.(none)>2011-02-27 18:48:35 +0100
commitdacd393fefeabafd1306533dd6c5a56e0ab347cc (patch)
treedd3d0ed19a9490109a890df2c07634a6b823d1ff /plugins/alt
Initial commit
Diffstat (limited to 'plugins/alt')
-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
10 files changed, 342 insertions, 0 deletions
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 <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
new file mode 100644
index 0000000..b89e5ad
--- /dev/null
+++ b/plugins/alt/bar.cpp
@@ -0,0 +1,46 @@
+/*
+ * 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
new file mode 100644
index 0000000..7bdc477
--- /dev/null
+++ b/plugins/alt/display.cpp
@@ -0,0 +1,23 @@
+#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
new file mode 100644
index 0000000..257d821
--- /dev/null
+++ b/plugins/alt/display2.cpp
@@ -0,0 +1,23 @@
+#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
new file mode 100644
index 0000000..a62a6b6
--- /dev/null
+++ b/plugins/alt/foo.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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
new file mode 100644
index 0000000..15a4dfd
--- /dev/null
+++ b/plugins/alt/ircsend.cpp
@@ -0,0 +1,23 @@
+#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
new file mode 100644
index 0000000..de28d6b
--- /dev/null
+++ b/plugins/alt/pong.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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
new file mode 100644
index 0000000..ceb136c
--- /dev/null
+++ b/plugins/alt/say.cpp
@@ -0,0 +1,45 @@
+/*
+ * 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
new file mode 100644
index 0000000..6704d93
--- /dev/null
+++ b/plugins/alt/send.cpp
@@ -0,0 +1,23 @@
+#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
new file mode 100644
index 0000000..de77b64
--- /dev/null
+++ b/plugins/alt/test.cpp
@@ -0,0 +1,22 @@
+#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!"));
+}