Methods Summary |
---|
public void | closeAllChatSessions()
synchronized (mActiveSessions) {
ArrayList<ChatSessionAdapter> sessions =
new ArrayList<ChatSessionAdapter>(mActiveSessions.values());
for (ChatSessionAdapter ses : sessions) {
ses.leave();
}
}
|
public void | closeChatSession(ChatSessionAdapter adapter)
synchronized (mActiveSessions) {
ChatSession session = adapter.getAdaptee();
mSessionManager.closeChatSession(session);
mActiveSessions.remove(adapter.getAddress());
}
|
public com.android.im.IChatSession | createChatSession(java.lang.String contactAddress)
ContactListManagerAdapter listManager =
(ContactListManagerAdapter) mConnection.getContactListManager();
Contact contact = listManager.getContactByAddress(contactAddress);
if(contact == null) {
try {
contact = listManager.createTemporaryContact(contactAddress);
} catch (IllegalArgumentException e) {
mSessionListenerAdapter.notifyChatSessionCreateFailed(contactAddress,
new ImErrorInfo(ImErrorInfo.ILLEGAL_CONTACT_ADDRESS,
"Invalid contact address:" + contactAddress));
return null;
}
}
ChatSession session = mSessionManager.createChatSession(contact);
return getChatSessionAdapter(session);
|
public java.util.List | getActiveChatSessions()
synchronized (mActiveSessions) {
return new ArrayList<ChatSessionAdapter>(mActiveSessions.values());
}
|
public com.android.im.IChatSession | getChatSession(java.lang.String address)
synchronized (mActiveSessions) {
return mActiveSessions.get(address);
}
|
ChatSessionAdapter | getChatSessionAdapter(com.android.im.engine.ChatSession session)
synchronized (mActiveSessions) {
Address participantAddress = session.getParticipant().getAddress();
String key = participantAddress.getFullName();
ChatSessionAdapter adapter = mActiveSessions.get(key);
if (adapter == null) {
adapter = new ChatSessionAdapter(session, mConnection);
mActiveSessions.put(key, adapter);
}
return adapter;
}
|
public int | getChatSessionCount()
synchronized (mActiveSessions) {
return mActiveSessions.size();
}
|
public void | registerChatSessionListener(com.android.im.IChatSessionListener listener)
if (listener != null) {
mRemoteListeners.register(listener);
}
|
public void | unregisterChatSessionListener(com.android.im.IChatSessionListener listener)
if (listener != null) {
mRemoteListeners.unregister(listener);
}
|
public void | updateChatSession(java.lang.String oldAddress, ChatSessionAdapter adapter)
synchronized (mActiveSessions) {
mActiveSessions.remove(oldAddress);
mActiveSessions.put(adapter.getAddress(), adapter);
}
|