MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9
   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/Constants>
00033 #include <TelepathyQt4/Contact>
00034 #include <TelepathyQt4/Types>
00035 
00036 class QDateTime;
00037 
00038 namespace Tp
00039 {
00040 
00041 class Contact;
00042 class TextChannel;
00043 
00044 class TELEPATHY_QT4_EXPORT Message
00045 {
00046 public:
00047     Message(ChannelTextMessageType, const QString &);
00048     Message(const Message &other);
00049     ~Message();
00050 
00051     Message &operator=(const Message &other);
00052     bool operator==(const Message &other) const;
00053     inline bool operator!=(const Message &other) const
00054     {
00055         return !(*this == other);
00056     }
00057 
00058     // Convenient access to headers
00059 
00060     QDateTime sent() const;
00061 
00062     ChannelTextMessageType messageType() const;
00063 
00064     bool isTruncated() const;
00065 
00066     bool hasNonTextContent() const;
00067 
00068     QString messageToken() const;
00069 
00070     bool isSpecificToDBusInterface() const;
00071     QString dbusInterface() const;
00072 
00073     QString text() const;
00074 
00075     // Direct access to the whole message (header and body)
00076 
00077     MessagePart header() const;
00078 
00079     int size() const;
00080     MessagePart part(uint index) const;
00081     MessagePartList parts() const;
00082 
00083 private:
00084     friend class ContactMessenger;
00085     friend class ReceivedMessage;
00086     friend class TextChannel;
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     class DeliveryDetails
00101     {
00102     public:
00103         DeliveryDetails();
00104         DeliveryDetails(const DeliveryDetails &other);
00105         ~DeliveryDetails();
00106 
00107         DeliveryDetails &operator=(const DeliveryDetails &other);
00108 
00109         bool isValid() const { return mPriv.constData() != 0; }
00110 
00111         DeliveryStatus status() const;
00112 
00113         bool hasOriginalToken() const;
00114         QString originalToken() const;
00115 
00116         bool isError() const;
00117         ChannelTextSendError error() const;
00118 
00119         bool hasDebugMessage() const;
00120         QString debugMessage() const;
00121 
00122         QString dbusError() const;
00123 
00124         bool hasEchoedMessage() const;
00125         Message echoedMessage() const;
00126 
00127     private:
00128         friend class ReceivedMessage;
00129 
00130         TELEPATHY_QT4_NO_EXPORT DeliveryDetails(const MessagePartList &parts);
00131 
00132         struct Private;
00133         friend struct Private;
00134         QSharedDataPointer<Private> mPriv;
00135     };
00136 
00137     ReceivedMessage(const ReceivedMessage &other);
00138     ReceivedMessage &operator=(const ReceivedMessage &other);
00139     ~ReceivedMessage();
00140 
00141     QDateTime received() const;
00142     ContactPtr sender() const;
00143     QString senderNickname() const;
00144 
00145     QString supersededToken() const;
00146 
00147     bool isScrollback() const;
00148     bool isRescued() const;
00149 
00150     bool isDeliveryReport() const;
00151     DeliveryDetails deliveryDetails() const;
00152 
00153     bool isFromChannel(const TextChannelPtr &channel) const;
00154 
00155 private:
00156     friend class TextChannel;
00157 
00158     TELEPATHY_QT4_NO_EXPORT ReceivedMessage(const MessagePartList &parts,
00159             const TextChannelPtr &channel);
00160     TELEPATHY_QT4_NO_EXPORT ReceivedMessage();
00161 
00162     TELEPATHY_QT4_NO_EXPORT uint senderHandle() const;
00163     TELEPATHY_QT4_NO_EXPORT QString senderId() const;
00164     TELEPATHY_QT4_NO_EXPORT uint pendingId() const;
00165 
00166     TELEPATHY_QT4_NO_EXPORT void setForceNonText();
00167     TELEPATHY_QT4_NO_EXPORT void clearSenderHandle();
00168     TELEPATHY_QT4_NO_EXPORT void setSender(const ContactPtr &sender);
00169 };
00170 
00171 } // Tp
00172 
00173 #endif

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