Search in sources :

Example 1 with ItemRemove

use of com.xabber.xmpp.archive.ItemRemove in project xabber-android by redsolution.

the class MessageArchiveManager method sendItemRemove.

private void sendItemRemove(String account, String user) throws NetworkException {
    Item extension = new Item();
    extension.setJid(user);
    ItemRemove packet = new ItemRemove();
    packet.addItem(extension);
    packet.setType(Type.set);
    ConnectionManager.getInstance().sendStanza(account, packet);
}
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) ItemRemove(com.xabber.xmpp.archive.ItemRemove)

Example 2 with ItemRemove

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

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