I want to block a particular friend from my chat list with XMPP
. code works fine. There is no Exception, but I am not able to block a user.
I'm using open fire server. what changes should i made on server?
Can u guys have any idea?
My code:
public void XMPPAddNewPrivacyList(Connection connection, String userName) {
String listName = "newList";
// Create the list of PrivacyItem that will allow or
// deny some privacy aspect
List<PrivacyItem> privacyItems = new Vector<PrivacyItem>();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.toString(),
false, 1);
item.setValue(userName);
privacyItems.add(item);
// Create the new list.
try {
PrivacyListManager privacyManager = new PrivacyListManager(connection);
privacyManager = PrivacyListManager
.getInstanceFor(connection);
privacyManager.createPrivacyList(listName, privacyItems);
} catch (XMPPException e) {
System.out.println("PRIVACY_ERROR: " + e);
}
}
try this ...
and for unblock just replace false with true in object of privacyitem `
Privacy is a method for users to block communications from particular other users. In XMPP this is done by managing one's privacy lists.
1 - In order to add a new list in the server, the client MAY implement something like:
2 - In order to add a new list in the server, the client MAY implement something like:
I think that the problem should be one of the following:
I reccomend you take a closer look to the documentation Smack documentation