summaryrefslogtreecommitdiff
path: root/src/modules/demos
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-14 20:57:20 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-14 20:57:20 +0000
commit6c55e0a529c7f1216ff6f63a4fc77ea06a2a3a38 (patch)
tree91b0841faf23087ebe0c74dd4269d181a383f1e7 /src/modules/demos
parent069409cd99cf78ab8bf87a1fe69a833576414fd3 (diff)
Insane commit of doom: s/ \t/g
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1681 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/modules/demos')
-rw-r--r--src/modules/demos/catserv/catserv_messages.c10
-rw-r--r--src/modules/demos/catserv/ircd_catserv.c112
-rw-r--r--src/modules/demos/catserv/purr.c4
-rw-r--r--src/modules/demos/events.c46
-rw-r--r--src/modules/demos/hs_conf.c52
-rw-r--r--src/modules/demos/hs_moo.c54
6 files changed, 139 insertions, 139 deletions
diff --git a/src/modules/demos/catserv/catserv_messages.c b/src/modules/demos/catserv/catserv_messages.c
index 23c1b4ec1..667b336b5 100644
--- a/src/modules/demos/catserv/catserv_messages.c
+++ b/src/modules/demos/catserv/catserv_messages.c
@@ -5,10 +5,10 @@
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);
+ 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/ircd_catserv.c b/src/modules/demos/catserv/ircd_catserv.c
index 763ae9cec..0f98df58a 100644
--- a/src/modules/demos/catserv/ircd_catserv.c
+++ b/src/modules/demos/catserv/ircd_catserv.c
@@ -22,89 +22,89 @@ char *s_CatServ = "CatServ";
int AnopeInit(int argc, char **argv)
{
- Message *msg = NULL;
- int status;
+ Message *msg = NULL;
+ int status;
#ifdef IRC_UNREAL32
- if (UseTokens) {
- msg = createMessage("!", my_privmsg);
- } else {
- msg = createMessage("PRIVMSG", my_privmsg);
- }
+ if (UseTokens) {
+ msg = createMessage("!", my_privmsg);
+ } else {
+ msg = createMessage("PRIVMSG", my_privmsg);
+ }
#else
- msg = createMessage("PRIVMSG", my_privmsg);
+ 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;
+ 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();
+ delClient();
}
int my_privmsg(char *source, int ac, char **av)
{
- User *u;
- char *s;
+ 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;
- }
+ /* 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, "+");
+ anope_SendClientIntroduction(nick, "catserv", "meow.meow.land", realname, "+");
}
void delClient(void)
{
- anope_SendQuit(s_CatServ, "QUIT :Module Unloaded!");
+ anope_SendQuit(s_CatServ, "QUIT :Module Unloaded!");
}
/*****************************************************************************/
/* Main CatServ routine. */
void catserv(User * u, char *buf)
{
- char *cmd, *s;
+ char *cmd, *s;
- cmd = strtok(buf, " ");
+ 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);
- }
+ 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/purr.c b/src/modules/demos/catserv/purr.c
index 5a39dc26e..e7c1e9c8d 100644
--- a/src/modules/demos/catserv/purr.c
+++ b/src/modules/demos/catserv/purr.c
@@ -3,6 +3,6 @@
int do_purr(User * u)
{
- notice(s_CatServ, u->nick, "PURR!");
- return MOD_STOP;
+ notice(s_CatServ, u->nick, "PURR!");
+ return MOD_STOP;
}
diff --git a/src/modules/demos/events.c b/src/modules/demos/events.c
index 25dd79fb9..bea3ccd6d 100644
--- a/src/modules/demos/events.c
+++ b/src/modules/demos/events.c
@@ -17,22 +17,22 @@ 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);
+ 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_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;
+ hook = createEventHook(EVENT_BOT_FANTASY, do_moo);
+ status = this->AddEventHook(hook);
+
+ this->SetAuthor(AUTHOR);
+ this->SetVersion(VERSION);
+ return MOD_CONT;
}
void AnopeFini(void)
@@ -50,9 +50,9 @@ int my_save(int argc, char **argv)
{
if(argc>=1) {
if (!stricmp(argv[0], EVENT_START)) {
- alog("Saving the databases! has started");
+ alog("Saving the databases! has started");
} else {
- alog("Saving the databases is complete");
+ alog("Saving the databases is complete");
}
}
return MOD_CONT;
@@ -68,15 +68,15 @@ int my_save(int argc, char **argv)
* @return MOD_CONT or MOD_STOP
**/
int do_moo(int argc, char **argv) {
- ChannelInfo *ci;
- if(argc>=3) { /* We need at least 3 arguments */
+ 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 */
- }
+ 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 */
+ }
+ 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
index 233aa2ff1..755b1bae4 100644
--- a/src/modules/demos/hs_conf.c
+++ b/src/modules/demos/hs_conf.c
@@ -14,24 +14,24 @@ int mReadConfig(int argc, char **argv);
char *setting;
int AnopeInit(int argc, char **argv) {
- Command *c;
- EvtHook *hook;
- int status = 0;
+ Command *c;
+ EvtHook *hook;
+ int status = 0;
- setting = NULL;
+ setting = NULL;
- mReadConfig(0,NULL);
-
- c = createCommand("SHOW",mShowSetting,NULL,-1,-1,-1,-1,-1);
- status = this->AddCommand(HOSTSERV, c, MOD_HEAD);
+ 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) {
+ hook = createEventHook(EVENT_RELOAD, mReadConfig);
+ status = this->AddEventHook(hook);
+
+ if(status!=MOD_ERR_OK) {
return MOD_STOP;
- }
- return MOD_CONT;
+ }
+ return MOD_CONT;
}
/**
@@ -46,8 +46,8 @@ void AnopeFini(void) {
* 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;
+ notice(s_HostServ,u->nick,"Setting in use is [%s]",setting);
+ return MOD_CONT;
}
/**
@@ -55,19 +55,19 @@ int mShowSetting(User *u) {
* 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);
+ char *tmp=NULL;
+ Directive d[] = {{"HSConfigSetting", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}};
+ moduleGetConfigDirective(d);
- if(setting) {
- free(setting);
- }
- if(tmp) {
+ if(setting) {
+ free(setting);
+ }
+ if(tmp) {
setting = tmp;
- } else {
+ } else {
setting = sstrdup(DEFAULT_SETTING);
- }
- return MOD_CONT;
+ }
+ return MOD_CONT;
}
diff --git a/src/modules/demos/hs_moo.c b/src/modules/demos/hs_moo.c
index 61210271b..ab677527c 100644
--- a/src/modules/demos/hs_moo.c
+++ b/src/modules/demos/hs_moo.c
@@ -22,22 +22,22 @@ int myHostServMooRootHelp(User *u); /* Function to display extra help t
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 */
+ 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 */
+ 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 */
+ moduleSetHostHelp(myHostServHelp); /* add us to the .hs help list */
- status = this->AddCommand(HOSTSERV, c, MOD_HEAD); /* Add the command to the HOSTSERV cmd table */
+ 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) {
+ /* 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]) {
@@ -45,24 +45,24 @@ int AnopeInit(int argc, char **argv) /* This will be executed when the mod
} 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) {
+ }
+ 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;
+ }
+ 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 */
+ 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) {
@@ -76,11 +76,11 @@ void AnopeFini(void)
}
/***************************************************************************************************************************************/
-/* The code below here shows various ways of dealing with the module help system */
+/* 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 */
+ notice(s_HostServ,u->nick, " MOO Moo's at the user!"); /* this will appear in the help list */
}
int myHostServMooHelp(User *u) {