powered by Jive Software

Presence Problem

How can I make sure Presencepacket whether or not is requesting me to add him to my roster?

thanks!

hmm, your question needs clarifying a little bit.

Do you mean:

1: How can I tell if my Subscription request has been accepted/rejected

2: How can I tell if someone wants to Subscribe to my Presence

Both 1 and 2 are what I want Know;

Fortunately Smack makes all this very easy.

When someone wants to subscribe to your Presence you will receive a Presence packet of type SUBSCRIBE.

When someone has allowed you to subscribe to their Presence you will receive a Presence Packet of type SUBSCRIBED

When someone has rejected your Subscribe request you will receive a Presence packet of type UNSUBSCRIBED

So you just need to listen out on your Connection for these Presence packets and then react accordingly