X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=main%2Fglobal.h;h=a662fd77ed32f5927cccb3ba7f15dbe672111018;hb=b33348cfb80cce7efffc97dd227a0069a5aaede3;hp=1c3666113ca60acbf601ab70f456e03b93b6a1d7;hpb=d6a96a47a3964b9c0b1ea2413601d70d0d327413;p=quassel.git diff --git a/main/global.h b/main/global.h index 1c366611..a662fd77 100644 --- a/main/global.h +++ b/main/global.h @@ -36,6 +36,9 @@ class Global; typedef QMap VarMap; extern Global *global; +typedef uint UserId; +typedef uint MsgId; + /** * This class is mostly a globally synchronized data store, meant for storing systemwide settings such * as identities or network lists. This class is a singleton, but not static as we'd like to use signals and @@ -93,4 +96,35 @@ class Exception { }; +class BufferId { + public: + BufferId() { id = gid = 0; } // FIXME + BufferId(uint uid, QString net, QString buf, uint gid = 0); + + inline uint uid() { return id; } + inline uint groupId() { return gid; } + inline QString network() { return net; } + QString buffer(); // nickfrommask? + + void setGroupId(uint _gid) { gid = _gid; } + + inline bool operator==(const BufferId &other) const { return id == other.id; } + private: + uint id; + uint gid; + QString net; + QString buf; + + friend uint qHash(const BufferId &); + friend QDataStream &operator<<(QDataStream &out, const BufferId &bufferId); + friend QDataStream &operator>>(QDataStream &in, BufferId &bufferId); +}; + +QDataStream &operator<<(QDataStream &out, const BufferId &bufferId); +QDataStream &operator>>(QDataStream &in, BufferId &bufferId); + +Q_DECLARE_METATYPE(BufferId); + +uint qHash(const BufferId &); + #endif