diff options
author | Peter Powell <petpow@saberuk.com> | 2013-04-07 22:23:25 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-04-11 23:08:03 +0100 |
commit | 5c29c53f651fb0c513a50c9396e08ba340a6d2bf (patch) | |
tree | c00ab92b6ff6d002e6c40909587b146ba5e45612 /src/modules | |
parent | 295b3e7ba15a228948358bd6f23591a9cb5bf5a8 (diff) |
Convert ISUPPORT to use a map instead of a string.
Diffstat (limited to 'src/modules')
34 files changed, 77 insertions, 74 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 39602539f..67a0dd24f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -471,12 +471,12 @@ class ModuleSSLGnuTLS : public Module return Version("Provides SSL support for clients", VF_VENDOR); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { if (!sslports.empty()) - output.append(" SSL=" + sslports); + tokens["SSL"] = sslports; if (starttls.enabled) - output.append(" STARTTLS"); + tokens["STARTTLS"]; } void OnHookIO(StreamSocket* user, ListenSocket* lsb) diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index bf4a9b215..258a6a840 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -267,10 +267,10 @@ class ModuleSSLOpenSSL : public Module fclose(dhpfile); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { if (!sslports.empty()) - output.append(" SSL=" + sslports); + tokens["SSL"] = sslports; } ~ModuleSSLOpenSSL() diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index fbfdf9e7c..9cc8261b8 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -43,9 +43,9 @@ class ModuleAllowInvite : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('A'); + tokens["EXTBAN"].push_back('A'); } virtual ModResult OnUserPreInvite(User* user,User* dest,Channel* channel, time_t timeout) diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index c521c5405..cf4144935 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -63,9 +63,9 @@ class ModuleBanException : public Module ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" EXCEPTS=e"); + tokens["EXCEPTS"] = "e"; } ModResult OnExtBanCheck(User *user, Channel *chan, char type) diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index eb48da243..8371dd106 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -53,9 +53,9 @@ public: ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('B'); + tokens["EXTBAN"].push_back('B'); } virtual void OnRehash(User* user) diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 6a0d486fd..d843fc9b0 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -49,9 +49,9 @@ class ModuleBlockColor : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('c'); + tokens["EXTBAN"].push_back('c'); } virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index ee7b5e71a..e8448bc91 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -347,9 +347,9 @@ public: return Version("Implementation of callerid, usermode +g, /accept", VF_COMMON | VF_VENDOR); } - virtual void On005Numeric(std::string& output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - output += " CALLERID=g"; + tokens["CALLERID"] = "g"; } ModResult PreText(User* user, User* dest, std::string& text) diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp index 034a06e29..51a8105ab 100644 --- a/src/modules/m_channelban.cpp +++ b/src/modules/m_channelban.cpp @@ -66,9 +66,9 @@ class ModuleBadChannelExtban : public Module return MOD_RES_PASSTHRU; } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('j'); + tokens["EXTBAN"].push_back('j'); } }; diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp index 4b1fb59e0..b33362a8d 100644 --- a/src/modules/m_gecosban.cpp +++ b/src/modules/m_gecosban.cpp @@ -45,9 +45,9 @@ class ModuleGecosBan : public Module return MOD_RES_PASSTHRU; } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('r'); + tokens["EXTBAN"].push_back('r'); } }; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 3af9ee754..691fa8163 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -119,7 +119,13 @@ class ModuleHttpStats : public Module stime = gmtime(&server_uptime); data << "<uptime><days>" << stime->tm_yday << "</days><hours>" << stime->tm_hour << "</hours><mins>" << stime->tm_min << "</mins><secs>" << stime->tm_sec << "</secs><boot_time_t>" << ServerInstance->startup_time << "</boot_time_t></uptime>"; - data << "<isupport>" << Sanitize(ServerInstance->Config->data005) << "</isupport></general><xlines>"; + data << "<isupport>"; + const std::vector<std::string>& isupport = ServerInstance->ISupport.GetLines(); + for (std::vector<std::string>::const_iterator it = isupport.begin(); it != isupport.end(); it++) + { + data << Sanitize(*it) << std::endl; + } + data << "</isupport></general><xlines>"; std::vector<std::string> xltypes = ServerInstance->XLines->GetAllTypes(); for (std::vector<std::string>::iterator it = xltypes.begin(); it != xltypes.end(); ++it) { diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index aa5da086b..2d8382832 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -64,9 +64,9 @@ public: ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" INVEX=I"); + tokens["INVEX"] = "I"; } ModResult OnCheckInvite(User* user, Channel* chan) diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 2b6bedc1c..2c8a123f1 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -56,9 +56,9 @@ class ModuleQuietBan : public Module return OnUserPreMessage(user, dest, target_type, text, status, exempt_list); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('m'); + tokens["EXTBAN"].push_back('m'); } }; diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index b9d05024e..4ba8613d8 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -44,9 +44,9 @@ class ModuleNamesX : public Module return Version("Provides the NAMESX (CAP multi-prefix) capability.",VF_VENDOR); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" NAMESX"); + tokens["NAMESX"]; } ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, LocalUser *user, bool validated, const std::string &original_line) diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index cf60194d1..b59d278db 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -247,11 +247,9 @@ class ModuleNationalChars : public Module OnRehash(NULL); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - std::string tmp(casemapping); - tmp.insert(0, "CASEMAPPING="); - SearchAndReplace(output, std::string("CASEMAPPING=rfc1459"), tmp); + tokens["CASEMAPPING"] = casemapping; } virtual void OnRehash(User* user) diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 2a684e3a8..fb6e61c6e 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -77,9 +77,9 @@ class ModuleNoCTCP : public Module return MOD_RES_PASSTHRU; } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('C'); + tokens["EXTBAN"].push_back('C'); } }; diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 22f5664ed..1be389bf7 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -47,9 +47,9 @@ class ModuleNoKicks : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('Q'); + tokens["EXTBAN"].push_back('Q'); } ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index c1eb63da9..c1c1dd136 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -51,9 +51,9 @@ class ModuleNoNickChange : public Module return Version("Provides support for channel mode +N & extban +b N: which prevents nick changes on channel", VF_VENDOR); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('N'); + tokens["EXTBAN"].push_back('N'); } virtual ModResult OnUserPreNick(User* user, const std::string &newnick) diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 9216531bb..89e6be3b7 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -46,9 +46,9 @@ class ModuleNoNotice : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('T'); + tokens["EXTBAN"].push_back('T'); } virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index 0daf48c10..be01fa6c0 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -44,9 +44,9 @@ class ModulePartMsgBan : public Module partmessage.clear(); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('p'); + tokens["EXTBAN"].push_back('p'); } }; diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 2ac98e90c..e986b632a 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -70,9 +70,9 @@ class ModuleOperChans : public Module return MOD_RES_PASSTHRU; } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('O'); + tokens["EXTBAN"].push_back('O'); } Version GetVersion() diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 4c67ea32b..03984618b 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -70,9 +70,9 @@ class ModuleOperLog : public Module return MOD_RES_PASSTHRU; } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" OPERLOG"); + tokens["OPERLOG"]; } }; diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 81f4230eb..ea9d11c94 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -52,9 +52,9 @@ class ModuleOverride : public Module RequireKey = tag->getBool("requirekey"); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" OVERRIDE"); + tokens["OVERRIDE"]; } bool CanOverride(User* source, const char* token) diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index d95c0c6c6..6f7c1c369 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -211,9 +211,9 @@ class ModuleRemove : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" REMOVE"); + tokens["REMOVE"]; } virtual void OnRehash(User* user) diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index fb841d81b..382968355 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -82,9 +82,9 @@ class ModuleSecureList : public Module return MOD_RES_PASSTHRU; } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" SECURELIST"); + tokens["SECURELIST"]; } }; diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index cd9db395a..7ed663b20 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -45,9 +45,9 @@ class ModuleServerBan : public Module return MOD_RES_PASSTHRU; } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('s'); + tokens["EXTBAN"].push_back('s'); } }; diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 62e96ca7c..fbf099924 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -128,10 +128,10 @@ class ModuleServicesAccount : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - void On005Numeric(std::string &t) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('R'); - ServerInstance->AddExtBanChar('U'); + tokens["EXTBAN"].push_back('R'); + tokens["EXTBAN"].push_back('U'); } /* <- :twisted.oscnet.org 330 w00t2 w00t2 w00t :is logged in as */ diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 55403a9b0..d1885269d 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -320,10 +320,10 @@ class ModuleSilence : public Module maxsilence = 32; } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - // we don't really have a limit... - output = output + " ESILENCE SILENCE=" + ConvToStr(maxsilence); + tokens["ESILENCE"]; + tokens["SILENCE"] = ConvToStr(maxsilence); } void OnBuildExemptList(MessageType message_type, Channel* chan, User* sender, char status, CUList &exempt_list, const std::string &text) diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 97a57cc73..efd899c44 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -360,12 +360,13 @@ ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& para TreeServer* found = Utils->FindServerMask(parameters[0]); if (found) { - std::string Version = found->GetVersion(); - user->WriteNumeric(351, "%s :%s",user->nick.c_str(),Version.c_str()); if (found == Utils->TreeRoot) { - ServerInstance->Config->Send005(user); + // Pass to default VERSION handler. + return MOD_RES_PASSTHRU; } + std::string Version = found->GetVersion(); + user->WriteNumeric(351, "%s :%s",user->nick.c_str(),Version.c_str()); } else { diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index b331571ca..089f64cb0 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -64,8 +64,7 @@ ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std } else if ((command == "VERSION") && (parameters.size() > 0)) { - this->HandleVersion(parameters,user); - return MOD_RES_DENY; + return this->HandleVersion(parameters,user); } return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index be215924b..fbd77c249 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -126,9 +126,9 @@ class ModuleSSLModes : public Module return MOD_RES_PASSTHRU; } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('z'); + tokens["EXTBAN"].push_back('z'); } Version GetVersion() diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index de7b754c5..d63750a57 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -58,9 +58,9 @@ class ModuleStripColor : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - ServerInstance->AddExtBanChar('S'); + tokens["EXTBAN"].push_back('S'); } virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index 67ed560ca..1b0c91c94 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -44,9 +44,9 @@ class ModuleUHNames : public Module return Version("Provides the UHNAMES facility.",VF_VENDOR); } - void On005Numeric(std::string &output) + void On005Numeric(std::map<std::string, std::string>& tokens) { - output.append(" UHNAMES"); + tokens["UHNAMES"]; } ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, LocalUser *user, bool validated, const std::string &original_line) diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 0a91a1b6e..fdceda063 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -77,9 +77,9 @@ class ModuleUserIP : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - output = output + " USERIP"; + tokens["USERIP"]; } virtual Version GetVersion() diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 615cdf191..60ea79a83 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -527,10 +527,9 @@ class Modulewatch : public Module } } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::map<std::string, std::string>& tokens) { - // we don't really have a limit... - output = output + " WATCH=" + ConvToStr(maxwatch); + tokens["WATCH"] = ConvToStr(maxwatch); } virtual ~Modulewatch() |