diff options
-rw-r--r-- | include/modules.h | 38 | ||||
-rw-r--r-- | src/modules/demos/catserv/Makefile | 9 | ||||
-rw-r--r-- | src/modules/demos/catserv/README | 4 | ||||
-rw-r--r-- | src/modules/demos/catserv/catserv_extern.h | 11 | ||||
-rw-r--r-- | src/modules/demos/catserv/catserv_messages.c | 14 | ||||
-rw-r--r-- | src/modules/demos/catserv/catserv_messages.h | 10 | ||||
-rw-r--r-- | src/modules/demos/catserv/ircd_catserv.c | 110 | ||||
-rw-r--r-- | src/modules/demos/catserv/makefile.win32 | 4 | ||||
-rw-r--r-- | src/modules/demos/catserv/meow.c | 9 | ||||
-rw-r--r-- | src/modules/demos/catserv/meow.h | 9 | ||||
-rw-r--r-- | src/modules/demos/catserv/purr.c | 8 | ||||
-rw-r--r-- | src/modules/demos/catserv/purr.h | 9 | ||||
-rw-r--r-- | src/modules/demos/events.c | 82 | ||||
-rw-r--r-- | src/modules/demos/hs_conf.c | 74 | ||||
-rw-r--r-- | src/modules/demos/hs_moo.c | 119 |
15 files changed, 0 insertions, 510 deletions
diff --git a/include/modules.h b/include/modules.h index 6564f0fbd..30875e664 100644 --- a/include/modules.h +++ b/include/modules.h @@ -129,8 +129,6 @@ typedef struct ModuleHash_ ModuleHash; typedef struct Message_ Message; typedef struct MessageHash_ MessageHash; typedef struct ModuleCallBack_ ModuleCallBack; -typedef struct EvtMessage_ EvtMessage; -typedef struct EvtMessageHash_ EvtMessageHash; typedef struct EvtHook_ EvtHook; typedef struct EvtHookHash_ EvtHookHash; @@ -143,7 +141,6 @@ extern MDE CommandHash *HELPSERV[MAX_CMD_HASH]; extern MDE CommandHash *OPERSERV[MAX_CMD_HASH]; extern MDE MessageHash *IRCD[MAX_CMD_HASH]; extern MDE ModuleHash *MODULE_HASH[MAX_CMD_HASH]; -extern MDE EvtMessageHash *EVENT[MAX_CMD_HASH]; extern MDE EvtHookHash *EVENTHOOKS[MAX_CMD_HASH]; struct ModuleLang_ { @@ -237,19 +234,6 @@ CoreExport class Module **/ int AddEventHook(EvtHook *evh); - /** Add a module message to the IRCD message hash - * @param m the Message to add - * @param pos the Position to add the message to, e.g. MOD_HEAD, MOD_TAIL, MOD_UNIQUE - * @return MOD_ERR_OK on success, althing else on fail. - **/ - int AddEventHandler(EvtMessage *evm); - - /** Remove the given message from the IRCD message hash - * @param name the name of the message to remove - * @return MOD_ERR_OK on success, althing else on fail. - **/ - int DelEventHandler(const char *name); - /** * remove the given message from the IRCD message hash * @param name the name of the message to remove @@ -379,21 +363,6 @@ struct ModuleCallBack_ { ModuleCallBack *next; }; -struct EvtMessage_ { - char *name; - int (*func)(const char *source, int ac, const char **av); - int core; - char *mod_name; - EvtMessage *next; -}; - -struct EvtMessageHash_ { - char *name; - EvtMessage *evm; - EvtMessageHash *next; -}; - - struct EvtHook_ { int (*func)(int argc, char **argv); int core; @@ -459,13 +428,6 @@ int destroyMessage(Message *m); /* destroy a Message*/ /*************************************************************************/ -MDE EvtMessage *createEventHandler(char *name, int (*func) (const char *source, int ac, const char **av)); -EvtMessage *findEventHandler(EvtMessageHash * msgEvtTable[], const char *name); -int addCoreEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm); -int delEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm, const char *mod_name); -int destroyEventHandler(EvtMessage * evm); -int addEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm); - MDE EvtHook *createEventHook(const char *name, int (*func) (int argc, char **argv)); EvtHook *findEventHook(EvtHookHash * HookEvtTable[], const char *name); int addCoreEventHook(EvtHookHash * HookEvtTable[], EvtHook * evh); diff --git a/src/modules/demos/catserv/Makefile b/src/modules/demos/catserv/Makefile deleted file mode 100644 index 5b2f4efa3..000000000 --- a/src/modules/demos/catserv/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -SRCS= ircd_catserv.c \ - catserv_messages.c \ - meow.c \ - purr.c - -TARGET=ircd_catserv - -include ../Makefile.sub - diff --git a/src/modules/demos/catserv/README b/src/modules/demos/catserv/README deleted file mode 100644 index c3d3f7084..000000000 --- a/src/modules/demos/catserv/README +++ /dev/null @@ -1,4 +0,0 @@ -This is an EXAMPLE module, it serves no real purpose. - -This module was broken down into multiple files to demonstrate how multiple files can be used. - diff --git a/src/modules/demos/catserv/catserv_extern.h b/src/modules/demos/catserv/catserv_extern.h deleted file mode 100644 index 02c21addb..000000000 --- a/src/modules/demos/catserv/catserv_extern.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CATSERV_DEFS_H -#define CATSERV_DEFS_H - -#ifdef _WIN32 -extern __declspec(dllexport) char *s_CatServ; -#else -E char *s_CatServ; -#endif - -#endif - diff --git a/src/modules/demos/catserv/catserv_messages.c b/src/modules/demos/catserv/catserv_messages.c deleted file mode 100644 index 667b336b5..000000000 --- a/src/modules/demos/catserv/catserv_messages.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "catserv_messages.h" -#include "module.h" -#include "meow.h" -#include "purr.h" - -void addMessageList(void) -{ - Command *c; - c = createCommand("meow", do_meow, NULL, -1, -1, -1, -1, -1); - this->AddCommand(Catserv_cmdTable, c, MOD_UNIQUE); - c = createCommand("purr", do_purr, NULL, -1, -1, -1, -1, -1); - this->AddCommand(Catserv_cmdTable, c, MOD_UNIQUE); -} - diff --git a/src/modules/demos/catserv/catserv_messages.h b/src/modules/demos/catserv/catserv_messages.h deleted file mode 100644 index bb3f82dd0..000000000 --- a/src/modules/demos/catserv/catserv_messages.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CATSERV_MESSAGES_H -#define CATSERV_MESSAGES_H - -#include "module.h" - -CommandHash *Catserv_cmdTable[MAX_CMD_HASH]; -void addMessageList(void); - -#endif - diff --git a/src/modules/demos/catserv/ircd_catserv.c b/src/modules/demos/catserv/ircd_catserv.c deleted file mode 100644 index 0f98df58a..000000000 --- a/src/modules/demos/catserv/ircd_catserv.c +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Simple module to load up a client called CatServ and process commands for it - * This module is an example, and has no useful purpose! - * - * Please visit http://modules.anope.org for useful modules! - * - **/ - -#include "module.h" -#include "catserv_messages.h" - -#define AUTHOR "Anope" -#define VERSION "$Id$" - -int my_privmsg(char *source, int ac, char **av); - -void addClient(char *nick, char *realname); -void delClient(void); -void catserv(User * u, char *buf); - -char *s_CatServ = "CatServ"; - -int AnopeInit(int argc, char **argv) -{ - Message *msg = NULL; - int status; -#ifdef IRC_UNREAL32 - if (UseTokens) { - msg = createMessage("!", my_privmsg); - } else { - msg = createMessage("PRIVMSG", my_privmsg); - } -#else - msg = createMessage("PRIVMSG", my_privmsg); -#endif - status = moduleAddMessage(msg, MOD_HEAD); - if (status == MOD_ERR_OK) { - addClient(s_CatServ, "meow!"); - addMessageList(); - } - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - alog("ircd_catserv.so: loaded, message status [%d]", status); - return MOD_CONT; -} - -void AnopeFini(void) -{ - delClient(); -} - -int my_privmsg(char *source, int ac, char **av) -{ - User *u; - char *s; - - /* First, some basic checks */ - if (ac != 2) - return MOD_CONT; /* bleh */ - if (!(u = finduser(source))) { - return MOD_CONT; - } /* non-user source */ - if (*av[0] == '#') { - return MOD_CONT; - } - /* Channel message */ - /* we should prolly honour the ignore list here, but i cba for this... */ - s = strchr(av[0], '@'); - if (s) { - *s++ = 0; - if (stricmp(s, ServerName) != 0) - return MOD_CONT; - } - if ((stricmp(av[0], s_CatServ)) == 0) { /* its for US! */ - catserv(u, av[1]); - return MOD_STOP; - } else { /* ok it isnt us, let the old code have it */ - return MOD_CONT; - } -} - -void addClient(char *nick, char *realname) -{ - anope_SendClientIntroduction(nick, "catserv", "meow.meow.land", realname, "+"); -} - -void delClient(void) -{ - anope_SendQuit(s_CatServ, "QUIT :Module Unloaded!"); -} - -/*****************************************************************************/ -/* Main CatServ routine. */ -void catserv(User * u, char *buf) -{ - char *cmd, *s; - - cmd = strtok(buf, " "); - - if (!cmd) { - return; - } else if (stricmp(cmd, "\1PING") == 0) { - if (!(s = strtok(NULL, ""))) - s = "\1"; - notice(s_CatServ, u->nick, "\1PING %s", s); - } else { - mod_run_cmd(s_CatServ, u, Catserv_cmdTable, cmd); - } -} - diff --git a/src/modules/demos/catserv/makefile.win32 b/src/modules/demos/catserv/makefile.win32 deleted file mode 100644 index 638704440..000000000 --- a/src/modules/demos/catserv/makefile.win32 +++ /dev/null @@ -1,4 +0,0 @@ -SRCS=ircd_catserv.c purr.c catserv_messages.c meow.c -TARGET=ircd_catserv.dll - -include ..\Makefile.sub.win32 diff --git a/src/modules/demos/catserv/meow.c b/src/modules/demos/catserv/meow.c deleted file mode 100644 index 9279eec0b..000000000 --- a/src/modules/demos/catserv/meow.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "meow.h" - -#include "catserv_extern.h" - -int do_meow(User * u) { - notice(s_CatServ, u->nick, "MEOW!"); - return MOD_STOP; -} - diff --git a/src/modules/demos/catserv/meow.h b/src/modules/demos/catserv/meow.h deleted file mode 100644 index 0f28673a0..000000000 --- a/src/modules/demos/catserv/meow.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CATSERV_MEOW_H -#define CATSERV_MEOW_H - -#include "module.h" - -int do_meow(User * u); - -#endif - diff --git a/src/modules/demos/catserv/purr.c b/src/modules/demos/catserv/purr.c deleted file mode 100644 index e7c1e9c8d..000000000 --- a/src/modules/demos/catserv/purr.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "purr.h" -#include "catserv_extern.h" - -int do_purr(User * u) -{ - notice(s_CatServ, u->nick, "PURR!"); - return MOD_STOP; -} diff --git a/src/modules/demos/catserv/purr.h b/src/modules/demos/catserv/purr.h deleted file mode 100644 index a92e421f6..000000000 --- a/src/modules/demos/catserv/purr.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CATSERV_PURR_H -#define CATSERV_PURR_H - -#include "module.h" - -int do_purr(User * u); - -#endif - diff --git a/src/modules/demos/events.c b/src/modules/demos/events.c deleted file mode 100644 index bea3ccd6d..000000000 --- a/src/modules/demos/events.c +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Simple module to show the usage of event messages and hooks - * This module is an example, and has no useful purpose! - * - * Please visit http://modules.anope.org for useful modules! - * - **/ - -#include "module.h" - -#define AUTHOR "Anope" -#define VERSION "$Id$" - -int my_nick(char *source, int ac, char **av); -int my_save(int argc, char **argv); -int do_moo(int argc, char **argv); - -int AnopeInit(int argc, char **argv) -{ - EvtMessage *msg = NULL; - EvtHook *hook = NULL; - int status; - msg = createEventHandler("NICK", my_nick); - status = moduleAddEventHandler(msg); - - hook = createEventHook(EVENT_DB_SAVING, my_save); - status = this->AddEventHook(hook); - - - hook = createEventHook(EVENT_BOT_FANTASY, do_moo); - status = this->AddEventHook(hook); - - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - return MOD_CONT; -} - -void AnopeFini(void) -{ - /* unloading */ -} - -int my_nick(char *source, int ac, char **av) -{ - alog("Internal Event - nick is %s",av[0]); - return MOD_CONT; -} - -int my_save(int argc, char **argv) -{ - if(argc>=1) { - if (!stricmp(argv[0], EVENT_START)) { - alog("Saving the databases! has started"); - } else { - alog("Saving the databases is complete"); - } - } - return MOD_CONT; -} - -/** - * command to be called when a EVENT_BOT_FANTASY event is recived. - * @param argc The paramater count for this event. - * @param argv[0] The cmd used. - * @param argv[1] The nick of the command user. - * @param argv[2] The channel name the command was used in. - * @param argv[3] The rest of the text after the command. - * @return MOD_CONT or MOD_STOP - **/ -int do_moo(int argc, char **argv) { - ChannelInfo *ci; - if(argc>=3) { /* We need at least 3 arguments */ - if(stricmp(argv[0],"moo")==0) { /* is it meant for us? */ - if((ci = cs_findchan(argv[2]))) { /* channel should always exist */ - anope_cmd_privmsg(ci->bi->nick, ci->name, "%cACTION moo's at %s %c",1,argv[1],1); - return MOD_STOP; /* We've dealt with it, dont let others */ - } - } - } - return MOD_CONT; /* guess it wasnt for us, pass it on */ -} - diff --git a/src/modules/demos/hs_conf.c b/src/modules/demos/hs_conf.c deleted file mode 100644 index 755b1bae4..000000000 --- a/src/modules/demos/hs_conf.c +++ /dev/null @@ -1,74 +0,0 @@ -#include "module.h" - -#define AUTHOR "Anope" -#define VERSION "1" - -/** - * Default setting to be used if no confing value is found - **/ -#define DEFAULT_SETTING "moo" - -int mShowSetting(User *u); -int mReadConfig(int argc, char **argv); - -char *setting; - -int AnopeInit(int argc, char **argv) { - Command *c; - EvtHook *hook; - int status = 0; - - setting = NULL; - - mReadConfig(0,NULL); - - c = createCommand("SHOW",mShowSetting,NULL,-1,-1,-1,-1,-1); - status = this->AddCommand(HOSTSERV, c, MOD_HEAD); - - hook = createEventHook(EVENT_RELOAD, mReadConfig); - status = this->AddEventHook(hook); - - if(status!=MOD_ERR_OK) { - return MOD_STOP; - } - return MOD_CONT; -} - -/** - * free the globals when we close - **/ -void AnopeFini(void) { - if(setting) - free(setting); -} - -/** - * Simple function to show the user the current config setting - **/ -int mShowSetting(User *u) { - notice(s_HostServ,u->nick,"Setting in use is [%s]",setting); - return MOD_CONT; -} - -/** - * Load the config setting up, this will be called whenever - * the EVENT_RELOAD event is recived. - **/ -int mReadConfig(int argc, char **argv) { - char *tmp=NULL; - Directive d[] = {{"HSConfigSetting", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}}; - moduleGetConfigDirective(d); - - if(setting) { - free(setting); - } - if(tmp) { - setting = tmp; - } else { - setting = sstrdup(DEFAULT_SETTING); - } - return MOD_CONT; -} - - -/* EOF */ diff --git a/src/modules/demos/hs_moo.c b/src/modules/demos/hs_moo.c deleted file mode 100644 index ab677527c..000000000 --- a/src/modules/demos/hs_moo.c +++ /dev/null @@ -1,119 +0,0 @@ -/** - * This is an EXAMPLE module, which adds the "moo" command to HostServ - * - * This command does NOT do anything useful at all! - * - * Please visit http://modules.anope.org for useful modules! - * - **/ -#include "module.h" - -#define AUTHOR "Anope" /* Set the Author for a modinfo reply */ -#define VERSION "$Id$" /* Set the version for a modinfo reply */ - -int hs_moo_show(User * u); /* Function to use when a /hs moo command is recived */ -int test(int argc, char **argv); -void myHostServHelp(User *u); /* Function to display out help in a /hs help response */ -int myHostServMooHelp(User *u); /* Function to display help to _everyone_ when a /hs help moo is called*/ -int myHostServMooRegHelp(User *u); /* Function to display extra help to regular-users when a /hs help moo is called*/ -int myHostServMooOperHelp(User *u); /* Function to display extra help to opers when a /hs help moo is called*/ -int myHostServMooAdminHelp(User *u); /* Function to display extra help to admins when a /hs help moo is called*/ -int myHostServMooRootHelp(User *u); /* Function to display extra help to roors when a /hs help moo is called*/ - -int AnopeInit(int argc, char **argv) /* This will be executed when the module is loaded */ -{ - Command *c; /* Pointer to a Command */ - int status = 0; /* the status of our new command */ - c = createCommand("moo", hs_moo_show, NULL, -1, -1, -1, -1, -1); /* Create a new command "moo" pointing to hs_moo */ - - moduleAddHelp(c,myHostServMooHelp); /* add help for all users to this command */ - moduleAddRegHelp(c,myHostServMooRegHelp); /* add extra regular-user only help to this command */ - moduleAddOperHelp(c,myHostServMooOperHelp); /* add extra oper only help to this command */ - moduleAddAdminHelp(c,myHostServMooAdminHelp); /* add extra admin only help to this command */ - moduleAddRootHelp(c,myHostServMooRootHelp); /* add extra root only help to this command */ - - moduleSetHostHelp(myHostServHelp); /* add us to the .hs help list */ - - status = this->AddCommand(HOSTSERV, c, MOD_HEAD); /* Add the command to the HOSTSERV cmd table */ - - /* Check if we have any argv's */ - if(argc>0) { - /* we do, the first will be the nick of the person modload'ing us */ - /* or NULL if we were auto-loaded */ - if(argv[0]) { - alog("hs_moo was modloaded by: [%s]",argv[0]); - } else { - alog("hs_moo was automatically loaded by anope"); - } - } - alog("hs_moo.so: Add Command 'moo' Status: %d",status); /* Log the command being added */ - - moduleAddCallback("test",time(NULL)+dotime("15s"),test,0,NULL); /* set a call-back function to exec in 3 mins time */ - moduleDelCallback("test"); - this->SetAuthor(AUTHOR); /* tell Anope about the author */ - this->SetVersion(VERSION); /* Tell Anope about the verison */ - - if(status!=MOD_ERR_OK) { - return MOD_STOP; - } - return MOD_CONT; -} - -int hs_moo_show(User * u) -{ - notice(s_HostServ, u->nick, "MOO! - This command was loaded via a module!"); /* Just notice the user */ - return MOD_STOP; /* MOD_STOP means we will NOT pass control back to other */ -} /* modules waiting to handle the /hs moo command! */ - -int test(int argc, char **argv) { - alog("CallBack from hs_moo with %d paramaters",argc); - return MOD_CONT; -} - -void AnopeFini(void) -{ - /* module is unloading */ -} - -/***************************************************************************************************************************************/ -/* The code below here shows various ways of dealing with the module help system */ -/***************************************************************************************************************************************/ - -void myHostServHelp(User *u) { - notice(s_HostServ,u->nick, " MOO Moo's at the user!"); /* this will appear in the help list */ -} - -int myHostServMooHelp(User *u) { - notice(s_HostServ,u->nick,"Syntax: Moo"); /* this will be sent to everyone who does /msg hostserv help moo */ - notice(s_HostServ,u->nick,"This command is an example provided"); - notice(s_HostServ,u->nick,"by the Anope development team."); - return MOD_CONT; /* allow any other module's with help for /hs moo to run */ -} - -int myHostServMooRootHelp(User *u) { /* this will only be sent to ROOTS ONLY who /msg hostserv moo */ - myHostServMooAdminHelp(u); /* this line lets us show roots the ADMIN help as well as the root help */ - notice(s_HostServ,u->nick,"Only roots will see this part of the help"); - return MOD_CONT; -} - -int myHostServMooAdminHelp(User *u) { /* this will only be sent to ADMINS ONLY who /msg hostserv moo */ - myHostServMooOperHelp(u); /* this line lets us show admins the OPER help as well as the admin help */ - notice(s_HostServ,u->nick,"Only admins will see this part of the help"); - notice(s_HostServ,u->nick,"why not visit us on www.anope.org ?"); - return MOD_CONT; -} - -int myHostServMooOperHelp(User *u) { /* this will only be sent to OPERS ONLY who /msg hostserv moo */ - notice(s_HostServ,u->nick,"Only opers will see this part of the help"); - notice(s_HostServ,u->nick,"for more help/support with modules"); - notice(s_HostServ,u->nick,"visit us on irc.anope.org #anope! :)"); - return MOD_CONT; -} - -int myHostServMooRegHelp(User *u) { /* this will only be sent to REGULAR USERS ONLY who /msg hostserv moo */ - notice(s_HostServ,u->nick,"Only non-opers will see this part of the help"); - notice(s_HostServ,u->nick,"as we've left it hidden from opers"); - return MOD_CONT; -} - -/* EOF */ |