Search in sources :

Example 6 with OnResponseListener

use of com.xabber.android.data.connection.OnResponseListener in project xabber-android by redsolution.

the class MessageArchiveManager method requestPreferences.

private void requestPreferences(String account) {
    Pref pref = new Pref();
    pref.setType(Type.get);
    try {
        ConnectionManager.getInstance().sendRequest(account, pref, new OnResponseListener() {

            @Override
            public void onReceived(String account, String packetId, IQ iq) {
                if (iq instanceof Pref && ((Pref) iq).isValid())
                    onPreferencesResponce(account, (Pref) iq);
                onPreferenceAvailable(account);
            }

            @Override
            public void onError(String account, String packetId, IQ iq) {
                onPreferenceAvailable(account);
            }

            @Override
            public void onTimeout(String account, String packetId) {
                onError(account, packetId, null);
            }

            @Override
            public void onDisconnect(String account, String packetId) {
            }
        });
    } catch (NetworkException e) {
    }
}
Also used : OnResponseListener(com.xabber.android.data.connection.OnResponseListener) Pref(com.xabber.xmpp.archive.Pref) IQ(org.jivesoftware.smack.packet.IQ) NetworkException(com.xabber.android.data.NetworkException)

Aggregations

NetworkException (com.xabber.android.data.NetworkException)6 OnResponseListener (com.xabber.android.data.connection.OnResponseListener)6 IQ (org.jivesoftware.smack.packet.IQ)6 Set (com.xabber.xmpp.rsm.Set)2 AsyncHttpClient (com.loopj.android.http.AsyncHttpClient)1 AsyncHttpResponseHandler (com.loopj.android.http.AsyncHttpResponseHandler)1 AbstractChat (com.xabber.android.data.message.AbstractChat)1 MessageItem (com.xabber.android.data.message.MessageItem)1 OnContactChangedListener (com.xabber.android.data.roster.OnContactChangedListener)1 Chat (com.xabber.xmpp.archive.Chat)1 Modified (com.xabber.xmpp.archive.Modified)1 Pref (com.xabber.xmpp.archive.Pref)1 Retrieve (com.xabber.xmpp.archive.Retrieve)1 Block (com.xabber.xmpp.blocking.Block)1 BlockList (com.xabber.xmpp.blocking.BlockList)1 Request (com.xabber.xmpp.httpfileupload.Request)1 Slot (com.xabber.xmpp.httpfileupload.Slot)1 FileEntity (cz.msebera.android.httpclient.entity.FileEntity)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1