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

message.h
1
23 #ifndef _TelepathyQt_message_h_HEADER_GUARD_
24 #define _TelepathyQt_message_h_HEADER_GUARD_
25
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29
30 #include <QSharedDataPointer>
31
32 #include <TelepathyQt/Constants>
33 #include <TelepathyQt/Contact>
34 #include <TelepathyQt/Types>
35
36 class QDateTime;
37
38 namespace Tp
39 {
40
41 class Contact;
42 class TextChannel;
43
44 class TP_QT_EXPORT Message
45 {
46 public:
47 Message(ChannelTextMessageType, const QString &);
48 Message(const Message &other);
49 ~Message();
50
51 Message &operator=(const Message &other);
52 bool operator==(const Message &other) const;
53 inline bool operator!=(const Message &other) const
54 {
55 return !(*this == other);
56 }
57
58 // Convenient access to headers
59
60 QDateTime sent() const;
61
62 ChannelTextMessageType messageType() const;
63
64 bool isTruncated() const;
65
66 bool hasNonTextContent() const;
67
68 QString messageToken() const;
69
70 bool isSpecificToDBusInterface() const;
71 QString dbusInterface() const;
72
73 QString text() const;
74
75 // Direct access to the whole message (header and body)
76
77 MessagePart header() const;
78
79 int size() const;
80 MessagePart part(uint index) const;
81 MessagePartList parts() const;
82
83 private:
84 friend class ContactMessenger;
85 friend class ReceivedMessage;
86 friend class TextChannel;
87
88 TP_QT_NO_EXPORT Message();
89 TP_QT_NO_EXPORT Message(const MessagePartList &parts);
90 TP_QT_NO_EXPORT Message(uint, uint, const QString &);
91
92 struct Private;
93 friend struct Private;
94 QSharedDataPointer<Private> mPriv;
95 };
96
97 class TP_QT_EXPORT ReceivedMessage : public Message
98 {
99 public:
100 class DeliveryDetails
101 {
102 public:
103 DeliveryDetails();
104 DeliveryDetails(const DeliveryDetails &other);
105 ~DeliveryDetails();
106
107 DeliveryDetails &operator=(const DeliveryDetails &other);
108
109 bool isValid() const { return mPriv.constData() != 0; }
110
111 DeliveryStatus status() const;
112
113 bool hasOriginalToken() const;
114 QString originalToken() const;
115
116 bool isError() const;
117 ChannelTextSendError error() const;
118
119 bool hasDebugMessage() const;
120 QString debugMessage() const;
121
122 QString dbusError() const;
123
124 bool hasEchoedMessage() const;
125 Message echoedMessage() const;
126
127 private:
128 friend class ReceivedMessage;
129
130 TP_QT_NO_EXPORT DeliveryDetails(const MessagePartList &parts);
131
132 struct Private;
133 friend struct Private;
134 QSharedDataPointer<Private> mPriv;
135 };
136
137 ReceivedMessage(const ReceivedMessage &other);
138 ReceivedMessage &operator=(const ReceivedMessage &other);
139 ~ReceivedMessage();
140
141 QDateTime received() const;
142 ContactPtr sender() const;
143 QString senderNickname() const;
144
145 QString supersededToken() const;
146
147 bool isScrollback() const;
148 bool isRescued() const;
149
150 bool isDeliveryReport() const;
151 DeliveryDetails deliveryDetails() const;
152
153 bool isFromChannel(const TextChannelPtr &channel) const;
154
155 protected:
156 friend class TextChannel;
157
158 ReceivedMessage(const MessagePartList &parts,
159 const TextChannelPtr &channel);
160 ReceivedMessage();
161
162 uint senderHandle() const;
163 QString senderId() const;
164 uint pendingId() const;
165
166 void setForceNonText();
167 void clearSenderHandle();
168 void setSender(const ContactPtr &sender);
169 };
170
171 } // Tp
172
173 #endif
Tp::Message::operator!=
bool operator!=(const Message &other) const
Definition: message.h:53
Tp::ContactMessenger
The ContactMessenger class provides an easy way to send text messages to a contact and also track sen...
Definition: contact-messenger.h:40
Tp
Definition: abstract-adaptor.cpp:31
Tp::ReceivedMessage::DeliveryDetails
The ReceivedMessage::DeliveryDetails class represents the details of a delivery report.
Definition: message.h:100
Tp::MessagePart
Definition: obj-x86_64-linux-gnu/TelepathyQt/_gen/types.h:2013
Tp::ReceivedMessage::DeliveryDetails::isValid
bool isValid() const
Definition: message.h:109
Tp::ReceivedMessage
The ReceivedMessage class is a subclass of Message, representing a received message only...
Definition: message.h:97
Tp::ChannelTextSendError
ChannelTextSendError
Definition: obj-x86_64-linux-gnu/TelepathyQt/_gen/constants.h:2815
Tp::DeliveryStatus
DeliveryStatus
Definition: obj-x86_64-linux-gnu/TelepathyQt/_gen/constants.h:3558
Tp::Message
The Message class represents a Telepathy message in a TextChannel.
Definition: message.h:44
QString
QList
Tp::ChannelTextMessageType
ChannelTextMessageType
Definition: obj-x86_64-linux-gnu/TelepathyQt/_gen/constants.h:2866
Tp::operator==
bool operator==(const SUSocketAddress &v1, const SUSocketAddress &v2)
Definition: types.cpp:50
Tp::TextChannel
The TextChannel class represents a Telepathy channel of type Text.
Definition: text-channel.h:40
QSharedDataPointer< Private >
QDateTime