public ImConnectionAdapter(long providerId, ImConnection connection, RemoteImService service) { mProviderId = providerId; mConnection = connection; mService = service; mConnectionListener = new ConnectionListenerAdapter(); mConnection.addConnectionListener(mConnectionListener); if ((connection.getCapability() & ImConnection.CAPABILITY_GROUP_CHAT) != 0) { mGroupManager = mConnection.getChatGroupManager(); mInvitationListener = new InvitationListenerAdapter(); mGroupManager.setInvitationListener(mInvitationListener); } }
void reestablishSession() { mConnectionState = ImConnection.LOGGING_IN; ContentResolver cr = mService.getContentResolver(); if ((mConnection.getCapability() & ImConnection.CAPABILITY_SESSION_REESTABLISHMENT) != 0) { HashMap<String, String> cookie = querySessionCookie(cr); if (cookie != null) { Log.d(TAG, "re-establish session"); try { mConnection.reestablishSessionAsync(cookie); } catch (IllegalArgumentException e) { Log.e(TAG, "Invalid session cookie, probably modified by others."); clearSessionCookie(cr); } } } }