[Bug 33410] Do on-disk avatar cache in CM

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 2 14:50:50 CEST 2012


https://bugs.freedesktop.org/show_bug.cgi?id=33410

--- Comment #24 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2012-07-02 05:50:50 PDT ---
(Only commenting on the API right now, not the English.)

+ <li>Image:
<em>$XDG_CACHE_HOME</em>/telepathy/avatars/<em>cm</em>/<em>protocol</em>/<em>escaped-token</em></li>
+ <li>MIME Type:
<em>$XDG_CACHE_HOME</em>/telepathy/avatars/<em>cm</em>/<em>protocol</em>/<em>escaped-token</em>.mime</li>
+ </ul> where <em>escaped-token</em> is the avatar <em>token</em> escaped
+ using telepathy-glib's tp_escape_as_identifier reference implementation.</p>

I think we should just say the CM SHOULD cache avatars somewhere in
XDG_CACHE_HOME/telepathy/avatars/*cm*, and that for each avatar for which the
MIME type is known, it MUST store that in the file with the same name + ".mime"
(or equivalently, the same file: URI + ".mime").

The precise details are up to the CM: for instance, if we were to merge Gabble
and Wocky into one CM, they could safely mix local-xmpp and jabber avatars into
a single directory, because they can't collide anyway, assuming no SHA-1
collisions (they both use SHA-1).

If we do (eventually) care about SHA-1 collisions, the best format would be
something like escaped JID + SHA-1 (and that would also make it easier to do
logic like "purge all but the last 2 avatars for each JID").

Specifying tp_escape_as_identifier in the spec is unnecessarily strict -
there's no requirement that these strings are valid C/C++/D-Bus identifiers,
and no interop requirement that CMs use the same escaping algorithm. The CM
could equally well use the hex SHA-1 directly (practical effect: no need to
escape a leading digit), or even use (a modified, URI-safe form of) Base64 to
get shorter names.

+ <tp:struct name="Contact_Avatar">

Do we need the MIME type on D-Bus at all? I don't think we do. If the CM is
required to store the MIME type (where known) alongside the image, then we can
just have plain avatar URIs in the D-Bus API, and any client that consumes them
will read the image from that URI, and the MIME type from that URI + ".mime",
successively.

I don't like the name "contact avatar" for something that is only a reference
to the avatar (specifically, the file URI). I'd prefer Avatar_URI or even
Cache_URI (and without the MIME type, it'd become a tp:simple-type).

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list