Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
rheuser #1
Member since Aug 2008 · 25 posts · Location: Fremont, Ca, USA
Group memberships: Members
Show profile · Link to this post
Subject: Matching Presence to Roster Item and getting the Avatar
I am trying to learn how to use the agsXMPP sdk.  I have built a GTalk client using the Gtalk sample and the MiniClientWM5 as examples.  I am able to connect to Gtalk and I receive Roster Items at my OnRosterItem Event handler and I receive Presence at my OnPresence Event Handler.  But I am having difficulty matching them up.  IN the MiniClientWM5 example you match the incoming presence.From to the previously saved RosterItem.JID.  But the data I received from Gtalk does not seem to match up.  Here is is:

Values from RosterItem at OnRosterItem Event:

item.Jid.ToString() = {donnie.pinkston@gmail.com}
{<item xmlns="jabber:iq:roster" jid="donnie.pinkston@gmail.com" name="Donnie Pinkston" subscription="both" />}

item.Jid.ToString() = {eduardo.sciammarella@gmail.com}
{<item xmlns="jabber:iq:roster" jid="eduardo.sciammarella@gmail.com" ask="subscribe" subscription="none" />}

item.Jid.ToString() = {kernel1983@gmail.com}
{<item xmlns="jabber:iq:roster" jid="kernel1983@gmail.com" name="KJ" subscription="both" />}


Values from Presence at OnPresence Event:

pres.From = {dick.heuser@gmail.com/TalkGadgetD5440F8D}
{<presence xmlns="jabber:client" from="dick.heuser@gmail.com/TalkGadgetD5440F8D" to="dick.heuser@gmail.com/agsXMPP620FF05A"><caps:c xmlns:caps="http://jabber.org/protocol/caps" ver="1.0" node="http://talkgadget.google.com/client/caps" ext="pmuc-v1" /><status /><x xmlns="vcard-temp:x:update"><photo>e71b3b6276d994e77384c76c0e4d04cb864ae38e</photo></x></presence>}

pres.From = {dick.heuser@gmail.com/Talk.v104E1AE0897}
pres = {<presence xmlns="jabber:client" from="dick.heuser@gmail.com/Talk.v104E1AE0897" to="dick.heuser@gmail.com/agsXMPP620FF05A"><priority>24</priority><c xmlns="http://jabber.org/protocol/caps" ver="1.0.0.104" node="http://www.google.com/xmpp/client/caps" ext="s...

pres.From = {dick.heuser@gmail.com/Talk.v1044C40FE37}
{<presence xmlns="jabber:client" from="dick.heuser@gmail.com/Talk.v1044C40FE37" to="dick.heuser@gmail.com/agsXMPP620FF05A"><show>away</show><priority>24</priority><c xmlns="http://jabber.org/protocol/caps" ver="1.0.0.104" node="http://www.google.com/xmpp/client/caps" ext="share-v1 voice-v1" /><x xmlns="jabber:x:delay" stamp="20080816T03:59:00" /><status /><x xmlns="vcard-temp:x:update"><photo>e71b3b6276d994e77384c76c0e4d04cb864ae38e</photo></x></presence>}

pres.From = {dick.heuser@gmail.com/gmail.ADF42707}
{<presence xmlns="jabber:client" from="dick.heuser@gmail.com/gmail.ADF42707" to="dick.heuser@gmail.com/agsXMPP620FF05A"><show>away</show><priority>0</priority><caps:c xmlns:caps="http://jabber.org/protocol/caps" ver="1.1" node="http://mail.google.com/xmpp/client/caps" ext="pmuc-v1" /><status /><x xmlns="vcard-temp:x:update"><photo>e71b3b6276d994e77384c76c0e4d04cb864ae38e</photo></x></presence>}

Anyway, I am confused and do not have a clue as to how I relate the Presence data to the Roster Items received.

After that, I see that the Presence data contains a HashTotal for the Photo.  Is that the Avatar?  How do I get it?  Do I use and IQ to retrieve a VCARD and dig it out of there?

This product seems quite complete but it is so extensive that it is a little overwhelming at first.

Regards,
Dick (rheuser)
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Dick,

what you are doing is correct.

item.Jid.ToString() = {eduardo.sciammarella@gmail.com}
{<item xmlns="jabber:iq:roster" jid="eduardo.sciammarella@gmail.com" ask="subscribe" subscription="none" />}

for this contact the subscription is none. This means there is no presence exchanged in both directions. You have to ask for subscription and vice versa.
The other contacts have both and look correct.

After you have received your contacts from the server you send your own presence to teh server. After this the server notifies you with your contacts presences. But you get only a presence stanza when user != offline. So if you get no presence the user is offline.

Were the contacts with correct subscription (both) online during your tests?

After that, I see that the Presence data contains a HashTotal for the Photo.  Is that the Avatar?  How do I get it?  Do I use and IQ to retrieve a VCARD and dig it out of there?

yes, if you use teh forums search you will find many threads and examples about avatars.

Alex
Avatar
rheuser #3
Member since Aug 2008 · 25 posts · Location: Fremont, Ca, USA
Group memberships: Members
Show profile · Link to this post
Thank you for your help.

By the way, I noticed that your contact information is for Heilbron.  I was there visiting friends a few years ago and it seems like a really good place to live.

Regards,
Dick
Avatar
rheuser #4
Member since Aug 2008 · 25 posts · Location: Fremont, Ca, USA
Group memberships: Members
Show profile · Link to this post
Alex,

Once I changed the Presence of some of the contacts, it came through with matching From to the Roster Item JID as you said that it would.

Thank you,
Dick
Avatar
rheuser #5
Member since Aug 2008 · 25 posts · Location: Fremont, Ca, USA
Group memberships: Members
Show profile · Link to this post
Alex,

In the MiniClientWM5 sample, you use images in an ImageList, ilsRoster, to show the Presence.show in the ListViewRoster.  However, the images are not included.  Are they available somewhere?

Regards,
Dick
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you can find the icons in the desktop example clients.

Here also also some links for nice roster icons:

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