Don't log to stdout if --syslog and/or --logfile are specified
[quassel.git] / src / common / ircevent.h
index 6704013..18e4402 100644 (file)
@@ -22,6 +22,7 @@
 #define IRCEVENT_H
 
 #include "networkevent.h"
+#include "util.h"
 
 class IrcEvent : public NetworkEvent {
 public:
@@ -34,9 +35,19 @@ public:
   inline QString prefix() const { return _prefix; }
   inline void setPrefix(const QString &prefix) { _prefix = prefix; }
 
+  inline QString nick() const { return nickFromMask(prefix()); }
+
   inline QStringList params() const { return _params; }
   inline void setParams(const QStringList &params) { _params = params; }
 
+protected:
+  virtual inline QString className() const { return "IrcEvent"; }
+  virtual inline void debugInfo(QDebug &dbg) const {
+    NetworkEvent::debugInfo(dbg);
+    dbg << ", prefix = " << qPrintable(prefix())
+        << ", params = " << params();
+  }
+
 private:
   QString _prefix;
   QStringList _params;
@@ -56,6 +67,16 @@ public:
   inline QString target() const { return _target; }
   inline void setTarget(const QString &target) { _target = target; }
 
+protected:
+  virtual inline QString className() const { return "IrcEventNumeric"; }
+  virtual inline void debugInfo(QDebug &dbg) const {
+    dbg << ", num = " << number();
+    NetworkEvent::debugInfo(dbg);
+    dbg << ", target = " << qPrintable(target())
+        << ", prefix = " << qPrintable(prefix())
+        << ", params = " << params();
+  }
+
 private:
   uint _number;
   QString _target;
@@ -64,10 +85,14 @@ private:
 
 class IrcEventRawMessage : public IrcEvent {
 public:
-  explicit IrcEventRawMessage(EventManager::EventType type, Network *network, const QString &prefix, const QString &target, const QByteArray &rawMessage)
+  explicit inline IrcEventRawMessage(EventManager::EventType type, Network *network,
+                                     const QByteArray &rawMessage, const QString &prefix, const QString &target,
+                                     const QDateTime &timestamp = QDateTime())
     : IrcEvent(type, network, prefix, QStringList() << target),
       _rawMessage(rawMessage)
-  {}
+  {
+    setTimestamp(timestamp);
+  }
 
   inline QString target() const { return params().at(0); }
   inline void setTarget(const QString &target) { setParams(QStringList() << target); }
@@ -75,6 +100,16 @@ public:
   inline QByteArray rawMessage() const { return _rawMessage; }
   inline void setRawMessage(const QByteArray &rawMessage) { _rawMessage = rawMessage; }
 
+protected:
+  virtual inline QString className() const { return "IrcEventRawMessage"; }
+  virtual inline void debugInfo(QDebug &dbg) const {
+    NetworkEvent::debugInfo(dbg);
+    dbg << ", target = " << qPrintable(target())
+        << ", prefix = " << qPrintable(prefix())
+        << ", msg = " << rawMessage();
+  }
+
+
 private:
   QByteArray _rawMessage;
 };