X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmode.cpp;h=ad46e602de1e39390dd3304b785be9266e289c8b;hb=3fc88ba7c97a5db3bfbb0c422afd4e180271b348;hp=1627933698889d01117b8e7aa1e322315c5426f9;hpb=2f181fef775da4a686a892c06af843dddfb7950a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/mode.cpp b/src/mode.cpp index 162793369..ad46e602d 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -145,10 +145,12 @@ bool ParamChannelModeHandler::ParamValidate(std::string& parameter) ModeWatcher::ModeWatcher(Module* Creator, const std::string& modename, ModeType type) : mode(modename), m_type(type), creator(Creator) { + ServerInstance->Modes->AddModeWatcher(this); } ModeWatcher::~ModeWatcher() { + ServerInstance->Modes->DelModeWatcher(this); } ModeType ModeWatcher::GetModeType() @@ -205,7 +207,12 @@ PrefixMode::PrefixMode(Module* Creator, const std::string& Name, char ModeLetter ModeAction PrefixMode::OnModeChange(User* source, User*, Channel* chan, std::string& parameter, bool adding) { - User* target = ServerInstance->FindNick(parameter); + User* target; + if (IS_LOCAL(source)) + target = ServerInstance->FindNickOnly(parameter); + else + target = ServerInstance->FindNick(parameter); + if (!target) { source->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameter.c_str()); @@ -345,9 +352,16 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool void ModeParser::Process(const std::vector& parameters, User* user, ModeProcessFlag flags) { - std::string target = parameters[0]; + const std::string& target = parameters[0]; Channel* targetchannel = ServerInstance->FindChan(target); - User* targetuser = ServerInstance->FindNick(target); + User* targetuser = NULL; + if (!targetchannel) + { + if (IS_LOCAL(user)) + targetuser = ServerInstance->FindNickOnly(target); + else + targetuser = ServerInstance->FindNick(target); + } ModeType type = targetchannel ? MODETYPE_CHANNEL : MODETYPE_USER; LastParse.clear();