|
@@ -36,6 +36,7 @@ Client::Client(App *app, ActiveClient* ac, bool supportsSendPrivate):
|
|
|
mySpamMutedFlag(false),
|
|
|
myQWMutedFlag(false),
|
|
|
myKeepNickTimer(new QTimer()),
|
|
|
+ mySPDetectionTimer(new QTimer()),
|
|
|
myFloodTimer(new QTimer()),
|
|
|
myQWBroadcastFloodTimer(new QTimer()),
|
|
|
mySpamBroadcastFloodTimer(new QTimer()),
|
|
@@ -55,6 +56,7 @@ Client::~Client()
|
|
|
delete myFloodTimer;
|
|
|
delete myQWBroadcastFloodTimer;
|
|
|
delete mySpamBroadcastFloodTimer;
|
|
|
+ delete mySPDetectionTimer;
|
|
|
}
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
@@ -166,6 +168,23 @@ void Client::parsePrintedLine()
|
|
|
|
|
|
QString message(myPrintLine.right(myPrintLine.size() - lastMatchSize));
|
|
|
|
|
|
+ // Detects whether s-p command is supported
|
|
|
+ if(mySPDetectionActive)
|
|
|
+ {
|
|
|
+ if(mySPDetectionTimer->isActive() && nick == Settings::globalInstance()->botName() && message == "s-p")
|
|
|
+ {
|
|
|
+ mySupportsSendPrivate = false;
|
|
|
+ mySPDetectionTimer->stop();
|
|
|
+ mySPDetectionActive = false;
|
|
|
+ }
|
|
|
+ else if(!mySPDetectionTimer->isActive())
|
|
|
+ {
|
|
|
+ mySupportsSendPrivate = true;
|
|
|
+ mySPDetectionTimer->stop();
|
|
|
+ mySPDetectionActive = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
QRegExp regex("^:\\s+\\.(spam|qw|help|qw_mute|qw_unmute|spam_mute|spam_unmute|lm)\\s*(.+)$");
|
|
|
if(regex.indexIn(message) == -1)
|
|
|
return;
|
|
@@ -450,6 +469,7 @@ void Client::onStuffedCmd(const char *cmd)
|
|
|
myOnServerFlag = true;
|
|
|
|
|
|
setPing(Settings::globalInstance()->botPing());
|
|
|
+ spDetection();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -482,6 +502,15 @@ bool Client::supportsSendPrivate() const
|
|
|
return mySupportsSendPrivate;
|
|
|
}
|
|
|
|
|
|
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
+void Client::spDetection()
|
|
|
+{
|
|
|
+ say("s-p");
|
|
|
+ mySPDetectionTimer->setSingleShot(true);
|
|
|
+ mySPDetectionTimer->start(2000);
|
|
|
+ mySPDetectionActive = true;
|
|
|
+}
|
|
|
+
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
QString Client::parseNameFun(const QString &string)
|
|
|
{
|