Search in sources :

Example 6 with OtrException

use of net.java.otr4j.OtrException in project Conversations by siacs.

the class VerifyOTRActivity method abortSmp.

protected boolean abortSmp() {
    final Session session = mConversation.getOtrSession();
    if (session != null) {
        try {
            session.abortSmp();
            mConversation.smp().status = Conversation.Smp.STATUS_NONE;
            mConversation.smp().hint = null;
            mConversation.smp().secret = null;
            return true;
        } catch (OtrException e) {
            return false;
        }
    } else {
        return false;
    }
}
Also used : OtrException(net.java.otr4j.OtrException) Session(net.java.otr4j.session.Session)

Example 7 with OtrException

use of net.java.otr4j.OtrException in project xabber-android by redsolution.

the class OTRManager method onContactUnAvailable.

public void onContactUnAvailable(String account, String user) {
    Session session = sessions.get(account, user);
    if (session == null) {
        return;
    }
    if (session.getSessionStatus() == SessionStatus.ENCRYPTED) {
        try {
            LogManager.i(this, "onContactUnAvailable. Refresh session for " + user);
            session.refreshSession();
        } catch (OtrException e) {
            LogManager.exception(this, e);
        }
    }
}
Also used : OtrException(net.java.otr4j.OtrException) Session(net.java.otr4j.session.Session)

Example 8 with OtrException

use of net.java.otr4j.OtrException in project xabber-android by redsolution.

the class OTRManager method refreshSession.

public void refreshSession(String account, String user) throws NetworkException {
    LogManager.i(this, "Refreshing session for " + user);
    try {
        getOrCreateSession(account, user).refreshSession();
    } catch (OtrException e) {
        throw new NetworkException(R.string.OTR_ERROR, e);
    }
    LogManager.i(this, "Refreshed session for " + user);
}
Also used : OtrException(net.java.otr4j.OtrException) NetworkException(com.xabber.android.data.NetworkException)

Example 9 with OtrException

use of net.java.otr4j.OtrException in project xabber-android by redsolution.

the class OTRManager method initSmp.

/**
     * Initiate request using SM protocol.
     */
public void initSmp(String account, String user, String question, String secret) throws NetworkException {
    LogManager.i(this, "initializing smp... " + user);
    removeSMRequest(account, user);
    addSMProgress(account, user);
    try {
        getOrCreateSession(account, user).initSmp(question, secret);
    } catch (OtrException e) {
        throw new NetworkException(R.string.OTR_ERROR, e);
    }
}
Also used : OtrException(net.java.otr4j.OtrException) NetworkException(com.xabber.android.data.NetworkException)

Example 10 with OtrException

use of net.java.otr4j.OtrException in project xabber-android by redsolution.

the class OTRManager method startSession.

public void startSession(String account, String user) throws NetworkException {
    LogManager.i(this, "Starting session for " + user);
    try {
        getOrCreateSession(account, user).startSession();
    } catch (OtrException e) {
        throw new NetworkException(R.string.OTR_ERROR, e);
    }
    LogManager.i(this, "Started session for " + user);
}
Also used : OtrException(net.java.otr4j.OtrException) NetworkException(com.xabber.android.data.NetworkException)

Aggregations

OtrException (net.java.otr4j.OtrException)16 NetworkException (com.xabber.android.data.NetworkException)7 Session (net.java.otr4j.session.Session)7 AbstractChat (com.xabber.android.data.message.AbstractChat)2 MessagePacket (eu.siacs.conversations.xmpp.stanzas.MessagePacket)2 OTRUnencryptedException (com.xabber.android.data.extension.otr.OTRUnencryptedException)1 Account (eu.siacs.conversations.entities.Account)1 PublicKey (java.security.PublicKey)1 OtrCryptoException (net.java.otr4j.crypto.OtrCryptoException)1 SessionID (net.java.otr4j.session.SessionID)1 SessionImpl (net.java.otr4j.session.SessionImpl)1 SessionStatus (net.java.otr4j.session.SessionStatus)1 Message (org.jivesoftware.smack.packet.Message)1 Presence (org.jivesoftware.smack.packet.Presence)1 MUCUser (org.jivesoftware.smackx.muc.packet.MUCUser)1