[JDEV] Avatar images are per-resource
Jens Alfke
jens at mac.com
Wed Sep 5 12:05:10 CDT 2001
One more note on the avatar spec. I realized while in the shower this
morning that it's important that the image be stored in the public XML
associated with the resource, not in the XML for the user itself.
Otherwise multiple logins trying to set different images will stomp over
the image stored on the server.
I was unsure at the time (this was about while I was lathering my
armpits) whether the public-XML thingy supported per-resource storage,
but on looking at the very vague description
<http://docs.jabber.org/draft-proto/html/xml.html> it appears that it
does. The trick is to include your resource when sending the IQ 'set' to
yourself.
So to use an example, the provider of the image would store it on the
server as follows:
<iq id="1" type="set" to="me at myserver/myresource">
<query xmlns="jabber-storage:iq:avatar>
<data mimetype="image/jpeg"> ...Base64 image data goes here.. </data>
</query>
</iq>
The important thing to note is that the "to" address contains the
sender's resource. The requester would also need to include the resource
(as is already shown in the current avatar proposal.)
An additional thing I've done in the example is include a "mimetype"
attribute on the <data> element. I know I said earlier that the common
graphics formats are self-describing, but I think it's still safer to
tag the data. Not all OS's may have support for auto-detecting the image
type, and future image types may be harder to detect, and also this way
we could in the future include multiple <data> elements with different
MIME types and let the receiver easily pick out the best one.
--Jens
More information about the JDev
mailing list