Fix event propagation
[quassel.git] / src / common / bufferinfo.cpp
index a63d703..5732048 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 BufferInfo::BufferInfo()
   : _bufferId(0),
     _netid(0),
+    _type(InvalidBuffer),
     _groupId(0),
     _bufferName(QString())
 {
 }
 
-BufferInfo::BufferInfo(BufferId id,  NetworkId networkid, uint gid, QString buf)
+BufferInfo::BufferInfo(BufferId id,  NetworkId networkid, Type type, uint gid, QString buf)
   : _bufferId(id),
     _netid(networkid),
+    _type(type),
     _groupId(gid),
     _bufferName(buf)
 {
 }
 
+BufferInfo BufferInfo::fakeStatusBuffer(NetworkId networkId) {
+  return BufferInfo(0, networkId, StatusBuffer);
+}
+
 QString BufferInfo::bufferName() const {
   if(isChannelName(_bufferName))
     return _bufferName;
@@ -56,18 +62,20 @@ QDebug operator<<(QDebug dbg, const BufferInfo &b) {
 }
 
 QDataStream &operator<<(QDataStream &out, const BufferInfo &bufferInfo) {
-  out << bufferInfo._bufferId << bufferInfo._netid << bufferInfo._groupId << bufferInfo._bufferName.toUtf8();
+  out << bufferInfo._bufferId << bufferInfo._netid << (qint16)bufferInfo._type << bufferInfo._groupId << bufferInfo._bufferName.toUtf8();
   return out;
 }
 
 QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo) {
   QByteArray buffername;
-  in >> bufferInfo._bufferId >> bufferInfo._netid >> bufferInfo._groupId >> buffername;
+  qint16 bufferType;
+  in >> bufferInfo._bufferId >> bufferInfo._netid >> bufferType >> bufferInfo._groupId >> buffername;
+  bufferInfo._type = (BufferInfo::Type)bufferType;
   bufferInfo._bufferName = QString::fromUtf8(buffername);
   return in;
 }
 
 uint qHash(const BufferInfo &bufferid) {
-  return qHash(bufferid._bufferId.toInt());
+  return qHash(bufferid._bufferId);
 }