diff options
-rw-r--r-- | include/modules.h | 15 | ||||
-rw-r--r-- | src/mode.cpp | 12 | ||||
-rw-r--r-- | src/modules.cpp | 2 |
3 files changed, 13 insertions, 16 deletions
diff --git a/include/modules.h b/include/modules.h index 0c521332a..a5f99ee86 100644 --- a/include/modules.h +++ b/include/modules.h @@ -667,16 +667,17 @@ class CoreExport Module : public classbase, public usecountbase virtual void OnText(User* user, void* dest, int target_type, const std::string &text, char status, CUList &exempt_list); /** Called after every MODE command sent from a user - * The dest variable contains a User* if target_type is TYPE_USER and a Channel* - * if target_type is TYPE_CHANNEL. The text variable contains the remainder of the - * mode string after the target, e.g. "+wsi" or "+ooo nick1 nick2 nick3". + * Either the usertarget or the chantarget variable contains the target of the modes, + * the actual target will have a non-NULL pointer. + * The modes vector contains the remainder of the mode string after the target, + * e.g.: "+wsi" or ["+ooo", "nick1", "nick2", "nick3"]. * @param user The user sending the MODEs - * @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 usertarget The target user of the modes, NULL if the target is a channel + * @param chantarget The target channel of the modes, NULL if the target is a user + * @param modes 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::vector<std::string> &text, const std::vector<TranslateType> &translate); + virtual void OnMode(User* user, User* usertarget, Channel* chantarget, const std::vector<std::string>& modes, 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 diff --git a/src/mode.cpp b/src/mode.cpp index 63008f45c..9c38afaad 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -469,15 +469,11 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user, ServerInstance->PI->SendMode(user, targetuser, targetchannel, LastParseParams, LastParseTranslate); if (targetchannel) - { - targetchannel->WriteChannel(user, "MODE %s", LastParse.c_str()); - FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, LastParseParams, LastParseTranslate)); - } + targetchannel->WriteChannel(user, "MODE " + LastParse); else - { - targetuser->WriteFrom(user, "MODE %s", LastParse.c_str()); - FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, LastParseParams, LastParseTranslate)); - } + targetuser->WriteFrom(user, "MODE " + LastParse); + + FOREACH_MOD(I_OnMode,OnMode(user, targetuser, targetchannel, LastParseParams, LastParseTranslate)); } else if (targetchannel && parameters.size() == 2) { diff --git a/src/modules.cpp b/src/modules.cpp index 039e01421..58a77faff 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -87,7 +87,7 @@ void Module::OnPreRehash(User*, const std::string&) { } void Module::OnModuleRehash(User*, const std::string&) { } void Module::OnRehash(User*) { } ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::string&, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnMode(User*, void*, int, const std::vector<std::string>&, const std::vector<TranslateType>&) { } +void Module::OnMode(User*, User*, Channel*, const std::vector<std::string>&, const std::vector<TranslateType>&) { } void Module::OnOper(User*, const std::string&) { } void Module::OnPostOper(User*, const std::string&, const std::string &) { } void Module::OnInfo(User*) { } |