diff options
-rw-r--r-- | src/modules/m_sajoin.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_sakick.cpp | 22 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 27 |
3 files changed, 18 insertions, 45 deletions
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index f586896de..9d1e34ff3 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -58,18 +58,10 @@ class CommandSajoin : public Command if (localuser) { Channel* n = Channel::JoinUser(localuser, parameters[1], true); - if (n) + if (n && n->HasUser(dest)) { - if (n->HasUser(dest)) - { - ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SAJOIN to make "+dest->nick+" join "+parameters[1]); - return CMD_SUCCESS; - } - else - { - user->WriteNotice("*** Could not join "+dest->nick+" to "+parameters[1]+" (User is probably banned, or blocking modes)"); - return CMD_FAILURE; - } + ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SAJOIN to make "+dest->nick+" join "+parameters[1]); + return CMD_SUCCESS; } else { diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index a94701283..3dd7ed3d1 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -54,27 +54,21 @@ class CommandSakick : public Command return CMD_FAILURE; } + if (!channel->HasUser(dest)) + { + user->WriteNotice("*** " + dest->nick + " is not on " + channel->name); + return CMD_FAILURE; + } + /* For local clients, directly kick them. For remote clients, * just return CMD_SUCCESS knowing the protocol module will route the SAKICK to the user's * local server and that will kick them instead. */ if (IS_LOCAL(dest)) { + // Target is on this server, kick them and send the snotice channel->KickUser(ServerInstance->FakeClient, dest, reason); - - Channel *n = ServerInstance->FindChan(parameters[1]); - if (n && n->HasUser(dest)) - { - /* Sort-of-bug: If the command was issued remotely, this message won't be sent */ - user->WriteNotice("*** Unable to kick " + dest->nick + " from " + parameters[0]); - return CMD_FAILURE; - } - } - - if (IS_LOCAL(user)) - { - /* Locally issued command; send the snomasks */ - ServerInstance->SNO->WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + parameters[0]); + ServerInstance->SNO->WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + channel->name); } return CMD_SUCCESS; diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 1b2ef34b0..6de01c852 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -49,6 +49,12 @@ class CommandSapart : public Command return CMD_FAILURE; } + if (!channel->HasUser(dest)) + { + user->WriteNotice("*** " + dest->nick + " is not on " + channel->name); + return CMD_FAILURE; + } + /* For local clients, directly part them generating a PART message. For remote clients, * just return CMD_SUCCESS knowing the protocol module will route the SAPART to the users * local server and that will generate the PART instead @@ -56,26 +62,7 @@ class CommandSapart : public Command if (IS_LOCAL(dest)) { channel->PartUser(dest, reason); - - Channel* n = ServerInstance->FindChan(parameters[1]); - if (!n) - { - ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAPART to make "+dest->nick+" part "+parameters[1]); - return CMD_SUCCESS; - } - else - { - if (!n->HasUser(dest)) - { - ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAPART to make "+dest->nick+" part "+parameters[1]); - return CMD_SUCCESS; - } - else - { - user->WriteNotice("*** Unable to make " + dest->nick + " part " + parameters[1]); - return CMD_FAILURE; - } - } + ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAPART to make "+dest->nick+" part "+channel->name); } return CMD_SUCCESS; |