コード例 #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
  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());
  }