diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:49:36 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:49:36 +0000 |
commit | 86775e2e98f55b3b88befe2daff0ca23f02f3155 (patch) | |
tree | cbc3abf3f55ae6fd1112bcf6bf44e02b502ac2d6 /src/modules/m_spanningtree | |
parent | 3d8ec5dbd9cfde34fcbc63ad7b9b1369866f0a33 (diff) |
ModResult conversion: Change return type of all module functions
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11634 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 28 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_admin.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_map.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_modules.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_motd.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_squit.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_stats.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_time.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_whois.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/precommand.cpp | 14 |
11 files changed, 65 insertions, 65 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index cb9d53b32..3e2b5d3b5 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -360,7 +360,7 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime) } } -int ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user) { // we've already checked if pcnt > 0, so this is safe TreeServer* found = Utils->FindServerMask(parameters[0]); @@ -377,7 +377,7 @@ int ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters { user->WriteNumeric(402, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str()); } - return 1; + return MOD_RES_DENY; } /* This method will attempt to get a message to a remote user. @@ -397,7 +397,7 @@ void ModuleSpanningTree::RemoteMessage(User* user, const char* format, ...) ServerInstance->PI->SendUserNotice(user, text); } -int ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters, User* user) { for (std::vector<Link>::iterator x = Utils->LinkBlocks.begin(); x < Utils->LinkBlocks.end(); x++) { @@ -406,7 +406,7 @@ int ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name))) { RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str()); - return 1; + return MOD_RES_DENY; } TreeServer* CheckDupe = Utils->FindServer(x->Name.c_str()); @@ -414,17 +414,17 @@ int ModuleSpanningTree::HandleConnect(const std::vector<std::string>& parameters { RemoteMessage(user, "*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port); ConnectServer(&(*x)); - return 1; + return MOD_RES_DENY; } else { RemoteMessage(user, "*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002",x->Name.c_str(),CheckDupe->GetParent()->GetName().c_str()); - return 1; + return MOD_RES_DENY; } } } RemoteMessage(user, "*** CONNECT: No server matching \002%s\002 could be found in the config file.",parameters[0].c_str()); - return 1; + return MOD_RES_DENY; } void ModuleSpanningTree::OnGetServerDescription(const std::string &servername,std::string &description) @@ -615,15 +615,15 @@ void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool sync, boo } } -int ModuleSpanningTree::OnChangeLocalUserHost(User* user, const std::string &newhost) +ModResult ModuleSpanningTree::OnChangeLocalUserHost(User* user, const std::string &newhost) { if (user->registered != REG_ALL) - return 0; + return MOD_RES_PASSTHRU; parameterlist params; params.push_back(newhost); Utils->DoOneToMany(user->uuid,"FHOST",params); - return 0; + return MOD_RES_PASSTHRU; } void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos) @@ -856,7 +856,7 @@ void ModuleSpanningTree::OnMode(User* user, void* dest, int target_type, const p } } -int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) +ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) { if (IS_LOCAL(user)) { @@ -874,7 +874,7 @@ int ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) } } - return 0; + return MOD_RES_PASSTHRU; } void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const parameterlist &modeline, const std::vector<TranslateType> &translate) diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 54524c720..a9cba73af 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -87,35 +87,35 @@ class ModuleSpanningTree : public Module /** Handle remote MOTD */ - int HandleMotd(const std::vector<std::string>& parameters, User* user); + ModResult HandleMotd(const std::vector<std::string>& parameters, User* user); /** Handle remote ADMIN */ - int HandleAdmin(const std::vector<std::string>& parameters, User* user); + ModResult HandleAdmin(const std::vector<std::string>& parameters, User* user); /** Handle remote STATS */ - int HandleStats(const std::vector<std::string>& parameters, User* user); + ModResult HandleStats(const std::vector<std::string>& parameters, User* user); /** Handle MAP command */ - int HandleMap(const std::vector<std::string>& parameters, User* user); + bool HandleMap(const std::vector<std::string>& parameters, User* user); /** Handle SQUIT */ - int HandleSquit(const std::vector<std::string>& parameters, User* user); + ModResult HandleSquit(const std::vector<std::string>& parameters, User* user); /** Handle TIME */ - int HandleTime(const std::vector<std::string>& parameters, User* user); + ModResult HandleTime(const std::vector<std::string>& parameters, User* user); /** Handle remote WHOIS */ - int HandleRemoteWhois(const std::vector<std::string>& parameters, User* user); + ModResult HandleRemoteWhois(const std::vector<std::string>& parameters, User* user); /** Handle remote MODULES */ - int HandleModules(const std::vector<std::string>& parameters, User* user); + ModResult HandleModules(const std::vector<std::string>& parameters, User* user); /** Ping all local servers */ @@ -135,11 +135,11 @@ class ModuleSpanningTree : public Module /** Handle remote VERSON */ - int HandleVersion(const std::vector<std::string>& parameters, User* user); + ModResult HandleVersion(const std::vector<std::string>& parameters, User* user); /** Handle CONNECT */ - int HandleConnect(const std::vector<std::string>& parameters, User* user); + ModResult HandleConnect(const std::vector<std::string>& parameters, User* user); /** Attempt to send a message to a user */ @@ -157,7 +157,7 @@ class ModuleSpanningTree : public Module ** *** MODULE EVENTS *** **/ - virtual int OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line); + virtual ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line); virtual void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line); virtual void OnGetServerDescription(const std::string &servername,std::string &description); virtual void OnUserConnect(User* source); @@ -168,7 +168,7 @@ class ModuleSpanningTree : public Module virtual void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list); virtual void OnBackgroundTimer(time_t curtime); virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created); - virtual int OnChangeLocalUserHost(User* user, const std::string &newhost); + virtual ModResult OnChangeLocalUserHost(User* user, const std::string &newhost); virtual void OnChangeName(User* user, const std::string &gecos); virtual void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent); virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message); @@ -182,8 +182,8 @@ class ModuleSpanningTree : public Module virtual void OnAddLine(User *u, XLine *x); virtual void OnDelLine(User *u, XLine *x); virtual void OnMode(User* user, void* dest, int target_type, const std::vector<std::string> &text, const std::vector<TranslateType> &translate); - virtual int OnStats(char statschar, User* user, string_list &results); - virtual int OnSetAway(User* user, const std::string &awaymsg); + virtual ModResult OnStats(char statschar, User* user, string_list &results); + virtual ModResult OnSetAway(User* user, const std::string &awaymsg); virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::vector<std::string> &modeline, const std::vector<TranslateType> &translate); virtual void ProtoSendMetaData(void* opaque, Extensible* target, const std::string &extname, const std::string &extdata); virtual std::string ProtoTranslate(Extensible* item); diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp index 50ab04566..c63b8dc4d 100644 --- a/src/modules/m_spanningtree/override_admin.cpp +++ b/src/modules/m_spanningtree/override_admin.cpp @@ -27,12 +27,12 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, User* user) { if (parameters.size() > 0) { if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) - return 0; + return MOD_RES_PASSTHRU; /* Remote ADMIN, the server is within the 1st parameter */ parameterlist params; @@ -46,8 +46,8 @@ int ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, } else user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); - return 1; + return MOD_RES_DENY; } - return 0; + return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index 989ee8900..e3f103cc8 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -80,7 +80,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int // and divisons, we instead render the map onto a backplane of characters // (a character matrix), then draw the branches as a series of "L" shapes // from the nodes. This is not only friendlier on CPU it uses less stack. -int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, User* user) +bool ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, User* user) { if (parameters.size() > 0) { @@ -104,7 +104,7 @@ int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, Us // Don't return if s == Utils->TreeRoot (us) if (ret) - return 1; + return true; } // These arrays represent a virtual screen which we will @@ -189,6 +189,6 @@ int ModuleSpanningTree::HandleMap(const std::vector<std::string>& parameters, Us delete[] names; delete[] stats; - return 1; + return true; } diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp index 039cbb0d0..10d46bbc3 100644 --- a/src/modules/m_spanningtree/override_modules.cpp +++ b/src/modules/m_spanningtree/override_modules.cpp @@ -27,12 +27,12 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters, User* user) { if (parameters.size() > 0) { if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) - return 0; + return MOD_RES_PASSTHRU; parameterlist params; params.push_back(parameters[0]); @@ -44,8 +44,8 @@ int ModuleSpanningTree::HandleModules(const std::vector<std::string>& parameters } else user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); - return 1; + return MOD_RES_DENY; } - return 0; + return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp index bee75975d..fe229d5cc 100644 --- a/src/modules/m_spanningtree/override_motd.cpp +++ b/src/modules/m_spanningtree/override_motd.cpp @@ -27,12 +27,12 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, User* user) { if (parameters.size() > 0) { if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) - return 0; + return MOD_RES_PASSTHRU; /* Remote MOTD, the server is within the 1st parameter */ parameterlist params; @@ -46,8 +46,8 @@ int ModuleSpanningTree::HandleMotd(const std::vector<std::string>& parameters, U } else user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); - return 1; + return MOD_RES_DENY; } - return 0; + return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp index 829c69880..a13385cd1 100644 --- a/src/modules/m_spanningtree/override_squit.cpp +++ b/src/modules/m_spanningtree/override_squit.cpp @@ -27,7 +27,7 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, User* user) { TreeServer* s = Utils->FindServerMask(parameters[0]); if (s) @@ -35,7 +35,7 @@ int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, if (s == Utils->TreeRoot) { user->WriteServ("NOTICE %s :*** SQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)",user->nick.c_str(),parameters[0].c_str()); - return 1; + return MOD_RES_DENY; } TreeSocket* sock = s->GetSocket(); @@ -56,6 +56,6 @@ int ModuleSpanningTree::HandleSquit(const std::vector<std::string>& parameters, { user->WriteServ("NOTICE %s :*** SQUIT: The server \002%s\002 does not exist on the network.",user->nick.c_str(),parameters[0].c_str()); } - return 1; + return MOD_RES_DENY; } diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp index 76522a3dd..ecffcf05e 100644 --- a/src/modules/m_spanningtree/override_stats.cpp +++ b/src/modules/m_spanningtree/override_stats.cpp @@ -28,12 +28,12 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters, User* user) { if (parameters.size() > 1) { if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[1])) - return 0; + return MOD_RES_PASSTHRU; /* Remote STATS, the server is within the 2nd parameter */ parameterlist params; @@ -51,12 +51,12 @@ int ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters, { user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[1].c_str()); } - return 1; + return MOD_RES_DENY; } - return 0; + return MOD_RES_PASSTHRU; } -int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results) +ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results) { if ((statschar == 'c') || (statschar == 'n')) { @@ -66,7 +66,7 @@ int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results if (statschar == 'c') results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+Utils->LinkBlocks[i].Name.c_str()); } - return 1; + return MOD_RES_DENY; } if (statschar == 'p') @@ -87,6 +87,6 @@ int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results " (server, " + transport + ")"); } } - return 0; + return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp index d8498cd02..bd9727498 100644 --- a/src/modules/m_spanningtree/override_time.cpp +++ b/src/modules/m_spanningtree/override_time.cpp @@ -27,7 +27,7 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, User* user) { if ((IS_LOCAL(user)) && (parameters.size() > 0)) { @@ -36,7 +36,7 @@ int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, U { // we dont' override for local server if (found == Utils->TreeRoot) - return 0; + return MOD_RES_PASSTHRU; parameterlist params; params.push_back(found->GetName()); @@ -48,6 +48,6 @@ int ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, U user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str()); } } - return 1; + return MOD_RES_DENY; } diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index 68b0919c9..2d7199571 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -27,7 +27,7 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parameters, User* user) +ModResult ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parameters, User* user) { if ((IS_LOCAL(user)) && (parameters.size() > 1)) { @@ -37,15 +37,15 @@ int ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& parame parameterlist params; params.push_back(remote->uuid); Utils->DoOneToOne(user->uuid,"IDLE",params,remote->server); - return 1; + return MOD_RES_DENY; } else if (!remote) { user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[1].c_str()); user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick.c_str(), parameters[1].c_str()); - return 1; + return MOD_RES_DENY; } } - return 0; + return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index 86b31143e..94f98faf1 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -27,11 +27,11 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ -int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line) +ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line) { /* If the command doesnt appear to be valid, we dont want to mess with it. */ if (!validated) - return 0; + return MOD_RES_PASSTHRU; if (command == "CONNECT") { @@ -55,7 +55,7 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri } else if (command == "MAP") { - return this->HandleMap(parameters,user); + return this->HandleMap(parameters,user) ? MOD_RES_DENY : MOD_RES_PASSTHRU; } else if ((command == "TIME") && (parameters.size() > 0)) { @@ -64,12 +64,12 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri else if (command == "LUSERS") { this->HandleLusers(parameters,user); - return 1; + return MOD_RES_DENY; } else if (command == "LINKS") { this->HandleLinks(parameters,user); - return 1; + return MOD_RES_DENY; } else if (command == "WHOIS") { @@ -82,12 +82,12 @@ int ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std::stri else if ((command == "VERSION") && (parameters.size() > 0)) { this->HandleVersion(parameters,user); - return 1; + return MOD_RES_DENY; } else if ((command == "MODULES") && (parameters.size() > 0)) { return this->HandleModules(parameters,user); } - return 0; + return MOD_RES_PASSTHRU; } |