Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
glory209 #1
Member since Aug 2006 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to set my avatar?
How to send my avatar to gtalk client?
Avatar
Jabberer #2
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hello,

there are different XEP's for avatars.
http://www.xmpp.org/extensions/xep-0084.html
http://www.xmpp.org/extensions/xep-0084.html

here is a presence packet form a GTalk user
  1. <presence from="user@gmail.com/Talk.XXXX">
  2. <show>away</show>
  3. <priority>0</priority>
  4. <c xmlns="http://jabber.org/protocol/caps" node="http://www.google.com/xmpp/client/caps" ver="1.0.0.92" ext="voice-v1" />
  5. <x xmlns="jabber:x:delay" stamp="20061027T08:24:01" />
  6. <status/>
  7. <x xmlns="vcard-temp:x:update">
  8. <photo>some hash value</photo>
  9. </x>
  10. </presence>

So it looks like they use vCard based avatars (XEP-0153).

With vCard based avatars your send a hash of your photo with your presence packets. Other clients store this hash and your photo. When a clients get a new presence from a user it has to compare the hash values. If it has changed you know that there must be a new photo and you can request it from the vCard.
Software Developer
AG-Software
Avatar
draekz #3
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Do you know how to get agsXMPP to send this when you SendMyPresence?

I'm trying to make it so that avatars update dynamically, but eventhough i know what XML should be transmitted, i'm not sure yet how to deal with it using agsXMPP.
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you have to create the xml/classes yourself.
They are not supported in agsXMPP for various reasons.

There are also many other avatar threads here in the forums which may help you.

Alex
Avatar
draekz #5
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Yeah I've  been trying to read them, but this forum is kinda big :P
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here is a code snipped for creating such a custom Presence packet:

XML to create:
  1. <presence>
  2.     <show>xa</show>
  3.     <status>Away from the computer.</status>
  4.     <priority>5</priority>
  5.     <c xmlns="http://jabber.org/protocol/caps" node="http://www.ag-software.net/caps" ver="1.1.0" ext="rtf html-im crypt" />
  6.     <x xmlns="jabber:x:avatar">
  7.     <hash>1bb12134f2528c4617fcc393180ddcfcc8462311</hash>
  8.     </x>
  9. </presence>

c# code:
  1. Presence pres = new Presence();
  2. pres.Show = agsXMPP.protocol.client.ShowType.xa;
  3. pres.Status = "Away from the computer.";
  4. pres.Priority = 5;
  5.  
  6. Capabilities caps = new Capabilities();
  7. caps.Node = "http://www.ag-software.net/caps";
  8. caps.Version = "1.1.0";
  9. caps.Extensions = new string[] { "rtf", "html-im", "crypt"};
  10.  
  11. Avatar avatar = new Avatar();
  12. avatar.Hash = "1bb12134f2528c4617fcc393180ddcfcc8462311";
  13.  
  14. pres.AddChild(caps);
  15. pres.AddChild(avatar);
  16.  
  17. Console.WriteLine(pres .ToString());

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS