This should fix duplicate messages that would occur when new messages arrived while...
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 20 Feb 2008 17:53:55 +0000 (17:53 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 20 Feb 2008 17:53:55 +0000 (17:53 +0000)
was still being requested.
Breaks core protocol, because somebody *cough* forgot to serialize the MsgId of Message objects...

src/client/buffer.cpp
src/common/message.cpp
src/common/types.h
version.inc

index a6687ce..d4ac236 100644 (file)
@@ -54,6 +54,10 @@ void Buffer::appendMsg(const Message &msg) {
 }
 
 void Buffer::prependMsg(const Message &msg) {
+  // check for duplicate first
+  if(contents().count() > 0 && msg.msgId() >= contents().first()->msgId()) {
+    return;
+  }
   updateActivityLevel(msg);
   layoutQueue.append(msg);
 }
index 91e1f49..4b2dc4d 100644 (file)
@@ -176,7 +176,7 @@ QString Message::formattedToHtml(const QString &f) {
 */
 
 QDataStream &operator<<(QDataStream &out, const Message &msg) {
-  out << (quint32)msg.timestamp().toTime_t() << (quint32)msg.type() << (quint8)msg.flags()
+  out << msg.msgId() << (quint32)msg.timestamp().toTime_t() << (quint32)msg.type() << (quint8)msg.flags()
       << msg.bufferInfo() << msg.sender().toUtf8() << msg.text().toUtf8();
   return out;
 }
@@ -187,7 +187,7 @@ QDataStream &operator>>(QDataStream &in, Message &msg) {
   quint32 ts;
   QByteArray s, m;
   BufferInfo buf;
-  in >> ts >> t >> f >> buf >> s >> m;
+  in >> msg._msgId >> ts >> t >> f >> buf >> s >> m;
   msg._type = (Message::Type)t;
   msg._flags = (quint8)f;
   msg._bufferInfo = buf;
index 949306b..e2acbeb 100644 (file)
@@ -37,6 +37,8 @@ class SignedId {
     inline bool operator==(const SignedId &other) const { return id == other.id; }
     inline bool operator!=(const SignedId &other) const { return id != other.id; }
     inline bool operator<(const SignedId &other) const { return id < other.id; }
+    inline bool operator>(const SignedId &other) const { return id > other.id; }
+    inline bool operator>=(const SignedId &other) const { return id >= other.id; }
     inline bool operator==(int i) const { return id == i; }
     inline bool operator!=(int i) const { return id != i; }
     inline bool operator<(int i) const { return id < i; }
index 3c51ba9..f6a0f4b 100644 (file)
@@ -5,14 +5,14 @@
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-02-20";
-  quasselBuild = 564;
+  quasselBuild = 563;
 
   //! Minimum client build number the core needs
-  clientBuildNeeded = 559;
+  clientBuildNeeded = 563;
   clientVersionNeeded = quasselVersion;
 
   //! Minimum core build number the client needs
-  coreBuildNeeded = 559;
+  coreBuildNeeded = 563;
   coreVersionNeeded = quasselVersion;
 
 }