Jabber user profile picture save another method vCard-base Avatar JEP-0153
This method is used by PSI, except for Versions later than 0.11. Disadvantage: It is bound with the vCard information. Each time a large amount of content is updated, additional redundant information needs to be added each time in the Presence broadcast. Advantage: the server is easy to implement without additional programming.Procedure: How to save the Avatar: Add a photo label to the vCard <IQ from = 'timyang @ jabber.org' Type = 'set' Id = 'vc1 '> <VCard xmlns = 'vcard-Temp '> <Bday> 1476-06-09 </bday> <ADR> <Ctry> Italy </ctry> <Locality> Verona </locality> <Home/> </ADR> <Nickname/> <N> <given> Tim </given> <family> Yang </family> </n> <Email> jcapulet@shakespeare.lit </Email> <Photo> <Type> image/JPEG </type> <Binval> Base64-encoded-avatar-file-here! </Binval> </Photo> </VCard> </IQ> Add Avatar information to user broadcast <presence>. <Presence from = 'timyang @ jabber.org/balcony'> <X xmlns = 'vcard-Temp: X: Update'> <Photo> sha1-hash-of-image </photo> </X> </Presence>
A friend can query the vCard by obtaining the user's avatar information: <IQ from = 'Romeo @ montague.net/orchard' To = 'timyang @ jabber.org' Type = 'get' Id = 'vc2 '> <VCard xmlns = 'vcard-Temp '/> </IQ> Server Returns vCard on behalf of user <IQ from = 'timyang @ jabber.org' 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> |