diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-09-16 18:21:32 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2010-09-16 18:33:06 +0100 |
commit | f02defd4f8053c62aafc867954474b4c97bae178 (patch) | |
tree | ab431f9b81427c4188eda1edf01e05c7a34e35d6 | |
parent | 02023109462143bba05b169ecc1c690038c357c9 (diff) | |
download | telepathy-mission-control-f02defd4f8053c62aafc867954474b4c97bae178.tar.gz |
Correctly initialize Account.CurrentPresence
The spec says that CurrentPresence being 'Unset' (which is value 0,
hence the default if we don't change it) means that the connection is
online, but doesn't support SimplePresence.
-rw-r--r-- | src/mcd-account.c | 4 | ||||
-rw-r--r-- | test/twisted/account-manager/request-online.py | 37 |
2 files changed, 27 insertions, 14 deletions
diff --git a/src/mcd-account.c b/src/mcd-account.c index 74af7280..027e86de 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -2977,6 +2977,10 @@ mcd_account_init (McdAccount *account) priv->min_presence_status = NULL; priv->min_presence_message = NULL; + priv->curr_presence_type = TP_CONNECTION_PRESENCE_TYPE_OFFLINE; + priv->curr_presence_status = g_strdup ("offline"); + priv->curr_presence_status = g_strdup (""); + combine_presences (account); priv->always_on = FALSE; diff --git a/test/twisted/account-manager/request-online.py b/test/twisted/account-manager/request-online.py index 08be67aa..90fb4cd3 100644 --- a/test/twisted/account-manager/request-online.py +++ b/test/twisted/account-manager/request-online.py @@ -1,5 +1,6 @@ -# Copyright (C) 2009 Nokia Corporation -# Copyright (C) 2009 Collabora Ltd. +# Python is really rubbish. vim: set fileencoding=utf-8 : +# Copyright © 2009–2010 Nokia Corporation +# Copyright © 2009–2010 Collabora Ltd. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,9 +20,13 @@ import dbus import dbus.service -from servicetest import EventPattern, tp_name_prefix, tp_path_prefix -from mctest import exec_test, SimulatedConnection, create_fakecm_account,\ - SimulatedChannel, SimulatedClient, expect_client_setup +from servicetest import ( + EventPattern, tp_name_prefix, tp_path_prefix, assertEquals, +) +from mctest import ( + exec_test, SimulatedConnection, create_fakecm_account, + SimulatedChannel, SimulatedClient, expect_client_setup, +) import constants as cs def test(q, bus, mc): @@ -47,11 +52,14 @@ def test(q, bus, mc): "password": "secrecy"}, signature='sv') (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params) - # The account is initially valid but disabled - assert not account.Get(cs.ACCOUNT, 'Enabled', - dbus_interface=cs.PROPERTIES_IFACE) - assert account.Get(cs.ACCOUNT, 'Valid', - dbus_interface=cs.PROPERTIES_IFACE) + # The account is initially valid but disabled, and hence offline + props = account.GetAll(cs.ACCOUNT, dbus_interface=cs.PROPERTIES_IFACE) + assert not props['Enabled'] + assert props['Valid'] + # The spec says it should be (Offline, "", "") but I don't think the + # strings really matter. If anything, the second one should start out at + # "offline". + assertEquals(cs.PRESENCE_TYPE_OFFLINE, props['CurrentPresence'][0]) # Enable the account account.Set(cs.ACCOUNT, 'Enabled', True, @@ -61,10 +69,11 @@ def test(q, bus, mc): signal='AccountPropertyChanged', interface=cs.ACCOUNT) - assert account.Get(cs.ACCOUNT, 'Enabled', - dbus_interface=cs.PROPERTIES_IFACE) - assert account.Get(cs.ACCOUNT, 'Valid', - dbus_interface=cs.PROPERTIES_IFACE) + props = account.GetAll(cs.ACCOUNT, dbus_interface=cs.PROPERTIES_IFACE) + assert props['Enabled'] + assert props['Valid'] + # Ditto above re. string fields. + assertEquals(cs.PRESENCE_TYPE_OFFLINE, props['CurrentPresence'][0]) # Go online requested_presence = dbus.Struct((dbus.UInt32(2L), dbus.String(u'brb'), |