|
@@ -205,7 +205,7 @@ void Client::parsePrintedLine()
|
|
QString message(myPrintLine.right(myPrintLine.size() - lastMatchSize));
|
|
QString message(myPrintLine.right(myPrintLine.size() - lastMatchSize));
|
|
|
|
|
|
|
|
|
|
- QRegExp regex("^:\\s+\\.(spam|qw|help|qw_mute|qw_unmute|spam_mute|spam_unmute|lm|about)\\s*(.+)$");
|
|
|
|
|
|
+ QRegExp regex("^:\\s+\\.(spam|qw|help|qw_mute|qw_unmute|spam_mute|spam_unmute|lm|about|qw_local)\\s*(.+)$");
|
|
if(regex.indexIn(message) == -1)
|
|
if(regex.indexIn(message) == -1)
|
|
return;
|
|
return;
|
|
|
|
|
|
@@ -230,7 +230,8 @@ void Client::parsePrintedLine()
|
|
|
|
|
|
if(command == "help")
|
|
if(command == "help")
|
|
{
|
|
{
|
|
- say("Broadcast a message: .qw <message> and .spam <message>", bestPlayer.name);
|
|
|
|
|
|
+ say("Broadcast a message: .qw <message> or .spam <message>", bestPlayer.name);
|
|
|
|
+ say("Broadcast locally (only to the game servers this bot is connected to): .qw_local <message>", bestPlayer.name);
|
|
say("(Un)Mute: .qw_mute .qw_unmute or .spam_mute .spam_unmute", bestPlayer.name);
|
|
say("(Un)Mute: .qw_mute .qw_unmute or .spam_mute .spam_unmute", bestPlayer.name);
|
|
say("Last 5 messages: .lm", bestPlayer.name);
|
|
say("Last 5 messages: .lm", bestPlayer.name);
|
|
say("About this bot: .about", bestPlayer.name);
|
|
say("About this bot: .about", bestPlayer.name);
|
|
@@ -243,7 +244,7 @@ void Client::parsePrintedLine()
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if(command == "qw" || command == "spam")
|
|
|
|
|
|
+ if(command == "qw" || command == "spam" || command == "qw_local")
|
|
{
|
|
{
|
|
if(!args.trimmed().size())
|
|
if(!args.trimmed().size())
|
|
{
|
|
{
|
|
@@ -252,7 +253,7 @@ void Client::parsePrintedLine()
|
|
}
|
|
}
|
|
|
|
|
|
/* Floodprot for broadcasting commands */
|
|
/* Floodprot for broadcasting commands */
|
|
- if(command == "qw" || command == "spam")
|
|
|
|
|
|
+ if(command == "qw" || command == "spam" || command == "qw_local")
|
|
{
|
|
{
|
|
if(myBroadcastFloodTimer->isActive())
|
|
if(myBroadcastFloodTimer->isActive())
|
|
{
|
|
{
|
|
@@ -260,11 +261,13 @@ void Client::parsePrintedLine()
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- int time;
|
|
|
|
|
|
+ int time = 0;
|
|
if(command == "qw")
|
|
if(command == "qw")
|
|
time = Settings::globalInstance()->qwFloodProtTime();
|
|
time = Settings::globalInstance()->qwFloodProtTime();
|
|
- else
|
|
|
|
|
|
+ else if(command == "spam")
|
|
time = Settings::globalInstance()->spamFloodProtTime();
|
|
time = Settings::globalInstance()->spamFloodProtTime();
|
|
|
|
+ else if(command == "qw_local")
|
|
|
|
+ time = 30;
|
|
myBroadcastFloodTimerStart = currentTime;
|
|
myBroadcastFloodTimerStart = currentTime;
|
|
myBroadcastFloodTimer->start(time*1000);
|
|
myBroadcastFloodTimer->start(time*1000);
|
|
}
|
|
}
|
|
@@ -284,7 +287,13 @@ void Client::parsePrintedLine()
|
|
// the server ip isn't replaced by a hostname automatically
|
|
// the server ip isn't replaced by a hostname automatically
|
|
QString internalMessage("-" + command + "- " + nick + " - " + resolvedServer + " " + QString::number(playerCount()) + "/" + QString::number(myMaxClients) + " : " + args.trimmed());
|
|
QString internalMessage("-" + command + "- " + nick + " - " + resolvedServer + " " + QString::number(playerCount()) + "/" + QString::number(myMaxClients) + " : " + args.trimmed());
|
|
myApp->broadcast(internalMessage, myActiveClient);
|
|
myApp->broadcast(internalMessage, myActiveClient);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // If this is a local message don't broadcast externally
|
|
|
|
+ if (command == "qw_local") {
|
|
|
|
+ say("Broadcasting within qw servers only...", bestPlayer.name);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Message that will be broadcast to other networks (needs namefun parsing)
|
|
// Message that will be broadcast to other networks (needs namefun parsing)
|
|
// this message passes tru central, thus the server ip will be replaced by a hostname
|
|
// this message passes tru central, thus the server ip will be replaced by a hostname
|
|
// automatically
|
|
// automatically
|