summaryrefslogtreecommitdiffstats
path: root/src/crsm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crsm.cpp')
-rw-r--r--src/crsm.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/crsm.cpp b/src/crsm.cpp
index 174fe71..cef3f83 100644
--- a/src/crsm.cpp
+++ b/src/crsm.cpp
@@ -457,11 +457,11 @@ void CRSM::ircMessageReceived(IrcMessage *message)
{
watchMsg += target + ":";
}
- watchMsg += message->nick() + "> " + mess;
+ watchMsg += message->nick() + "> " + mess + "\n";
foreach(const ClientInfo& client, ircModWatchList)
{
- connection->sendCommand(IrcCommand::createMessage(client.nick, watchMsg));
+ respond(client, watchMsg, RespondType::PrivateNotice);
}
}
}
@@ -1802,6 +1802,19 @@ QString CRSM::getCommand(const QString &message)
return QString();
}
+bool CRSM::isChannelName(const QString &name)
+{
+ if(connection == nullptr || name.length() < 1)
+ {
+ return false;
+ }
+ else
+ {
+ const QStringList& channelTypes = connection->network()->channelTypes();
+ return channelTypes.contains(name.at(0));
+ }
+}
+
CMD_FUNCTION_IMPL(help)
bool longHelp = (args == "long");
if(args.isEmpty() || longHelp)
@@ -2356,13 +2369,12 @@ CMD_FUNCTION_IMPL(passToClonkOnOff)
CMD_FUNCTION_IMPL(join)
QStringList argList = args.split(' ');
- static QRegExp chanExp("^#[^\\s]+$");
if(argList.size() < 1 || argList.first().isEmpty())
{
respond(client, "Kein Channel angegeben!\n");
return SyntaxFail;
}
- else if(chanExp.exactMatch(argList.first()))
+ else if(isChannelName(argList.first()))
{
QString chan = argList.first();
argList.removeFirst();
@@ -2393,8 +2405,7 @@ CMD_FUNCTION_IMPL(leave)
{
reason = client.toString();
}
- static QRegExp chanExp("^#[^\\s]+$");
- if(chanExp.exactMatch(chan))
+ if(isChannelName(chan))
{
connection->sendCommand(IrcCommand::createPart(chan, reason));
return Success;
@@ -2533,7 +2544,7 @@ CMD_FUNCTION_IMPL(ircSay)
QString target = parts.first();
parts.removeFirst();
QString message = parts.join(' ');
- if(target.at(0) != '#')
+ if(!isChannelName(target))
{
ircSayQueryFifos[target].append(message);
ircCheckUserStatus(client, ClientInfo::ircClient(target), &CRSM::ircSayQuery);