Search in sources :

Example 1 with ChatGroupManager

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

the class ChatSessionManagerAdapter method createMultiUserChatSession.

public IChatSession createMultiUserChatSession(String roomAddress, String subject, String nickname, boolean isNewChat) {
    ChatGroupManager groupMan = mConnection.getAdaptee().getChatGroupManager();
    try {
        if (roomAddress.endsWith("@")) {
            String confServer = groupMan.getDefaultGroupChatService();
            if (confServer != null)
                roomAddress += confServer;
        }
        // TODO hard coding XMPP for now
        Address address = new XmppAddress(roomAddress);
        groupMan.createChatGroupAsync(roomAddress, subject, nickname);
        ChatGroup chatGroup = groupMan.getChatGroup(address);
        if (chatGroup != null && mConnection.getState() == ImConnection.LOGGED_IN) {
            ChatSession session = getChatSessionManager().createChatSession(chatGroup, isNewChat);
            ChatSessionAdapter adapter = getChatSessionAdapter(session, isNewChat);
            groupMan.loadMembers(chatGroup);
            return adapter;
        } else {
            return null;
        }
    } catch (Exception e) {
        Log.e(ImApp.LOG_TAG, "unable to join group chat" + e.getMessage());
        return null;
    }
}
Also used : Address(org.awesomeapp.messenger.model.Address) XmppAddress(org.awesomeapp.messenger.plugin.xmpp.XmppAddress) XmppAddress(org.awesomeapp.messenger.plugin.xmpp.XmppAddress) ChatGroup(org.awesomeapp.messenger.model.ChatGroup) IChatSession(org.awesomeapp.messenger.service.IChatSession) ChatSession(org.awesomeapp.messenger.model.ChatSession) RemoteException(android.os.RemoteException) ChatGroupManager(org.awesomeapp.messenger.model.ChatGroupManager)

Example 2 with ChatGroupManager

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

the class ChatSessionManagerAdapter method getChatGroupManager.

public ChatGroupManager getChatGroupManager() {
    if ((mConnection.getAdaptee().getCapability() & ImConnection.CAPABILITY_GROUP_CHAT) != 0) {
        ChatGroupManager groupManager = mConnection.getAdaptee().getChatGroupManager();
        groupManager.addGroupListener(new ChatGroupListenerAdapter());
        return groupManager;
    } else
        return null;
}
Also used : ChatGroupManager(org.awesomeapp.messenger.model.ChatGroupManager)

Aggregations

ChatGroupManager (org.awesomeapp.messenger.model.ChatGroupManager)2 RemoteException (android.os.RemoteException)1 Address (org.awesomeapp.messenger.model.Address)1 ChatGroup (org.awesomeapp.messenger.model.ChatGroup)1 ChatSession (org.awesomeapp.messenger.model.ChatSession)1 XmppAddress (org.awesomeapp.messenger.plugin.xmpp.XmppAddress)1 IChatSession (org.awesomeapp.messenger.service.IChatSession)1