Esempio n. 1
0
  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;
      }
    }
  }
Esempio n. 2
0
  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));
  }
Esempio n. 3
0
 /** @methodtype set */
 public void setConfirmed() {
   setStatus(status.asConfirmed());
   incWriteCount();
 }
Esempio n. 4
0
 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);
 }