Home · Modules · All Classes · All Namespaces
text-channel.h
1 
23 #ifndef _TelepathyQt_text_channel_h_HEADER_GUARD_
24 #define _TelepathyQt_text_channel_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/Channel>
31 #include <TelepathyQt/PendingOperation>
32 #include <TelepathyQt/PendingSendMessage>
33 
34 namespace Tp
35 {
36 
37 class Message;
38 class ReceivedMessage;
39 
40 class TP_QT_EXPORT TextChannel : public Channel
41 {
42  Q_OBJECT
43  Q_DISABLE_COPY(TextChannel)
44 
45 public:
46  static const Feature FeatureCore;
50  static const Feature FeatureChatState;
51 
52  static TextChannelPtr create(const ConnectionPtr &connection,
53  const QString &objectPath, const QVariantMap &immutableProperties);
54 
55  virtual ~TextChannel();
56 
57  bool hasMessagesInterface() const;
58  bool hasChatStateInterface() const;
59  bool canInviteContacts() const;
60 
61  // requires FeatureMessageCapabilities
62  bool supportsMessageType(ChannelTextMessageType messageType) const;
63  QList<ChannelTextMessageType> supportedMessageTypes() const;
64  QStringList supportedContentTypes() const;
65  MessagePartSupportFlags messagePartSupport() const;
66  DeliveryReportingSupportFlags deliveryReportingSupport() const;
67 
68  // requires FeatureMessageQueue
69  QList<ReceivedMessage> messageQueue() const;
70 
71  // requires FeatureChatState
72  ChannelChatState chatState(const ContactPtr &contact) const;
73 
74 public Q_SLOTS:
75  void acknowledge(const QList<ReceivedMessage> &messages);
76 
77  void forget(const QList<ReceivedMessage> &messages);
78 
79  PendingSendMessage *send(const QString &text,
81  MessageSendingFlags flags = 0);
82 
83  PendingSendMessage *send(const MessagePartList &parts,
84  MessageSendingFlags flags = 0);
85 
87  const QList<ContactPtr> &contacts,
88  const QString &message = QString())
89  {
90  return groupAddContacts(contacts, message);
91  }
92 
93  PendingOperation *requestChatState(ChannelChatState state);
94 
95 Q_SIGNALS:
96  // FeatureMessageSentSignal
97  void messageSent(const Tp::Message &message,
99  const QString &sentMessageToken);
100 
101  // FeatureMessageQueue
102  void messageReceived(const Tp::ReceivedMessage &message);
103  void pendingMessageRemoved(
104  const Tp::ReceivedMessage &message);
105 
106  // FeatureChatState
107  void chatStateChanged(const Tp::ContactPtr &contact,
108  Tp::ChannelChatState state);
109 
110 protected:
111  TextChannel(const ConnectionPtr &connection, const QString &objectPath,
112  const QVariantMap &immutableProperties,
113  const Feature &coreFeature = TextChannel::FeatureCore);
114 
115 private Q_SLOTS:
116  TP_QT_NO_EXPORT void onContactsFinished(Tp::PendingOperation *);
117  TP_QT_NO_EXPORT void onAcknowledgePendingMessagesReply(QDBusPendingCallWatcher *);
118 
119  TP_QT_NO_EXPORT void onMessageSent(const Tp::MessagePartList &, uint,
120  const QString &);
121  TP_QT_NO_EXPORT void onMessageReceived(const Tp::MessagePartList &);
122  TP_QT_NO_EXPORT void onPendingMessagesRemoved(const Tp::UIntList &);
123 
124  TP_QT_NO_EXPORT void onTextSent(uint, uint, const QString &);
125  TP_QT_NO_EXPORT void onTextReceived(uint, uint, uint, uint, uint, const QString &);
126  TP_QT_NO_EXPORT void onTextSendError(uint, uint, uint, const QString &);
127 
128  TP_QT_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *);
129  TP_QT_NO_EXPORT void gotPendingMessages(QDBusPendingCallWatcher *);
130 
131  TP_QT_NO_EXPORT void onChatStateChanged(uint, uint);
132 
133 private:
134  struct Private;
135  friend struct Private;
136  Private *mPriv;
137 };
138 
139 } // Tp
140 
141 #endif
static const Feature FeatureCore
Definition: text-channel.h:46
Definition: build/TelepathyQt/_gen/types.h:109
QList< MessagePart > MessagePartList
Definition: build/TelepathyQt/_gen/types.h:2068
QFlags< MessageSendingFlag > MessageSendingFlags
Definition: build/TelepathyQt/_gen/constants.h:1166
static const Feature FeatureMessageCapabilities
Definition: text-channel.h:48
The Channel class represents a Telepathy channel.
Definition: channel.h:51
static const Feature FeatureChatState
Definition: text-channel.h:50
ChannelTextMessageType
Definition: build/TelepathyQt/_gen/constants.h:2866
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
Definition: build/TelepathyQt/_gen/constants.h:2871
static const Feature FeatureMessageQueue
Definition: text-channel.h:47
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
QFlags< MessagePartSupportFlag > MessagePartSupportFlags
Definition: build/TelepathyQt/_gen/constants.h:1106
The Message class represents a Telepathy message in a TextChannel.
Definition: message.h:44
QFlags< DeliveryReportingSupportFlag > DeliveryReportingSupportFlags
Definition: build/TelepathyQt/_gen/constants.h:1219
static const Feature FeatureMessageSentSignal
Definition: text-channel.h:49
Definition: abstract-adaptor.cpp:31
The TextChannel class represents a Telepathy channel of type Text.
Definition: text-channel.h:40
PendingOperation * inviteContacts(const QList< ContactPtr > &contacts, const QString &message=QString())
Definition: text-channel.h:86
ChannelChatState
Definition: build/TelepathyQt/_gen/constants.h:3078
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45