Home · Modules · All Classes · All Namespaces
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:
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  bool isSilent() const;
150 
151  bool isDeliveryReport() const;
152  DeliveryDetails deliveryDetails() const;
153 
154  bool isFromChannel(const TextChannelPtr &channel) const;
155 
156 protected:
157  friend class TextChannel;
158 
159  ReceivedMessage(const MessagePartList &parts,
160  const TextChannelPtr &channel);
161  ReceivedMessage();
162 
163  uint senderHandle() const;
164  QString senderId() const;
165  uint pendingId() const;
166 
167  void setForceNonText();
168  void clearSenderHandle();
169  void setSender(const ContactPtr &sender);
170 };
171 
172 } // Tp
173 
174 #endif
bool operator==(const SUSocketAddress &v1, const SUSocketAddress &v2)
Definition: types.cpp:50
QList< MessagePart > MessagePartList
Definition: build/TelepathyQt/_gen/types.h:2068
bool operator!=(const Message &other) const
Definition: message.h:53
ChannelTextMessageType
Definition: build/TelepathyQt/_gen/constants.h:2866
The ReceivedMessage::DeliveryDetails class represents the details of a delivery report.
Definition: message.h:100
ChannelTextSendError
Definition: build/TelepathyQt/_gen/constants.h:2815
DeliveryStatus
Definition: build/TelepathyQt/_gen/constants.h:3558
The ReceivedMessage class is a subclass of Message, representing a received message only.
Definition: message.h:97
Definition: build/TelepathyQt/_gen/types.h:2049
The ContactMessenger class provides an easy way to send text messages to a contact and also track sen...
Definition: contact-messenger.h:40
bool isValid() const
Definition: message.h:109
The Message class represents a Telepathy message in a TextChannel.
Definition: message.h:44
Definition: abstract-adaptor.cpp:31
The TextChannel class represents a Telepathy channel of type Text.
Definition: text-channel.h:40