diff options
Diffstat (limited to 'src/messages.c')
-rw-r--r-- | src/messages.c | 108 |
1 files changed, 41 insertions, 67 deletions
diff --git a/src/messages.c b/src/messages.c index 6b119bd8f..926c24dcc 100644 --- a/src/messages.c +++ b/src/messages.c @@ -71,7 +71,7 @@ int m_time(const char *source, int ac, const char **av) time(&t); tm = localtime(&t); strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm); - anope_cmd_391(source, buf); + anope_cmd_numeric(ServerName, 391, source, "%s :%s", ServerName, buf); return MOD_CONT; } @@ -88,15 +88,15 @@ int m_motd(const char *source) f = fopen(MOTDFilename, "r"); if (f) { - anope_cmd_375(source); + anope_cmd_numeric(ServerName, 375, source, ":- %s Message of the Day", ServerName); while (fgets(buf, sizeof(buf), f)) { buf[strlen(buf) - 1] = 0; - anope_cmd_372(source, buf); + anope_cmd_numeric(ServerName, 372, source, ":- %s", buf); } fclose(f); - anope_cmd_376(source); + anope_cmd_numeric(ServerName, 376, source, ":End of /MOTD command."); } else { - anope_cmd_372_error(source); + anope_cmd_numeric(ServerName, 422, source, ":- MOTD file not found! Please contact your IRC administrator."); } return MOD_CONT; } @@ -237,71 +237,54 @@ int m_stats(const char *source, int ac, const char **av) if (u && is_oper(u)) { if (servernum == 1) { - 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); + anope_cmd_numeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); + anope_cmd_numeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer, write_buffer_len(), total_written, -1, read_buffer_len(), + total_read, -1, time(NULL) - start_time); } else if (servernum == 2) { - 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); + anope_cmd_numeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); + anope_cmd_numeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer2, write_buffer_len(), total_written, -1, read_buffer_len(), + total_read, -1, time(NULL) - start_time); } else if (servernum == 3) { - 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); + anope_cmd_numeric(ServerName, 211, source, "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); + anope_cmd_numeric(ServerName, 211, source, "%s %d %d %d %d %d %d %ld", RemoteServer3, write_buffer_len(), total_written, -1, read_buffer_len(), + total_read, -1, time(NULL) - start_time); } } - anope_cmd_219(source, av[0]); + anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); break; case 'o': case 'O': /* Check whether the user is an operator */ u = finduser(source); if (u && !is_oper(u) && HideStatsO) { - anope_cmd_219(source, av[0]); + anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); } else { for (i = 0; i < RootNumber; i++) - anope_cmd_243("%s O * * %s Root 0", source, - ServicesRoots[i]); + anope_cmd_numeric(ServerName, 243, source, "O * * %s Root 0", ServicesRoots[i]); for (i = 0; i < servadmins.count && (nc = (NickCore *)servadmins.list[i]); i++) - anope_cmd_243("%s O * * %s Admin 0", source, nc->display); + anope_cmd_numeric(ServerName, 243, source, "O * * %s Admin 0", nc->display); for (i = 0; i < servopers.count && (nc = (NickCore *)servopers.list[i]); i++) - anope_cmd_243("%s O * * %s Oper 0", source, nc->display); + anope_cmd_numeric(ServerName, 243, source, "O * * %s Oper 0", nc->display); - anope_cmd_219(source, av[0]); + anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); } break; case 'u':{ int uptime = time(NULL) - start_time; - anope_cmd_242("%s :Services up %d day%s, %02d:%02d:%02d", - source, uptime / 86400, - (uptime / 86400 == 1) ? "" : "s", - (uptime / 3600) % 24, (uptime / 60) % 60, - uptime % 60); - anope_cmd_250("%s :Current users: %d (%d ops); maximum %d", - source, usercnt, opcnt, maxusercnt); - anope_cmd_219(source, av[0]); + anope_cmd_numeric(ServerName, 242, source, ":Services up %d day%s, %02d:%02d:%02d", uptime / 86400, uptime / 86400 == 1 ? "" : "s", + (uptime / 3600) % 24, (uptime / 60) % 60, uptime % 60); + anope_cmd_numeric(ServerName, 250, source, ":Current users: %d (%d ops); maximum %d", usercnt, opcnt, maxusercnt); + anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); break; } /* case 'u' */ default: - anope_cmd_219(source, av[0]); + anope_cmd_numeric(ServerName, 219, source, "%c :End of /STATS report.", *av[0] ? *av[0] : '*'); break; } return MOD_CONT; @@ -311,10 +294,9 @@ int m_stats(const char *source, int ac, const char **av) int m_version(const char *source, int ac, const char **av) { - if (source) { - anope_cmd_351(source); - } - return MOD_CONT; + if (source) anope_cmd_numeric(ServerName, 351, source, "Anope-%s %s :%s - %s (%s) -- %s", version_number, ServerName, ircd->name, version_flags, + EncModule, version_build); + return MOD_CONT; } @@ -347,15 +329,11 @@ int m_whois(const char *source, const char *who) clientdesc = desc_DevNull; else if (s_BotServ && (bi = findbot(who))) { /* Bots are handled separately */ - anope_cmd_311("%s %s %s %s * :%s", source, bi->nick, - bi->user, bi->host, bi->real); - anope_cmd_307("%s %s :is a registered nick", source, bi->nick); - anope_cmd_312("%s %s %s :%s", source, bi->nick, ServerName, - ServerDesc); - anope_cmd_317("%s %s %ld %ld :seconds idle, signon time", - source, bi->nick, time(NULL) - bi->lastmsg, - start_time); - anope_cmd_318(source, bi->nick); + anope_cmd_numeric(ServerName, 311, source, "%s %s %s * :%s", bi->nick, bi->user, bi->host, bi->real); + anope_cmd_numeric(ServerName, 307, source, "%s :is a registered nick", bi->nick); + anope_cmd_numeric(ServerName, 312, source, "%s %s :%s", bi->nick, ServerName, ServerDesc); + anope_cmd_numeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", bi->nick, time(NULL) - bi->lastmsg, start_time); + anope_cmd_numeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); return MOD_CONT; } else if (!(ircd->svshold && UseSVSHOLD) && (na = findnick(who)) && (na->status & NS_KILL_HELD)) { @@ -363,22 +341,18 @@ int m_whois(const char *source, const char *who) * We can't just say it doesn't exist here, even tho it does for * other servers :) -GD */ - anope_cmd_311("%s %s %s %s * :Services Enforcer", source, - na->nick, NSEnforcerUser, NSEnforcerHost); - anope_cmd_312("%s %s %s :%s", source, na->nick, ServerName, - ServerDesc); - anope_cmd_318(source, na->nick); + anope_cmd_numeric(ServerName, 311, source, "%s %s %s * :Services Enforcer", na->nick, NSEnforcerUser, NSEnforcerHost); + anope_cmd_numeric(ServerName, 312, source, "%s %s :%s", na->nick, ServerName, ServerDesc); + anope_cmd_numeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); return MOD_CONT; } else { - anope_cmd_401(source, who); + anope_cmd_numeric(ServerName, 401, source, "%s :No such service.", who); return MOD_CONT; } - anope_cmd_311("%s %s %s %s * :%s", source, who, - ServiceUser, ServiceHost, clientdesc); - anope_cmd_312("%s %s %s :%s", source, who, ServerName, ServerDesc); - anope_cmd_317("%s %s %ld %ld :seconds idle, signon time", source, - who, time(NULL) - start_time, start_time); - anope_cmd_318(source, who); + anope_cmd_numeric(ServerName, 311, source, "%s %s %s * :%s", who, ServiceUser, ServiceHost, clientdesc); + anope_cmd_numeric(ServerName, 312, source, "%s %s :%s", who, ServerName, ServerDesc); + anope_cmd_numeric(ServerName, 317, source, "%s %ld %ld :seconds idle, signon time", who, time(NULL) - start_time, start_time); + anope_cmd_numeric(ServerName, 318, source, "%s :End of /WHOIS list.", who); } return MOD_CONT; } |