Home · All Classes · All Namespaces · Modules · Functions · Files
channel.h
1 
23 #ifndef _TelepathyQt_channel_h_HEADER_GUARD_
24 #define _TelepathyQt_channel_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/_gen/cli-channel.h>
31 
32 #include <TelepathyQt/Constants>
33 #include <TelepathyQt/DBus>
34 #include <TelepathyQt/DBusProxy>
35 #include <TelepathyQt/OptionalInterfaceFactory>
36 #include <TelepathyQt/ReadinessHelper>
37 #include <TelepathyQt/SharedPtr>
38 #include <TelepathyQt/Types>
39 
40 #include <QSet>
41 #include <QSharedDataPointer>
42 #include <QVariantMap>
43 
44 namespace Tp
45 {
46 
47 class Connection;
48 class PendingOperation;
49 class PendingReady;
50 
51 class TP_QT_EXPORT Channel : public StatefulDBusProxy,
52  public OptionalInterfaceFactory<Channel>
53 {
54  Q_OBJECT
55  Q_DISABLE_COPY(Channel)
56 
57 public:
58  static const Feature FeatureCore;
60 
61  static ChannelPtr create(const ConnectionPtr &connection,
62  const QString &objectPath, const QVariantMap &immutableProperties);
63 
64  virtual ~Channel();
65 
66  ConnectionPtr connection() const;
67 
68  QVariantMap immutableProperties() const;
69 
70  QString channelType() const;
71 
72  HandleType targetHandleType() const;
73  uint targetHandle() const;
74  QString targetId() const;
75  ContactPtr targetContact() const;
76 
77  bool isRequested() const;
78  ContactPtr initiatorContact() const;
79 
80  PendingOperation *requestClose();
81  PendingOperation *requestLeave(const QString &message = QString(),
83 
84  ChannelGroupFlags groupFlags() const;
85 
86  bool groupCanAddContacts() const;
87  bool groupCanAddContactsWithMessage() const;
88  bool groupCanAcceptContactsWithMessage() const;
89  PendingOperation *groupAddContacts(const QList<ContactPtr> &contacts,
90  const QString &message = QString());
91  bool groupCanRescindContacts() const;
92  bool groupCanRescindContactsWithMessage() const;
93  bool groupCanRemoveContacts() const;
94  bool groupCanRemoveContactsWithMessage() const;
95  bool groupCanRejectContactsWithMessage() const;
96  bool groupCanDepartWithMessage() const;
97  PendingOperation *groupRemoveContacts(const QList<ContactPtr> &contacts,
98  const QString &message = QString(),
100 
101  Contacts groupContacts(bool includeSelfContact = true) const;
102  Contacts groupLocalPendingContacts(bool includeSelfContact = true) const;
103  Contacts groupRemotePendingContacts(bool includeSelfContact = true) const;
104 
106  {
107  public:
111 
112  GroupMemberChangeDetails &operator=(const GroupMemberChangeDetails &other);
113 
114  bool isValid() const { return mPriv.constData() != 0; }
115 
116  bool hasActor() const;
117  ContactPtr actor() const;
118 
119  bool hasReason() const { return allDetails().contains(QLatin1String("change-reason")); }
120  ChannelGroupChangeReason reason() const { return (ChannelGroupChangeReason) qdbus_cast<uint>(allDetails().value(QLatin1String("change-reason"))); }
121 
122  bool hasMessage() const { return allDetails().contains(QLatin1String("message")); }
123  QString message () const { return qdbus_cast<QString>(allDetails().value(QLatin1String("message"))); }
124 
125  bool hasError() const { return allDetails().contains(QLatin1String("error")); }
126  QString error() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("error"))); }
127 
128  bool hasDebugMessage() const { return allDetails().contains(QLatin1String("debug-message")); }
129  QString debugMessage() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("debug-message"))); }
130 
131  QVariantMap allDetails() const;
132 
133  private:
134  friend class Channel;
135  friend class Contact;
136  friend class ContactManager;
137 
138  TP_QT_NO_EXPORT GroupMemberChangeDetails(const ContactPtr &actor, const QVariantMap &details);
139 
140  struct Private;
141  friend struct Private;
142  QSharedDataPointer<Private> mPriv;
143  };
144 
145  GroupMemberChangeDetails groupLocalPendingContactChangeInfo(const ContactPtr &contact) const;
146  GroupMemberChangeDetails groupSelfContactRemoveInfo() const;
147 
148  bool groupAreHandleOwnersAvailable() const;
149  HandleOwnerMap groupHandleOwners() const;
150 
151  bool groupIsSelfContactTracked() const;
152  ContactPtr groupSelfContact() const;
153 
154  bool isConference() const;
155  Contacts conferenceInitialInviteeContacts() const;
156  QList<ChannelPtr> conferenceChannels() const;
157  QList<ChannelPtr> conferenceInitialChannels() const;
158  QHash<uint, ChannelPtr> conferenceOriginalChannels() const;
159 
160  bool supportsConferenceMerging() const;
161  PendingOperation *conferenceMergeChannel(const ChannelPtr &channel);
162 
163  bool supportsConferenceSplitting() const;
164  PendingOperation *conferenceSplitChannel();
165 
166 Q_SIGNALS:
167  void groupFlagsChanged(Tp::ChannelGroupFlags flags,
169 
170  void groupCanAddContactsChanged(bool canAddContacts);
171  void groupCanRemoveContactsChanged(bool canRemoveContacts);
172  void groupCanRescindContactsChanged(bool canRescindContacts);
173 
174  void groupMembersChanged(
175  const Tp::Contacts &groupMembersAdded,
176  const Tp::Contacts &groupLocalPendingMembersAdded,
177  const Tp::Contacts &groupRemotePendingMembersAdded,
178  const Tp::Contacts &groupMembersRemoved,
180 
181  void groupHandleOwnersChanged(const Tp::HandleOwnerMap &owners,
182  const Tp::UIntList &added, const Tp::UIntList &removed);
183 
184  void groupSelfContactChanged();
185 
186  void conferenceChannelMerged(const Tp::ChannelPtr &channel);
187  void conferenceChannelRemoved(const Tp::ChannelPtr &channel,
189 
190 protected:
191  Channel(const ConnectionPtr &connection,const QString &objectPath,
192  const QVariantMap &immutableProperties, const Feature &coreFeature);
193 
194  Client::ChannelInterface *baseInterface() const;
195 
196  bool groupSelfHandleIsLocalPending() const;
197 
198 protected Q_SLOTS:
199  PendingOperation *groupAddSelfHandle();
200 
201 private Q_SLOTS:
202  TP_QT_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
203  TP_QT_NO_EXPORT void gotChannelType(QDBusPendingCallWatcher *watcher);
204  TP_QT_NO_EXPORT void gotHandle(QDBusPendingCallWatcher *watcher);
205  TP_QT_NO_EXPORT void gotInterfaces(QDBusPendingCallWatcher *watcher);
206  TP_QT_NO_EXPORT void onClosed();
207 
208  TP_QT_NO_EXPORT void onConnectionReady(Tp::PendingOperation *op);
209  TP_QT_NO_EXPORT void onConnectionInvalidated();
210 
211  TP_QT_NO_EXPORT void gotGroupProperties(QDBusPendingCallWatcher *watcher);
212  TP_QT_NO_EXPORT void gotGroupFlags(QDBusPendingCallWatcher *watcher);
213  TP_QT_NO_EXPORT void gotAllMembers(QDBusPendingCallWatcher *watcher);
214  TP_QT_NO_EXPORT void gotLocalPendingMembersWithInfo(QDBusPendingCallWatcher *watcher);
215  TP_QT_NO_EXPORT void gotSelfHandle(QDBusPendingCallWatcher *watcher);
216  TP_QT_NO_EXPORT void gotContacts(Tp::PendingOperation *op);
217 
218  TP_QT_NO_EXPORT void onGroupFlagsChanged(uint added, uint removed);
219  TP_QT_NO_EXPORT void onMembersChanged(const QString &message,
220  const Tp::UIntList &added, const Tp::UIntList &removed,
221  const Tp::UIntList &localPending, const Tp::UIntList &remotePending,
222  uint actor, uint reason);
223  TP_QT_NO_EXPORT void onMembersChangedDetailed(
224  const Tp::UIntList &added, const Tp::UIntList &removed,
225  const Tp::UIntList &localPending, const Tp::UIntList &remotePending,
226  const QVariantMap &details);
227  TP_QT_NO_EXPORT void onHandleOwnersChanged(const Tp::HandleOwnerMap &added, const Tp::UIntList &removed);
228  TP_QT_NO_EXPORT void onSelfHandleChanged(uint selfHandle);
229 
230  TP_QT_NO_EXPORT void gotConferenceProperties(QDBusPendingCallWatcher *watcher);
231  TP_QT_NO_EXPORT void gotConferenceInitialInviteeContacts(Tp::PendingOperation *op);
232  TP_QT_NO_EXPORT void onConferenceChannelMerged(const QDBusObjectPath &channel, uint channelSpecificHandle,
233  const QVariantMap &properties);
234  TP_QT_NO_EXPORT void onConferenceChannelMerged(const QDBusObjectPath &channel);
235  TP_QT_NO_EXPORT void onConferenceChannelRemoved(const QDBusObjectPath &channel, const QVariantMap &details);
236  TP_QT_NO_EXPORT void onConferenceChannelRemoved(const QDBusObjectPath &channel);
237  TP_QT_NO_EXPORT void gotConferenceChannelRemovedActorContact(Tp::PendingOperation *op);
238 
239 private:
240  class PendingLeave;
241  friend class PendingLeave;
242 
243  struct Private;
244  friend struct Private;
245  Private *mPriv;
246 };
247 
248 } // Tp
249 
250 Q_DECLARE_METATYPE(Tp::Channel::GroupMemberChangeDetails);
251 
252 #endif
bool hasDebugMessage() const
Definition: channel.h:128
QString message() const
Definition: channel.h:123
The StatefulDBusProxy class is a base class representing a remote object whose API is stateful...
Definition: dbus-proxy.h:96
Definition: buildqt4/TelepathyQt/_gen/types.h:101
Definition: cli-channel.h:44
The Channel class represents a Telepathy channel.
Definition: channel.h:51
ChannelGroupChangeReason reason() const
Definition: channel.h:120
The Contact class represents a Telepathy contact.
Definition: contact.h:51
bool hasError() const
Definition: channel.h:125
bool hasReason() const
Definition: channel.h:119
bool isValid() const
Definition: channel.h:114
Definition: buildqt4/TelepathyQt/_gen/constants.h:3255
The OptionalInterfaceFactory class is a helper class for high-level D-Bus proxy classes willing to of...
Definition: optional-interface-factory.h:65
ChannelGroupChangeReason
Definition: buildqt4/TelepathyQt/_gen/constants.h:3234
The ContactManager class is responsible for managing contacts.
Definition: contact-manager.h:50
QString debugMessage() const
Definition: channel.h:129
static const Feature FeatureConferenceInitialInviteeContacts
Definition: channel.h:59
bool hasMessage() const
Definition: channel.h:122
QFlags< ChannelGroupFlag > ChannelGroupFlags
Definition: buildqt4/TelepathyQt/_gen/constants.h:1043
QString error() const
Definition: channel.h:126
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
The Channel::GroupMemberChangeDetails class represents the details of a group membership change...
Definition: channel.h:105
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45
Definition: buildqt4/TelepathyQt/_gen/types.h:1668
static const Feature FeatureCore
Definition: channel.h:58
HandleType
Definition: buildqt4/TelepathyQt/_gen/constants.h:1375


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.4