use of com.xabber.xmpp.archive.List in project xabber-android by redsolution.
the class MessageArchiveManager method requestList.
private String requestList(String account, String bareAddress, String before) {
List packet = new List();
packet.setType(Type.get);
Set rsm = new Set();
rsm.setMax(RSM_MAX);
rsm.setBefore(before);
packet.setRsm(rsm);
packet.setWith(bareAddress);
packet.setEnd(connected.get(account));
String packetId = packet.getPacketID();
try {
ConnectionManager.getInstance().sendStanza(account, packet);
} catch (NetworkException e) {
}
return packetId;
}
use of com.xabber.xmpp.archive.List in project xabber-android by redsolution.
the class MessageArchiveManager method onPacket.
@Override
public void onPacket(ConnectionItem connection, final String bareAddress, Stanza packet) {
if (!(connection instanceof AccountItem))
return;
String account = ((AccountItem) connection).getAccount();
if (AccountManager.getInstance().getArchiveMode(account) != ArchiveMode.server)
return;
if (bareAddress != null && !Jid.getServer(account).equals(bareAddress))
return;
if (!(packet instanceof IQ))
return;
IQ iq = (IQ) packet;
if (iq.getType() == Type.set && packet instanceof Pref && ((Pref) packet).isValid())
onPreferenceReceived(account, (Pref) packet);
else if (iq.getType() == Type.set && packet instanceof ItemRemove && ((ItemRemove) packet).isValid())
onItemRemoveReceived(account, (ItemRemove) packet);
else if (iq.getType() == Type.set && packet instanceof SessionRemove && ((SessionRemove) packet).isValid())
onSessionRemoveReceived(account, (SessionRemove) packet);
else if (iq.getType() == Type.result && packet instanceof List && ((List) packet).isValid())
onListReceived(account, (List) packet);
else if (iq.getType() == Type.result && packet instanceof Chat && ((Chat) packet).isValid())
onChatReceived(account, (Chat) packet);
}
Aggregations