Stop log_backtrace() from looping in some (all? rare? whatever) cases
[quassel.git] / src / common / bufferinfo.h
index 6a5a779..f5a9f38 100644 (file)
@@ -17,8 +17,8 @@
  *   Free Software Foundation, Inc.,                                       *
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
-#ifndef _BUFFERINFO_H_
-#define _BUFFERINFO_H_
+#ifndef BUFFERINFO_H
+#define BUFFERINFO_H
 
 #include <QtCore>
 #include "types.h"
@@ -28,11 +28,31 @@ class QDataStream;
 
 class BufferInfo {
 public:
-  BufferInfo();
-  BufferInfo(BufferId id, NetworkId networkid, uint gid = 0, QString buf = QString());
+  enum Type {
+    InvalidBuffer = 0x00,
+    StatusBuffer = 0x01,
+    ChannelBuffer = 0x02,
+    QueryBuffer = 0x04,
+    GroupBuffer = 0x08
+  };
   
+  enum Activity {
+    NoActivity = 0x00,
+    OtherActivity = 0x01,
+    NewMessage = 0x02,
+    Highlight = 0x40
+  };
+  Q_DECLARE_FLAGS(ActivityLevel, Activity)
+
+  BufferInfo();
+  BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid = 0, QString buf = QString());
+
+  static BufferInfo fakeStatusBuffer(NetworkId networkId);
+
+  inline bool isValid() const { return _bufferId != 0; }
   inline BufferId bufferId() const { return _bufferId; }
   inline NetworkId networkId() const { return _netid; }
+  inline Type type() const { return _type; }
   inline uint groupId() const { return _groupId; }
   QString bufferName() const;
   
@@ -43,6 +63,7 @@ public:
 private:
   BufferId _bufferId;
   NetworkId _netid;
+  Type _type;
   uint _groupId;
   QString _bufferName;
   
@@ -55,7 +76,8 @@ QDataStream &operator<<(QDataStream &out, const BufferInfo &bufferInfo);
 QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo);
 QDebug operator<<(QDebug dbg, const BufferInfo &b);
 
-Q_DECLARE_METATYPE(BufferInfo);
+Q_DECLARE_METATYPE(BufferInfo)
+Q_DECLARE_OPERATORS_FOR_FLAGS(BufferInfo::ActivityLevel)
 
 uint qHash(const BufferInfo &);