/** * @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); } }
/** * @param account * @return Account vCard based nick name or verbose name if nick is not specified. */ public String getNickName(String account) { String jid = OAuthManager.getInstance().getAssignedJid(account); String result = VCardManager.getInstance().getName(Jid.getBareAddress(jid)); if ("".equals(result)) return getVerboseName(account); else return result; }