diff options
| author | dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-08-23 18:36:58 +0000 |
|---|---|---|
| committer | dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-08-23 18:36:58 +0000 |
| commit | 61a23cd017465cd2bff5f037cf54e051a6318b37 (patch) | |
| tree | 5827cad42b833c88be5783d457ffb03b00c785bf /src/messages.c | |
| parent | 26ea4bc11b4e07bbeb95031f2337ff695f83cc16 (diff) | |
BUILD : 1.7.5 (327) BUGS : none NOTES : Merged anope-capab into main trunk...
git-svn-id: svn://svn.anope.org/anope/trunk@327 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@203 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/messages.c')
| -rw-r--r-- | src/messages.c | 1203 |
1 files changed, 155 insertions, 1048 deletions
diff --git a/src/messages.c b/src/messages.c index 887a9986f..335fc1093 100644 --- a/src/messages.c +++ b/src/messages.c @@ -16,593 +16,132 @@ #include "messages.h" #include "language.h" -static char *uplink; -int servernum; -/* List of messages is at the bottom of the file. */ - -/*************************************************************************/ -/*************************************************************************/ - -static int m_nickcoll(char *source, int ac, char **av) -{ - if (ac < 1) - return MOD_CONT; - if (!skeleton && !readonly) - introduce_user(av[0]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_ping(char *source, int ac, char **av) -{ - if (ac < 1) - return MOD_CONT; - send_cmd(ServerName, "PONG %s %s", ac > 1 ? av[1] : ServerName, av[0]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_away(char *source, int ac, char **av) -{ - User *u = finduser(source); - - if (u && (ac == 0 || *av[0] == 0)) /* un-away */ - check_memos(u); - return MOD_CONT; -} - -/*************************************************************************/ +int servernum; -#ifdef IRC_BAHAMUT - -static int m_capab(char *source, int ac, char **av) -{ - int i; - - for (i = 0; i < ac; i++) { - if (!stricmp(av[i], "NOQUIT")) - uplink_capab |= CAPAB_NOQUIT; - else if (!stricmp(av[i], "TSMODE")) - uplink_capab |= CAPAB_TSMODE; - else if (!stricmp(av[i], "UNCONNECT")) - uplink_capab |= CAPAB_UNCONNECT; - } - - return MOD_CONT; -} - -#endif /*************************************************************************/ -#ifdef IRC_BAHAMUT - -static int m_cs(char *source, int ac, char **av) +int m_nickcoll(char *user) { - User *u; - time_t starttime, stoptime; /* When processing started and finished */ - - if (ac < 1 || skeleton) - return MOD_CONT; - - u = finduser(source); - - if (!u) { - alog("%s: user record for %s not found", s_ChanServ, source); - notice(s_ChanServ, source, getstring(NULL, USER_RECORD_NOT_FOUND)); - return MOD_CONT; - } - - /* Check if we should ignore. Operators always get through. */ - if (allow_ignore && !is_oper(u)) { - IgnoreData *ign = get_ignore(source); - if (ign && ign->time > time(NULL)) { - alog("Ignored message from %s: \"%s\"", source, inbuf); - return MOD_CONT; - } - } - - starttime = time(NULL); - if (!is_oper(u) && CSOpersOnly) - notice_lang(s_ChanServ, u, ACCESS_DENIED); - else - chanserv(u, av[0]); - - /* Add to ignore list if the command took a significant amount of time. */ - if (allow_ignore) { - stoptime = time(NULL); - if (stoptime > starttime && *source && !strchr(source, '.')) - add_ignore(source, stoptime - starttime); - } + if (!skeleton && !readonly) + introduce_user(user); return MOD_CONT; } -#endif - /*************************************************************************/ -#ifdef IRC_BAHAMUT - -static int m_hs(char *source, int ac, char **av) +int m_away(char *source, char *msg) { User *u; - time_t starttime, stoptime; /* When processing started and finished */ - - if (ac < 1 || skeleton) - return MOD_CONT; u = finduser(source); - if (!u) { - alog("%s: user record for %s not found", s_HelpServ, source); - notice(s_HelpServ, source, getstring(NULL, USER_RECORD_NOT_FOUND)); - return MOD_CONT; - } - - /* Check if we should ignore. Operators always get through. */ - if (allow_ignore && !is_oper(u)) { - IgnoreData *ign = get_ignore(source); - if (ign && ign->time > time(NULL)) { - alog("Ignored message from %s: \"%s\"", source, inbuf); - return MOD_CONT; - } - } - - starttime = time(NULL); - - notice_help(s_HelpServ, u, HELP_HELP, s_NickServ, s_ChanServ, - s_MemoServ); - if (s_BotServ) - notice_help(s_HelpServ, u, HELP_HELP_BOT, s_BotServ); - - /* Add to ignore list if the command took a significant amount of time. */ - if (allow_ignore) { - stoptime = time(NULL); - if (stoptime > starttime && *source && !strchr(source, '.')) - add_ignore(source, stoptime - starttime); - } - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -static int m_join(char *source, int ac, char **av) -{ - if (ac != 1) - return MOD_CONT; - do_join(source, ac, av); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_kick(char *source, int ac, char **av) -{ - if (ac != 3) - return MOD_CONT; - do_kick(source, ac, av); + if (u && msg == 0) /* un-away */ + check_memos(u); return MOD_CONT; } /*************************************************************************/ -static int m_kill(char *source, int ac, char **av) +int m_kill(char *nick, char *msg) { BotInfo *bi; - if (ac != 2) - return MOD_CONT; /* Recover if someone kills us. */ - if (stricmp(av[0], s_OperServ) == 0 || - (s_OperServAlias && stricmp(av[0], s_OperServAlias) == 0) || - stricmp(av[0], s_NickServ) == 0 || - (s_NickServAlias && stricmp(av[0], s_NickServAlias) == 0) || - stricmp(av[0], s_ChanServ) == 0 || - (s_ChanServAlias && stricmp(av[0], s_ChanServAlias) == 0) || - stricmp(av[0], s_MemoServ) == 0 || - (s_MemoServAlias && stricmp(av[0], s_MemoServAlias) == 0) || - (s_HostServ && stricmp(av[0], s_HostServ) == 0) || - (s_HostServAlias && stricmp(av[0], s_HostServAlias) == 0) || - (s_BotServ && stricmp(av[0], s_BotServ) == 0) || - (s_BotServAlias && stricmp(av[0], s_BotServAlias) == 0) || - stricmp(av[0], s_HelpServ) == 0 || - (s_HelpServAlias && stricmp(av[0], s_HelpServAlias) == 0) || - (s_DevNull && stricmp(av[0], s_DevNull) == 0) || - (s_DevNullAlias && stricmp(av[0], s_DevNullAlias) == 0) || - stricmp(av[0], s_GlobalNoticer) == 0 || - (s_GlobalNoticerAlias && stricmp(av[0], s_GlobalNoticerAlias) == 0) + if (stricmp(nick, s_OperServ) == 0 || + (s_OperServAlias && stricmp(nick, s_OperServAlias) == 0) || + stricmp(nick, s_NickServ) == 0 || + (s_NickServAlias && stricmp(nick, s_NickServAlias) == 0) || + stricmp(nick, s_ChanServ) == 0 || + (s_ChanServAlias && stricmp(nick, s_ChanServAlias) == 0) || + stricmp(nick, s_MemoServ) == 0 || + (s_MemoServAlias && stricmp(nick, s_MemoServAlias) == 0) || + (s_HostServ && stricmp(nick, s_HostServ) == 0) || + (s_HostServAlias && stricmp(nick, s_HostServAlias) == 0) || + (s_BotServ && stricmp(nick, s_BotServ) == 0) || + (s_BotServAlias && stricmp(nick, s_BotServAlias) == 0) || + stricmp(nick, s_HelpServ) == 0 || + (s_HelpServAlias && stricmp(nick, s_HelpServAlias) == 0) || + (s_DevNull && stricmp(nick, s_DevNull) == 0) || + (s_DevNullAlias && stricmp(nick, s_DevNullAlias) == 0) || + stricmp(nick, s_GlobalNoticer) == 0 || + (s_GlobalNoticerAlias && stricmp(nick, s_GlobalNoticerAlias) == 0) ) { if (!readonly && !skeleton) - introduce_user(av[0]); - } else if (s_BotServ && (bi = findbot(av[0]))) { + introduce_user(nick); + } else if (s_BotServ && (bi = findbot(nick))) { if (!readonly && !skeleton) { - introduce_user(av[0]); + introduce_user(nick); bot_rejoin_all(bi); } } else { - do_kill(source, ac, av); + do_kill(nick, msg); } return MOD_CONT; } /*************************************************************************/ -static int m_mode(char *source, int ac, char **av) +int m_time(char *source, int ac, char **av) { - if (*av[0] == '#' || *av[0] == '&') { - if (ac < 2) - return MOD_CONT; - do_cmode(source, ac, av); - } else { - if (ac != 2) - return MOD_CONT; - do_umode(source, ac, av); - } + time_t t; + struct tm *tm; + char buf[64]; + + time(&t); + tm = localtime(&t); + strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm); + anope_cmd_391(source, buf); return MOD_CONT; } /*************************************************************************/ -static int m_motd(char *source, int ac, char **av) +int m_motd(char *source) { FILE *f; char buf[BUFSIZE]; f = fopen(MOTDFilename, "r"); - send_cmd(ServerName, "375 %s :- %s Message of the Day", - source, ServerName); + anope_cmd_375(source); if (f) { while (fgets(buf, sizeof(buf), f)) { buf[strlen(buf) - 1] = 0; - send_cmd(ServerName, "372 %s :- %s", source, buf); + anope_cmd_372(source, buf); } fclose(f); } else { - send_cmd(ServerName, "372 %s :- MOTD file not found! Please " - "contact your IRC administrator.", source); - } - send_cmd(ServerName, "376 %s :End of /MOTD command.", source); - return MOD_CONT; -} - -/*************************************************************************/ - -#ifdef IRC_BAHAMUT - -static int m_ms(char *source, int ac, char **av) -{ - User *u; - time_t starttime, stoptime; /* When processing started and finished */ - - if (ac < 1 || skeleton) - return MOD_CONT; - - u = finduser(source); - - if (!u) { - alog("%s: user record for %s not found", s_MemoServ, source); - notice(s_MemoServ, source, getstring(NULL, USER_RECORD_NOT_FOUND)); - return MOD_CONT; - } - - /* Check if we should ignore. Operators always get through. */ - if (allow_ignore && !is_oper(u)) { - IgnoreData *ign = get_ignore(source); - if (ign && ign->time > time(NULL)) { - alog("Ignored message from %s: \"%s\"", source, inbuf); - return MOD_CONT; - } - } - - starttime = time(NULL); - - memoserv(u, av[0]); - - /* Add to ignore list if the command took a significant amount of time. */ - if (allow_ignore) { - stoptime = time(NULL); - if (stoptime > starttime && *source && !strchr(source, '.')) - add_ignore(source, stoptime - starttime); - } - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -static int m_nick(char *source, int ac, char **av) -{ - if (ac != 2) { -#if defined(IRC_HYBRID) - User *user = do_nick(source, av[0], av[4], av[5], av[6], av[7], - strtoul(av[2], NULL, 10), 0); - if (user) - set_umode(user, 1, &av[3]); -#else -#if defined(IRC_BAHAMUT) -#if defined(IRC_ULTIMATE3) || defined(IRC_RAGE2) - User *user = do_nick(source, av[0], av[4], av[5], av[6], av[9], - strtoul(av[2], NULL, 10), strtoul(av[7], NULL, - 0), - strtoul(av[8], NULL, 0), "*"); -# else - User *user = do_nick(source, av[0], av[4], av[5], av[6], av[9], - strtoul(av[2], NULL, 10), strtoul(av[7], NULL, - 0), - strtoul(av[8], NULL, 0)); -# endif - if (user) - set_umode(user, 1, &av[3]); -#elif defined(IRC_UNREAL) - if (ac == 7) { - /* For some reasons, Unreal sends this sometimes */ - do_nick(source, av[0], av[3], av[4], av[5], av[6], - strtoul(av[2], NULL, 10), 0, "*"); - } else { - User *user = do_nick(source, av[0], av[3], av[4], av[5], av[9], - strtoul(av[2], NULL, 10), strtoul(av[6], - NULL, - 0), - av[8]); - - if (user) - set_umode(user, 1, &av[7]); - } -#else -# if defined(IRC_ULTIMATE) - if (ac == 7) { - do_nick(source, av[0], av[3], av[4], av[5], av[6], - strtoul(av[2], NULL, 10), 0); - } else { - do_nick(source, av[0], av[3], av[4], av[5], av[7], - strtoul(av[2], NULL, 10), strtoul(av[6], NULL, 0)); - } -/* PTlink IRCd - PTS4 */ -#elif defined(IRC_PTLINK) - User *user = do_nick(source, av[0], av[4], av[6], av[7], av[8], - strtoul(av[2], NULL, 10), 0, av[5]); - if (user) - set_umode(user, 1, &av[3]); -#else - do_nick(source, av[0], av[3], av[4], av[5], av[7], - strtoul(av[2], NULL, 10), strtoul(av[6], NULL, 0)); -# endif -#endif -#endif - } else { - do_nick(source, av[0], NULL, NULL, NULL, NULL, - strtoul(av[1], NULL, 10), 0); - } - return MOD_CONT; -} - -/*************************************************************************/ - -#ifdef IRC_ULTIMATE3 - -static int m_client(char *source, int ac, char **av) -{ - if (ac != 2) { - User *user = do_nick(source, av[0], av[5], av[6], av[8], av[11], - strtoul(av[2], NULL, 10), strtoul(av[9], NULL, - 0), - strtoul(av[10], NULL, 0), av[7]); - if (user) { - set_umode(user, 1, &av[3]); - } - } - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -#ifdef IRC_RAGE2 - -static int m_snick(char *source, int ac, char **av) -{ - if (ac != 2) { - User *user = do_nick(source, av[0], av[3], av[4], av[7], av[10], - strtoul(av[1], NULL, 10), strtoul(av[8], NULL, - 0), - strtoul(av[5], NULL, 0), av[6]); - if (user) { - set_umode(user, 1, &av[9]); - } - } - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -#ifdef IRC_BAHAMUT - -static int m_ns(char *source, int ac, char **av) -{ - User *u; - time_t starttime, stoptime; /* When processing started and finished */ - - if (ac < 1 || skeleton) - return MOD_CONT; - - u = finduser(source); - - if (!u) { - alog("%s: user record for %s not found", s_NickServ, source); - notice(s_NickServ, source, getstring(NULL, USER_RECORD_NOT_FOUND)); - return MOD_CONT; - } - - /* Check if we should ignore. Operators always get through. */ - if (allow_ignore && !is_oper(u)) { - IgnoreData *ign = get_ignore(source); - if (ign && ign->time > time(NULL)) { - alog("Ignored message from %s: \"%s\"", source, inbuf); - return MOD_CONT; - } - } - - starttime = time(NULL); - - nickserv(u, av[0]); - - /* Add to ignore list if the command took a significant amount of time. */ - if (allow_ignore) { - stoptime = time(NULL); - if (stoptime > starttime && *source && !strchr(source, '.')) - add_ignore(source, stoptime - starttime); - } - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -#ifdef IRC_PTLINK -/* - * Note: This function has no validation whatsoever. Also, as of PTlink6.15.1 - * when you /deoper you get to keep your vindent, but you lose your vhost. In - * that case serives will *NOT* modify it's internal record for the vhost. We - * need to address this in the future. - */ -static int m_newmask(char *source, int ac, char **av) -{ - User *u; - char *newhost = NULL, *newuser = NULL; - - if (ac != 1) - return MOD_CONT; - u = finduser(source); - - if (!u) { - alog("user: NEWMASK for nonexistent user %s", av[0]); - return MOD_CONT; - } - - newuser = myStrGetOnlyToken(av[0], '@', 0); - if (newuser) { - newhost = myStrGetTokenRemainder(av[0], '@', 1); - change_user_username(u, newuser); - } else { - newhost = av[0]; - } - - if (*newhost == '@') - newhost++; - - if (newhost) { - change_user_host(u, newhost); - } - - return MOD_CONT; -} -#endif - - -/*************************************************************************/ - -#ifdef IRC_BAHAMUT - -static int m_os(char *source, int ac, char **av) -{ - User *u; - time_t starttime, stoptime; /* When processing started and finished */ - - if (ac < 1) - return MOD_CONT; - - u = finduser(source); - - if (!u) { - alog("%s: user record for %s not found", s_OperServ, source); - notice(s_OperServ, source, getstring(NULL, USER_RECORD_NOT_FOUND)); - return MOD_CONT; - } - - /* Check if we should ignore. Operators always get through. */ - if (allow_ignore && !is_oper(u)) { - IgnoreData *ign = get_ignore(source); - if (ign && ign->time > time(NULL)) { - alog("Ignored message from %s: \"%s\"", source, inbuf); - return MOD_CONT; - } - } - - starttime = time(NULL); - - if (is_oper(u)) { - operserv(u, av[0]); - } else { - notice_lang(s_OperServ, u, ACCESS_DENIED); - - if (WallBadOS) - wallops(s_OperServ, - "Denied access to %s from %s!%s@%s (non-oper)", - s_OperServ, u->nick, u->username, u->host); - } - - /* Add to ignore list if the command took a significant amount of time. */ - if (allow_ignore) { - stoptime = time(NULL); - if (stoptime > starttime && *source && !strchr(source, '.')) - add_ignore(source, stoptime - starttime); + anope_cmd_372_error(source); } + anope_cmd_376(source); return MOD_CONT; } -#endif - /*************************************************************************/ -static int m_part(char *source, int ac, char **av) -{ - if (ac < 1 || ac > 2) - return MOD_CONT; - do_part(source, ac, av); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_privmsg(char *source, int ac, char **av) +int m_privmsg(char *source, char *receiver, char *msg) { char *s; - char *buf; time_t starttime, stoptime; /* When processing started and finished */ BotInfo *bi; ChannelInfo *ci; User *u; - if (ac != 2) - return MOD_CONT; - u = finduser(source); if (!u) { - alog("%s: user record for %s not found", av[1], source); - notice(av[1], source, getstring(NULL, USER_RECORD_NOT_FOUND)); + alog("%s: user record for %s not found", msg, source); + anope_cmd_notice(msg, source, + getstring(NULL, USER_RECORD_NOT_FOUND)); return MOD_CONT; } - if (*av[0] == '#') { - if (s_BotServ && (ci = cs_findchan(av[0]))) - if (!(ci->flags & CI_VERBOTEN) && ci->c && ci->bi) - /* Some paranoia checks */ - /* Copy the message to a temp. variable, otherwise botchanmsgs would break the buffer for modules -Keeper */ - buf = sstrdup(av[1]); - botchanmsgs(u, ci, buf); - free(buf); + if (*receiver == '#') { + if (s_BotServ && (ci = cs_findchan(receiver))) + if (!(ci->flags & CI_VERBOTEN) && ci->c && ci->bi) /* Some paranoia checks */ + botchanmsgs(u, ci, msg); } else { /* Check if we should ignore. Operators always get through. */ @@ -616,7 +155,7 @@ static int m_privmsg(char *source, int ac, char **av) /* If a server is specified (nick@server format), make sure it matches * us, and strip it off. */ - s = strchr(av[0], '@'); + s = strchr(receiver, '@'); if (s) { *s++ = 0; if (stricmp(s, ServerName) != 0) @@ -625,59 +164,54 @@ static int m_privmsg(char *source, int ac, char **av) starttime = time(NULL); - if ((stricmp(av[0], s_OperServ) == 0) - || (s_OperServAlias && (stricmp(av[0], s_OperServAlias) == 0))) { + if ((stricmp(receiver, s_OperServ) == 0) + || (s_OperServAlias + && (stricmp(receiver, s_OperServAlias) == 0))) { if (is_oper(u)) { - operserv(u, av[1]); + operserv(u, msg); } else { notice_lang(s_OperServ, u, ACCESS_DENIED); if (WallBadOS) - wallops(s_OperServ, - "Denied access to %s from %s!%s@%s (non-oper)", - s_OperServ, u->nick, u->username, u->host); + anope_cmd_global(s_OperServ, + "Denied access to %s from %s!%s@%s (non-oper)", + s_OperServ, u->nick, u->username, + u->host); } - } else if ((stricmp(av[0], s_NickServ) == 0) + } else if ((stricmp(receiver, s_NickServ) == 0) || (s_NickServAlias - && (stricmp(av[0], s_NickServAlias) == 0))) { - nickserv(u, av[1]); - } else if ((stricmp(av[0], s_ChanServ) == 0) + && (stricmp(receiver, s_NickServAlias) == 0))) { + nickserv(u, msg); + } else if ((stricmp(receiver, s_ChanServ) == 0) || (s_ChanServAlias - && (stricmp(av[0], s_ChanServAlias) == 0))) { + && (stricmp(receiver, s_ChanServAlias) == 0))) { if (!is_oper(u) && CSOpersOnly) notice_lang(s_ChanServ, u, ACCESS_DENIED); else - chanserv(u, av[1]); - } else if ((stricmp(av[0], s_MemoServ) == 0) + chanserv(u, msg); + } else if ((stricmp(receiver, s_MemoServ) == 0) || (s_MemoServAlias - && (stricmp(av[0], s_MemoServAlias) == 0))) { - memoserv(u, av[1]); - } else if (s_HostServ && ((stricmp(av[0], s_HostServ) == 0) + && (stricmp(receiver, s_MemoServAlias) == 0))) { + memoserv(u, msg); + } else if (s_HostServ && ((stricmp(receiver, s_HostServ) == 0) || (s_HostServAlias - && (stricmp(av[0], s_HostServAlias) - == 0)))) { - hostserv(u, av[1]); - } else if (s_HelpServ && ((stricmp(av[0], s_HelpServ) == 0) + && + (stricmp(receiver, s_HostServAlias) + == 0)))) { + hostserv(u, msg); + } else if (s_HelpServ && ((stricmp(receiver, s_HelpServ) == 0) || (s_HelpServAlias - && (stricmp(av[0], s_HelpServAlias) - == 0)))) { - helpserv(u, av[1]); - } else if (s_BotServ && ((stricmp(av[0], s_BotServ) == 0) + && + (stricmp(receiver, s_HelpServAlias) + == 0)))) { + helpserv(u, msg); + } else if (s_BotServ && ((stricmp(receiver, s_BotServ) == 0) || (s_BotServAlias - && (stricmp(av[0], s_BotServAlias) == - 0)))) { - botserv(u, av[1]); -/* This HelpServ code is history since HelpServ is a REAL service */ - -/* } else if ((stricmp(av[0], s_HelpServ) == 0) - || (s_HelpServAlias - && (stricmp(av[0], s_HelpServAlias) == 0))) { - notice_help(s_HelpServ, u, HELP_HELP, s_NickServ, s_ChanServ, - s_MemoServ); - if (s_BotServ) - notice_help(s_HelpServ, u, HELP_HELP_BOT, s_BotServ); */ - } else if (s_BotServ && (bi = findbot(av[0]))) { - botmsgs(u, bi, av[1]); + && (stricmp(receiver, s_BotServAlias) + == 0)))) { + botserv(u, msg); + } else if (s_BotServ && (bi = findbot(receiver))) { + botmsgs(u, bi, msg); } /* Add to ignore list if the command took a significant amount of time. */ @@ -692,222 +226,7 @@ static int m_privmsg(char *source, int ac, char **av) /*************************************************************************/ -static int m_quit(char *source, int ac, char **av) -{ - if (ac != 1) - return MOD_CONT; - do_quit(source, ac, av); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_squit(char *source, int ac, char **av) -{ - if (ac != 2) - return MOD_CONT; - do_squit(source, ac, av); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_server(char *source, int ac, char **av) -{ - if (!stricmp(av[1], "1")) - uplink = sstrdup(av[0]); -#ifdef IRC_PTLINK - if (ac != 4) -#else - if (ac != 3) -#endif - return MOD_CONT; - do_server(source, ac, av); - return MOD_CONT; -} - -/*************************************************************************/ - -#if defined(IRC_ULTIMATE3) - -static int m_sethost(char *source, int ac, char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) - alog("user: SETHOST for nonexistent user %s", av[0]); - return MOD_CONT; - } - - change_user_host(u, av[1]); - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -#ifdef IRC_RAGE2 - -static int m_vhost(char *source, int ac, char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - if (debug) - alog("user: VHOST for nonexistent user %s", av[0]); - return MOD_CONT; - } - - change_user_host(u, av[1]); - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -#if defined(IRC_ULTIMATE) || defined(IRC_UNREAL) || defined(IRC_VIAGRA) - -static int m_chghost(char *source, int ac, char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - alog("user: CHGHOST for nonexistent user %s", av[0]); - return MOD_CONT; - } - - change_user_host(u, av[1]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_sethost(char *source, int ac, char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - if (debug) - alog("user: SETHOST for nonexistent user %s", source); - return MOD_CONT; - } - - change_user_host(u, av[0]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_chgident(char *source, int ac, char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - alog("user: CHGIDENT for nonexistent user %s", av[0]); - return MOD_CONT; - } - - change_user_username(u, av[1]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_setident(char *source, int ac, char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - alog("user: SETIDENT for nonexistent user %s", source); - return MOD_CONT; - } - - change_user_username(u, av[0]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_chgname(char *source, int ac, char **av) -{ - User *u; - - if (ac != 2) - return MOD_CONT; - - u = finduser(av[0]); - if (!u) { - alog("user: CHGNAME for nonexistent user %s", av[0]); - return MOD_CONT; - } - - change_user_realname(u, av[1]); - return MOD_CONT; -} - -/*************************************************************************/ - -static int m_setname(char *source, int ac, char **av) -{ - User *u; - - if (ac != 1) - return MOD_CONT; - - u = finduser(source); - if (!u) { - alog("user: SETNAME for nonexistent user %s", source); - return MOD_CONT; - } - - change_user_realname(u, av[0]); - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -#if defined(IRC_BAHAMUT) || defined(IRC_HYBRID) || defined(IRC_PTLINK) || defined(IRC_RAGE2) - -static int m_sjoin(char *source, int ac, char **av) -{ - do_sjoin(source, ac, av); - return MOD_CONT; -} - -#endif - -/*************************************************************************/ - -static int m_stats(char *source, int ac, char **av) +int m_stats(char *source, int ac, char **av) { int i; User *u; @@ -923,76 +242,71 @@ static int m_stats(char *source, int ac, char **av) if (u && is_oper(u)) { if (servernum == 1) { - send_cmd(NULL, - "211 %s Server SendBuf SentBytes SentMsgs RecvBuf " - "RecvBytes RecvMsgs ConnTime", source); - send_cmd(NULL, "211 %s %s %d %d %d %d %d %d %ld", source, - RemoteServer, write_buffer_len(), total_written, - -1, read_buffer_len(), total_read, -1, - time(NULL) - start_time); + anope_cmd_211 + ("%s Server SendBuf SentBytes SentMsgs RecvBuf " + "RecvBytes RecvMsgs ConnTime", source); + anope_cmd_211("%s %s %d %d %d %d %d %d %ld", source, + RemoteServer, write_buffer_len(), + total_written, -1, read_buffer_len(), + total_read, -1, time(NULL) - start_time); } else if (servernum == 2) { - send_cmd(NULL, - "211 %s Server SendBuf SentBytes SentMsgs RecvBuf " - "RecvBytes RecvMsgs ConnTime", source); - send_cmd(NULL, "211 %s %s %d %d %d %d %d %d %ld", source, - RemoteServer2, write_buffer_len(), total_written, - -1, read_buffer_len(), total_read, -1, - time(NULL) - start_time); + anope_cmd_211 + ("%s Server SendBuf SentBytes SentMsgs RecvBuf " + "RecvBytes RecvMsgs ConnTime", source); + anope_cmd_211("%s %s %d %d %d %d %d %d %ld", source, + RemoteServer2, write_buffer_len(), + total_written, -1, read_buffer_len(), + total_read, -1, time(NULL) - start_time); } else if (servernum == 3) { - send_cmd(NULL, - "211 %s Server SendBuf SentBytes SentMsgs RecvBuf " - "RecvBytes RecvMsgs ConnTime", source); - send_cmd(NULL, "211 %s %s %d %d %d %d %d %d %ld", source, - RemoteServer3, write_buffer_len(), total_written, - -1, read_buffer_len(), total_read, -1, - time(NULL) - start_time); + anope_cmd_211 + ("%s Server SendBuf SentBytes SentMsgs RecvBuf " + "RecvBytes RecvMsgs ConnTime", source); + anope_cmd_211("%s %s %d %d %d %d %d %d %ld", source, + RemoteServer3, write_buffer_len(), + total_written, -1, read_buffer_len(), + total_read, -1, time(NULL) - start_time); } } - send_cmd(NULL, "219 %s l :End of /STATS report.", source); + anope_cmd_219(source, NULL); break; case 'o': case 'O': /* Check whether the user is an operator */ u = finduser(source); if (u && !is_oper(u) && HideStatsO) { - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - *av[0]); + anope_cmd_219(source, av[0]); } else { for (i = 0; i < RootNumber; i++) - send_cmd(NULL, "243 %s O * * %s Root 0", source, - ServicesRoots[i]); + anope_cmd_243("%s O * * %s Root 0", source, + ServicesRoots[i]); for (i = 0; i < servadmins.count && (nc = servadmins.list[i]); i++) - send_cmd(NULL, "243 %s O * * %s Admin 0", source, - nc->display); + anope_cmd_243("%s O * * %s Admin 0", source, nc->display); for (i = 0; i < servopers.count && (nc = servopers.list[i]); i++) - send_cmd(NULL, "243 %s O * * %s Oper 0", source, - nc->display); + anope_cmd_243("%s O * * %s Oper 0", source, nc->display); - send_cmd(NULL, "219 %s %c :End of /STATS report.", source, - |
