diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2012-04-11 17:54:30 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2012-04-12 16:36:25 +0300 |
commit | 34fa155da0c204af7c5d6d7f94d09d9cd5c58811 (patch) | |
tree | 21daa8ff84fc10acd3131a975d2e08490b0853e2 | |
parent | 20f343b3dc5b1fa3c9eb7c90ca9e51a52338155d (diff) |
BaseProtocol: Add a new convenience interface(interfaceName) method
-rw-r--r-- | TelepathyQt/base-protocol.cpp | 19 | ||||
-rw-r--r-- | TelepathyQt/base-protocol.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/TelepathyQt/base-protocol.cpp b/TelepathyQt/base-protocol.cpp index c1e0a5f0..f1ea198e 100644 --- a/TelepathyQt/base-protocol.cpp +++ b/TelepathyQt/base-protocol.cpp @@ -622,7 +622,7 @@ QString BaseProtocol::normalizeContact(const QString &contactId, Tp::DBusError * * object has been registered on the bus with registerObject(). * * \return A list containing all the Protocol interface implementation objects. - * \sa plugInterface() + * \sa plugInterface(), interface() */ QList<AbstractProtocolInterfacePtr> BaseProtocol::interfaces() const { @@ -630,6 +630,21 @@ QList<AbstractProtocolInterfacePtr> BaseProtocol::interfaces() const } /** + * Return a pointer to the interface with the given name. + * + * \param interfaceName The D-Bus name of the interface, + * ex. TP_QT_IFACE_PROTOCOL_INTERFACE_ADDRESSING. + * \return A pointer to the AbstractProtocolInterface object that implements + * the D-Bus interface with the given name, or a null pointer if such an interface + * has not been plugged into this object. + * \sa plugInterface(), interfaces() + */ +AbstractProtocolInterfacePtr BaseProtocol::interface(const QString &interfaceName) const +{ + return mPriv->interfaces.value(interfaceName); +} + +/** * Plug a new interface into this Protocol D-Bus object. * * This property is immutable and cannot change after this Protocol @@ -638,7 +653,7 @@ QList<AbstractProtocolInterfacePtr> BaseProtocol::interfaces() const * \param interface An AbstractProtocolInterface instance that implements * the interface that is to be plugged. * \return \c true on success or \c false otherwise - * \sa interfaces() + * \sa interfaces(), interface() */ bool BaseProtocol::plugInterface(const AbstractProtocolInterfacePtr &interface) { diff --git a/TelepathyQt/base-protocol.h b/TelepathyQt/base-protocol.h index e2b7e34c..ddb255b5 100644 --- a/TelepathyQt/base-protocol.h +++ b/TelepathyQt/base-protocol.h @@ -110,6 +110,7 @@ public: QString normalizeContact(const QString &contactId, DBusError *error); QList<AbstractProtocolInterfacePtr> interfaces() const; + AbstractProtocolInterfacePtr interface(const QString & interfaceName) const; bool plugInterface(const AbstractProtocolInterfacePtr &interface); protected: |