Home · All Classes · All Namespaces · Modules · Functions · Files
base-protocol.h
1 
23 #ifndef _TelepathyQt_base_protocol_h_HEADER_GUARD_
24 #define _TelepathyQt_base_protocol_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/AvatarSpec>
31 #include <TelepathyQt/Callbacks>
32 #include <TelepathyQt/DBusService>
33 #include <TelepathyQt/Global>
34 #include <TelepathyQt/PresenceSpecList>
35 #include <TelepathyQt/ProtocolParameterList>
36 #include <TelepathyQt/RequestableChannelClassSpecList>
37 #include <TelepathyQt/Types>
38 
39 #include <QDBusConnection>
40 
41 class QString;
42 class QStringList;
43 
44 namespace Tp
45 {
46 
47 class TP_QT_EXPORT BaseProtocol : public DBusService
48 {
49  Q_OBJECT
50  Q_DISABLE_COPY(BaseProtocol)
51 
52 public:
53  static BaseProtocolPtr create(const QString &name)
54  {
55  return BaseProtocolPtr(new BaseProtocol(QDBusConnection::sessionBus(), name));
56  }
57  template<typename BaseProtocolSubclass>
58  static SharedPtr<BaseProtocolSubclass> create(const QString &name)
59  {
60  return SharedPtr<BaseProtocolSubclass>(new BaseProtocolSubclass(
61  QDBusConnection::sessionBus(), name));
62  }
63  static BaseProtocolPtr create(const QDBusConnection &dbusConnection, const QString &name)
64  {
65  return BaseProtocolPtr(new BaseProtocol(dbusConnection, name));
66  }
67  template<typename BaseProtocolSubclass>
68  static SharedPtr<BaseProtocolSubclass> create(const QDBusConnection &dbusConnection,
69  const QString &name)
70  {
71  return SharedPtr<BaseProtocolSubclass>(new BaseProtocolSubclass(dbusConnection, name));
72  }
73 
74  virtual ~BaseProtocol();
75 
76  QString name() const;
77 
78  QVariantMap immutableProperties() const;
79 
80  // Proto
81  QStringList connectionInterfaces() const;
82  void setConnectionInterfaces(const QStringList &connInterfaces);
83 
84  ProtocolParameterList parameters() const;
85  void setParameters(const ProtocolParameterList &parameters);
86 
87  RequestableChannelClassSpecList requestableChannelClasses() const;
88  void setRequestableChannelClasses(const RequestableChannelClassSpecList &rccSpecs);
89 
90  QString vcardField() const;
91  void setVCardField(const QString &vcardField);
92 
93  QString englishName() const;
94  void setEnglishName(const QString &englishName);
95 
96  QString iconName() const;
97  void setIconName(const QString &iconName);
98 
99  QStringList authenticationTypes() const;
100  void setAuthenticationTypes(const QStringList &authenticationTypes);
101 
103  void setCreateConnectionCallback(const CreateConnectionCallback &cb);
104  Tp::BaseConnectionPtr createConnection(const QVariantMap &parameters, DBusError *error);
105 
107  void setIdentifyAccountCallback(const IdentifyAccountCallback &cb);
108  QString identifyAccount(const QVariantMap &parameters, DBusError *error);
109 
111  void setNormalizeContactCallback(const NormalizeContactCallback &cb);
112  QString normalizeContact(const QString &contactId, DBusError *error);
113 
114  QList<AbstractProtocolInterfacePtr> interfaces() const;
115  AbstractProtocolInterfacePtr interface(const QString & interfaceName) const;
116  bool plugInterface(const AbstractProtocolInterfacePtr &interface);
117 
118 protected:
119  BaseProtocol(const QDBusConnection &dbusConnection, const QString &name);
120 
121  virtual bool registerObject(const QString &busName, const QString &objectPath,
122  DBusError *error);
123 
124 private:
125  friend class BaseConnectionManager;
126  class Adaptee;
127  friend class Adaptee;
128  class Private;
129  friend class Private;
130  Private *mPriv;
131 };
132 
134 {
135  Q_OBJECT
136  Q_DISABLE_COPY(AbstractProtocolInterface)
137 
138 public:
139  AbstractProtocolInterface(const QString &interfaceName);
140  virtual ~AbstractProtocolInterface();
141 
142 private:
143  friend class BaseProtocol;
144 
145  class Private;
146  friend class Private;
147  Private *mPriv;
148 };
149 
151 {
152  Q_OBJECT
153  Q_DISABLE_COPY(BaseProtocolAddressingInterface)
154 
155 public:
156  static BaseProtocolAddressingInterfacePtr create()
157  {
158  return BaseProtocolAddressingInterfacePtr(new BaseProtocolAddressingInterface());
159  }
160  template<typename BaseProtocolAddressingInterfaceSubclass>
162  {
164  new BaseProtocolAddressingInterfaceSubclass());
165  }
166 
168 
169  QVariantMap immutableProperties() const;
170 
171  QStringList addressableVCardFields() const;
172  void setAddressableVCardFields(const QStringList &vcardFields);
173 
174  QStringList addressableUriSchemes() const;
175  void setAddressableUriSchemes(const QStringList &uriSchemes);
176 
178  void setNormalizeVCardAddressCallback(const NormalizeVCardAddressCallback &cb);
179  QString normalizeVCardAddress(const QString &vcardField, const QString &vcardAddress, DBusError *error);
180 
182  void setNormalizeContactUriCallback(const NormalizeContactUriCallback &cb);
183  QString normalizeContactUri(const QString &uri, DBusError *error);
184 
185 protected:
187 
188 private:
189  void createAdaptor();
190 
191  class Adaptee;
192  friend class Adaptee;
193  struct Private;
194  friend struct Private;
195  Private *mPriv;
196 };
197 
199 {
200  Q_OBJECT
201  Q_DISABLE_COPY(BaseProtocolAvatarsInterface)
202 
203 public:
204  static BaseProtocolAvatarsInterfacePtr create()
205  {
206  return BaseProtocolAvatarsInterfacePtr(new BaseProtocolAvatarsInterface());
207  }
208  template<typename BaseProtocolAvatarsInterfaceSubclass>
210  {
212  new BaseProtocolAvatarsInterfaceSubclass());
213  }
214 
215  virtual ~BaseProtocolAvatarsInterface();
216 
217  QVariantMap immutableProperties() const;
218 
219  AvatarSpec avatarDetails() const;
220  void setAvatarDetails(const AvatarSpec &spec);
221 
222 protected:
224 
225 private:
226  void createAdaptor();
227 
228  class Adaptee;
229  friend class Adaptee;
230  struct Private;
231  friend struct Private;
232  Private *mPriv;
233 };
234 
236 {
237  Q_OBJECT
238  Q_DISABLE_COPY(BaseProtocolPresenceInterface)
239 
240 public:
241  static BaseProtocolPresenceInterfacePtr create()
242  {
243  return BaseProtocolPresenceInterfacePtr(new BaseProtocolPresenceInterface());
244  }
245  template<typename BaseProtocolPresenceInterfaceSubclass>
247  {
249  new BaseProtocolPresenceInterfaceSubclass());
250  }
251 
253 
254  QVariantMap immutableProperties() const;
255 
256  PresenceSpecList statuses() const;
257  void setStatuses(const PresenceSpecList &statuses);
258 
259 protected:
261 
262 private:
263  void createAdaptor();
264 
265  class Adaptee;
266  friend class Adaptee;
267  struct Private;
268  friend struct Private;
269  Private *mPriv;
270 };
271 
272 }
273 
274 #endif
static SharedPtr< BaseProtocolPresenceInterfaceSubclass > create()
Definition: base-protocol.h:246
Base class for all the Protocol object interface implementations.
Definition: base-protocol.h:133
static SharedPtr< BaseProtocolAvatarsInterfaceSubclass > create()
Definition: base-protocol.h:209
static BaseProtocolAvatarsInterfacePtr create()
Definition: base-protocol.h:204
The AvatarSpec class represents a Telepathy avatar information supported by a protocol.
Definition: avatar.h:51
static BaseProtocolPtr create(const QDBusConnection &dbusConnection, const QString &name)
Definition: base-protocol.h:63
Callback3< QString, const QString &, const QString &, DBusError * > NormalizeVCardAddressCallback
Definition: base-protocol.h:177
Base class for D-Bus services.
Definition: dbus-service.h:46
Base class for D-Bus service interfaces.
Definition: dbus-service.h:73
Base class for implementations of Protocol.Interface.Avatars.
Definition: base-protocol.h:198
static BaseProtocolAddressingInterfacePtr create()
Definition: base-protocol.h:156
Callback2< QString, const QVariantMap &, DBusError * > IdentifyAccountCallback
Definition: base-protocol.h:106
Small container class, containing a D-Bus error.
Definition: dbus-error.h:35
Callback2< QString, const QString &, DBusError * > NormalizeContactCallback
Definition: base-protocol.h:110
static SharedPtr< BaseProtocolAddressingInterfaceSubclass > create()
Definition: base-protocol.h:161
QList< ProtocolParameter > ProtocolParameterList
Definition: protocol-parameter.h:85
Base class for implementations of Protocol.Interface.Addressing.
Definition: base-protocol.h:150
static SharedPtr< BaseProtocolSubclass > create(const QDBusConnection &dbusConnection, const QString &name)
Definition: base-protocol.h:68
Callback2< BaseConnectionPtr, const QVariantMap &, DBusError * > CreateConnectionCallback
Definition: base-protocol.h:102
Callback2< QString, const QString &, DBusError * > NormalizeContactUriCallback
Definition: base-protocol.h:181
The PresenceSpecList class represents a list of PresenceSpec.
Definition: presence.h:125
static SharedPtr< BaseProtocolSubclass > create(const QString &name)
Definition: base-protocol.h:58
Base class for connection manager implementations.
Definition: base-connection-manager.h:41
static BaseProtocolPtr create(const QString &name)
Definition: base-protocol.h:53
static BaseProtocolPresenceInterfacePtr create()
Definition: base-protocol.h:241
Definition: abstract-adaptor.cpp:31
Base class for protocol implementations.
Definition: base-protocol.h:47
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
The RequestableChannelClassSpecList class represents a list of RequestableChannelClassSpec.
Definition: requestable-channel-class-spec.h:101
Base class for implementations of Protocol.Interface.Presence.
Definition: base-protocol.h:235


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