Improve debugging for new IRCv3 functionality
[quassel.git] / src / core / ircparser.cpp
index a030a6a..8a6a7eb 100644 (file)
@@ -42,6 +42,9 @@ IrcParser::IrcParser(CoreSession* session)
     // Check if raw IRC logging is enabled
     _debugLogRawIrc = (Quassel::isOptionSet("debug-irc") || Quassel::isOptionSet("debug-irc-id"));
     _debugLogRawNetId = Quassel::optionValue("debug-irc-id").toInt();
+    // Check if parsed IRC logging is enabled
+    _debugLogParsedIrc = (Quassel::isOptionSet("debug-irc-parsed") || Quassel::isOptionSet("debug-irc-parsed-id"));
+    _debugLogParsedNetId = Quassel::optionValue("debug-irc-parsed-id").toInt();
 
     connect(this, &IrcParser::newEvent, coreSession()->eventManager(), &EventManager::postEvent);
 }
@@ -110,6 +113,12 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent* e)
         return net->serverDecode(data);
     }, rawMsg, tags, prefix, cmd, params);
 
+    // Log the message if enabled and network ID matches or allows all
+    if (_debugLogParsedIrc && (_debugLogParsedNetId == -1 || net->networkId().toInt() == _debugLogParsedNetId)) {
+        // Include network ID
+        qDebug() << "IRC net" << net->networkId() << "<<" << tags << prefix << cmd << params;
+    }
+
     QList<Event*> events;
     EventManager::EventType type = EventManager::Invalid;