示例#1
0
  /**
   * @param account
   * @return Verbose account name.
   */
  public String getVerboseName(String account) {
    AccountItem accountItem = getAccount(account);
    if (accountItem == null) return account;
    if (accountItem.getConnectionSettings().getProtocol().isOAuth()) {
      String jid = OAuthManager.getInstance().getAssignedJid(account);
      AccountProtocol accountProtocol = accountItem.getConnectionSettings().getProtocol();
      String name;
      if (jid == null) {
        if (hasSameProtocol(account)) name = accountItem.getConnectionSettings().getUserName();
        else return application.getString(accountProtocol.getNameResource());

      } else {
        name = Jid.getBareAddress(jid);
        if (!hasSameBareAddress(jid)) return name;
      }
      return application.getString(accountProtocol.getShortResource()) + " - " + name;
    } else {
      if (hasSameBareAddress(account)) return account;
      else return Jid.getBareAddress(account);
    }
  }