diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-04-14 17:10:26 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-04-14 17:10:26 +0200 |
commit | 978f2a26b5b7c0fd6c68114349134d78bb8af18a (patch) | |
tree | 3b5ea51676ebb56fd84ebb79686173eb955e9512 | |
parent | ee4262d276606649489db02007c7a34e8ac75bc4 (diff) |
m_sajoin Abort and report if the target user is already on the channel
Fixes issue #820 reported by @UselessOper
-rw-r--r-- | src/modules/m_sajoin.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 406d9ffcd..e30084690 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -59,6 +59,13 @@ class CommandSajoin : public Command return CMD_FAILURE; } + Channel* chan = ServerInstance->FindChan(channel); + if ((chan) && (chan->HasUser(dest))) + { + user->SendText(":" + user->server->GetName() + " NOTICE " + user->nick + " :*** " + dest->nick + " is already on " + channel); + return CMD_FAILURE; + } + /* For local users, we call Channel::JoinUser which may create a channel and set its TS. * For non-local users, we just return CMD_SUCCESS, knowing this will propagate it where it needs to be * and then that server will handle the command. @@ -66,8 +73,8 @@ class CommandSajoin : public Command LocalUser* localuser = IS_LOCAL(dest); if (localuser) { - Channel* n = Channel::JoinUser(localuser, channel, true); - if (n && n->HasUser(dest)) + chan = Channel::JoinUser(localuser, channel, true); + if (chan) { ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAJOIN to make "+dest->nick+" join "+channel); return CMD_SUCCESS; |