[Sugar-devel] [PATCH sugar] Fully update the salut account information when the nick name changes #10749

Simon Schampijer simon at schampijer.de
Tue Mar 29 12:49:58 EDT 2011


Sascha, in the '--in-reply-to' conversation this might have been falling 
of the crack :) At least was not part of the great review replies I 
found in my inbox this morning.

Cheers,
    Simon


On 03/23/2011 10:56 AM, Simon Schampijer wrote:
> When we update the nick name we need to update the information
> saved by the telepathy account manager. This does fix the complete
> update of the salut account information.
>
> Signed-off-by: Simon Schampijer<simon at laptop.org>
> ---
>   src/jarabe/model/neighborhood.py |   41 +++++++++++++++++++++++++-------------
>   1 files changed, 27 insertions(+), 14 deletions(-)
>
> diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
> index f0b3923..91fedd3 100644
> --- a/src/jarabe/model/neighborhood.py
> +++ b/src/jarabe/model/neighborhood.py
> @@ -798,12 +798,12 @@ class Neighborhood(gobject.GObject):
>           server = client.get_string(
>               '/desktop/sugar/collaboration/jabber_server')
>           account_id = self._get_jabber_account_id()
> -        needs_reconnect = account.UpdateParameters({'server': server,
> -                                                    'account': account_id,
> -                                                    'register': True},
> -                                                    dbus.Array([], 's'),
> -                                                    dbus_interface=ACCOUNT)
> -        if needs_reconnect:
> +        params_needing_reconnect = account.UpdateParameters(
> +            {'server': server,
> +             'account': account_id,
> +             'register': True},
> +            dbus.Array([], 's'), dbus_interface=ACCOUNT)
> +        if params_needing_reconnect:
>               account.Reconnect()
>
>           self._update_jid()
> @@ -812,10 +812,23 @@ class Neighborhood(gobject.GObject):
>           logging.debug('__nick_changed_cb')
>
>           nick = client.get_string('/desktop/sugar/user/nick')
> -        for account in self._server_account, self._link_local_account:
> -            bus = dbus.Bus()
> -            obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, account.object_path)
> -            obj.Set(ACCOUNT, 'Nickname', nick, dbus_interface=PROPERTIES_IFACE)
> +
> +        bus = dbus.Bus()
> +        server_obj = bus.get_object(ACCOUNT_MANAGER_SERVICE,
> +                                    self._server_account.object_path)
> +        server_obj.Set(ACCOUNT, 'Nickname', nick,
> +                       dbus_interface=PROPERTIES_IFACE)
> +
> +        link_local_obj = bus.get_object(ACCOUNT_MANAGER_SERVICE,
> +                                        self._link_local_account.object_path)
> +        link_local_obj.Set(ACCOUNT, 'Nickname', nick,
> +                           dbus_interface=PROPERTIES_IFACE)
> +        params_needing_reconnect = link_local_obj.UpdateParameters(
> +            {'nickname': nick,
> +             'published-name': self._limit_published_name(nick)},
> +            dbus.Array([], 's'), dbus_interface=ACCOUNT)
> +        if params_needing_reconnect:
> +            link_local_obj.Reconnect()
>
>           self._update_jid()
>
> @@ -825,10 +838,10 @@ class Neighborhood(gobject.GObject):
>                                    self._link_local_account.object_path)
>
>           account_id = self._get_jabber_account_id()
> -        needs_reconnect = account.UpdateParameters({'jid': account_id},
> -                                                   dbus.Array([], 's'),
> -                                                   dbus_interface=ACCOUNT)
> -        if needs_reconnect:
> +        params_needing_reconnect = account.UpdateParameters(
> +            {'jid': account_id},
> +            dbus.Array([], 's'), dbus_interface=ACCOUNT)
> +        if params_needing_reconnect:
>               account.Reconnect()
>
>       def __buddy_added_cb(self, account, contact_id, nick, handle):



More information about the Sugar-devel mailing list