diff options
37 files changed, 63 insertions, 60 deletions
diff --git a/include/numerics.h b/include/numerics.h index 53620661e..e96f57cf2 100644 --- a/include/numerics.h +++ b/include/numerics.h @@ -26,18 +26,21 @@ enum Numerics /* * Reply range of numerics. */ - RPL_WELCOME = 001, // not RFC, extremely common though - RPL_YOURHOSTIS = 002, // not RFC, extremely common though - RPL_SERVERCREATED = 003, // not RFC, extremely common though - RPL_SERVERVERSION = 004, // not RFC, extremely common though - RPL_ISUPPORT = 005, // not RFC, extremely common though + RPL_WELCOME = 1, // not RFC, extremely common though + RPL_YOURHOSTIS = 2, // not RFC, extremely common though + RPL_SERVERCREATED = 3, // not RFC, extremely common though + RPL_SERVERVERSION = 4, // not RFC, extremely common though + RPL_ISUPPORT = 5, // not RFC, extremely common though - RPL_SNOMASKIS = 8, // unrealircd - cant put 008 as it will be interpreted as octal + RPL_MAP = 6, // unrealircd + RPL_ENDMAP = 7, // unrealircd + RPL_SNOMASKIS = 8, // unrealircd - RPL_YOURUUID = 42, // taken from ircnet - see above + RPL_YOURUUID = 42, // taken from ircnet RPL_UMODEIS = 221, RPL_RULES = 232, // unrealircd + RPL_MAPUSERS = 270, // insp-specific(?) RPL_RULESTART = 308, // unrealircd RPL_RULESEND = 309, // unrealircd @@ -53,6 +56,7 @@ enum Numerics RPL_MOTDSTART = 375, RPL_ENDOFMOTD = 376, + RPL_YOUAREOPER = 381, RPL_REHASHING = 382, RPL_TIME = 391, RPL_YOURDISPLAYEDHOST = 396, // from charybdis/etc, common convention @@ -61,12 +65,16 @@ enum Numerics * Error range of numerics. */ ERR_NOSUCHNICK = 401, + ERR_NOSUCHSERVER = 402, ERR_NOSUCHCHANNEL = 403, // used to indicate an invalid channel name also, so don't rely on RFC text (don't do that anyway!) + ERR_CANNOTSENDTOCHAN = 404, ERR_TOOMANYCHANNELS = 405, + ERR_INVALIDCAPSUBCOMMAND = 410, // ratbox/charybdis(?) ERR_UNKNOWNCOMMAND = 421, ERR_NOMOTD = 422, ERR_NORULES = 434, // unrealircd ERR_USERNOTINCHANNEL = 441, + ERR_CANTCHANGENICK = 447, // unrealircd, probably ERR_NOTREGISTERED = 451, ERR_NEEDMOREPARAMS = 461, ERR_ALREADYREGISTERED = 462, @@ -95,9 +103,16 @@ enum Numerics ERR_NOPRIVILEGES = 481, // rfc, beware though, we use this for other things opers may not do also ERR_CHANOPRIVSNEEDED = 482, // rfc, beware though, we use this for other things like trying to kick a uline + ERR_ALLMUSTSSL = 490, // unrealircd + ERR_NOCTCPALLOWED = 492, // XXX: bzzzz. 1459 defines this as ERR_NOSERVICEHOST, research it more and perhaps change this! (ERR_CANNOTSENDTOCHAN?) + // wtf, we also use this for m_noinvite. UGLY! + ERR_DELAYREJOIN = 495, // insp-specific, XXX: we should use 'resource temporarily unavailable' from ircnet/ratbox or whatever ERR_UNKNOWNSNOMASK = 501, // insp-specific ERR_USERSDONTMATCH = 502, + ERR_CANTJOINOPERSONLY = 520, // unrealircd, but crap to have so many numerics for cant join.. + ERR_CANTSENDTOUSER = 531, // ??? + ERR_WORDFILTERED = 936, // insp-specific, would be nice if we could get rid of this.. ERR_CANTUNLOADMODULE = 972, // insp-specific RPL_UNLOADEDMODULE = 973, // insp-specific ERR_CANTLOADMODULE = 974, // insp-specific diff --git a/src/configreader.cpp b/src/configreader.cpp index 561b5d8de..72429f8ac 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1296,7 +1296,7 @@ void ServerConfig::Read(bool bail, User* user) else { if (user) - user->WriteNumeric(RPL_CANTLOADMODULE, "%s %s :Failed to load module %s: %s",user->nick.c_str(), adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(ERR_CANTLOADMODULE, "%s %s :Failed to load module %s: %s",user->nick.c_str(), adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError().c_str()); } } } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 60207548d..8e8427681 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -307,7 +307,7 @@ public: user->ChangeDisplayedHost(operhost.c_str()); ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), type.c_str()); - user->WriteNumeric(381, "%s :You are now %s %s",user->nick.c_str(), strchr("aeiouAEIOU", type[0]) ? "an" : "a", irc::Spacify(type.c_str())); + user->WriteNumeric(RPL_YOUAREOPER, "%s :You are now %s %s",user->nick.c_str(), strchr("aeiouAEIOU", type[0]) ? "an" : "a", irc::Spacify(type.c_str())); if (!user->modes[UM_OPERATOR]) user->Oper(type, tname); diff --git a/src/modules/extra/m_sslinfo.cpp b/src/modules/extra/m_sslinfo.cpp index 6d0c78937..82ac7c18e 100644 --- a/src/modules/extra/m_sslinfo.cpp +++ b/src/modules/extra/m_sslinfo.cpp @@ -58,7 +58,7 @@ class cmd_sslinfo : public Command } } else - user->WriteNumeric(401, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index c1da8ca8c..6563cd3be 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -26,7 +26,7 @@ class AuditoriumMode : public ModeHandler { if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP)) { - source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +u", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un"); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only channel operators may %sset channel mode +u", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un"); return MODEACTION_DENY; } else diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 0b47f8821..23658a9fa 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -86,7 +86,7 @@ public: } if ( ((caps*100)/(int)text.length()) >= percent ) { - user->WriteServ( "404 %s %s :Your line cannot be more than %d%% capital letters if it is %d or more letters long", user->nick.c_str(), c->name.c_str(), percent, minlen); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Your line cannot be more than %d%% capital letters if it is %d or more letters long", user->nick.c_str(), c->name.c_str(), percent, minlen); return 1; } } diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 4f66008a5..b56300ba8 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -127,7 +127,7 @@ class CommandCAP : public Command } else { - user->WriteNumeric(410, "* %s :Invalid CAP subcommand", subcommand.c_str()); + user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "* %s :Invalid CAP subcommand", subcommand.c_str()); } return CMD_FAILURE; diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 46e4daa48..0a90d1025 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -38,8 +38,6 @@ class CensorChannel : public SimpleChannelModeHandler class ModuleCensor : public Module { - - censor_t censors; CensorUser *cu; CensorChannel *cc; @@ -115,7 +113,7 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str()); + user->WriteNumeric(ERR_WORDFILTERED, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str()); return 1; } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 67b39cb66..b1d9ade7c 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -56,7 +56,7 @@ class CommandChghost : public Command if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 4c8b256e4..192a7e8a0 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -33,7 +33,7 @@ class CommandChgident : public Command if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 787980d80..038686cfc 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -33,7 +33,7 @@ class CommandChgname : public Command if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index e0552f0d7..0bb1de227 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -77,7 +77,7 @@ class ModulePrivacyMode : public Module User* t = (User*)dest; if (!IS_OPER(user) && (t->IsModeSet('c')) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t)) { - user->WriteNumeric(531, "%s %s :You are not permitted to send private messages to this user (+c set)", user->nick.c_str(), t->nick.c_str()); + user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user (+c set)", user->nick.c_str(), t->nick.c_str()); return 1; } } diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 6b6f0c5a1..0196c6b8f 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -29,7 +29,7 @@ class DelayJoinMode : public ModeHandler { if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP)) { - source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +D", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un"); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only channel operators may %sset channel mode +D", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un"); return MODEACTION_DENY; } else diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 21bc25799..265f96efc 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -145,7 +145,7 @@ public: { if (iter->first == user) { - user->WriteNumeric(495, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)", user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter('J').c_str()); + user->WriteNumeric(ERR_DELAYREJOIN, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)", user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter('J').c_str()); return 1; } } diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 00eea1309..8d7d3957d 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -84,7 +84,7 @@ class ModuleNoCTCP : public Module { if (strncmp(text.c_str(),"\1ACTION ",8)) { - user->WriteNumeric(492, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str()); return 1; } } diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index d9f01f044..d4e38bd86 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -42,7 +42,7 @@ class ModuleNoInvite : public Module { if (channel->IsModeSet('V')) { - user->WriteNumeric(492, "%s %s :Can't invite %s to channel (+V set)",user->nick.c_str(), channel->name.c_str(), dest->nick.c_str()); + user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't invite %s to channel (+V set)",user->nick.c_str(), channel->name.c_str(), dest->nick.c_str()); return 1; } } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 3956c265f..de6eab1c7 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -54,7 +54,7 @@ class ModuleNoKicks : public Module else { // nobody else can (not even opers with override, and founders) - source->WriteNumeric(484, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name.c_str(), dest->nick.c_str()); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), channel->name.c_str(), dest->nick.c_str()); return ACR_DENY; } } diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index a816018e6..ed02af39f 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -85,7 +85,7 @@ class ModuleNoNickChange : public Module if (CHANOPS_EXEMPT(ServerInstance, 'N') && curr->GetStatus(user) == STATUS_OP) continue; - user->WriteNumeric(447, "%s :Can't change nickname while on %s (+N is set)", user->nick.c_str(), curr->name.c_str()); + user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)", user->nick.c_str(), curr->name.c_str()); return 1; } } diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index ae00a126a..8424be897 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -58,7 +58,7 @@ class ModuleNoNotice : public Module } else { - user->WriteNumeric(404, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str()); return 1; } } diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 020e097ff..3b28eeb38 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -69,7 +69,7 @@ class ModuleOperChans : public Module { if (chan->IsModeSet('O')) { - user->WriteNumeric(520, "%s %s :Only IRC operators may join the channel %s (+O is set)",user->nick.c_str(), chan->name.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANTJOINOPERSONLY, "%s %s :Only IRC operators may join the channel %s (+O is set)",user->nick.c_str(), chan->name.c_str(), chan->name.c_str()); return 1; } } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index e50087dbf..29b24354e 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -76,7 +76,7 @@ class ModuleOperLevels : public Module { ServerInstance->SNO->WriteToSnoMask('A', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str()); dest->WriteServ("NOTICE %s :Oper %s attempted to /kill you!",dest->nick.c_str(),source->nick.c_str()); - source->WriteNumeric(481, "%s :Permission Denied - Oper %s is a higher level than you",source->nick.c_str(),dest->nick.c_str()); + source->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper %s is a higher level than you",source->nick.c_str(),dest->nick.c_str()); return 1; } } diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 9be3e1400..7d53eeb02 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -36,7 +36,8 @@ class ModuleRegOnlyCreate : public Module if ((!user->IsModeSet('r')) && (!user->GetExt("accountname"))) { - user->WriteNumeric(482, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname); + // XXX. there may be a better numeric for this.. + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname); return 1; } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index d35f1f8dd..5ded9bda0 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -99,7 +99,7 @@ class RemoveBase /* Fix by brain - someone needs to learn to validate their input! */ if (!target || !channel) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), !target ? username : channame); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !target ? username : channame); return CMD_FAILURE; } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 7b229687f..35665fad9 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -60,7 +60,7 @@ class ModuleRestrictChans : public Module // channel does not yet exist (record is null, about to be created IF we were to allow it) if (!chan) { - user->WriteNumeric(530, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname); + user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname); return 1; } } diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 5670286b8..65bae4657 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -44,7 +44,7 @@ class ModuleRestrictMsg : public Module { return 0; } - user->WriteNumeric(531, "%s %s :You are not permitted to send private messages to this user",user->nick.c_str(),u->nick.c_str()); + user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user",user->nick.c_str(),u->nick.c_str()); return 1; } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 72fdd3e08..d429704d9 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -34,7 +34,7 @@ class CommandSajoin : public Command { if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); return CMD_FAILURE; } if (IS_LOCAL(user) && !ServerInstance->IsChannel(parameters[1].c_str(), ServerInstance->Config->Limits.ChanMax)) diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 9adaff40c..a14bfc097 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -34,7 +34,7 @@ class CommandSanick : public Command { if (ServerInstance->ULine(target->server)) { - user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); return CMD_FAILURE; } std::string oldnick = user->nick; diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index f01cb1564..8fba73359 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -40,7 +40,7 @@ class CommandSapart : public Command if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 00f8cfba2..1ace7eea3 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -34,7 +34,7 @@ class CommandSaquit : public Command { if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp index a15cba93c..95b0c8432 100644 --- a/src/modules/m_spanningtree/override_admin.cpp +++ b/src/modules/m_spanningtree/override_admin.cpp @@ -51,7 +51,7 @@ int ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, Utils->DoOneToOne(user->uuid, "ADMIN", params, s->GetName()); } else - user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); return 1; } return 0; diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index 229997e5b..b17e266b2 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -37,7 +37,6 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha { for (int t = 0; t < depth; t++) { - ServerInstance->Logs->Log("map",DEBUG,"Zero to depth"); matrix[line][t] = ' '; } @@ -75,27 +74,20 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha strlcpy(&matrix[line][depth],text,126); line++; - ServerInstance->Logs->Log("map",DEBUG,"Increment line to %d, ChildCount %d", line, Current->ChildCount()); - for (unsigned int q = 0; q < Current->ChildCount(); q++) { - ServerInstance->Logs->Log("map",DEBUG,"Hidden? %d HideULines? %d GetName %s", Current->GetChild(q)->Hidden, Utils->HideULines, Current->GetChild(q)->GetName().c_str()); if ((Current->GetChild(q)->Hidden) || ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName().c_str())))) { if (IS_OPER(user)) { ShowMap(Current->GetChild(q),user,(Utils->FlatLinks && (!IS_OPER(user))) ? depth : depth+2,matrix,totusers,totservers); - ServerInstance->Logs->Log("map",DEBUG,"Show to oper"); } - ServerInstance->Logs->Log("map",DEBUG,"Fall through"); } else { ShowMap(Current->GetChild(q),user,(Utils->FlatLinks && (!IS_OPER(user))) ? depth : depth+2,matrix,totusers,totservers); - ServerInstance->Logs->Log("map",DEBUG,"Show to non oper"); } } - ServerInstance->Logs->Log("map",DEBUG,"After loop"); } } @@ -117,7 +109,7 @@ int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, Us bool ret = false; if (!s) { - user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); ret = true; } else if (s && s != Utils->TreeRoot) @@ -196,21 +188,18 @@ int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, Us ServerInstance->Logs->Log("map",DEBUG,"local"); for (int t = 0; t < line; t++) { - user->WriteNumeric(6, "%s :%s",user->nick.c_str(),&matrix[t][0]); + user->WriteNumeric(RPL_MAP, "%s :%s",user->nick.c_str(),&matrix[t][0]); } - user->WriteNumeric(270, "%s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick.c_str(),totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users); - user->WriteNumeric(7, "%s :End of /MAP",user->nick.c_str()); + user->WriteNumeric(RPL_MAPUSERS, "%s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick.c_str(),totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users); + user->WriteNumeric(RPL_ENDMAP, "%s :End of /MAP",user->nick.c_str()); } else { - - //void SpanningTreeProtocolInterface::PushToClient(User* target, const std::string &rawline) - // ServerInstance->Logs->Log("map", DEBUG, "remote dump lines=%d", line); + // XXX: annoying that we have to use hardcoded numerics here.. for (int t = 0; t < line; t++) { - ServerInstance->Logs->Log("map",DEBUG,"Dump %d", line); ServerInstance->PI->PushToClient(user, std::string("::") + ServerInstance->Config->ServerName + " 006 " + user->nick + " :" + &matrix[t][0]); } diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp index b06634a4d..f237c27b9 100644 --- a/src/modules/m_spanningtree/override_modules.cpp +++ b/src/modules/m_spanningtree/override_modules.cpp @@ -49,7 +49,7 @@ int ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters Utils->DoOneToOne(user->uuid, "MODULES", params, s->GetName()); } else - user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[0].c_str()); + user->WriteServ(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); return 1; } return 0; diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp index b312769c7..acbebe3da 100644 --- a/src/modules/m_spanningtree/override_motd.cpp +++ b/src/modules/m_spanningtree/override_motd.cpp @@ -51,7 +51,7 @@ int ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, U Utils->DoOneToOne(user->uuid, "MOTD", params, s->GetName()); } else - user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[0].c_str()); + user->WriteServ(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); return 1; } return 0; diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp index 0f6a1bef6..9f298c5f0 100644 --- a/src/modules/m_spanningtree/override_time.cpp +++ b/src/modules/m_spanningtree/override_time.cpp @@ -51,7 +51,7 @@ int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, U } else { - user->WriteNumeric(402, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str()); } } return 1; diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp index 5b6b8df82..fe3fd0461 100644 --- a/src/modules/m_spanningtree/time.cpp +++ b/src/modules/m_spanningtree/time.cpp @@ -67,7 +67,7 @@ bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> ¶ms char tms[26]; snprintf(tms,26,"%s",asctime(timeinfo)); tms[24] = 0; - u->WriteNumeric(391, "%s %s :%s",u->nick.c_str(),prefix.c_str(),tms); + u->WriteNumeric(RPL_TIME, "%s %s :%s",u->nick.c_str(),prefix.c_str(),tms); } else { diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index bc50ff510..069edde23 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -37,7 +37,7 @@ class SSLMode : public ModeHandler { if(!i->first->GetExt("ssl", dummy) && !ServerInstance->ULine(i->first->server)) { - source->WriteNumeric(490, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name.c_str()); + source->WriteNumeric(ERR_ALLMUSTSSL, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name.c_str()); return MODEACTION_DENY; } } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index dcef9196d..4a9c38589 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -34,7 +34,7 @@ class CommandSwhois : public Command if (!dest) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } |