Home · Modules · All Classes · All Namespaces
contact-messenger.h
1 
23 #ifndef _TelepathyQt_contact_messenger_h_HEADER_GUARD_
24 #define _TelepathyQt_contact_messenger_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/Constants>
31 #include <TelepathyQt/Message>
32 #include <TelepathyQt/Types>
33 
34 namespace Tp
35 {
36 
37 class PendingSendMessage;
38 class MessageContentPartList;
39 
40 class TP_QT_EXPORT ContactMessenger : public QObject, public RefCounted
41 {
42  Q_OBJECT
43  Q_DISABLE_COPY(ContactMessenger)
44 
45 public:
46  static ContactMessengerPtr create(const AccountPtr &account, const ContactPtr &contact);
47  static ContactMessengerPtr create(const AccountPtr &account, const QString &contactIdentifier);
48 
49  virtual ~ContactMessenger();
50 
51  AccountPtr account() const;
52  QString contactIdentifier() const;
53 
54  QList<TextChannelPtr> textChats() const;
55 
56  PendingSendMessage *sendMessage(const QString &text,
58  MessageSendingFlags flags = 0);
59  PendingSendMessage *sendMessage(const MessageContentPartList &parts,
60  MessageSendingFlags flags = 0);
61 
62 Q_SIGNALS:
63  void messageSent(const Tp::Message &message, Tp::MessageSendingFlags flags,
64  const QString &sentMessageToken, const Tp::TextChannelPtr &channel);
65  void messageReceived(const Tp::ReceivedMessage &message, const Tp::TextChannelPtr &channel);
66 
67 private:
68  TP_QT_NO_EXPORT ContactMessenger(const AccountPtr &account,
69  const QString &contactIdentifier);
70 
71  struct Private;
72  friend struct Private;
73  Private *mPriv;
74 };
75 
76 } // Tp
77 
78 #endif
QFlags< MessageSendingFlag > MessageSendingFlags
Definition: build/TelepathyQt/_gen/constants.h:1166
The MessageContentPartList class represents a list of MessageContentPart.
Definition: message-content-part.h:57
ChannelTextMessageType
Definition: build/TelepathyQt/_gen/constants.h:2866
Definition: build/TelepathyQt/_gen/constants.h:2871
The PendingSendMessage class represents the parameters of and the reply to an asynchronous message se...
Definition: pending-send-message.h:41
The ReceivedMessage class is a subclass of Message, representing a received message only.
Definition: message.h:97
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
The ContactMessenger class provides an easy way to send text messages to a contact and also track sen...
Definition: contact-messenger.h:40
The Message class represents a Telepathy message in a TextChannel.
Definition: message.h:44
Definition: abstract-adaptor.cpp:31