[telepathy-qt4/master] Update to telepathy-spec 0.17.24 (UpdateParameters, CreateAccount API break)

Simon McVittie simon.mcvittie at collabora.co.uk
Thu May 7 10:46:08 PDT 2009


---
 TelepathyQt4/Prototype/Account.cpp        |    2 +-
 TelepathyQt4/Prototype/AccountManager.cpp |    3 +-
 TelepathyQt4/account-manager.cpp          |   27 +++++-
 TelepathyQt4/account-manager.h            |    4 +-
 TelepathyQt4/account.cpp                  |   28 +++++
 TelepathyQt4/account.h                    |    4 +
 TelepathyQt4/pending-account.cpp          |    5 +-
 TelepathyQt4/pending-account.h            |    3 +-
 spec/Account.xml                          |   79 ++++++++++++--
 spec/Account_Manager.xml                  |  104 +++++++++++++++++-
 spec/Connection_Interface_Requests.xml    |    6 +
 spec/Debug.xml                            |  166 +++++++++++++++++++++++++++++
 spec/all.xml                              |    6 +-
 tests/lib/account-manager.py              |   14 ++-
 tests/prototype/prototype.cpp             |    2 +-
 15 files changed, 423 insertions(+), 30 deletions(-)
 create mode 100644 spec/Debug.xml

diff --git a/TelepathyQt4/Prototype/Account.cpp b/TelepathyQt4/Prototype/Account.cpp
index 572d5d2..155543e 100644
--- a/TelepathyQt4/Prototype/Account.cpp
+++ b/TelepathyQt4/Prototype/Account.cpp
@@ -122,7 +122,7 @@ bool Account::setParameters( const QVariantMap& parameters )
     if ( parameters.isEmpty() )
     { return false; }
     
-    QDBusPendingReply<> reply = d->m_pInterface->UpdateParameters( parameters, QStringList() );
+    QDBusPendingReply<QStringList> reply = d->m_pInterface->UpdateParameters( parameters, QStringList() );
     reply.waitForFinished();
 
     if ( !reply.isValid() )
diff --git a/TelepathyQt4/Prototype/AccountManager.cpp b/TelepathyQt4/Prototype/AccountManager.cpp
index 44af61d..125aeb1 100644
--- a/TelepathyQt4/Prototype/AccountManager.cpp
+++ b/TelepathyQt4/Prototype/AccountManager.cpp
@@ -233,7 +233,8 @@ bool AccountManager::createAccount( const QString& connectionManager, const QStr
     QDBusPendingReply<QDBusObjectPath> create_reply = d->m_pInterface->CreateAccount( connectionManager,
                                                                                       protocol,
                                                                                       displayName,
-                                                                                      parameters );
+                                                                                      parameters,
+                                                                                      QVariantMap());
     create_reply.waitForFinished();
         
     if ( !create_reply.isValid() )
diff --git a/TelepathyQt4/account-manager.cpp b/TelepathyQt4/account-manager.cpp
index 9d65cb8..2d1a3c2 100644
--- a/TelepathyQt4/account-manager.cpp
+++ b/TelepathyQt4/account-manager.cpp
@@ -82,6 +82,7 @@ struct AccountManager::Private
     QSet<QString> validAccountPaths;
     QSet<QString> invalidAccountPaths;
     QMap<QString, AccountPtr> accounts;
+    QStringList supportedAccountProperties;
 };
 
 AccountManager::Private::Private(AccountManager *parent)
@@ -458,24 +459,42 @@ QList<AccountPtr> AccountManager::accountsForPaths(const QStringList &paths)
 }
 
 /**
+ * Return a list of the fully qualified names of properties that can be set
+ * when calling AccountManager::createAccount.
+ *
+ * \return A list of fully qualified D-Bus property names,
+ *  such as "org.freedesktop.Telepathy.Account.Enabled"
+ */
+QStringList AccountManager::supportedAccountProperties() const
+{
+    return mPriv->supportedAccountProperties;
+}
+
+/**
  * Create an account with the given parameters.
  *
  * Return a pending operation representing the Account object which will succeed
  * when the account has been created or fail if an error occurred.
  *
+ * The optional properties argument can be used to set any property listed in
+ * AccountManager::supportedAccountProperties at the time the account is
+ * created.
+ *
  * \param connectionManager Name of the connection manager to create the account for.
  * \param protocol Name of the protocol to create the account for.
  * \param displayName The account display name.
  * \param parameters The account parameters.
+ * \param properties An optional map from fully qualified D-Bus property
+ *  names such as "org.freedesktop.Telepathy.Account.Enabled" to their values
  * \return A PendingAccount object which will emit PendingAccount::finished
  *         when the account has been created of failed its creation process.
  */
 PendingAccount *AccountManager::createAccount(const QString &connectionManager,
         const QString &protocol, const QString &displayName,
-        const QVariantMap &parameters)
+        const QVariantMap &parameters, const QVariantMap &properties)
 {
     return new PendingAccount(AccountManagerPtr(this), connectionManager,
-            protocol, displayName, parameters);
+            protocol, displayName, parameters, properties);
 }
 
 /**
@@ -568,6 +587,10 @@ void AccountManager::gotMainProperties(QDBusPendingCallWatcher *watcher)
             mPriv->setAccountPaths(mPriv->invalidAccountPaths,
                     props["InvalidAccounts"]);
         }
+        if (props.contains("SupportedAccountProperties")) {
+            mPriv->supportedAccountProperties =
+                qdbus_cast<QStringList>(props["SupportedAccountProperties"]);
+        }
     } else {
         warning().nospace() <<
             "GetAll(AccountManager) failed: " <<
diff --git a/TelepathyQt4/account-manager.h b/TelepathyQt4/account-manager.h
index e3da144..cf9c72a 100644
--- a/TelepathyQt4/account-manager.h
+++ b/TelepathyQt4/account-manager.h
@@ -83,9 +83,11 @@ public:
     AccountPtr accountForPath(const QString &path);
     QList<AccountPtr> accountsForPaths(const QStringList &paths);
 
+    QStringList supportedAccountProperties() const;
     PendingAccount *createAccount(const QString &connectionManager,
             const QString &protocol, const QString &displayName,
-            const QVariantMap &parameters);
+            const QVariantMap &parameters,
+            const QVariantMap &properties = QVariantMap());
 
     // TODO: enabledAccounts(), accountsByProtocol(), ... ?
 
diff --git a/TelepathyQt4/account.cpp b/TelepathyQt4/account.cpp
index 9660168..2c9a4b8 100644
--- a/TelepathyQt4/account.cpp
+++ b/TelepathyQt4/account.cpp
@@ -448,6 +448,21 @@ QVariantMap Account::parameters() const
     return mPriv->parameters;
 }
 
+/* FIXME: we would like this function to be as follows:
+ *
+ * Update this account parameters.
+ *
+ * On success, the pending operation returned by this method will produce a
+ * list of strings, which are the names of parameters whose changes will not
+ * take effect until the account is disconnected and reconnected (for instance
+ * by calling Account::reconnect).
+ *
+ * \param set Parameters to set.
+ * \param unset Parameters to unset.
+ * \return A PendingStringList which will emit PendingOperation::finished
+ *         when the call has finished
+ */
+
 /**
  * Update this account parameters.
  *
@@ -665,6 +680,19 @@ QString Account::normalizedName() const
 }
 
 /**
+ * If this account is currently connected, disconnect and reconnect it. If it
+ * is currently trying to connect, cancel the attempt to connect and start
+ * another. If it is currently disconnected, do nothing.
+ *
+ * \return A PendingOperation which will emit PendingOperation::finished
+ *         when the call has finished.
+ */
+PendingOperation *Account::reconnect()
+{
+    return new PendingVoidMethodCall(this, baseInterface()->Reconnect());
+}
+
+/**
  * Delete this account.
  *
  * \return A PendingOperation which will emit PendingOperation::finished
diff --git a/TelepathyQt4/account.h b/TelepathyQt4/account.h
index 4213fd9..8daf7ca 100644
--- a/TelepathyQt4/account.h
+++ b/TelepathyQt4/account.h
@@ -51,6 +51,7 @@ class Connection;
 class PendingConnection;
 class PendingOperation;
 class PendingReady;
+class PendingStringList;
 class ProtocolInfo;
 
 class Account : public StatelessDBusProxy,
@@ -97,8 +98,11 @@ public:
     PendingOperation *setAvatar(const Avatar &avatar);
 
     QVariantMap parameters() const;
+    // FIXME: should return a PendingStringList
     PendingOperation *updateParameters(const QVariantMap &set,
             const QStringList &unset);
+    // requires spec 0.17.24
+    PendingOperation *reconnect();
 
     // comes from the ConnectionManager
     ProtocolInfo *protocolInfo() const;
diff --git a/TelepathyQt4/pending-account.cpp b/TelepathyQt4/pending-account.cpp
index e032727..56f488d 100644
--- a/TelepathyQt4/pending-account.cpp
+++ b/TelepathyQt4/pending-account.cpp
@@ -78,13 +78,14 @@ struct PendingAccount::Private
  */
 PendingAccount::PendingAccount(const AccountManagerPtr &manager,
         const QString &connectionManager, const QString &protocol,
-        const QString &displayName, const QVariantMap &parameters)
+        const QString &displayName, const QVariantMap &parameters,
+        const QVariantMap &properties)
     : PendingOperation(manager.data()),
       mPriv(new Private(manager))
 {
     QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(
             manager->baseInterface()->CreateAccount(connectionManager,
-                protocol, displayName, parameters), this);
+                protocol, displayName, parameters, properties), this);
     connect(watcher,
             SIGNAL(finished(QDBusPendingCallWatcher *)),
             SLOT(onCallFinished(QDBusPendingCallWatcher *)));
diff --git a/TelepathyQt4/pending-account.h b/TelepathyQt4/pending-account.h
index 960effb..82cbe22 100644
--- a/TelepathyQt4/pending-account.h
+++ b/TelepathyQt4/pending-account.h
@@ -59,7 +59,8 @@ private:
     Q_DISABLE_COPY(PendingAccount);
     PendingAccount(const AccountManagerPtr &manager,
             const QString &connectionManager, const QString &protocol,
-            const QString &displayName, const QVariantMap &parameters);
+            const QString &displayName, const QVariantMap &parameters,
+            const QVariantMap &properties = QVariantMap());
 
     struct Private;
     friend struct Private;
diff --git a/spec/Account.xml b/spec/Account.xml
index b6a2670..4b112cb 100644
--- a/spec/Account.xml
+++ b/spec/Account.xml
@@ -282,19 +282,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
     <method name="UpdateParameters" tp:name-for-bindings="Update_Parameters">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        Change the value of the <tp:member-ref>Parameters</tp:member-ref>
-        property. If any of the changed parameters'
-        <tp:type>Conn_Mgr_Param_Flags</tp:type> include
-        <code>DBus_Property</code>, the change will be applied to the
-        corresponding D-Bus Property on the active
-        <tp:member-ref>Connection</tp:member-ref> if there is one; changes to
-        other parameters will not take effect until the next time the account
-        is disconnected and reconnected.
+        <p>Change the value of the <tp:member-ref>Parameters</tp:member-ref>
+          property.</p>
+
+        <p>If any of the changed parameters'
+          <tp:type>Conn_Mgr_Param_Flags</tp:type> include
+          <code>DBus_Property</code>, the change will be applied to the
+          corresponding D-Bus Property on the active
+          <tp:member-ref>Connection</tp:member-ref>, if there is one. Changes to
+          other parameters will not take effect until the next time the account
+          is disconnected and reconnected.</p>
 
         <tp:rationale>
-          Migration tools that twiddle the settings of all accounts shouldn't
-          cause an automatic disconnect and reconnect, probably. I could be
-          persuaded otherwise, though. Or we could add a Reconnect() method.
+          <p>In general, reconnecting is a destructive operation that shouldn't
+            happen as a side-effect. In particular, migration tools that
+            twiddle the settings of all accounts shouldn't cause an automatic
+            disconnect and reconnect.</p>
         </tp:rationale>
       </tp:docstring>
 
@@ -303,12 +306,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         existing Connections
       </tp:changed>
 
+      <tp:changed version="0.17.24">
+        return an array of the parameters that won't change until the account
+        is reconnected
+      </tp:changed>
+
       <arg name="Set" type="a{sv}" direction="in">
         <tp:docstring>
           A mapping from parameter names to their values. These parameters
           should be stored for future use.
         </tp:docstring>
       </arg>
+
       <arg name="Unset" type="as" direction="in">
         <tp:docstring>
           A list of the names of parameters to be removed from the set of
@@ -319,6 +328,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         </tp:docstring>
       </arg>
 
+      <arg name="Reconnect_Required" type="as" direction="out">
+        <tp:docstring>
+          A list of the names of parameters with changes that will not take
+          effect until the account is reconnected (this may be empty, e.g. if
+          all the parameters are D-Bus properties or parameters for which the
+          account manager has specific support). User interfaces that
+          require "instant apply" semantics MAY call
+          <tp:member-ref>Reconnect</tp:member-ref> in response to receiving
+          a non-empty list.
+        </tp:docstring>
+      </arg>
+
       <tp:possible-errors>
         <tp:error name="org.freedesktop.Telepathy.Error.PermissionDenied"/>
         <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
@@ -459,6 +480,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
+    <method name="Reconnect" tp:name-for-bindings="Reconnect">
+      <tp:added version="0.17.24"/>
+      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+        <p>Re-connect this account. If the account is currently disconnected
+          and the requested presence is offline, or if the account
+          is not <tp:member-ref>Enabled</tp:member-ref> or not
+          <tp:member-ref>Valid</tp:member-ref>, this does nothing.</p>
+
+        <p>If the account is disconnected and the requested presence is not
+          offline, this forces an attempt to connect with the requested
+          presence immediately.</p>
+
+        <p>If the account is connecting or connected, this is equivalent to
+          remembering the current value of
+          <tp:member-ref>RequestedPresence</tp:member-ref>, setting its value
+          to (OFFLINE, "offline", ""), waiting for the change to take effect,
+          then setting its value to the value that was previously
+          remembered.</p>
+
+        <tp:rationale>
+          <p>Clients desiring "instant apply" semantics for CM parameters MAY
+            call this method to achieve that.</p>
+        </tp:rationale>
+
+        <p>In particular, if the account's
+          <tp:member-ref>Connection</tp:member-ref> is in the Connecting
+          state, calling this method causes the attempt to connect to be
+          aborted and re-tried.</p>
+
+        <tp:rationale>
+          <p>This is necessary to ensure that the new parameters are
+            picked up.</p>
+        </tp:rationale>
+      </tp:docstring>
+    </method>
+
     <property name="NormalizedName" type="s" access="read"
       tp:name-for-bindings="Normalized_Name">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
diff --git a/spec/Account_Manager.xml b/spec/Account_Manager.xml
index 6fb9b08..9b54f5f 100644
--- a/spec/Account_Manager.xml
+++ b/spec/Account_Manager.xml
@@ -127,12 +127,78 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </arg>
     </signal>
 
+    <property name="SupportedAccountProperties"
+      tp:name-for-bindings="Supported_Account_Properties"
+      type="as" tp:type="DBus_Qualified_Member[]" access="read">
+      <tp:added version="0.17.24"/>
+      <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+        <p>A list of the fully qualified names of properties that can be set
+          via the Properties argument to
+          <tp:member-ref>CreateAccount</tp:member-ref> when an account is
+          created.</p>
+
+        <tp:rationale>
+          <p>Examples of good properties to support here include
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">Icon</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">Enabled</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">Nickname</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">AutomaticPresence</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">ConnectAutomatically</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">RequestedPresence</tp:dbus-ref>
+            and
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account.Interface.Avatar">Avatar</tp:dbus-ref>.
+            </p>
+
+          <p>Examples of properties that would make no sense here include
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">Valid</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">Connection</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">ConnectionStatus</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">ConnectionStatusReason</tp:dbus-ref>,
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">CurrentPresence</tp:dbus-ref>
+            and
+            <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">NormalizedName</tp:dbus-ref>.
+          </p>
+        </tp:rationale>
+
+        <p>This property MUST NOT include include the <tp:dbus-ref
+            namespace="org.freedesktop.Telepathy.Account">DisplayName</tp:dbus-ref>
+          and <tp:dbus-ref
+            namespace="org.freedesktop.Telepathy.Account">Parameters</tp:dbus-ref>
+          properties, which are set using separate arguments.</p>
+
+        <p>This property MAY include the names of properties that, after
+          account creation, will be read-only: this indicates that the property
+          can be set at account creation but not changed later.</p>
+
+        <tp:rationale>
+          <p>For example, an account manager might support migration tools that
+            use this to preserve the <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">HasBeenOnline</tp:dbus-ref>
+            property, even though that property is usually read-only.</p>
+        </tp:rationale>
+      </tp:docstring>
+    </property>
+
     <method name="CreateAccount" tp:name-for-bindings="Create_Account">
       <tp:docstring>
         Request the creation of a new <tp:dbus-ref
           namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref>. The
         account manager SHOULD NOT allow invalid accounts to be created.
       </tp:docstring>
+      <tp:changed version="0.17.24">added the Properties argument</tp:changed>
 
       <arg name="Connection_Manager" direction="in" type="s"
         tp:type="Connection_Manager_Name">
@@ -152,8 +218,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
           property. The account manager SHOULD modify this to make it unique if
           an Account already exists with the same display name, for instance by
           appending a number or the 'account' parameter. Account manager
-          implementations SHOULD accept an empty string but account editing user
-          interfaces should avoid passing an empty string for this parameter.
+          implementations SHOULD accept an empty string, but account editing
+          user interfaces should avoid passing an empty string for this
+          parameter.
 
           <tp:rationale>
             <p>The account creation UI may ask the user for a name for the new
@@ -176,6 +243,26 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
             namespace="org.freedesktop.Telepathy.ConnectionManager">RequestConnection</tp:dbus-ref>.</tp:docstring>
       </arg>
 
+      <arg name="Properties" direction="in" type="a{sv}"
+        tp:type="Qualified_Property_Value_Map">
+        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+          <p>The values of any other properties to be set immediately on the
+            new Account.</p>
+
+          <p>Only the properties mentioned in
+            <tp:member-ref>SupportedAccountProperties</tp:member-ref> are
+            acceptable here. In particular, the <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">DisplayName</tp:dbus-ref>
+            and <tp:dbus-ref
+              namespace="org.freedesktop.Telepathy.Account">Parameters</tp:dbus-ref>
+            properties are never allowed here, since they are set using the other
+            arguments to this method.</p>
+
+          <p>Account manager implementations SHOULD support creating accounts
+            with an empty value for this argument.</p>
+        </tp:docstring>
+      </arg>
+
       <arg name="Account" direction="out" type="o">
         <tp:docstring>The new <tp:dbus-ref
           namespace="org.freedesktop.Telepathy">Account</tp:dbus-ref>.</tp:docstring>
@@ -183,12 +270,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
       <tp:possible-errors>
         <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented">
-          <tp:docstring>The connection manager is not installed or does not
-            implement that protocol.</tp:docstring>
+          <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+            <p>The Connection_Manager is not installed or does not
+              implement the given Protocol, or one of the properties in the
+              Properties argument is unsupported.</p>
+          </tp:docstring>
         </tp:error>
         <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument">
-          <tp:docstring>The parameters provided omit a required argument
-            or provide unsupported arguments.
+          <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+            <p>The Parameters provided omit a required parameter
+              or provide unsupported parameter, or the type of one
+              of the Parameters or Properties is inappropriate.</p>
           </tp:docstring>
         </tp:error>
       </tp:possible-errors>
diff --git a/spec/Connection_Interface_Requests.xml b/spec/Connection_Interface_Requests.xml
index b63aa5b..5c56db3 100644
--- a/spec/Connection_Interface_Requests.xml
+++ b/spec/Connection_Interface_Requests.xml
@@ -30,6 +30,12 @@
         represent bundles of channels that should be dispatched together, and
         does not assume any particular properties by which channels are
         uniquely identifiable.</p>
+
+      <p>If this interface is implemented on a connection, then
+        <tp:member-ref>NewChannels</tp:member-ref> MUST be emitted for
+        all new channels, even those created with <tp:dbus-ref
+          namespace="org.freedesktop.Telepathy.Connection"
+        >RequestChannel</tp:dbus-ref>.</p>
     </tp:docstring>
 
     <tp:struct name="Channel_Details" array-name="Channel_Details_List">
diff --git a/spec/Debug.xml b/spec/Debug.xml
new file mode 100644
index 0000000..a21d9db
--- /dev/null
+++ b/spec/Debug.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" ?>
+<node name="/Debug"
+  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
+  <tp:copyright>Copyright (C) 2009 Collabora Ltd.</tp:copyright>
+  <tp:license xmlns="http://www.w3.org/1999/xhtml">
+    <p>This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.</p>
+
+<p>This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.</p>
+
+<p>You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</p>
+  </tp:license>
+  <interface name="org.freedesktop.Telepathy.Debug.DRAFT"
+    tp:causes-havoc="experimental">
+    <tp:added version="0.17.24"/>
+
+    <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+      <p>An interface for providing debug messages.</p>
+
+      <p>This interface is primarily provided by one object per
+      service, at the path <tt>/org/freedesktop/Telepathy/debug</tt>.</p>
+    </tp:docstring>
+
+    <property name="Enabled" type="b" access="readwrite"
+      tp:name-for-bindings="Enabled">
+      <tp:docstring>
+        TRUE if the <tp:member-ref>NewDebugMessage</tp:member-ref> signal
+        should be emitted when a new debug message is generated.
+      </tp:docstring>
+    </property>
+
+    <method name="GetMessages" tp:name-for-bindings="Get_Messages">
+      <tp:docstring>
+        Retrieve buffered debug messages. An implementation could have a
+        limit on how many message it keeps and so the array returned from
+        this method should not be assumed to be all of the messages in
+        the lifetime of the service.
+      </tp:docstring>
+
+      <arg direction="out" name="Messages" type="a(dsus)"
+        tp:type="Debug_Message[]">
+        <tp:docstring>
+          A list of debug messages.
+        </tp:docstring>
+      </arg>
+    </method>
+
+    <signal name="NewDebugMessage" tp:name-for-bindings="New_Debug_Message">
+      <tp:docstring>
+        Emitted when a debug messages is generated if the
+        <tp:member-ref>Enabled</tp:member-ref> property is set to TRUE.
+      </tp:docstring>
+
+      <arg name="time" type="d">
+        <tp:docstring>
+          Timestamp of the debug message.
+        </tp:docstring>
+      </arg>
+      <arg name="domain" type="s">
+        <tp:docstring>
+          Domain of the debug message, as described in the Debug_Message struct.
+        </tp:docstring>
+      </arg>
+      <arg name="level" type="u" tp:type="Debug_Level">
+        <tp:docstring>
+          Level of the debug message.
+        </tp:docstring>
+      </arg>
+      <arg name="message" type="s">
+        <tp:docstring>
+          The text of the debug message.
+        </tp:docstring>
+      </arg>
+    </signal>
+
+    <tp:enum name="Debug_Level" type="u">
+      <tp:enumvalue suffix="Error" value="0">
+        <tp:docstring>
+          Log level for errors. Error messages are always fatal, resulting
+          in the service terminating after something completely
+          unexpected occurred.
+        </tp:docstring>
+      </tp:enumvalue>
+      <tp:enumvalue suffix="Critical" value="1">
+        <tp:docstring>
+          Log level for critical messages. Critical messages are messages
+          that the service might predict and it is up to the service itself
+          to decide whether to terminate following a critical message.
+        </tp:docstring>
+      </tp:enumvalue>
+      <tp:enumvalue suffix="Warning" value="2">
+        <tp:docstring>
+          Log level for warnings.
+        </tp:docstring>
+      </tp:enumvalue>
+      <tp:enumvalue suffix="Message" value="3">
+        <tp:docstring>
+          Log level for messages.
+        </tp:docstring>
+      </tp:enumvalue>
+      <tp:enumvalue suffix="Info" value="4">
+        <tp:docstring>
+          Log level for information messages.
+        </tp:docstring>
+      </tp:enumvalue>
+      <tp:enumvalue suffix="Debug" value="5">
+        <tp:docstring>
+          Log level for debug messages.
+        </tp:docstring>
+      </tp:enumvalue>
+    </tp:enum>
+
+    <tp:struct name="Debug_Message" array-name="Debug_Message_List">
+      <tp:docstring>
+        A struct representing a debug message, as returned by
+        <tp:member-ref>GetMessages</tp:member-ref>.
+      </tp:docstring>
+
+      <tp:member type="d" name="Timestamp">
+        <tp:docstring>
+          Timestamp of the debug message. This is a double to allow
+          more accuracy in the time the message was logged.
+        </tp:docstring>
+      </tp:member>
+
+      <tp:member type="s" name="Domain">
+        <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
+          <p>Domain of the debug message. This is used to identify
+          the source of debug messages. For example, debug messages
+          from a connection manager could have this Domain struct
+          member be the name of the connection manager, and logs
+          from any helper library could have the name of the helper
+          library.</p>
+
+          <p>The domain could also contain a category as to where
+          the log message originated separated by a forward-slash.
+          For example, if a debug message was output in a connection
+          manager called "dummy", in the file-transfer code, this
+          Domain struct member might be <tt>dummy/file-transfer</tt>.</p>
+        </tp:docstring>
+      </tp:member>
+
+      <tp:member type="u" tp:type="Debug_Level" name="Level">
+        <tp:docstring>
+          Level of the debug message. This states the severity of the
+          debug message.
+        </tp:docstring>
+      </tp:member>
+
+      <tp:member type="s" name="Message">
+        <tp:docstring>
+          The text of the debug message.
+        </tp:docstring>
+      </tp:member>
+    </tp:struct>
+
+  </interface>
+</node>
+<!-- vim:set sw=2 sts=2 et ft=xml: -->
diff --git a/spec/all.xml b/spec/all.xml
index 93ce925..080fa83 100644
--- a/spec/all.xml
+++ b/spec/all.xml
@@ -3,7 +3,7 @@
   xmlns:xi="http://www.w3.org/2001/XInclude">
 
 <tp:title>Telepathy D-Bus Interface Specification</tp:title>
-<tp:version>0.17.23</tp:version>
+<tp:version>0.17.24</tp:version>
 
 <tp:copyright>Copyright © 2005-2009 Collabora Limited</tp:copyright>
 <tp:copyright>Copyright © 2005-2009 Nokia Corporation</tp:copyright>
@@ -116,6 +116,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</
   <xi:include href="Media_Session_Handler.xml"/>
   <xi:include href="Media_Stream_Handler.xml"/>
  </tp:section>
+
+ <tp:section name="Debugging">
+  <xi:include href="Debug.xml"/>
+ </tp:section>
 </tp:section>
 
 <tp:section name="The Account Manager">
diff --git a/tests/lib/account-manager.py b/tests/lib/account-manager.py
index 857497a..cd5ff94 100755
--- a/tests/lib/account-manager.py
+++ b/tests/lib/account-manager.py
@@ -55,6 +55,7 @@ class AccountManager(Object):
                 signature='o'),
             'InvalidAccounts': dbus.Array(self._invalid_accounts.keys(),
                 signature='o'),
+            'SupportedAccountProperties': dbus.Array([], signature='s'),
         }, signature='sv')
 
     @method(dbus.PROPERTIES_IFACE,
@@ -104,8 +105,9 @@ class AccountManager(Object):
         self._invalid_accounts.pop(path, None)
         print "Emitting AccountRemoved(%s)" % path
 
-    @method(AM_IFACE, in_signature='sssa{sv}', out_signature='o')
-    def CreateAccount(self, cm, protocol, display_name, parameters):
+    @method(AM_IFACE, in_signature='sssa{sv}a{sv}', out_signature='o')
+    def CreateAccount(self, cm, protocol, display_name, parameters,
+            properties):
 
         if not VALID_CONNECTION_MANAGER_NAME.match(cm):
             raise ValueError('Invalid CM name')
@@ -113,6 +115,10 @@ class AccountManager(Object):
         if not VALID_PROTOCOL_NAME.match(protocol):
             raise ValueError('Invalid protocol name')
 
+        if properties:
+            raise ValueError('This AM does not support setting properties at'
+                    'account creation')
+
         base = ACCOUNT_OBJECT_PATH_BASE + cm + '/' + protocol.replace('-', '_')
 
         # FIXME: This is a stupid way to generate the paths - we should
@@ -174,7 +180,7 @@ class Account(Object):
     def _is_valid(self):
         return True
 
-    @method(ACCOUNT_IFACE, in_signature='a{sv}as', out_signature='')
+    @method(ACCOUNT_IFACE, in_signature='a{sv}as', out_signature='as')
     def UpdateParameters(self, set_, unset):
         print ("%s: entering UpdateParameters(\n    %r,\n    %r    \n)"
             % (self.__dbus_object_path__, set_, unset))
@@ -187,6 +193,8 @@ class Account(Object):
 
         self.AccountPropertyChanged({'Parameters': self._parameters})
 
+        return []
+
     @signal(ACCOUNT_IFACE, signature='a{sv}')
     def AccountPropertyChanged(self, delta):
         print ("%s: emitting AccountPropertyChanged(\n    %r    \n)"
diff --git a/tests/prototype/prototype.cpp b/tests/prototype/prototype.cpp
index 733a862..6fa4e4b 100644
--- a/tests/prototype/prototype.cpp
+++ b/tests/prototype/prototype.cpp
@@ -309,7 +309,7 @@ void UnitTests::testAccountManager_createAccount()
     QSignalSpy spy_validity_changed( &accountmanager_interface, SIGNAL( AccountValidityChanged( const QDBusObjectPath&, bool ) ) );
     QCOMPARE( spy_validity_changed.isValid(), true );
                                                       
-    QDBusPendingReply<QDBusObjectPath> create_reply = accountmanager_interface.CreateAccount( "gabble", "jabber", g_displayName, parameter_map );
+    QDBusPendingReply<QDBusObjectPath> create_reply = accountmanager_interface.CreateAccount( "gabble", "jabber", g_displayName, parameter_map, QVariantMap() );
     create_reply.waitForFinished();
         
     if ( !create_reply.isValid() )
-- 
1.5.6.5



More information about the telepathy-commits mailing list