telepathy-qt: Add BaseChannelServerAuthenticationType

David Edmundson davidedmundson at kemper.freedesktop.org
Sat Jun 14 04:57:36 PDT 2014


Module: telepathy-qt
Branch: master
Commit: a0fc3be57195981af30c7efeace625f3cccb6f1d
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=a0fc3be57195981af30c7efeace625f3cccb6f1d

Author: Matthias Gehre <M.Gehre at gmx.de>
Date:   Sat Mar  9 21:08:19 2013 -0600

Add BaseChannelServerAuthenticationType

---

 TelepathyQt/base-channel-internal.h |   12 ++++++
 TelepathyQt/base-channel.cpp        |   72 +++++++++++++++++++++++++++++++++++
 TelepathyQt/base-channel.h          |   30 +++++++++++++++
 TelepathyQt/service-types.h         |    2 +
 4 files changed, 116 insertions(+)

diff --git a/TelepathyQt/base-channel-internal.h b/TelepathyQt/base-channel-internal.h
index bd010c2..37a3ba5 100644
--- a/TelepathyQt/base-channel-internal.h
+++ b/TelepathyQt/base-channel-internal.h
@@ -156,4 +156,16 @@ public:
     BaseChannelMessagesInterface *mInterface;
 };
 
+class TP_QT_NO_EXPORT BaseChannelServerAuthenticationType::Adaptee : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(QString authenticationMethod READ authenticationMethod)
+public:
+    Adaptee(BaseChannelServerAuthenticationType *interface);
+    ~Adaptee();
+    QString authenticationMethod() const;
+public:
+    BaseChannelServerAuthenticationType *mInterface;
+};
+
 }
diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index 93f73aa..676fdf3 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -729,5 +729,77 @@ QString BaseChannelMessagesInterface::sendMessage(const Tp::MessagePartList &mes
 }
 
 
+//Chan.T.ServerAuthentication
+BaseChannelServerAuthenticationType::Adaptee::Adaptee(BaseChannelServerAuthenticationType *interface)
+    : QObject(interface),
+      mInterface(interface)
+{
+}
+
+BaseChannelServerAuthenticationType::Adaptee::~Adaptee()
+{
+}
+
+struct TP_QT_NO_EXPORT BaseChannelServerAuthenticationType::Private {
+    Private(BaseChannelServerAuthenticationType *parent, const QString& authenticationMethod)
+        : authenticationMethod(authenticationMethod),
+          adaptee(new BaseChannelServerAuthenticationType::Adaptee(parent)) {
+    }
+    QString authenticationMethod;
+    BaseChannelServerAuthenticationType::Adaptee *adaptee;
+};
+
+QString BaseChannelServerAuthenticationType::Adaptee::authenticationMethod() const
+{
+    return mInterface->mPriv->authenticationMethod;
+}
+
+/**
+ * \class BaseChannelServerAuthenticationType
+ * \ingroup servicecm
+ * \headerfile TelepathyQt/base-channel.h <TelepathyQt/BaseChannel>
+ *
+ * \brief Base class for implementations of Channel.Type.ServerAuthentifcation
+ *
+ */
+
+/**
+ * Class constructor.
+ */
+BaseChannelServerAuthenticationType::BaseChannelServerAuthenticationType(const QString& authenticationMethod)
+    : AbstractChannelInterface(TP_QT_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION),
+      mPriv(new Private(this, authenticationMethod))
+{
+}
+
+/**
+ * Class destructor.
+ */
+BaseChannelServerAuthenticationType::~BaseChannelServerAuthenticationType()
+{
+    delete mPriv;
+}
+
+/**
+ * Return the immutable properties of this interface.
+ *
+ * Immutable properties cannot change after the interface has been registered
+ * on a service on the bus with registerInterface().
+ *
+ * \return The immutable properties of this interface.
+ */
+QVariantMap BaseChannelServerAuthenticationType::immutableProperties() const
+{
+    QVariantMap map;
+    map.insert(TP_QT_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION + QLatin1String(".AuthenticationMethod"),
+               QVariant::fromValue(mPriv->adaptee->authenticationMethod()));
+    return map;
+}
+
+void BaseChannelServerAuthenticationType::createAdaptor()
+{
+    (void) new Service::ChannelTypeServerAuthenticationAdaptor(dbusObject()->dbusConnection(),
+            mPriv->adaptee, dbusObject());
+}
 
 }
diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h
index 0f39a70..0ec421d 100644
--- a/TelepathyQt/base-channel.h
+++ b/TelepathyQt/base-channel.h
@@ -212,5 +212,35 @@ private:
     Private *mPriv;
 };
 
+class TP_QT_EXPORT BaseChannelServerAuthenticationType : public AbstractChannelInterface
+{
+    Q_OBJECT
+    Q_DISABLE_COPY(BaseChannelServerAuthenticationType)
+
+public:
+    static BaseChannelServerAuthenticationTypePtr create(const QString &authenticationMethod) {
+        return BaseChannelServerAuthenticationTypePtr(new BaseChannelServerAuthenticationType(authenticationMethod));
+    }
+    template<typename BaseChannelServerAuthenticationTypeSubclass>
+    static SharedPtr<BaseChannelServerAuthenticationTypeSubclass> create(const QString &authenticationMethod) {
+        return SharedPtr<BaseChannelServerAuthenticationTypeSubclass>(
+                   new BaseChannelServerAuthenticationTypeSubclass(authenticationMethod));
+    }
+    virtual ~BaseChannelServerAuthenticationType();
+
+    QVariantMap immutableProperties() const;
+private Q_SLOTS:
+private:
+    BaseChannelServerAuthenticationType(const QString &authenticationMethod);
+    void createAdaptor();
+
+    class Adaptee;
+    friend class Adaptee;
+    struct Private;
+    friend struct Private;
+    Private *mPriv;
+};
+
+
 }
 #endif
diff --git a/TelepathyQt/service-types.h b/TelepathyQt/service-types.h
index 80cb170..ae77021 100644
--- a/TelepathyQt/service-types.h
+++ b/TelepathyQt/service-types.h
@@ -49,6 +49,7 @@ class BaseProtocolPresenceInterface;
 class BaseChannel;
 class BaseChannelTextType;
 class BaseChannelMessagesInterface;
+class BaseChannelServerAuthenticationType;
 class DBusService;
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -70,6 +71,7 @@ typedef SharedPtr<BaseProtocolPresenceInterface> BaseProtocolPresenceInterfacePt
 typedef SharedPtr<BaseChannel> BaseChannelPtr;
 typedef SharedPtr<BaseChannelTextType> BaseChannelTextTypePtr;
 typedef SharedPtr<BaseChannelMessagesInterface> BaseChannelMessagesInterfacePtr;
+typedef SharedPtr<BaseChannelServerAuthenticationType> BaseChannelServerAuthenticationTypePtr;
 typedef SharedPtr<DBusService> DBusServicePtr;
 
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */



More information about the telepathy-commits mailing list