use of com.xabber.xmpp.archive.Default in project xabber-android by redsolution.
the class MessageArchiveManager method checkForDefaults.
private void checkForDefaults(String account, Default received) {
if (received == null || !received.isUnset() || received.getSave() != SaveMode.fls)
return;
Default defaultItem = new Default();
defaultItem.setExpire(received.getExpire());
defaultItem.setOtr(received.getOtr());
defaultItem.setSave(SaveMode.body);
Pref pref = new Pref();
pref.setDefault(defaultItem);
pref.setType(Type.set);
try {
ConnectionManager.getInstance().sendStanza(account, pref);
} catch (NetworkException e) {
}
}
use of com.xabber.xmpp.archive.Default 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());
}
Aggregations