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 ContactMessenger;
00086     friend class ReceivedMessage;
00087     friend class TextChannel;
00088 
00089     TELEPATHY_QT4_NO_EXPORT Message();
00090     TELEPATHY_QT4_NO_EXPORT Message(const MessagePartList &parts);
00091     TELEPATHY_QT4_NO_EXPORT Message(uint, uint, const QString &);
00092 
00093     struct Private;
00094     friend struct Private;
00095     QSharedDataPointer<Private> mPriv;
00096 };
00097 
00098 class TELEPATHY_QT4_EXPORT ReceivedMessage : public Message
00099 {
00100 public:
00101     ReceivedMessage(const ReceivedMessage &other);
00102     ReceivedMessage &operator=(const ReceivedMessage &other);
00103     ~ReceivedMessage();
00104 
00105     QDateTime received() const;
00106     ContactPtr sender() const;
00107     bool isScrollback() const;
00108     bool isRescued() const;
00109 
00110     bool isFromChannel(const TextChannelPtr &channel) const;
00111 
00112 private:
00113     friend class TextChannel;
00114 
00115     TELEPATHY_QT4_NO_EXPORT ReceivedMessage(const MessagePartList &parts,
00116             const TextChannelPtr &channel);
00117     TELEPATHY_QT4_NO_EXPORT ReceivedMessage();
00118 
00119     TELEPATHY_QT4_NO_EXPORT uint senderHandle() const;
00120     TELEPATHY_QT4_NO_EXPORT QString senderId() const;
00121     TELEPATHY_QT4_NO_EXPORT uint pendingId() const;
00122 
00123     TELEPATHY_QT4_NO_EXPORT void setForceNonText();
00124     TELEPATHY_QT4_NO_EXPORT void clearSenderHandle();
00125     TELEPATHY_QT4_NO_EXPORT void setSender(const ContactPtr &sender);
00126 };
00127 
00128 } // Tp
00129 
00130 #endif


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