use of com.xabber.xmpp.blocking.BlockList in project xabber-android by redsolution.
the class BlockingManager method requestBlockList.
public void requestBlockList(String account) {
if (!isSupported(account)) {
return;
}
final BlockList blockListRequest = new BlockList();
blockListRequest.setType(IQ.Type.get);
try {
ConnectionManager.getInstance().sendRequest(account, blockListRequest, new OnResponseListener() {
@Override
public void onReceived(String account, String packetId, IQ iq) {
if (!blockListRequest.getStanzaId().equals(packetId) || !(iq instanceof BlockList)) {
return;
}
if (iq.getType() == IQ.Type.result) {
blockListsForAccounts.put(account, ((BlockList) iq).getItems());
for (OnBlockedListChangedListener onBlockedListChangedListener : Application.getInstance().getUIListeners(OnBlockedListChangedListener.class)) {
onBlockedListChangedListener.onBlockedListChanged(account);
}
for (OnContactChangedListener onContactChangedListener : Application.getInstance().getUIListeners(OnContactChangedListener.class)) {
onContactChangedListener.onContactsChanged(new ArrayList<BaseEntity>());
}
}
}
@Override
public void onError(String account, String packetId, IQ iq) {
}
@Override
public void onTimeout(String account, String packetId) {
}
@Override
public void onDisconnect(String account, String packetId) {
}
});
} catch (NetworkException e) {
e.printStackTrace();
}
}
Aggregations