[Telepathy-commits] [telepathy-qt4/master] Message::Private: add accessors for sender handle and pending ID

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Feb 20 04:02:19 PST 2009


---
 TelepathyQt4/Client/text-channel.cpp |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/Client/text-channel.cpp b/TelepathyQt4/Client/text-channel.cpp
index 7390260..c432193 100644
--- a/TelepathyQt4/Client/text-channel.cpp
+++ b/TelepathyQt4/Client/text-channel.cpp
@@ -50,9 +50,13 @@ public:
     QSharedPointer<Contact> sender;
 
     inline QVariant value(uint index, const char *key) const;
+    inline uint getUIntOrZero(uint index, const char *key) const;
     inline QString getStringOrEmpty(uint index, const char *key) const;
     inline bool getBoolean(uint index, const char *key,
             bool assumeIfAbsent) const;
+    inline uint senderHandle() const;
+    inline uint pendingId() const;
+    void clearSenderHandle();
 };
 
 Message::Private::Private(const MessagePartList &parts)
@@ -82,6 +86,12 @@ inline QString Message::Private::getStringOrEmpty(uint index, const char *key)
     return s;
 }
 
+inline uint Message::Private::getUIntOrZero(uint index, const char *key)
+    const
+{
+    return value(index, key).toUInt();
+}
+
 inline bool Message::Private::getBoolean(uint index, const char *key,
         bool assumeIfAbsent) const
 {
@@ -92,6 +102,21 @@ inline bool Message::Private::getBoolean(uint index, const char *key,
     return assumeIfAbsent;
 }
 
+inline uint Message::Private::senderHandle() const
+{
+    return getUIntOrZero(0, "message-sender");
+}
+
+inline uint Message::Private::pendingId() const
+{
+    return getUIntOrZero(0, "pending-message-id");
+}
+
+void Message::Private::clearSenderHandle()
+{
+    parts[0].remove(QLatin1String("message-sender"));
+}
+
 /**
  * \class Message
  * \ingroup clientchannel
-- 
1.5.6.5




More information about the telepathy-commits mailing list