summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-04-14 17:14:10 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-04-14 17:14:10 +0200
commit78d46e846063dce850359fd1bcc04946828f3ecf (patch)
treedc5f65406f99644acee622cb5918330d58351455 /src
parent978f2a26b5b7c0fd6c68114349134d78bb8af18a (diff)
m_sajoin, m_sapart Support a comma separated list of channels
Issue #818
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_sajoin.cpp8
-rw-r--r--src/modules/m_sapart.cpp5
2 files changed, 10 insertions, 3 deletions
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;