From 96a4a1d41e42dba806c2e9954e148ed838262511 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 7 Mar 2009 01:29:45 +0000 Subject: Include explicit parameter list in ProtocolInterface::SendMode Also leave the strings split into deque, there's no need to pack it into a string just to unpack it during the translate. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11181 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/command_parse.h | 2 +- include/inspircd.h | 1 - include/mode.h | 4 ++++ include/modules.h | 4 ++-- include/protocol.h | 8 ++++++-- include/u_listmode.h | 8 +++----- 6 files changed, 16 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/command_parse.h b/include/command_parse.h index 21dae89dd..6f6b96ca1 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -203,7 +203,7 @@ class CoreExport CommandParser : public classbase */ int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest); - int TranslateUIDs(const std::vector to, const std::string &source, std::string &dest); + int TranslateUIDs(const std::deque to, const std::deque &source, std::string &dest); }; /** Command handler class for the RELOAD command. diff --git a/include/inspircd.h b/include/inspircd.h index fcd6849d5..5461adcca 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -721,7 +721,6 @@ class CoreExport InspIRCd : public classbase * The parameters provided are identical to that sent to the * handler for class cmd_mode. * @param parameters The mode parameters - * @param pcnt The number of items you have given in the first parameter * @param user The user to send error messages to */ void SendMode(const std::vector& parameters, User *user); diff --git a/include/mode.h b/include/mode.h index 525a26208..94d9f3dfe 100644 --- a/include/mode.h +++ b/include/mode.h @@ -445,6 +445,8 @@ class CoreExport ModeParser : public classbase * Use GetLastParse() to get this value, to be used for display purposes. */ std::string LastParse; + std::deque LastParseParams; + std::deque LastParseTranslate; unsigned int sent[256]; @@ -486,6 +488,8 @@ class CoreExport ModeParser : public classbase * @return Last parsed string, as seen by users. */ const std::string& GetLastParse(); + const std::deque& GetLastParseParams() { return LastParseParams; } + const std::deque& GetLastParseTranslate() { return LastParseTranslate; } /** Add a mode to the mode parser. * @return True if the mode was successfully added. */ diff --git a/include/modules.h b/include/modules.h index 90aeb178e..b58cbbc20 100644 --- a/include/modules.h +++ b/include/modules.h @@ -741,7 +741,7 @@ class CoreExport Module : public Extensible * @param text The actual modes and their parameters if any * @param translate The translation types of the mode parameters */ - virtual void OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector &translate); + virtual void OnMode(User* user, void* dest, int target_type, const std::deque &text, const std::deque &translate); /** Allows modules to alter or create server descriptions * Whenever a module requires a server description, for example for display in @@ -850,7 +850,7 @@ class CoreExport Module : public Extensible * @param modeline The modes and parameters to be sent * @param translate The translation types of the mode parameters */ - virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector &translate); + virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::deque &modeline, const std::deque &translate); /** Implemented by modules which provide the ability to link servers. * These modules will implement this method, which allows metadata (extra data added to diff --git a/include/protocol.h b/include/protocol.h index 4d6f8f27d..d9a2ce25d 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -68,7 +68,7 @@ class ProtocolInterface : public Extensible * @param target The channel name or user to send mode changes for. * @param The mode changes to send. */ - virtual void SendMode(const std::string &target, parameterlist &modedata) { } + virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::deque &translate) { } /** Convenience function, string wrapper around the above. */ @@ -76,10 +76,14 @@ class ProtocolInterface : public Extensible { irc::spacesepstream x(modeline); parameterlist n; + std::deque types; std::string v; while (x.GetToken(v)) + { n.push_back(v); - SendMode(target, n); + types.push_back(TR_TEXT); + } + SendMode(target, n, types); } /** Send a notice to users with a given mode(s). diff --git a/include/u_listmode.h b/include/u_listmode.h index 88b5fb3ee..1e7d1cceb 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -423,21 +423,19 @@ class ListModeBase : public ModeHandler chan->GetExt(infokey, mlist); irc::modestacker modestack(ServerInstance, true); std::deque stackresult; - std::vector types; + std::deque types; types.push_back(TR_TEXT); if (mlist) { for (modelist::iterator it = mlist->begin(); it != mlist->end(); it++) { modestack.Push(std::string(1, mode)[0], it->mask); - types.push_back(this->GetTranslateType()); } } while (modestack.GetStackedLine(stackresult)) { - irc::stringjoiner mode_join(" ", stackresult, 0, stackresult.size() - 1); - std::string line = mode_join.GetJoined(); - proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, line, types); + types.assign(stackresult.size(), this->GetTranslateType()); + proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, stackresult, types); } } -- cgit v1.2.3