Пример #1
0
  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();
    }
  }
Пример #2
0
    public void onMemberJoined(ChatGroup group, Contact contact) {
      if (mChatSession.getParticipant().equals(contact)) {
        onConvertToGroupChatSuccess(group);
      }

      mContactStatusMap.put(contact.getName(), contact.getPresence().getStatus());
    }
Пример #3
0
  private void init(Contact contact, boolean isNewSession) {
    mIsGroupChat = false;
    ContactListManagerAdapter listManager =
        (ContactListManagerAdapter) mConnection.getContactListManager();

    mContactId = listManager.queryOrInsertContact(contact);

    mChatURI = ContentUris.withAppendedId(Imps.Chats.CONTENT_URI, mContactId);

    if (isNewSession) insertOrUpdateChat(null);

    mMessageURI = Imps.Messages.getContentUriByThreadId(mContactId);

    mContactStatusMap.put(contact.getName(), contact.getPresence().getStatus());
  }