I am trying to block the user in quickblox using privacyList. Which is working fine when the user is online. Once the user goes to offline, the other blocked user is able to send a message.
Blcked user shouldn't be able to send message once blocked even if the user is offline.
here is the code to block the user.
private void blockUser() {
QBPrivacyList list = new QBPrivacyList();
list.setName("public");
list.setActiveList(true);
ArrayList<QBPrivacyListItem> items = new ArrayList<>();
QBPrivacyListItem item1 = new QBPrivacyListItem();
item1.setAllow(false);
item1.setType(QBPrivacyListItem.Type.USER_ID);
item1.setValueForType(String.valueOf(qbChatDialog.getRecipientId()));
item1.setMutualBlock(true);
items.add(item1);
list.setItems(items);
try {
privacyListsManager.setPrivacyList(list);
privacyListsManager.setPrivacyListAsDefault("public");
blockedSuccess = true;
isBlocked = false;
} catch (SmackException.NotConnectedException | XMPPException.XMPPErrorException | SmackException.NoResponseException e) {
Log.e(TAG,"Failed to block: "+ e);
}
}