diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-04-14 17:14:10 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-04-14 17:14:10 +0200 |
commit | 78d46e846063dce850359fd1bcc04946828f3ecf (patch) | |
tree | dc5f65406f99644acee622cb5918330d58351455 | |
parent | 978f2a26b5b7c0fd6c68114349134d78bb8af18a (diff) |
m_sajoin, m_sapart Support a comma separated list of channels
Issue #818
-rw-r--r-- | docs/conf/helpop-full.conf.example | 9 | ||||
-rw-r--r-- | src/modules/m_sajoin.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 5 |
3 files changed, 15 insertions, 7 deletions
diff --git a/docs/conf/helpop-full.conf.example b/docs/conf/helpop-full.conf.example index 7b819845f..3374dea34 100644 --- a/docs/conf/helpop-full.conf.example +++ b/docs/conf/helpop-full.conf.example @@ -521,13 +521,14 @@ The duration may be specified in seconds, or in the format 1y2w3d4h5m6s - meaning one year, two weeks, three days, 4 hours, 5 minutes and 6 seconds. All fields in this format are optional."> -<helpop key="sajoin" value="/SAJOIN [nick] [channel] +<helpop key="sajoin" value="/SAJOIN [<nick>] <channel>[,<channel>] -Forces the user to join the channel."> +Forces the user to join the channel(s). +If no nick is given, it joins the oper doing the /SAJOIN."> -<helpop key="sapart" value="/SAPART [nick] [channel] +<helpop key="sapart" value="/SAPART <nick> <channel>[,<channel>] -Forces the user to part the channel."> +Forces the user to part the channel(s)."> <helpop key="samode" value="/SAMODE [target] +/-[modes] {[parameters for modes]} diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index e30084690..d1321947b 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -29,13 +29,17 @@ class CommandSajoin : public Command CommandSajoin(Module* Creator) : Command(Creator,"SAJOIN", 1) { allow_empty_last_param = false; - flags_needed = 'o'; Penalty = 0; syntax = "[<nick>] <channel>"; + flags_needed = 'o'; Penalty = 0; syntax = "[<nick>] <channel>[,<channel>]"; TRANSLATE2(TR_NICK, TR_TEXT); } CmdResult Handle (const std::vector<std::string>& parameters, User *user) { - const std::string& channel = parameters.size() > 1 ? parameters[1] : parameters[0]; + const unsigned int channelindex = (parameters.size() > 1) ? 1 : 0; + if (CommandParser::LoopCall(user, this, parameters, channelindex)) + return CMD_FAILURE; + + const std::string& channel = parameters[channelindex]; const std::string& nickname = parameters.size() > 1 ? parameters[0] : user->nick; User* dest = ServerInstance->FindNick(nickname); diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index fa5ab176a..730bf0823 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -28,12 +28,15 @@ class CommandSapart : public Command public: CommandSapart(Module* Creator) : Command(Creator,"SAPART", 2, 3) { - flags_needed = 'o'; Penalty = 0; syntax = "<nick> <channel> [reason]"; + flags_needed = 'o'; Penalty = 0; syntax = "<nick> <channel>[,<channel>] [reason]"; TRANSLATE3(TR_NICK, TR_TEXT, TR_TEXT); } CmdResult Handle (const std::vector<std::string>& parameters, User *user) { + if (CommandParser::LoopCall(user, this, parameters, 1)) + return CMD_FAILURE; + User* dest = ServerInstance->FindNick(parameters[0]); Channel* channel = ServerInstance->FindChan(parameters[1]); std::string reason; |