diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-03-30 08:55:34 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-03-30 08:55:34 +0000 |
commit | b2d258328a596a053e571c58031c37f0e12119ea (patch) | |
tree | 8089a3034117b79c55e990cb41b137e1322a7406 /src | |
parent | ef5c945e0bf37f534c93fe7dc6303c9e7577615f (diff) |
Fixed catserv module demo to work correctly on TS6 IRCDs
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/stable@2843 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/demos/catserv/ircd_catserv.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/demos/catserv/ircd_catserv.c b/src/modules/demos/catserv/ircd_catserv.c index ae34d6161..082ab6718 100644 --- a/src/modules/demos/catserv/ircd_catserv.c +++ b/src/modules/demos/catserv/ircd_catserv.c @@ -24,15 +24,11 @@ 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!"); @@ -52,12 +48,15 @@ void AnopeFini(void) int my_privmsg(char *source, int ac, char **av) { User *u; + Uid *ud = NULL; char *s; /* First, some basic checks */ if (ac != 2) return MOD_CONT; /* bleh */ - if (!(u = finduser(source))) { + if (ircd->ts6) + u = find_byuid(source); // If this is a ts6 ircd, find the user by uid + if (!u && !(u = finduser(source))) { // If user isn't found and we cant find them by nick, return return MOD_CONT; } /* non-user source */ if (*av[0] == '#') { @@ -71,7 +70,9 @@ int my_privmsg(char *source, int ac, char **av) if (stricmp(s, ServerName) != 0) return MOD_CONT; } - if ((stricmp(av[0], s_CatServ)) == 0) { /* its for US! */ + if (ircd->ts6) + ud = find_uid(s_CatServ); // Find CatServs UID + if (stricmp(av[0], s_CatServ) == 0 || (ud && strcmp(av[0], ud->uid) == 0)) { /* If the nick or the uid matches its for us */ catserv(u, av[1]); return MOD_STOP; } else { /* ok it isnt us, let the old code have it */ |