Search in sources :

Example 6 with ChatGroup

use of org.awesomeapp.messenger.model.ChatGroup 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)

Example 7 with ChatGroup

use of org.awesomeapp.messenger.model.ChatGroup in project Zom-Android by zom.

the class ChatSessionAdapter method setGroupChatSubject.

@Override
public void setGroupChatSubject(String subject) throws RemoteException {
    try {
        if (isGroupChatSession()) {
            ChatGroup group = (ChatGroup) mChatSession.getParticipant();
            getGroupManager().setGroupSubject(group, subject);
            // update the database
            ContentValues values1 = new ContentValues(1);
            values1.put(Imps.Contacts.NICKNAME, subject);
            ContentValues values = values1;
            Uri uriContact = ContentUris.withAppendedId(Imps.Contacts.CONTENT_URI, mContactId);
            mContentResolver.update(uriContact, values, null, null);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ContentValues(android.content.ContentValues) ChatGroup(org.awesomeapp.messenger.model.ChatGroup) Uri(android.net.Uri) FileNotFoundException(java.io.FileNotFoundException) XmppStringprepException(org.jxmpp.stringprep.XmppStringprepException) RemoteException(android.os.RemoteException)

Aggregations

ChatGroup (org.awesomeapp.messenger.model.ChatGroup)7 RemoteException (android.os.RemoteException)3 Contact (org.awesomeapp.messenger.model.Contact)3 ChatSession (org.awesomeapp.messenger.model.ChatSession)2 ImEntity (org.awesomeapp.messenger.model.ImEntity)2 IChatSession (org.awesomeapp.messenger.service.IChatSession)2 XmppStringprepException (org.jxmpp.stringprep.XmppStringprepException)2 ContentValues (android.content.ContentValues)1 Uri (android.net.Uri)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 CertificateException (java.security.cert.CertificateException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 OtrChatListener (org.awesomeapp.messenger.crypto.otr.OtrChatListener)1 OtrChatManager (org.awesomeapp.messenger.crypto.otr.OtrChatManager)1 OtrChatSessionAdapter (org.awesomeapp.messenger.crypto.otr.OtrChatSessionAdapter)1