- ctcp = xdelimDequote(dequotedMessage.mid(xdelimPos + 1, xdelimEndPos - xdelimPos - 1));
- dequotedMessage = dequotedMessage.mid(xdelimEndPos + 1);
-
- //dispatch the ctcp command
- QString ctcpcmd = targetDecode(e, ctcp.left(spacePos));
- QString ctcpparam = targetDecode(e, ctcp.mid(spacePos + 1));
-
- spacePos = ctcp.indexOf(' ');
- if(spacePos != -1) {
- ctcpcmd = targetDecode(e, ctcp.left(spacePos));
- ctcpparam = targetDecode(e, ctcp.mid(spacePos + 1));
- } else {
- ctcpcmd = targetDecode(e, ctcp);
- ctcpparam = QString();
+ else {
+ int spacePos;
+ QString ctcpcmd, ctcpparam;
+
+ QByteArray ctcp = xdelimDequote(dequotedMessage.mid(1, dequotedMessage.count() - 2));
+ spacePos = ctcp.indexOf(' ');
+ if (spacePos != -1) {
+ ctcpcmd = targetDecode(e, ctcp.left(spacePos));
+ ctcpparam = targetDecode(e, ctcp.mid(spacePos + 1));
+ }
+ else {
+ ctcpcmd = targetDecode(e, ctcp);
+ ctcpparam = QString();
+ }
+ ctcpcmd = ctcpcmd.toUpper();
+
+ bool isAction = ctcpcmd == QLatin1String("ACTION");
+ // we don't want to block /me messages by the CTCP ignore list
+ if (isAction
+ || !coreSession()->ignoreListManager()->ctcpMatch(e->prefix(), e->network()->networkName(), ctcpcmd)) {
+ QUuid uuid = QUuid::createUuid();
+ _replies.insert(uuid, CtcpReply(coreNetwork(e), nickFromMask(e->prefix())));
+ CtcpEvent* event = new CtcpEvent(EventManager::CtcpEvent,
+ e->network(),
+ isAction ? QHash<IrcTagKey, QString>() : e->tags(),
+ e->prefix(),
+ e->target(),
+ ctcptype,
+ ctcpcmd,
+ ctcpparam,
+ e->timestamp(),
+ uuid);
+ emit newEvent(event);
+ CtcpEvent* flushEvent = new CtcpEvent(EventManager::CtcpEventFlush,
+ e->network(),
+ {},
+ e->prefix(),
+ e->target(),
+ ctcptype,
+ "INVALID",
+ QString(),
+ e->timestamp(),
+ uuid);
+ emit newEvent(flushEvent);
+ }