Search in sources :

Example 1 with OtrKeyManagerListener

use of net.java.otr4j.OtrKeyManagerListener in project Zom-Android by zom.

the class RemoteImService method initOtrChatManager.

private synchronized OtrChatManager initOtrChatManager() {
    int otrPolicy = convertPolicy();
    if (mOtrChatManager == null) {
        try {
            OtrAndroidKeyManagerImpl otrKeyManager = OtrAndroidKeyManagerImpl.getInstance(this);
            if (otrKeyManager != null) {
                mOtrChatManager = OtrChatManager.getInstance(otrPolicy, this, otrKeyManager);
                mOtrChatManager.addOtrEngineListener(this);
                otrKeyManager.addListener(new OtrKeyManagerListener() {

                    public void verificationStatusChanged(SessionID session) {
                        boolean isVerified = mOtrChatManager.getKeyManager().isVerified(session);
                        String msg = session + ": verification status=" + isVerified;
                        OtrDebugLogger.log(msg);
                    }

                    public void remoteVerifiedUs(SessionID session) {
                        String msg = session + ": remote verified us";
                        OtrDebugLogger.log(msg);
                        showToast(getString(R.string.remote_verified_us), Toast.LENGTH_SHORT);
                    // if (!isRemoteKeyVerified(session))
                    // showWarning(session, mContext.getApplicationContext().getString(R.string.remote_verified_us));
                    }
                });
            }
        } catch (Exception e) {
            OtrDebugLogger.log("unable to init OTR manager", e);
        }
    } else {
        mOtrChatManager.setPolicy(otrPolicy);
    }
    return mOtrChatManager;
}
Also used : OtrKeyManagerListener(net.java.otr4j.OtrKeyManagerListener) OtrAndroidKeyManagerImpl(org.awesomeapp.messenger.crypto.otr.OtrAndroidKeyManagerImpl) SessionID(net.java.otr4j.session.SessionID) GeneralSecurityException(java.security.GeneralSecurityException) ImException(org.awesomeapp.messenger.model.ImException) RemoteException(android.os.RemoteException) IOException(java.io.IOException)

Aggregations

RemoteException (android.os.RemoteException)1 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1 OtrKeyManagerListener (net.java.otr4j.OtrKeyManagerListener)1 SessionID (net.java.otr4j.session.SessionID)1 OtrAndroidKeyManagerImpl (org.awesomeapp.messenger.crypto.otr.OtrAndroidKeyManagerImpl)1 ImException (org.awesomeapp.messenger.model.ImException)1