Roster: Block user

Hi, I programming a bot with smack and use Roster with SUBSCRIPTION_ACCEPT_ALL

Can I remove User from my roster, so I get no longer messages from them?

Hi iNPUTmice,

Yes, you can. Try doing something like:

Roster roster = XMPPConnection.getRoster();

roster.removeEntry(roster.getEntry("bob@example.com");

/code

Hope that helps,

Ryan

Hi,

do you want to block all messages by using a privacy list? As far as I know Wildfire supports it but Smack doesn’'t.

LG

Hey LG,

Privacy list support has been added to Smack (by a community member). The code is not in the repository yet but it is fully implemented and will be available in the next Smack release. I guess that this week or the next week the code will be under SVN.

Regards,

– Gato

I guess we just need to know if INPUTmice wants to block a user (like the subject says) or remove a user (like the body says).

If i am correct by removing a RosterEntry you will lose a subscription to this entry, i.e. presence information. You can implement blocking by storing additional information in a database.

Be carefull with Subscription_Accept_All, because it effect not only subscription but unsubscription too, so if you remove a particular entry, this entry will automatically remove you, so both of you will lose presence information.

I think it is safer to use Manual subscription, although it can get complex.