Search This Blog

Monday, February 05, 2007

just a note,about vcard-based avatars in xmpp

It used to confuse me,but at last I understand.Well,everyone in the roster has a vcard,something recording his personal information.And to get someone's avatar,one of the methods is vcard-based.
Maybe someone's presence stanza is like this:


<presence from='juliet@capulet.com/balcony'>
<x xmlns='vcard-temp:x:update'>
<photo>sha1-hash-of-image</photo>
</x>
</presence>

on receiving it,we can check the sha1sums of all the cached avatars,if there is an avatar's sha1sum matches the "photo" element's content,then just use the avatar,otherwise,we need to retrieve the complete vcard infomation like this:

<iq from='romeo@montague.net/orchard'
to='juliet@capulet.com'
type='get'
id='vc2'>
<vCard xmlns='vcard-temp'/>
</iq>

then we wait for the response:

<iq from='juliet@capulet.com'
to='romeo@montague.net/orchard'
type='result'
id='vc2'>
<vCard xmlns='vcard-temp'>
<BDAY>1476-06-09</BDAY>
<ADR>
<CTRY>Italy</CTRY>
<LOCALITY>Verona</LOCALITY>
<HOME/>
</ADR>
<NICKNAME/>
<N><GIVEN>Juliet</GIVEN><FAMILY>Capulet</FAMILY></N>
<EMAIL>jcapulet@shakespeare.lit</EMAIL>
<PHOTO>
<TYPE>image/jpeg</TYPE>
<BINVAL>
Base64-encoded-avatar-file-here!
</BINVAL>
</PHOTO>
</vCard>
</iq>

Ok,decode the base64-encoded-avatar-file in the "BINVAL" and we can get the avatar.

Saturday, February 03, 2007

ebank of spdb

Shanghai Pudong Development Bank's new version of ebank can now be accessed under linux,using firefox,either version 1.5 or 2.0.
It's a milestone for Chinese banks,for there was never a bank escaped from evil MS,until spdb.
Personally,I am excited:I can throw terrible windows over completely,I can get it out of my hard disk.