[Sugar-devel] [PATCH sugar] Fix invitations from a non sugar client (empathy), part of OLPC #10814
Simon Schampijer
simon at schampijer.de
Mon May 30 08:53:11 EDT 2011
On 05/28/2011 06:33 PM, Sascha Silbe wrote:
> Excerpts from Simon Schampijer's message of Mon May 23 14:44:47 +0200 2011:
>
>>>> + def join(self):
>>>> + logging.error('PrivateInvite.join handler %r', self._handler)
>>>> +
>>>> + registry = bundleregistry.get_registry()
>>>> + bundle_id = self.get_bundle_id()
>>>> + bundle = registry.get_bundle(bundle_id)
>>>> + if bundle is None:
>>>> + self._call_handle_with()
>>>
>>> What exactly does the latter part do? Reject the invitation? Or pass it
>>> on to a non-Sugar application?
>>
>> http://telepathy.freedesktop.org/spec/Channel_Dispatch_Operation.html#Method:HandleWith
>
> The only code path I could find that involves PrivateInvite.join() is:
>
> Invites._dispatch_non_sugar_invitation()
> Invites._add_private_invite(handler=CLIENT + '.org.laptop.Chat')
> (Invitation added to Frame, user accepts invitation)
> InviteButton.__clicked_cb()
> InviteButton._launch()
> PrivateInvite.join()
>
> Since handler is the constant mentioned above,
> BaseInvite.get_bundle_id() always returns 'org.laptop.Chat' when called
> in PrivateInvite.join(). That means the if-then part of
> PrivateInvite.join() is dead code.
>
> Sascha
Good catch. I would simplify things then and pass in the handler
'org.laptop.Chat' to PrivateInvite then directly and remove the
'get_bundle_id()' part. If we support other ways of private invitations
later we can enhance the code.
Good with that change?
Regards,
Simon
More information about the Sugar-devel
mailing list