diff options
| author | Adam <Adam@drink-coca-cola.info> | 2010-05-29 20:44:31 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-06-18 21:04:08 -0400 |
| commit | b8f9116b19eb511c4f5e6a683725f50bf732a7dd (patch) | |
| tree | a5848c9797ec4dc3477621fc42211f4985eaec7b /src/protocol | |
| parent | 435c9116e9997634eb7215e998c8f01a5e46fb2c (diff) | |
Rewrote all of the command handling to get rid of all the nasty strtoks() everywhere, and added a bot map by uid
Diffstat (limited to 'src/protocol')
| -rw-r--r-- | src/protocol/inspircd12.cpp | 19 | ||||
| -rw-r--r-- | src/protocol/ratbox.cpp | 16 |
2 files changed, 16 insertions, 19 deletions
diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp index 5fa330197..3690fcea6 100644 --- a/src/protocol/inspircd12.cpp +++ b/src/protocol/inspircd12.cpp @@ -393,8 +393,8 @@ int anope_event_mode(const char *source, int ac, const char **av) users modes, we have to kludge this as it slightly breaks RFC1459 */ - User *u = find_byuid(source); - User *u2 = find_byuid(av[0]); + User *u = finduser(source); + User *u2 = finduser(av[0]); // This can happen with server-origin modes. if (u == NULL) @@ -550,7 +550,7 @@ int anope_event_fjoin(const char *source, int ac, const char **av) } buf.erase(buf.begin()); - User *u = find_byuid(buf); + User *u = finduser(buf); if (!u) { Alog(LOG_DEBUG) << "FJOIN for nonexistant user " << buf << " on " << c->name; @@ -642,7 +642,7 @@ int anope_event_topic(const char *source, int ac, const char **av) { Channel *c = findchan(av[0]); time_t topic_time = time(NULL); - User *u = find_byuid(source); + User *u = finduser(source); if (!c) { @@ -704,7 +704,7 @@ int anope_event_quit(const char *source, int ac, const char **av) int anope_event_kill(const char *source, int ac, const char **av) { - User *u = find_byuid(av[0]); + User *u = finduser(av[0]); BotInfo *bi = findbot(av[0]); m_kill(u ? u->nick.c_str() : (bi ? bi->nick : av[0]), av[1]); return MOD_CONT; @@ -904,13 +904,10 @@ int anope_event_server(const char *source, int ac, const char **av) int anope_event_privmsg(const char *source, int ac, const char **av) { - User *u = find_byuid(source); - BotInfo *bi = findbot(av[0]); - - if (!u) + if (!finduser(source)) return MOD_CONT; // likely a message from a server, which can happen. - m_privmsg(u->nick.c_str(), bi ? bi->nick: av[0], av[1]); + m_privmsg(source, av[0], av[1]); return MOD_CONT; } @@ -934,7 +931,7 @@ int anope_event_metadata(const char *source, int ac, const char **av) return MOD_CONT; else if (!strcmp(av[1], "accountname")) { - if ((u = find_byuid(av[0]))) + if ((u = finduser(av[0]))) { /* Identify the user for this account - Adam */ u->AutoID(av[2]); diff --git a/src/protocol/ratbox.cpp b/src/protocol/ratbox.cpp index 95ccf6392..339113e33 100644 --- a/src/protocol/ratbox.cpp +++ b/src/protocol/ratbox.cpp @@ -378,7 +378,7 @@ int anope_event_sjoin(const char *source, int ac, const char **av) Status.push_back(cm); } - User *u = find_byuid(buf); + User *u = finduser(buf); if (!u) { Alog(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << c->name; @@ -507,7 +507,7 @@ int anope_event_topic(const char *source, int ac, const char **av) if (ac > 1 && *av[1]) c->topic = sstrdup(av[1]); - u = find_byuid(source); + u = finduser(source); c->topic_setter = u ? u->nick : source; c->topic_time = topic_time; @@ -590,7 +590,7 @@ int anope_event_away(const char *source, int ac, const char **av) { User *u = NULL; - u = find_byuid(source); + u = finduser(source); m_away(u ? u->nick.c_str() : source, (ac ? av[0] : NULL)); return MOD_CONT; } @@ -642,7 +642,7 @@ int anope_event_privmsg(const char *source, int ac, const char **av) return MOD_CONT; } - u = find_byuid(source); + u = finduser(source); bi = findbot(av[0]); // XXX: this is really the same as charybdis m_privmsg(source, av[0], av[1]); @@ -657,7 +657,7 @@ int anope_event_part(const char *source, int ac, const char **av) return MOD_CONT; } - u = find_byuid(source); + u = finduser(source); do_part(u ? u->nick.c_str() : source, ac, av); return MOD_CONT; @@ -715,7 +715,7 @@ int anope_event_quit(const char *source, int ac, const char **av) return MOD_CONT; } - u = find_byuid(source); + u = finduser(source); do_quit(u ? u->nick.c_str() : source, ac, av); return MOD_CONT; @@ -732,8 +732,8 @@ int anope_event_mode(const char *source, int ac, const char **av) if (*av[0] == '#' || *av[0] == '&') { do_cmode(source, ac, av); } else { - u = find_byuid(source); - u2 = find_byuid(av[0]); + u = finduser(source); + u2 = finduser(av[0]); av[0] = u2->nick.c_str(); do_umode(u->nick.c_str(), ac, av); } |
