Search in sources :

Example 1 with OtrDataHandler

use of org.awesomeapp.messenger.crypto.otr.OtrDataHandler in project Zom-Android by zom.

the class ChatSessionAdapter method initOtrChatSession.

private void initOtrChatSession(ImEntity participant) {
    try {
        if (mConnection != null) {
            mDataHandler = new OtrDataHandler(mChatSession);
            mDataHandler.setDataListener(mDataHandlerListener);
            OtrChatManager cm = service.getOtrChatManager();
            cm.addOtrEngineListener(mListenerAdapter);
            mChatSession.setMessageListener(new OtrChatListener(cm, mListenerAdapter));
            if (participant instanceof Contact) {
                String key = participant.getAddress().getAddress();
                if (!mOtrChatSessions.containsKey(key)) {
                    OtrChatSessionAdapter adapter = new OtrChatSessionAdapter(mConnection.getLoginUser().getAddress().getAddress(), participant, cm);
                    mOtrChatSessions.put(key, adapter);
                }
            } else if (participant instanceof ChatGroup) {
            }
            mDataHandler.setChatId(getId());
        }
    } catch (NullPointerException npe) {
        Log.e(ImApp.LOG_TAG, "error init OTR session", npe);
    }
}
Also used : OtrChatSessionAdapter(org.awesomeapp.messenger.crypto.otr.OtrChatSessionAdapter) OtrDataHandler(org.awesomeapp.messenger.crypto.otr.OtrDataHandler) ChatGroup(org.awesomeapp.messenger.model.ChatGroup) OtrChatListener(org.awesomeapp.messenger.crypto.otr.OtrChatListener) OtrChatManager(org.awesomeapp.messenger.crypto.otr.OtrChatManager) Contact(org.awesomeapp.messenger.model.Contact)

Aggregations

OtrChatListener (org.awesomeapp.messenger.crypto.otr.OtrChatListener)1 OtrChatManager (org.awesomeapp.messenger.crypto.otr.OtrChatManager)1 OtrChatSessionAdapter (org.awesomeapp.messenger.crypto.otr.OtrChatSessionAdapter)1 OtrDataHandler (org.awesomeapp.messenger.crypto.otr.OtrDataHandler)1 ChatGroup (org.awesomeapp.messenger.model.ChatGroup)1 Contact (org.awesomeapp.messenger.model.Contact)1