Search in sources :

Example 1 with Session

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);
}
Also used : SessionRemove(com.xabber.xmpp.archive.SessionRemove) Session(com.xabber.xmpp.archive.Session)

Example 2 with 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());
}
Also used : AccountItem(com.xabber.android.data.account.AccountItem) Item(com.xabber.xmpp.archive.Item) MessageItem(com.xabber.android.data.message.MessageItem) ConnectionItem(com.xabber.android.data.connection.ConnectionItem) Default(com.xabber.xmpp.archive.Default) Session(com.xabber.xmpp.archive.Session)

Example 3 with Session

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);
}
Also used : Pref(com.xabber.xmpp.archive.Pref) Session(com.xabber.xmpp.archive.Session)

Aggregations

Session (com.xabber.xmpp.archive.Session)3 AccountItem (com.xabber.android.data.account.AccountItem)1 ConnectionItem (com.xabber.android.data.connection.ConnectionItem)1 MessageItem (com.xabber.android.data.message.MessageItem)1 Default (com.xabber.xmpp.archive.Default)1 Item (com.xabber.xmpp.archive.Item)1 Pref (com.xabber.xmpp.archive.Pref)1 SessionRemove (com.xabber.xmpp.archive.SessionRemove)1