Not logged in. · Lost password · Register
Forum: XMPP XMPP Protocol RSS
Avatar
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: roster management
Alex,

I am reviewing how my application adds and removes contacts from the roster.

I have looked at the mini client example but I still want to ask these questions:

Is the XmppCon_OnRosterItem callback the place to handle ALL additions or removals from the roster?

Should I be acting on the PresenceType.subscribed and PresenceType.unsubscribe in the XmppCon_OnPresence callback?

Say I want to write a client that automatically accepts invitations. What does the client have to do when it receives an invitation in order to set up a “both” relationship? Where should it issue the ApproveSubscriptionRequest and XmppCon.PresenceManager.Subcribe.

I am not getting exactly how to use the API in this case.

Thanks and Best regards,
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ayyrk:
Is the XmppCon_OnRosterItem callback the place to handle ALL additions or removals from the roster?
yes, also for updates and changes of a contact. Eg user wants to change the nickname/display name of a contact.

Quote by ayyrk:
Should I be acting on the PresenceType.subscribed and PresenceType.unsubscribe in the XmppCon_OnPresence callback?
no interaction on the xmpp layer is required there. Only in your user interface if you want to show your user a notification that he is subscribed or unsubscribed now.

Quote by ayyrk:
Say I want to write a client that automatically accepts invitations. What does the client have to do when it receives an invitation in order to set up a “both” relationship? Where should it issue the ApproveSubscriptionRequest and XmppCon.PresenceManager.Subcribe.
I am not getting exactly how to use the API in this case.

If you get a subscribe Presence send back automatically a subscribed Presence. As you mentioned this can be done with the PresenceManager. But to get a mutual subscription (both) you have to check whether the requesting person is already in your roster or not. If not then add this person and send a subscription request.

Alex
Alexander Gnauck
AG-Software
Avatar
ayyrk #3
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
If you get a subscribe Presence send back automatically a subscribed Presence.


Do I look for and handle the subscribe Presence in the XmppCon_OnPresence(object sender, Presence pres) callback by looking at pres.Type?

Or do I handle it in the XmppCon_OnRosterItem(object sender, RosterItem item) by looking at item.Ask?
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ayyrk:
Do I look for and handle the subscribe Presence in the XmppCon_OnPresence(object sender, Presence pres) callback by looking at pres.Type?
Yes
Alexander Gnauck
AG-Software
Avatar
ayyrk #5
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Hi,

I'm using XmppCon.PresenceManager.Subcribe(jid);

If I send a subscription to a client running the same resource then it works. That is to say sending subscription requests to other instances of my agsxmpp based client works. But if I send a subscription to a different client resource it doesn't work.

In the fail case the requesting JID ends up in the receivers roster but the subscription type is NONE.

Question: What is the relationship between resource and the PresenceManager.Subscribe API call?

Basically here's what I am doing: I am sending a subscription request from my mobile device to a spark client. The spark client doesn't popup the "accept deny" dialog box.

Thanks!
Avatar
Alex #6
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Use always Bare Jabber IDs (without resource) for roster and presence management.
Never use Jids with resources for roster management and Subscriptions

Alex
Alexander Gnauck
AG-Software
Avatar
ayyrk #7
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Thanks Alex -   I'm happy to say I figured that out just a minute ago.  Thanks again!!

-Mark
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: XMPP XMPP Protocol RSS