private void init(ChatGroup group, boolean isNewSession) { mIsGroupChat = true; mContactId = insertOrUpdateGroupContactInDb(group); group.addMemberListener(mListenerAdapter); try { mChatSessionManager .getChatGroupManager() .joinChatGroupAsync(group.getAddress(), group.getName()); mMessageURI = Imps.Messages.getContentUriByThreadId(mContactId); mChatURI = ContentUris.withAppendedId(Imps.Chats.CONTENT_URI, mContactId); if (isNewSession) insertOrUpdateChat(""); for (Contact c : group.getMembers()) { mContactStatusMap.put(c.getName(), c.getPresence().getStatus()); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void onGroupCreated(ChatGroup group) { if (mGroupName.equalsIgnoreCase(group.getName())) { mGroupMgr.removeGroupListener(this); group.addMemberListener(this); mGroupMgr.inviteUserAsync(group, (Contact) mChatSession.getParticipant()); } }