Search in sources :

Example 1 with SessionRemove

use of com.xabber.xmpp.archive.SessionRemove 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 SessionRemove

use of com.xabber.xmpp.archive.SessionRemove 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);
}
Also used : AccountItem(com.xabber.android.data.account.AccountItem) Pref(com.xabber.xmpp.archive.Pref) ItemRemove(com.xabber.xmpp.archive.ItemRemove) SessionRemove(com.xabber.xmpp.archive.SessionRemove) IQ(org.jivesoftware.smack.packet.IQ) AbstractChat(com.xabber.android.data.message.AbstractChat) Chat(com.xabber.xmpp.archive.Chat) List(com.xabber.xmpp.archive.List)

Aggregations

SessionRemove (com.xabber.xmpp.archive.SessionRemove)2 AccountItem (com.xabber.android.data.account.AccountItem)1 AbstractChat (com.xabber.android.data.message.AbstractChat)1 Chat (com.xabber.xmpp.archive.Chat)1 ItemRemove (com.xabber.xmpp.archive.ItemRemove)1 List (com.xabber.xmpp.archive.List)1 Pref (com.xabber.xmpp.archive.Pref)1 Session (com.xabber.xmpp.archive.Session)1 IQ (org.jivesoftware.smack.packet.IQ)1