X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmessage.h;h=1cf0f678743f3ab55bfaf387f7e2e9a3cc8f0841;hp=90a6a168da4a6450b1358e6df2169cc9a349283c;hb=342b6d8a5869e438362914f3848e639ac6c70bbc;hpb=46ddb293c61aeb90295fa1a14be71e8896f34ade diff --git a/src/common/message.h b/src/common/message.h index 90a6a168..1cf0f678 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -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 * @@ -46,7 +46,8 @@ public: Server = 0x0400, Info = 0x0800, Error = 0x1000, - DayChange = 0x2000 + DayChange = 0x2000, + Topic = 0x4000 }; // DO NOT CHANGE without knowing what you do, some of these flags are stored in the database @@ -55,6 +56,7 @@ public: Self = 0x01, Highlight = 0x02, Redirected = 0x04, + ServerMsg = 0x08, Backlog = 0x80 }; Q_DECLARE_FLAGS(Flags, Flag) @@ -65,17 +67,20 @@ public: const QString &contents = "", const QString &sender = "", Flags flags = None); inline static Message ChangeOfDay(const QDateTime &day) { return Message(day, BufferInfo(), DayChange, tr("Day changed to %1").arg(day.toString("dddd MMMM d yyyy"))); } - inline MsgId msgId() const { return _msgId; } + inline const MsgId &msgId() const { return _msgId; } inline void setMsgId(MsgId id) { _msgId = id; } - inline BufferInfo bufferInfo() const { return _bufferInfo; } - inline QString contents() const { return _contents; } - inline QString sender() const { return _sender; } + inline const BufferInfo &bufferInfo() const { return _bufferInfo; } + inline const BufferId &bufferId() const { return _bufferInfo.bufferId(); } + inline void setBufferId(BufferId id) { _bufferInfo.setBufferId(id); } + inline const QString &contents() const { return _contents; } + inline const QString &sender() const { return _sender; } inline Type type() const { return _type; } inline Flags flags() const { return _flags; } - inline QDateTime timestamp() const { return _timestamp; } + inline void setFlags(Flags flags) { _flags = flags; } + inline const QDateTime ×tamp() const { return _timestamp; } - void setFlags(Flags flags); + inline bool isValid() const { return _msgId.isValid(); } inline bool operator<(const Message &other) const { return _msgId < other._msgId; } @@ -88,14 +93,14 @@ private: Type _type; Flags _flags; - QString _formattedTimestamp, _formattedSender, _formattedText; // cache - - friend QDataStream &operator>>(QDataStream &in, Message &msg); }; +typedef QList MessageList; + QDataStream &operator<<(QDataStream &out, const Message &msg); QDataStream &operator>>(QDataStream &in, Message &msg); +QDebug operator<<(QDebug dbg, const Message &msg); Q_DECLARE_METATYPE(Message) Q_DECLARE_OPERATORS_FOR_FLAGS(Message::Flags)