From 978f2a26b5b7c0fd6c68114349134d78bb8af18a Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 14 Apr 2014 17:10:26 +0200 Subject: m_sajoin Abort and report if the target user is already on the channel Fixes issue #820 reported by @UselessOper --- src/modules/m_sajoin.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/modules/m_sajoin.cpp') 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; -- cgit v1.2.3