Home · All Classes · All Namespaces · Modules · Functions · Files
base-channel.h
1 
22 #ifndef _TelepathyQt_base_channel_h_HEADER_GUARD_
23 #define _TelepathyQt_base_channel_h_HEADER_GUARD_
24 
25 #ifndef IN_TP_QT_HEADER
26 #error IN_TP_QT_HEADER
27 #endif
28 
29 #include <TelepathyQt/DBusService>
30 #include <TelepathyQt/Global>
31 #include <TelepathyQt/Types>
32 #include <TelepathyQt/Callbacks>
33 #include <TelepathyQt/Constants>
34 
35 #include <QDBusConnection>
36 
37 class QString;
38 
39 namespace Tp
40 {
41 
42 class BaseChannel : public DBusService
43 {
44  Q_OBJECT
45  Q_DISABLE_COPY(BaseChannel)
46 
47 public:
48  static BaseChannelPtr create(BaseConnection* connection, const QString &channelType,
49  uint targetHandle, uint targetHandleType) {
50  return BaseChannelPtr(new BaseChannel(QDBusConnection::sessionBus(), connection,
51  channelType, targetHandle, targetHandleType));
52  }
53 
54  virtual ~BaseChannel();
55 
56  QVariantMap immutableProperties() const;
57  bool registerObject(DBusError *error = NULL);
58  virtual QString uniqueName() const;
59 
60  QString channelType() const;
61  QList<AbstractChannelInterfacePtr> interfaces() const;
62  AbstractChannelInterfacePtr interface(const QString &interfaceName) const;
63  uint targetHandle() const;
64  QString targetID() const;
65  uint targetHandleType() const;
66  bool requested() const;
67  uint initiatorHandle() const;
68  QString initiatorID() const;
70 
72  void setInitiatorID(const QString &initiatorID);
73  void setTargetID(const QString &targetID);
74  void setRequested(bool requested);
75 
76  void close();
77 
78  bool plugInterface(const AbstractChannelInterfacePtr &interface);
79 
80 Q_SIGNALS:
81  void closed();
82 protected:
83  BaseChannel(const QDBusConnection &dbusConnection, BaseConnection* connection,
84  const QString &channelType, uint targetHandle, uint targetHandleType);
85  virtual bool registerObject(const QString &busName, const QString &objectPath,
86  DBusError *error);
87 private:
88  class Adaptee;
89  friend class Adaptee;
90  class Private;
91  friend class Private;
92  Private *mPriv;
93 };
94 
96 {
97  Q_OBJECT
98  Q_DISABLE_COPY(AbstractChannelInterface)
99 
100 public:
101  AbstractChannelInterface(const QString &interfaceName);
102  virtual ~AbstractChannelInterface();
103 
104 private:
105  friend class BaseChannel;
106 
107  class Private;
108  friend class Private;
109  Private *mPriv;
110 };
111 
113 {
114  Q_OBJECT
115  Q_DISABLE_COPY(BaseChannelTextType)
116 
117 public:
118  static BaseChannelTextTypePtr create(BaseChannel* channel) {
119  return BaseChannelTextTypePtr(new BaseChannelTextType(channel));
120  }
121  template<typename BaseChannelTextTypeSubclass>
124  new BaseChannelTextTypeSubclass(channel));
125  }
126 
129 
132 
133  virtual ~BaseChannelTextType();
134 
135  QVariantMap immutableProperties() const;
136 
138 
140  void setMessageAcknowledgedCallback(const MessageAcknowledgedCallback &cb);
141 
142  Tp::MessagePartListList pendingMessages();
143 
144  /* Convenience function */
145  void addReceivedMessage(const Tp::MessagePartList &message);
146 private Q_SLOTS:
147  void sent(uint timestamp, uint type, QString text);
148 protected:
150  void acknowledgePendingMessages(const Tp::UIntList &IDs, DBusError* error);
151 
152 private:
153  void createAdaptor();
154 
155  class Adaptee;
156  friend class Adaptee;
157  struct Private;
158  friend struct Private;
159  Private *mPriv;
160 };
161 
163 {
164  Q_OBJECT
165  Q_DISABLE_COPY(BaseChannelMessagesInterface)
166 
167 public:
168  static BaseChannelMessagesInterfacePtr create(BaseChannelTextType* textTypeInterface,
169  QStringList supportedContentTypes,
170  UIntList messageTypes,
171  uint messagePartSupportFlags,
172  uint deliveryReportingSupport) {
173  return BaseChannelMessagesInterfacePtr(new BaseChannelMessagesInterface(textTypeInterface,
174  supportedContentTypes,
175  messageTypes,
176  messagePartSupportFlags,
177  deliveryReportingSupport));
178  }
179  template<typename BaseChannelMessagesInterfaceSubclass>
182  new BaseChannelMessagesInterfaceSubclass());
183  }
184  virtual ~BaseChannelMessagesInterface();
185 
186  QVariantMap immutableProperties() const;
187 
188  QStringList supportedContentTypes();
189  Tp::UIntList messageTypes();
190  uint messagePartSupportFlags();
191  uint deliveryReportingSupport();
192  Tp::MessagePartListList pendingMessages();
193 
194  void messageSent(const Tp::MessagePartList &content, uint flags, const QString &messageToken);
195 
197  void setSendMessageCallback(const SendMessageCallback &cb);
198 protected:
199  QString sendMessage(const Tp::MessagePartList &message, uint flags, DBusError* error);
200 private Q_SLOTS:
201  void pendingMessagesRemoved(const Tp::UIntList &messageIDs);
202  void messageReceived(const Tp::MessagePartList &message);
203 private:
205  QStringList supportedContentTypes,
206  Tp::UIntList messageTypes,
207  uint messagePartSupportFlags,
208  uint deliveryReportingSupport);
209  void createAdaptor();
210 
211  class Adaptee;
212  friend class Adaptee;
213  struct Private;
214  friend struct Private;
215  Private *mPriv;
216 };
217 
219 {
220  Q_OBJECT
222 
223 public:
224  static BaseChannelServerAuthenticationTypePtr create(const QString &authenticationMethod) {
225  return BaseChannelServerAuthenticationTypePtr(new BaseChannelServerAuthenticationType(authenticationMethod));
226  }
227  template<typename BaseChannelServerAuthenticationTypeSubclass>
228  static SharedPtr<BaseChannelServerAuthenticationTypeSubclass> create(const QString &authenticationMethod) {
230  new BaseChannelServerAuthenticationTypeSubclass(authenticationMethod));
231  }
233 
234  QVariantMap immutableProperties() const;
235 private Q_SLOTS:
236 private:
237  BaseChannelServerAuthenticationType(const QString &authenticationMethod);
238  void createAdaptor();
239 
240  class Adaptee;
241  friend class Adaptee;
242  struct Private;
243  friend struct Private;
244  Private *mPriv;
245 };
246 
248 {
249  Q_OBJECT
251 
252 public:
253  static BaseChannelCaptchaAuthenticationInterfacePtr create(bool canRetryCaptcha) {
254  return BaseChannelCaptchaAuthenticationInterfacePtr(new BaseChannelCaptchaAuthenticationInterface(canRetryCaptcha));
255  }
256  template<typename BaseChannelCaptchaAuthenticationInterfaceSubclass>
259  new BaseChannelCaptchaAuthenticationInterfaceSubclass(canRetryCaptcha));
260  }
262 
263  QVariantMap immutableProperties() const;
264 
266  void setGetCaptchasCallback(const GetCaptchasCallback &cb);
267 
269  void setGetCaptchaDataCallback(const GetCaptchaDataCallback &cb);
270 
272  void setAnswerCaptchasCallback(const AnswerCaptchasCallback &cb);
273 
275  void setCancelCaptchaCallback(const CancelCaptchaCallback &cb);
276 
277  void setCaptchaStatus(uint status);
278  void setCaptchaError(const QString &busName);
279  void setCaptchaErrorDetails(const QVariantMap &error);
280 private Q_SLOTS:
281 private:
282  BaseChannelCaptchaAuthenticationInterface(bool canRetryCaptcha);
283  void createAdaptor();
284 
285  class Adaptee;
286  friend class Adaptee;
287  struct Private;
288  friend struct Private;
289  Private *mPriv;
290 };
291 
293 {
294  Q_OBJECT
296 
297 public:
298  static BaseChannelSASLAuthenticationInterfacePtr create(const QStringList &availableMechanisms,
299  bool hasInitialData,
300  bool canTryAgain,
301  const QString &authorizationIdentity,
302  const QString &defaultUsername,
303  const QString &defaultRealm,
304  bool maySaveResponse)
305  {
306  return BaseChannelSASLAuthenticationInterfacePtr(new BaseChannelSASLAuthenticationInterface(availableMechanisms,
307  hasInitialData,
308  canTryAgain,
309  authorizationIdentity,
310  defaultUsername,
311  defaultRealm,
312  maySaveResponse));
313  }
314  template<typename BaseChannelSASLAuthenticationInterfaceSubclass>
315  static SharedPtr<BaseChannelSASLAuthenticationInterfaceSubclass> create(const QStringList &availableMechanisms,
316  bool hasInitialData,
317  bool canTryAgain,
318  const QString &authorizationIdentity,
319  const QString &defaultUsername,
320  const QString &defaultRealm,
321  bool maySaveResponse)
322  {
324  new BaseChannelSASLAuthenticationInterfaceSubclass(availableMechanisms,
325  hasInitialData,
326  canTryAgain,
327  authorizationIdentity,
328  defaultUsername,
329  defaultRealm,
330  maySaveResponse));
331  }
332 
334 
335  QVariantMap immutableProperties() const;
336 
337  QStringList availableMechanisms() const;
338  bool hasInitialData() const;
339  bool canTryAgain() const;
340  QString authorizationIdentity() const;
341  QString defaultUsername() const;
342  QString defaultRealm() const;
343  bool maySaveResponse() const;
344 
345  uint saslStatus() const;
346  void setSaslStatus(uint status, const QString &reason, const QVariantMap &details);
347 
348  QString saslError() const;
349  void setSaslError(const QString &saslError);
350 
351  QVariantMap saslErrorDetails() const;
352  void setSaslErrorDetails(const QVariantMap &saslErrorDetails);
353 
355  void setStartMechanismCallback(const StartMechanismCallback &cb);
356  void startMechanism(const QString &mechanism, DBusError *error);
357 
359  void setStartMechanismWithDataCallback(const StartMechanismWithDataCallback &cb);
360  void startMechanismWithData(const QString &mechanism, const QByteArray &initialData, DBusError *error);
361 
363  void setRespondCallback(const RespondCallback &cb);
364  void respond(const QByteArray &responseData, DBusError *error);
365 
367  void setAcceptSaslCallback(const AcceptSASLCallback &cb);
368  void acceptSasl(DBusError *error);
369 
371  void setAbortSaslCallback(const AbortSASLCallback &cb);
372  void abortSasl(uint reason, const QString &debugMessage, DBusError *error);
373 
374  void newChallenge(const QByteArray &challengeData);
375 
376 protected:
377  BaseChannelSASLAuthenticationInterface(const QStringList &availableMechanisms,
378  bool hasInitialData,
379  bool canTryAgain,
380  const QString &authorizationIdentity,
381  const QString &defaultUsername,
382  const QString &defaultRealm,
383  bool maySaveResponse);
384 
385 private:
386  void createAdaptor();
387 
388  class Adaptee;
389  friend class Adaptee;
390  struct Private;
391  friend struct Private;
392  Private *mPriv;
393 };
394 
396 {
397  Q_OBJECT
398  Q_DISABLE_COPY(BaseChannelSecurableInterface)
399 
400 public:
401  static BaseChannelSecurableInterfacePtr create()
402  {
403  return BaseChannelSecurableInterfacePtr(new BaseChannelSecurableInterface());
404  }
405  template<typename BaseChannelSecurableInterfaceSubclass>
407  {
409  new BaseChannelSecurableInterfaceSubclass());
410  }
411 
413 
414  QVariantMap immutableProperties() const;
415 
416  bool encrypted() const;
417  void setEncrypted(bool encrypted);
418 
419  bool verified() const;
420  void setVerified(bool verified);
421 
422 protected:
424 
425 private:
426  void createAdaptor();
427 
428  class Adaptee;
429  friend class Adaptee;
430  struct Private;
431  friend struct Private;
432  Private *mPriv;
433 };
434 
436 {
437  Q_OBJECT
438  Q_DISABLE_COPY(BaseChannelChatStateInterface)
439 
440 public:
441  static BaseChannelChatStateInterfacePtr create()
442  {
443  return BaseChannelChatStateInterfacePtr(new BaseChannelChatStateInterface());
444  }
445  template<typename BaseChannelChatStateInterfaceSubclass>
447  {
449  new BaseChannelChatStateInterfaceSubclass());
450  }
451 
453 
454  QVariantMap immutableProperties() const;
455 
456  Tp::ChatStateMap chatStates() const;
457  void setChatStates(const Tp::ChatStateMap &chatStates);
458 
460  void setSetChatStateCallback(const SetChatStateCallback &cb);
461  void setChatState(uint state, DBusError *error);
462 
463  void chatStateChanged(uint contact, uint state);
464 
465 protected:
467 
468 private:
469  void createAdaptor();
470 
471  class Adaptee;
472  friend class Adaptee;
473  struct Private;
474  friend struct Private;
475  Private *mPriv;
476 };
477 
479 {
480  Q_OBJECT
481  Q_DISABLE_COPY(BaseChannelGroupInterface)
482 
483 public:
484  static BaseChannelGroupInterfacePtr create(ChannelGroupFlags initialFlags, uint selfHandle) {
485  return BaseChannelGroupInterfacePtr(new BaseChannelGroupInterface(initialFlags, selfHandle));
486  }
487  template<typename BaseChannelGroupInterfaceSubclass>
490  new BaseChannelGroupInterfaceSubclass(initialFlags, selfHandle));
491  }
492  virtual ~BaseChannelGroupInterface();
493 
494  QVariantMap immutableProperties() const;
495 
497  void setRemoveMembersCallback(const RemoveMembersCallback &cb);
498 
500  void setAddMembersCallback(const AddMembersCallback &cb);
501 
502  /* Adds a contact to this group. No-op if already in this group */
503  void addMembers(const Tp::UIntList &handles, const QStringList &identifiers);
504  void removeMembers(const Tp::UIntList &handles);
505 
506 private Q_SLOTS:
507 private:
508  BaseChannelGroupInterface(ChannelGroupFlags initialFlags, uint selfHandle);
509  void createAdaptor();
510 
511  class Adaptee;
512  friend class Adaptee;
513  struct Private;
514  friend struct Private;
515  Private *mPriv;
516 };
517 
518 }
519 #endif
Base class for implementations of Channel.Interface.CaptchaAuthentication.
Definition: base-channel.h:247
static SharedPtr< BaseChannelSecurableInterfaceSubclass > create()
Definition: base-channel.h:406
void setInitiatorID(const QString &initiatorID)
Definition: base-channel.cpp:223
Callback2< QDBusObjectPath, const QVariantMap &, DBusError * > CreateChannelCallback
Definition: base-channel.h:127
Callback3< void, const QString &, const QByteArray &, DBusError * > StartMechanismWithDataCallback
Definition: base-channel.h:358
Base class for Connection implementations.
Definition: base-connection.h:43
void setRequested(bool requested)
Definition: base-channel.cpp:233
Definition: buildqt4/TelepathyQt/_gen/types.h:752
static SharedPtr< BaseChannelMessagesInterfaceSubclass > create()
Definition: base-channel.h:180
Callback2< void, const QByteArray &, DBusError * > RespondCallback
Definition: base-channel.h:362
BaseChannel(const QDBusConnection &dbusConnection, BaseConnection *connection, const QString &channelType, uint targetHandle, uint targetHandleType)
Definition: base-channel.cpp:118
bool plugInterface(const AbstractChannelInterfacePtr &interface)
Definition: base-channel.cpp:314
QVariantMap immutableProperties() const
Definition: base-channel.cpp:253
QList< MessagePart > MessagePartList
Definition: buildqt4/TelepathyQt/_gen/types.h:2031
Callback2< bool, const QVariantMap &, DBusError * > EnsureChannelCallback
Definition: base-channel.h:130
CreateChannelCallback createChannel
Definition: base-channel.h:128
Callback2< void, uint, DBusError * > SetChatStateCallback
Definition: base-channel.h:459
static BaseChannelSecurableInterfacePtr create()
Definition: base-channel.h:401
Base class for D-Bus services.
Definition: dbus-service.h:46
Definition: buildqt4/TelepathyQt/_gen/types.h:101
static SharedPtr< BaseChannelTextTypeSubclass > create(BaseChannel *channel)
Definition: base-channel.h:122
Base class for implementations of Channel.Interface.Messages.
Definition: base-channel.h:162
Callback1< void, DBusError * > AcceptSASLCallback
Definition: base-channel.h:366
QDBusConnection dbusConnection() const
Definition: dbus-service.cpp:88
uint targetHandle() const
Definition: base-channel.cpp:193
Callback3< void, const Tp::UIntList &, const QString &, DBusError * > AddMembersCallback
Definition: base-channel.h:499
Base class for implementations of Channel.Type.ServerAuthentifcation.
Definition: base-channel.h:218
static SharedPtr< BaseChannelServerAuthenticationTypeSubclass > create(const QString &authenticationMethod)
Definition: base-channel.h:228
virtual QString uniqueName() const
Definition: base-channel.cpp:141
QString objectPath() const
Definition: dbus-service.cpp:114
static BaseChannelSASLAuthenticationInterfacePtr create(const QStringList &availableMechanisms, bool hasInitialData, bool canTryAgain, const QString &authorizationIdentity, const QString &defaultUsername, const QString &defaultRealm, bool maySaveResponse)
Definition: base-channel.h:298
Callback1< void, QString > MessageAcknowledgedCallback
Definition: base-channel.h:139
virtual ~BaseChannel()
Definition: base-channel.cpp:131
Callback2< void, const QString &, DBusError * > StartMechanismCallback
Definition: base-channel.h:354
QList< AbstractChannelInterfacePtr > interfaces() const
Definition: base-channel.cpp:189
uint initiatorHandle() const
Definition: base-channel.cpp:209
Callback3< void, const Tp::UIntList &, const QString &, DBusError * > RemoveMembersCallback
Definition: base-channel.h:496
QString busName() const
Definition: dbus-service.cpp:101
static BaseChannelMessagesInterfacePtr create(BaseChannelTextType *textTypeInterface, QStringList supportedContentTypes, UIntList messageTypes, uint messagePartSupportFlags, uint deliveryReportingSupport)
Definition: base-channel.h:168
Callback3< void, uint, const QString &, DBusError * > CancelCaptchaCallback
Definition: base-channel.h:274
Base class for implementations of Channel.Interface.Group.
Definition: base-channel.h:478
Tp::ChannelDetails details() const
Definition: base-channel.cpp:275
Base class for implementations of Channel.Type.Text.
Definition: base-channel.h:112
static SharedPtr< BaseChannelSASLAuthenticationInterfaceSubclass > create(const QStringList &availableMechanisms, bool hasInitialData, bool canTryAgain, const QString &authorizationIdentity, const QString &defaultUsername, const QString &defaultRealm, bool maySaveResponse)
Definition: base-channel.h:315
static BaseChannelCaptchaAuthenticationInterfacePtr create(bool canRetryCaptcha)
Definition: base-channel.h:253
Callback2< void, const Tp::CaptchaAnswers &, DBusError * > AnswerCaptchasCallback
Definition: base-channel.h:271
Small container class, containing a D-Bus error.
Definition: dbus-error.h:35
Definition: buildqt4/TelepathyQt/_gen/types.h:907
EnsureChannelCallback ensureChannel
Definition: base-channel.h:131
static BaseChannelServerAuthenticationTypePtr create(const QString &authenticationMethod)
Definition: base-channel.h:224
void setTargetID(const QString &targetID)
Definition: base-channel.cpp:228
QString channelType() const
Definition: base-channel.cpp:185
Base class for D-Bus service interfaces.
Definition: dbus-service.h:73
friend class Adaptee
Definition: base-channel.h:88
Callback3< void, uint, const QString &, DBusError * > AbortSASLCallback
Definition: base-channel.h:370
QFlags< ChannelGroupFlag > ChannelGroupFlags
Definition: buildqt4/TelepathyQt/_gen/constants.h:1043
QList< MessagePartList > MessagePartListList
Definition: buildqt4/TelepathyQt/_gen/types.h:2039
Base class for implementations of Channel.Interface.Securable.
Definition: base-channel.h:395
friend class Private
Definition: base-channel.h:90
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
Tp::RequestableChannelClassList requestableChannelClasses
Definition: base-channel.h:137
static BaseChannelTextTypePtr create(BaseChannel *channel)
Definition: base-channel.h:118
Base class for all the Channel object interface implementations.
Definition: base-channel.h:95
static BaseChannelPtr create(BaseConnection *connection, const QString &channelType, uint targetHandle, uint targetHandleType)
Definition: base-channel.h:48
Base class for implementations of Channel.Interface.Chat.State.
Definition: base-channel.h:435
static SharedPtr< BaseChannelChatStateInterfaceSubclass > create()
Definition: base-channel.h:446
void setInitiatorHandle(uint initiatorHandle)
Definition: base-channel.cpp:218
Base class for channel implementations.
Definition: base-channel.h:42
void close()
Definition: base-channel.cpp:238
uint targetHandleType() const
Definition: base-channel.cpp:201
AbstractChannelInterfacePtr interface(const QString &interfaceName) const
Definition: base-channel.cpp:298
bool registerObject(DBusError *error=NULL)
Definition: base-channel.cpp:146
bool requested() const
Definition: base-channel.cpp:205
QList< RequestableChannelClass > RequestableChannelClassList
Definition: buildqt4/TelepathyQt/_gen/types.h:2621
Callback4< void, Tp::CaptchaInfoList &, uint &, QString &, DBusError * > GetCaptchasCallback
Definition: base-channel.h:265
Base class for implementations of Channel.Interface.SASLAuthentication.
Definition: base-channel.h:292
QString targetID() const
Definition: base-channel.cpp:197
Callback3< QByteArray, uint, const QString &, DBusError * > GetCaptchaDataCallback
Definition: base-channel.h:268
static BaseChannelGroupInterfacePtr create(ChannelGroupFlags initialFlags, uint selfHandle)
Definition: base-channel.h:484
QString initiatorID() const
Definition: base-channel.cpp:213
static BaseChannelChatStateInterfacePtr create()
Definition: base-channel.h:441
static SharedPtr< BaseChannelGroupInterfaceSubclass > create(ChannelGroupFlags initialFlags, uint selfHandle)
Definition: base-channel.h:488
static SharedPtr< BaseChannelCaptchaAuthenticationInterfaceSubclass > create(bool canRetryCaptcha)
Definition: base-channel.h:257
Callback3< QString, const Tp::MessagePartList &, uint, DBusError * > SendMessageCallback
Definition: base-channel.h:196


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