[sugar] [PATCH] Push get_buddy from Connect into sugar.presence (#6473)

Morgan Collett morgan.collett at gmail.com
Wed May 14 09:58:21 EDT 2008


On Wed, May 14, 2008 at 11:17 AM, Guillaume Desmottes
<guillaume.desmottes at collabora.co.uk> wrote:
> Le mardi 13 mai 2008 à 17:03 +0200, Morgan Collett a écrit :
>> This subclasses TubeConnection to make a version (SugarTubeConnection)
>> that can resolve a handle to a Buddy.
>>
>> Patches are for sugar(.presence) and Connect.
>
>
> +            handle = self._conn.GetSelfHandle()
>
> Why call the GetSelfHandle() D-Bus method as you already have the
> handle?
> handle = self.self_handle
> should be enough

In case it is a channel with channel specific handles...

if self.self_handle == cs_handle:
        # It's me, just get my global handle
        handle = self._conn.GetSelfHandle()

We either need to call GetSelfHandle regardless of knowing whether the
group has channel specific handles, or we need to call GetGroupFlags
regardless of whether it is my handle. Is either of those less costly?

> +            # deal with failure to get the handle owner
> +            if handle == 0:
> +                return None
> I think this should always be done, not only in the else branch.

Ah, that was probably the original intention. I looked back in the
history to check in case it was accidently indented at some point, but
didn't find anything.

> I'm wondering if it shouldn't be better to override watch_participants
> (or add a new similar mechanism) returning directly buddies instead of
> handles. Would it be possible/worth to completely hide handles and
> always use buddies from the activity Pov?

There's a chance that some will want to use telepathy calls directly
in the activity, in case we end up oversimplifying the collaboration
API. You could make the same argument about the bus names... but if
you think it's a good idea, provide a patch we can review :)

Morgan


More information about the Sugar mailing list