diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/command_parse.h | 2 | ||||
-rw-r--r-- | include/ctables.h | 2 | ||||
-rw-r--r-- | include/mode.h | 14 | ||||
-rw-r--r-- | include/modules.h | 6 | ||||
-rw-r--r-- | include/u_listmode.h | 5 |
5 files changed, 22 insertions, 7 deletions
diff --git a/include/command_parse.h b/include/command_parse.h index b3ae3236a..21dae89dd 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -202,6 +202,8 @@ class CoreExport CommandParser : public classbase * @return returns the number of substitutions made. Will always be 0 or 1 for TR_TEXT and 0..n for other types. */ int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest); + + int TranslateUIDs(const std::vector<TranslateType> to, const std::string &source, std::string &dest); }; /** Command handler class for the RELOAD command. diff --git a/include/ctables.h b/include/ctables.h index 3e10e7c23..d7c2a2050 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -33,8 +33,6 @@ enum TranslateType TR_END, /* End of known parameters, everything after this is TR_TEXT */ TR_TEXT, /* Raw text, leave as-is */ TR_NICK, /* Nickname, translate to UUID for server->server */ - TR_NICKLIST, /* Comma seperated nickname list, translate to UUIDs */ - TR_SPACENICKLIST, /* Space seperated nickname list, translate to UUIDs */ TR_CUSTOM /* Custom translation handled by EncodeParameter/DecodeParameter */ }; diff --git a/include/mode.h b/include/mode.h index f78fcda9c..525a26208 100644 --- a/include/mode.h +++ b/include/mode.h @@ -17,6 +17,7 @@ /* Forward declarations. */ class User; +#include "ctables.h" #include "channels.h" /** @@ -126,6 +127,10 @@ class CoreExport ModeHandler : public Extensible */ ModeType m_type; /** + * The mode parameter translation type + */ + TranslateType m_paramtype; + /** * True if the mode requires oper status * to set. */ @@ -161,7 +166,8 @@ class CoreExport ModeHandler : public Extensible * and the rank values OP_VALUE, HALFOP_VALUE and VOICE_VALUE respectively. Any prefixes you define should have unique values proportional * to these three defaults or proportional to another mode in a module you depend on. See src/cmode_o.cpp as an example. */ - ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix = 0, char prefixrequired = '%'); + ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, + char mprefix = 0, char prefixrequired = '%', TranslateType translate = TR_TEXT); /** * The default destructor does nothing */ @@ -191,10 +197,14 @@ class CoreExport ModeHandler : public Extensible */ virtual unsigned int GetPrefixRank(); /** - * Returns the modes type + * Returns the mode's type */ ModeType GetModeType(); /** + * Returns the mode's parameter translation type + */ + TranslateType GetTranslateType(); + /** * Returns true if the mode can only be set/unset by an oper */ bool NeedsOper(); diff --git a/include/modules.h b/include/modules.h index 536313d8f..90aeb178e 100644 --- a/include/modules.h +++ b/include/modules.h @@ -739,8 +739,9 @@ class CoreExport Module : public Extensible * @param dest The target of the modes (User* or Channel*) * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @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); + virtual void OnMode(User* user, void* dest, int target_type, const std::string &text, const std::vector<TranslateType> &translate); /** Allows modules to alter or create server descriptions * Whenever a module requires a server description, for example for display in @@ -847,8 +848,9 @@ class CoreExport Module : public Extensible * @param target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL * @param target The Channel* or User* that modes should be sent for * @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); + virtual void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::string &modeline, const std::vector<TranslateType> &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/u_listmode.h b/include/u_listmode.h index b08ad8d4d..88b5fb3ee 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -423,18 +423,21 @@ class ListModeBase : public ModeHandler chan->GetExt(infokey, mlist); irc::modestacker modestack(ServerInstance, true); std::deque<std::string> stackresult; + std::vector<TranslateType> 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); + proto->ProtoSendMode(opaque, TYPE_CHANNEL, chan, line, types); } } |