use of com.xabber.xmpp.archive.Session in project xabber-android by redsolution.
the class MessageArchiveManager method sendSessionRemove.
private void sendSessionRemove(String account, String session) throws NetworkException {
Session extension = new Session();
extension.setThread(session);
SessionRemove packet = new SessionRemove();
packet.addSession(extension);
packet.setType(Type.set);
ConnectionManager.getInstance().sendStanza(account, packet);
sessionSaves.remove(account, session);
}
use of com.xabber.xmpp.archive.Session in project xabber-android by redsolution.
the class MessageArchiveManager method onPreferenceReceived.
private void onPreferenceReceived(String account, Pref pref) {
Default defaultItem = pref.getDefault();
if (defaultItem != null)
defaults.put(account, new ArchivePreference(defaultItem.getOtr(), defaultItem.getSave()));
for (Item item : pref.getItems()) {
MatchMode matchMode;
String value = Jid.getStringPrep(item.getJid());
if (item.getExactmatch() != null && item.getExactmatch()) {
matchMode = MatchMode.exect;
} else {
String resource = Jid.getResource(item.getJid());
if (resource != null && !"".equals(resource))
matchMode = MatchMode.exect;
else {
String name = Jid.getName(item.getJid());
if (name != null && !"".equals(name)) {
matchMode = MatchMode.bare;
value = Jid.getBareAddress(value);
} else {
matchMode = MatchMode.domain;
value = Jid.getServer(value);
}
}
items.get(account).get(matchMode).put(value, new ArchivePreference(item.getOtr(), item.getSave()));
}
}
for (Session session : pref.getSessions()) sessionSaves.put(account, session.getThread(), session.getSave());
}
use of com.xabber.xmpp.archive.Session in project xabber-android by redsolution.
the class MessageArchiveManager method sendSessionUpdate.
private void sendSessionUpdate(String account, String session, SaveMode saveMode) throws NetworkException {
Session extension = new Session();
extension.setThread(session);
extension.setTimeout(SESSION_TIMEOUT);
extension.setSave(saveMode);
Pref packet = new Pref();
packet.addSession(extension);
packet.setType(Type.set);
ConnectionManager.getInstance().sendStanza(account, packet);
sessionSaves.put(account, session, saveMode);
}
Aggregations