Bug 18176

Summary: Don't get a signal after "RequestAvatars"
Product: Telepathy Reporter: Stefan Eilers <stefan.eilers>
Component: gabbleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED NOTABUG QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Full dump of DBus communcation to request avatar.

Description Stefan Eilers 2008-10-22 03:08:06 UTC
Created attachment 19810 [details]
Full dump of DBus communcation to request avatar.

I don't receive a signal after request the local avatar using the self handle.

Dbus-dump:
method call sender=:1.231 -> dest=org.freedesktop.Telepathy.Connection.gabble.jabber.basyskom_40localhost_2fTelepathy path=/org/freedesktop/Telepathy/Connection/gabble/jabber/basyskom_40localhost_2fTelepathy; interface=org.freedesktop.Telepathy.Connection.Interface.Avatars; member=RequestAvatars
   array [
      uint32 1
   ]
method return sender=:1.232 -> dest=:1.231 reply_serial=40

We wait for about 10 seconds and nothing happened.

See the detail dump attached.

Btw.: The same happens if I request an avatar of a contact.
Comment 1 Stefan Eilers 2008-10-24 01:26:30 UTC
Found the reason why the signal was missing:

If you don't have set an avatar for yourself or if a contact does not have an avatar you don't receive any signal. 

That's ok. But this makes it hard for a client application to detect/handle errors. Or did I missed a way to check whether there is a avatar available?
Comment 2 Will Thompson 2008-10-24 03:07:34 UTC
To check if an avatar is available, you call GetKnownAvatarTokens to get a map from contact handles to avatar tokens, which are the empty string if that contact is known not to have an avatar. Having done that, you can kick off RequestAvatars for contacts whose avatar token in that map is not the empty string.

Also, bind to the AvatarUpdated signal to be informed when the situation changes for any given contact.

So to figure out whether the self-handle has an avatar, call GetKnownAvatarTokens([self]) and look up self in the returned map.

* If it maps to a non-empty string, there's an avatar set, and the client can download it with RequestAvatars([self]), safe in the knowledge that it'll either get an AvatarRetrieved signal when it's been downloaded, or (in an unlikely situation where the user is changing their avatar on some other connection) it'll get AvatarUpdated for the self handle, at which point it should reconsider based on the new token in that signal.

* If it maps to the empty string, there's no avatar set, and calling RequestAvatars([self])  If you're on a rubbish protocol where avatars don't persist across connections, self will not be included in the returned map; at that point, a client should probably re-set its own idea of what the user's avatar is.

(Some CMs (Butterfly, IIRC) don't support GetKnownAvatarTokens, but support only GetAvatarTokens, which causes network roundtrips to retrieve the tokens for the specified contacts before returning. You could consider this to be a bug in those CMs, and ignore them. :-))

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.