UserStatus getConnectionStatus(JID jid) { InteropSession s = mSessions.get(jid.toBareJID()); if (s != null) { UserStatus u = new UserStatus(); u.username = s.getUsername(); u.password = s.getPassword(); u.state = s.getState(); u.nextConnectAttemptTime = s.getNextConnectTime(); return u; } else { Map<String, String> registration = null; try { registration = Interop.getDataProvider().getIMGatewayRegistration(jid, mName); } catch (IOException e) { warn( "Caught exception trying to fetch Gateway Registration from provider for " + jid.toBareJID() + " svc " + mName.toString(), e); } if (registration != null) { UserStatus u = new UserStatus(); u.username = registration.get(InteropRegistrationProvider.USERNAME); u.password = registration.get(InteropRegistrationProvider.PASSWORD); u.state = InteropSession.State.INTENTIONALLY_OFFLINE; return u; } else { return null; } } }
public void testGetFromString() { assertTrue(UserStatus.getFromString(UserStatus.CREATED.asString()).equals(UserStatus.CREATED)); assertTrue( UserStatus.getFromString(UserStatus.CONFIRMED.asString()).equals(UserStatus.CONFIRMED)); assertTrue( UserStatus.getFromString(UserStatus.DISABLED.asString()).equals(UserStatus.DISABLED)); // DISABLED2.asString() -> DISABLED.asString() assertTrue( UserStatus.getFromString(UserStatus.DISABLED2.asString()).equals(UserStatus.DISABLED)); }
/** @methodtype set */ public void setConfirmed() { setStatus(status.asConfirmed()); incWriteCount(); }
public void testGetFromInt() { assertTrue(UserStatus.getFromInt(UserStatus.CREATED.asInt()) == UserStatus.CREATED); assertTrue(UserStatus.getFromInt(UserStatus.CONFIRMED.asInt()) == UserStatus.CONFIRMED); assertTrue(UserStatus.getFromInt(UserStatus.DISABLED.asInt()) == UserStatus.DISABLED); assertTrue(UserStatus.getFromInt(UserStatus.DISABLED2.asInt()) == UserStatus.DISABLED2); }