base-protocol.h Source File

| 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
102 typedef Callback2<BaseConnectionPtr, const QVariantMap &, DBusError*> CreateConnectionCallback;
103 void setCreateConnectionCallback(const CreateConnectionCallback &cb);
104 Tp::BaseConnectionPtr createConnection(const QVariantMap &parameters, DBusError *error);
105
106 typedef Callback2<QString, const QVariantMap &, DBusError*> IdentifyAccountCallback;
107 void setIdentifyAccountCallback(const IdentifyAccountCallback &cb);
108 QString identifyAccount(const QVariantMap &parameters, DBusError *error);
109
110 typedef Callback2<QString, const QString &, DBusError*> NormalizeContactCallback;
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
133 class TP_QT_EXPORT AbstractProtocolInterface : public AbstractDBusServiceInterface
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
150 class TP_QT_EXPORT BaseProtocolAddressingInterface : public AbstractProtocolInterface
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>
161 static SharedPtr<BaseProtocolAddressingInterfaceSubclass> create()
162 {
163 return SharedPtr<BaseProtocolAddressingInterfaceSubclass>(
164 new BaseProtocolAddressingInterfaceSubclass());
165 }
166
167 virtual ~BaseProtocolAddressingInterface();
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
177 typedef Callback3<QString, const QString &, const QString &, DBusError*> NormalizeVCardAddressCallback;
178 void setNormalizeVCardAddressCallback(const NormalizeVCardAddressCallback &cb);
179 QString normalizeVCardAddress(const QString &vcardField, const QString &vcardAddress, DBusError *error);
180
181 typedef Callback2<QString, const QString &, DBusError*> NormalizeContactUriCallback;
182 void setNormalizeContactUriCallback(const NormalizeContactUriCallback &cb);
183 QString normalizeContactUri(const QString &uri, DBusError *error);
184
185 protected:
186 BaseProtocolAddressingInterface();
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
198 class TP_QT_EXPORT BaseProtocolAvatarsInterface : public AbstractProtocolInterface
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>
209 static SharedPtr<BaseProtocolAvatarsInterfaceSubclass> create()
210 {
211 return SharedPtr<BaseProtocolAvatarsInterfaceSubclass>(
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:
223 BaseProtocolAvatarsInterface();
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
235 class TP_QT_EXPORT BaseProtocolPresenceInterface : public AbstractProtocolInterface
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>
246 static SharedPtr<BaseProtocolPresenceInterfaceSubclass> create()
247 {
248 return SharedPtr<BaseProtocolPresenceInterfaceSubclass>(
249 new BaseProtocolPresenceInterfaceSubclass());
250 }
251
252 virtual ~BaseProtocolPresenceInterface();
253
254 QVariantMap immutableProperties() const;
255
256 PresenceSpecList statuses() const;
257 void setStatuses(const PresenceSpecList &statuses);
258
259 protected:
260 BaseProtocolPresenceInterface();
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
Tp::BaseProtocol::create
static BaseProtocolPtr create(const QDBusConnection &dbusConnection, const QString &name)
Definition: base-protocol.h:63
Tp::BaseProtocolAddressingInterface::create
static SharedPtr< BaseProtocolAddressingInterfaceSubclass > create()
Definition: base-protocol.h:161
Tp::BaseConnectionManager
Base class for connection manager implementations.
Definition: base-connection-manager.h:41
Tp::AbstractDBusServiceInterface
Base class for D-Bus service interfaces.
Definition: dbus-service.h:73
Tp::AvatarSpec
The AvatarSpec class represents a Telepathy avatar information supported by a protocol.
Definition: avatar.h:51
Tp::ProtocolParameterList
QList< ProtocolParameter > ProtocolParameterList
Definition: protocol-parameter.h:85
Tp::BaseProtocol
Base class for protocol implementations.
Definition: base-protocol.h:47
Tp::BaseProtocolPresenceInterface::create
static BaseProtocolPresenceInterfacePtr create()
Definition: base-protocol.h:241
Tp::BaseProtocolAddressingInterface::NormalizeContactUriCallback
Callback2< QString, const QString &, DBusError * > NormalizeContactUriCallback
Definition: base-protocol.h:181
Tp::BaseProtocolPresenceInterface
Base class for implementations of Protocol.Interface.Presence.
Definition: base-protocol.h:235
Tp::BaseProtocolAddressingInterface::NormalizeVCardAddressCallback
Callback3< QString, const QString &, const QString &, DBusError * > NormalizeVCardAddressCallback
Definition: base-protocol.h:177
Tp::Callback3< QString, const QString &, const QString &, DBusError * >
Tp::BaseProtocol::CreateConnectionCallback
Callback2< BaseConnectionPtr, const QVariantMap &, DBusError * > CreateConnectionCallback
Definition: base-protocol.h:102
Tp::BaseProtocol::IdentifyAccountCallback
Callback2< QString, const QVariantMap &, DBusError * > IdentifyAccountCallback
Definition: base-protocol.h:106
Tp::DBusService
Base class for D-Bus services.
Definition: dbus-service.h:46
Tp::BaseProtocol::create
static SharedPtr< BaseProtocolSubclass > create(const QDBusConnection &dbusConnection, const QString &name)
Definition: base-protocol.h:68
Tp::SharedPtr
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
Tp::BaseProtocolAvatarsInterface::create
static BaseProtocolAvatarsInterfacePtr create()
Definition: base-protocol.h:204
Tp::BaseProtocolPresenceInterface::create
static SharedPtr< BaseProtocolPresenceInterfaceSubclass > create()
Definition: base-protocol.h:246
Tp::PresenceSpecList
The PresenceSpecList class represents a list of PresenceSpec.
Definition: presence.h:125
Tp::BaseProtocolAvatarsInterface
Base class for implementations of Protocol.Interface.Avatars.
Definition: base-protocol.h:198
Tp::BaseProtocol::create
static SharedPtr< BaseProtocolSubclass > create(const QString &name)
Definition: base-protocol.h:58
Tp::BaseProtocol::create
static BaseProtocolPtr create(const QString &name)
Definition: base-protocol.h:53
Tp::Callback2< BaseConnectionPtr, const QVariantMap &, DBusError * >
Tp::DBusError
Small container class, containing a D-Bus error.
Definition: dbus-error.h:35
Tp::BaseProtocol::NormalizeContactCallback
Callback2< QString, const QString &, DBusError * > NormalizeContactCallback
Definition: base-protocol.h:110
Tp::RequestableChannelClassSpecList
The RequestableChannelClassSpecList class represents a list of RequestableChannelClassSpec.
Definition: requestable-channel-class-spec.h:101
Tp::BaseProtocolAvatarsInterface::create
static SharedPtr< BaseProtocolAvatarsInterfaceSubclass > create()
Definition: base-protocol.h:209
Tp::BaseProtocolAddressingInterface
Base class for implementations of Protocol.Interface.Addressing.
Definition: base-protocol.h:150
Tp::BaseProtocolAddressingInterface::create
static BaseProtocolAddressingInterfacePtr create()
Definition: base-protocol.h:156
Tp::AbstractProtocolInterface
Base class for all the Protocol object interface implementations.
Definition: base-protocol.h:133