[Telepathy-commits] [telepathy-mission-control/master] Update Account, AccountManager from telepathy-spec git master

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Nov 11 08:54:26 PST 2008


This removes the Account_Presence type in favour of using Simple_Presence
from the SimplePresence interface, so include some glue in dbus-api.h.

(This is an ABI break - an auto-generated function was removed - but
not an API break.)
---
 libmcclient/dbus-api.h   |    7 +++-
 libmcclient/mc-account.c |    2 +-
 src/mcd-account.c        |   10 ++--
 xml/Account.xml          |   92 +++++++++++++++++++--------------------------
 xml/Account_Manager.xml  |   26 ++++++++++---
 xml/all.xml              |    2 +
 6 files changed, 73 insertions(+), 66 deletions(-)

diff --git a/libmcclient/dbus-api.h b/libmcclient/dbus-api.h
index efe2625..d36661f 100644
--- a/libmcclient/dbus-api.h
+++ b/libmcclient/dbus-api.h
@@ -26,9 +26,12 @@
 
 #include <glib/gquark.h>
 #include <glib-object.h>
+
 #include <dbus/dbus-glib.h>
-#include <telepathy-glib/proxy.h>
+
 #include <telepathy-glib/errors.h>
+#include <telepathy-glib/gtypes.h>
+#include <telepathy-glib/proxy.h>
 
 #define MC_ACCOUNT_MANAGER_DBUS_SERVICE "org.freedesktop.Telepathy.AccountManager"
 #define MC_ACCOUNT_MANAGER_DBUS_OBJECT "/org/freedesktop/Telepathy/AccountManager"
@@ -51,6 +54,8 @@
 #include <libmcclient/_gen/gtypes.h>
 #include <libmcclient/_gen/interfaces.h>
 
+#define MC_STRUCT_TYPE_ACCOUNT_PRESENCE (TP_STRUCT_TYPE_SIMPLE_PRESENCE)
+
 void _mc_ext_register_dbus_glib_marshallers (void);
 
 inline void _mc_gvalue_stolen (GValue *value);
diff --git a/libmcclient/mc-account.c b/libmcclient/mc-account.c
index 0aee986..e5a92bd 100644
--- a/libmcclient/mc-account.c
+++ b/libmcclient/mc-account.c
@@ -122,7 +122,7 @@ set_presence_gvalue (GValue *value, TpConnectionPresenceType type,
 		     const gchar *status, const gchar *message)
 {
     GType gtype;
-    gtype = MC_STRUCT_TYPE_ACCOUNT_PRESENCE;
+    gtype = TP_STRUCT_TYPE_SIMPLE_PRESENCE;
     g_value_init (value, gtype);
     g_value_take_boxed (value, dbus_g_type_specialized_construct (gtype));
     GValueArray *va = (GValueArray *) g_value_get_boxed (value);
diff --git a/src/mcd-account.c b/src/mcd-account.c
index b4046e6..9196f95 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -670,7 +670,7 @@ get_automatic_presence (TpSvcDBusProperties *self,
     presence = priv->auto_presence_status;
     message = priv->auto_presence_message;
 
-    type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE;
+    type = TP_STRUCT_TYPE_SIMPLE_PRESENCE;
     g_value_init (value, type);
     g_value_take_boxed (value, dbus_g_type_specialized_construct (type));
     va = (GValueArray *) g_value_get_boxed (value);
@@ -781,7 +781,7 @@ get_current_presence (TpSvcDBusProperties *self, const gchar *name,
     status = priv->curr_presence_status;
     message = priv->curr_presence_message;
 
-    type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE;
+    type = TP_STRUCT_TYPE_SIMPLE_PRESENCE;
     g_value_init (value, type);
     g_value_take_boxed (value, dbus_g_type_specialized_construct (type));
     va = (GValueArray *) g_value_get_boxed (value);
@@ -830,7 +830,7 @@ get_requested_presence (TpSvcDBusProperties *self,
     presence = priv->req_presence_status;
     message = priv->req_presence_message;
 
-    type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE;
+    type = TP_STRUCT_TYPE_SIMPLE_PRESENCE;
     g_value_init (value, type);
     g_value_take_boxed (value, dbus_g_type_specialized_construct (type));
     va = (GValueArray *) g_value_get_boxed (value);
@@ -1639,7 +1639,7 @@ mcd_account_request_presence (McdAccount *account,
 	GType type;
         GValueArray *va;
 
-	type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE;
+	type = TP_STRUCT_TYPE_SIMPLE_PRESENCE;
 	g_value_init (&value, type);
 	g_value_take_boxed (&value, dbus_g_type_specialized_construct (type));
 	va = (GValueArray *) g_value_get_boxed (&value);
@@ -1691,7 +1691,7 @@ mcd_account_set_current_presence (McdAccount *account,
 
     if (!changed) return;
 
-    type = MC_STRUCT_TYPE_ACCOUNT_PRESENCE;
+    type = TP_STRUCT_TYPE_SIMPLE_PRESENCE;
     g_value_init (&value, type);
     g_value_take_boxed (&value, dbus_g_type_specialized_construct (type));
     va = (GValueArray *) g_value_get_boxed (&value);
diff --git a/xml/Account.xml b/xml/Account.xml
index 334a56a..e5b755f 100644
--- a/xml/Account.xml
+++ b/xml/Account.xml
@@ -29,9 +29,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         <code>/org/freedesktop/Telepathy/Account/<em>cm</em>/<em>proto</em>/<em>acct</em></code>, where:</p>
 
       <ul>
-        <li><em>cm</em> is the same connection manager name that appears
-          in the connection manager's well-known bus name and object path</li>
-        <li><em>proto</em> is the protocol name as seen in
+        <li><em>cm</em> is the same <tp:type>Connection_Manager_Name</tp:type>
+          that appears in the connection manager's well-known bus name and
+          object path</li>
+        <li><em>proto</em> is the <tp:type>Protocol</tp:type> name as seen in
           ConnectionManager.ListProtocols, but with "-" replaced with "_"
           (i.e. the same as in the object-path of a Connection)</li>
         <li><em>acct</em> is an arbitrary string of ASCII letters, digits
@@ -103,20 +104,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       are the ones given special status by the source, and we have all of them
     -->
 
-    <property name="Interfaces" type="as" access="read">
+    <property name="Interfaces" tp:name-for-bindings="Interfaces"
+      type="as" tp:type="DBus_Interface[]" access="read">
       <tp:docstring>
         A list of the extra interfaces provided by this account.
       </tp:docstring>
     </property>
 
-    <method name="Remove">
+    <method name="Remove" tp:name-for-bindings="Remove">
       <tp:docstring>Delete the account.</tp:docstring>
       <tp:possible-errors>
         <tp:error name="org.freedesktop.Telepathy.Error.PermissionDenied"/>
       </tp:possible-errors>
     </method>
 
-    <signal name="Removed">
+    <signal name="Removed" tp:name-for-bindings="Removed">
       <tp:docstring>
         This account has been removed.
 
@@ -129,7 +131,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </signal>
 
-    <signal name="AccountPropertyChanged">
+    <signal name="AccountPropertyChanged"
+      tp:name-for-bindings="Account_Property_Changed">
       <tp:docstring>
         The values of one or more properties on this interface (that do not
         specify that this signal does not apply to them) may have changed.
@@ -146,7 +149,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </arg>
     </signal>
 
-    <property name="DisplayName" type="s" access="readwrite">
+    <property name="DisplayName" type="s" access="readwrite"
+      tp:name-for-bindings="Display_Name">
       <tp:docstring>
         The user-visible name of this account. This SHOULD be chosen by the
         user at account creation time. The account creation user interface
@@ -160,7 +164,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="Icon" type="s" access="readwrite">
+    <property name="Icon" tp:name-for-bindings="Icon"
+      type="s" access="readwrite">
       <tp:docstring>
         The name of an icon in the system's icon theme, such as "im-msn",
         or the empty string to not specify an icon. If the icon is set to
@@ -176,7 +181,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="Valid" type="b" access="read">
+    <property name="Valid" tp:name-for-bindings="Valid"
+      type="b" access="read">
       <tp:docstring>
         If true, this account is considered by the account manager to be
         complete and usable. If false, user action is required to make it
@@ -195,7 +201,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="Enabled" type="b" access="readwrite">
+    <property name="Enabled" tp:name-for-bindings="Enabled"
+      type="b" access="readwrite">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
         <p>This property gives the users the possibility to prevent an account
           from being used. This flag does not change the validity of the
@@ -228,7 +235,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="Nickname" type="as" access="readwrite">
+    <property name="Nickname" tp:name-for-bindings="Nickname"
+      type="s" access="readwrite">
       <tp:docstring>
         The nickname to set on this account for display to other contacts,
         as set by the user. When the account becomes connected, the
@@ -246,7 +254,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="Parameters" type="a{sv}" access="read">
+    <property name="Parameters" tp:name-for-bindings="Parameters"
+      type="a{sv}" access="read">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
         <p>A map from connection manager parameter names (as in the
           ConnectionManager interface) to their values. This property includes
@@ -262,7 +271,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <method name="UpdateParameters">
+    <method name="UpdateParameters" tp:name-for-bindings="Update_Parameters">
       <tp:docstring>
         Change the value of the Parameters property. Any changes will not
         take effect until the next time the account is disconnected and
@@ -297,36 +306,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:possible-errors>
     </method>
 
-    <tp:struct name="Account_Presence">
-      <tp:docstring>
-        A simplified form of the presence statuses seen in the Presence
-        interface.
-      </tp:docstring>
-
-      <tp:member name="Type" type="u" tp:type="Connection_Presence_Type">
-        <tp:docstring>
-          The presence type, e.g. Connection_Presence_Type_Away.
-        </tp:docstring>
-      </tp:member>
-
-      <tp:member name="Status" type="s">
-        <tp:docstring>
-          The connection-manager-specific string identifier of the presence
-          status, e.g. "brb".
-        </tp:docstring>
-      </tp:member>
-
-      <tp:member name="Message" type="s">
-        <tp:docstring>
-          The user-defined status message, e.g. "Back soon!". This will be
-          used as the value for the 'message' keyword in the Presence
-          interface's dictionary, if possible.
-        </tp:docstring>
-      </tp:member>
-    </tp:struct>
-
     <property name="AutomaticPresence" type="(uss)" access="readwrite"
-      tp:type="Account_Presence">
+      tp:type="Simple_Presence" tp:name-for-bindings="Automatic_Presence">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
         <p>The presence status that this account should have if it is brought
           online.</p>
@@ -334,8 +315,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         <p>Setting this property MUST NOT actually change the account's
           status until the next time it is (re)connected for some reason.</p>
 
-        <p>The Connection_Presence_Type in the structure SHOULD NOT
-          be Offline or Unset.</p>
+        <p>The <tp:type>Connection_Presence_Type</tp:type> in the structure
+          SHOULD NOT be Offline or Unset.</p>
 
         <tp:rationale>
           In ITOS2007 and ITOS2008 this is a global preference, not visible
@@ -345,7 +326,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="ConnectAutomatically" type="b" access="readwrite">
+    <property name="ConnectAutomatically" type="b" access="readwrite"
+      tp:name-for-bindings="Connect_Automatically">
       <tp:docstring>
         If true, the account manager SHOULD attempt to put this account
         online with the AutomaticPresence whenever possible (in the base
@@ -363,7 +345,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="Connection" type="o" access="read">
+    <property name="Connection" tp:name-for-bindings="Connection"
+      type="o" access="read">
       <tp:docstring>
         Either the object path of the connection to this account,
         or the special value '/' if there is no connection.
@@ -374,7 +357,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="ConnectionStatus" type="u" access="read">
+    <property name="ConnectionStatus" type="u" access="read"
+      tp:name-for-bindings="Connection_Status">
       <tp:docstring>
         If the Connection property is non-empty, the status of that connection.
         If the Connection property is the empty string, this property may
@@ -393,9 +377,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="ConnectionStatusReason" type="u" access="read">
+    <property name="ConnectionStatusReason" type="u" access="read"
+      tp:name-for-bindings="Connection_Status_Reason">
       <tp:docstring>
-        The reason for the last change to Connection_Status.
+        The reason for the last change to ConnectionStatus.
         The account manager is expected to set this by observing signals
         from the Connection.
 
@@ -408,7 +393,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     </property>
 
     <property name="CurrentPresence" type="(uss)" access="read"
-      tp:type="Account_Presence">
+      tp:type="Simple_Presence" tp:name-for-bindings="Current_Presence">
       <tp:docstring>
         The actual presence. If the connection is not online, this should be
         (Connection_Presence_Type_Offline, "", "").
@@ -424,7 +409,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     </property>
 
     <property name="RequestedPresence" type="(uss)" access="readwrite"
-      tp:type="Account_Presence">
+      tp:type="Simple_Presence" tp:name-for-bindings="Requested_Presence">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
         <p>The requested presence for this account. When this is changed, the
           account manager should attempt to manipulate the connection manager
@@ -443,7 +428,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="NormalizedName" type="s" access="read">
+    <property name="NormalizedName" type="s" access="read"
+      tp:name-for-bindings="Normalized_Name">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
         <p>The normalized user ID of the local user on this account (i.e. the
           string returned when the InspectHandle method is called on the
diff --git a/xml/Account_Manager.xml b/xml/Account_Manager.xml
index 646affc..b92913e 100644
--- a/xml/Account_Manager.xml
+++ b/xml/Account_Manager.xml
@@ -29,7 +29,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         the session bus. This process must export an
         /org/freedesktop/Telepathy/AccountManager object with the
         AccountManager interface.</p>
+
+      <p>Until a mechanism exists for making a reasonable automatic choice
+        of AccountManager implementation, implementations SHOULD NOT
+        register as an activatable service for the AccountManager's
+        well-known bus name. Instead, it is RECOMMENDED that some component
+        of the user's session will select and activate a particular
+        implementation, and that other Telepathy-enabled programs can
+        detect whether Telepathy is in use by checking whether the
+        AccountManager's well-known name is in use at runtime.</p>
     </tp:docstring>
+    <tp:added version="0.17.2"/>
 
     <!-- Missing functionality compared with NMC 4.x:
     * look up accounts by conditions (can be done client-side, less
@@ -42,13 +52,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     * register filters (completely out of scope: Channel Dispatcher again)
     -->
 
-    <property name="Interfaces" type="as" access="read">
+    <property name="Interfaces" tp:name-for-bindings="Interfaces"
+      type="as" tp:type="DBus_Interface[]" access="read">
       <tp:docstring>
         A list of the interfaces provided by the account manager object.
       </tp:docstring>
     </property>
 
-    <property name="ValidAccounts" type="ao" access="read">
+    <property name="ValidAccounts" type="ao" access="read"
+      tp:name-for-bindings="Valid_Accounts">
       <tp:docstring>
         A list of the valid (complete, usable) accounts. Change notification
         is via AccountValidityChanged.
@@ -62,14 +74,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </tp:docstring>
     </property>
 
-    <property name="InvalidAccounts" type="ao" access="read">
+    <property name="InvalidAccounts" type="ao" access="read"
+      tp:name-for-bindings="Invalid_Accounts">
       <tp:docstring>
         A list of incomplete or otherwise unusable accounts. Change
         notification is via AccountValidityChanged.
       </tp:docstring>
     </property>
 
-    <signal name="AccountRemoved">
+    <signal name="AccountRemoved" tp:name-for-bindings="Account_Removed">
       <tp:docstring>
         The given account has been removed.
 
@@ -86,7 +99,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </arg>
     </signal>
 
-    <signal name="AccountValidityChanged">
+    <signal name="AccountValidityChanged"
+      tp:name-for-bindings="Account_Validity_Changed">
       <tp:docstring>
         The validity of the given account has changed. New accounts are
         also indicated by this signal, as an account validity change
@@ -111,7 +125,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
       </arg>
     </signal>
 
-    <method name="CreateAccount">
+    <method name="CreateAccount" tp:name-for-bindings="Create_Account">
       <tp:docstring>
         Request the creation of a new account. The account manager SHOULD NOT
         allow invalid accounts to be created. Accounts created through this
diff --git a/xml/all.xml b/xml/all.xml
index f39f616..ce2b451 100644
--- a/xml/all.xml
+++ b/xml/all.xml
@@ -18,6 +18,8 @@
 	from="Telepathy specification (ConnectionManager)"/>
     <tp:external-type name="Protocol" type="s"
 	from="Telepathy specification (ConnectionManager)"/>
+    <tp:external-type name="Simple_Presence" type="(uss)"
+	from="Telepathy specification (SimplePresence)"/>
 </tp:generic-types>
 
 <xi:include href="generic-types.xml"/>
-- 
1.5.6.5




More information about the Telepathy-commits mailing list