Home · All Classes · All Namespaces · Modules · Functions · Files

message.h

00001 
00023 #ifndef _TelepathyQt4_message_h_HEADER_GUARD_
00024 #define _TelepathyQt4_message_h_HEADER_GUARD_
00025 
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029 
00030 #include <QSharedDataPointer>
00031 
00032 #include <TelepathyQt4/Contact>
00033 #include <TelepathyQt4/Types>
00034 #include <TelepathyQt4/Constants>
00035 #include <TelepathyQt4/Types>
00036 
00037 class QDateTime;
00038 
00039 namespace Tp
00040 {
00041 
00042 class Contact;
00043 class TextChannel;
00044 
00045 class TELEPATHY_QT4_EXPORT Message
00046 {
00047 public:
00048     Message(ChannelTextMessageType, const QString &);
00049     Message(const Message &other);
00050     ~Message();
00051 
00052     Message &operator=(const Message &other);
00053     bool operator==(const Message &other) const;
00054     inline bool operator!=(const Message &other) const
00055     {
00056         return !(*this == other);
00057     }
00058 
00059     // Convenient access to headers
00060 
00061     QDateTime sent() const;
00062 
00063     ChannelTextMessageType messageType() const;
00064 
00065     bool isTruncated() const;
00066 
00067     bool hasNonTextContent() const;
00068 
00069     QString messageToken() const;
00070 
00071     bool isSpecificToDBusInterface() const;
00072     QString dbusInterface() const;
00073 
00074     QString text() const;
00075 
00076     // Direct access to the whole message (header and body)
00077 
00078     MessagePart header() const;
00079 
00080     int size() const;
00081     MessagePart part(uint index) const;
00082     MessagePartList parts() const;
00083 
00084 private:
00085     friend class TextChannel;
00086     friend class ReceivedMessage;
00087 
00088     TELEPATHY_QT4_NO_EXPORT Message();
00089     TELEPATHY_QT4_NO_EXPORT Message(const MessagePartList &parts);
00090     TELEPATHY_QT4_NO_EXPORT Message(uint, uint, const QString &);
00091 
00092     struct Private;
00093     friend struct Private;
00094     QSharedDataPointer<Private> mPriv;
00095 };
00096 
00097 class TELEPATHY_QT4_EXPORT ReceivedMessage : public Message
00098 {
00099 public:
00100     ReceivedMessage(const ReceivedMessage &other);
00101     ReceivedMessage &operator=(const ReceivedMessage &other);
00102     ~ReceivedMessage();
00103 
00104     QDateTime received() const;
00105     ContactPtr sender() const;
00106     bool isScrollback() const;
00107     bool isRescued() const;
00108 
00109     bool isFromChannel(const TextChannelPtr &channel) const;
00110 
00111 private:
00112     friend class TextChannel;
00113 
00114     TELEPATHY_QT4_NO_EXPORT ReceivedMessage(const MessagePartList &parts,
00115             const TextChannelPtr &channel);
00116     TELEPATHY_QT4_NO_EXPORT ReceivedMessage();
00117 
00118     TELEPATHY_QT4_NO_EXPORT uint senderHandle() const;
00119     TELEPATHY_QT4_NO_EXPORT QString senderId() const;
00120     TELEPATHY_QT4_NO_EXPORT uint pendingId() const;
00121 
00122     TELEPATHY_QT4_NO_EXPORT void setForceNonText();
00123     TELEPATHY_QT4_NO_EXPORT void clearSenderHandle();
00124     TELEPATHY_QT4_NO_EXPORT void setSender(const ContactPtr &sender);
00125 };
00126 
00127 } // Tp
00128 
00129 #endif


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.5.11