Set current time on creation of MessageEvents if no other time is given
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Oct 2010 19:41:13 +0000 (21:41 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 13 Oct 2010 23:06:33 +0000 (01:06 +0200)
While we can probable leave the timestamp uninitialized for other event types, we certainly
always need a valid time for messages.

src/common/messageevent.cpp

index 70857d8..d872da7 100644 (file)
@@ -41,7 +41,10 @@ MessageEvent::MessageEvent(Message::Type msgType, Network *net, const QString &m
 
   _bufferType = bufferTypeByTarget(_target);
 
-  setTimestamp(timestamp);
+  if(timestamp.isValid())
+    setTimestamp(timestamp);
+  else
+    setTimestamp(QDateTime::currentDateTime());
 }
 
 BufferInfo::Type MessageEvent::bufferTypeByTarget(const QString &target) const {