[jdev] Issues With Subscription Requests (Block and Unblock)

Dave Cridland dave at cridland.net
Fri Mar 7 08:14:22 CST 2008

On Fri Mar  7 13:31:45 2008, shashi kiran wrote:
> i Block a Contact, and it is Successfully done,but once i unblock  
> the same
> Contact in the current session my immediate Presence is not  
> broadcasted to
> the contact but his presence is seen by me. Once i Logout and then  
> login
> again everything is fine he is able to see my presence and me his...
One problem is that you're not actually blocking and unblocking.

> I Use the Following Stanzas for Block and Unblock
> For Block:
>      * <presence to='contact at jabber.org'   type='unsubscribe'/>

This one is unsubscribing - you're no longer trying to get them to  
send you their presence.

>       <presence to='contact at jabber.org'  type='unavailable'/>*
This one, on the other hand, is a directed presence - you're saying  
"Tell these people I'm unavailable for the rest of this session,  
unless I say otherwise."

> For Unblock:
>       *<presence to='contact at jabber.org'   type='subscribe'/>*
This one requests that the other person gives you permission to see  
his presence again.

But you never override the directed presence again, which lasts for  
the rest of the session. That's why everything works again once you  
log out and back in again.

For blocking, you either want to use privacy lists, or else you want  
to send out directed presence to the people you want to block - but  
note that doesn't actually block them, just make you appear offline.

Dave Cridland - mailto:dave at cridland.net - xmpp:dwd at jabber.org
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade

More information about the JDev mailing list