summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-01-21 18:44:08 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-01-21 18:44:08 +0100
commite244cb2c63b1ac1d85bdbb4691f7b1bd940ae804 (patch)
tree5a69b0efe6c0b7ab88925d3d066271ec40845e23 /src/mode.cpp
parentfead8af2b767cb5591536a3c98babf6b35194a66 (diff)
parent7dd831383f7506e49f568d0684ee1ecb1f5dc90f (diff)
Merge insp20
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index e0381b683..ad46e602d 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -207,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());
@@ -347,9 +352,16 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool
void ModeParser::Process(const std::vector<std::string>& 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();