/** * Sets status for all accounts. * * @param statusMode * @param statusText can be <code>null</code> if value was not changed. */ public void setStatus(StatusMode statusMode, String statusText) { SettingsManager.setStatusMode(statusMode); if (statusText != null) { addSavedStatus(statusMode, statusText); SettingsManager.setStatusText(statusText); } for (AccountItem accountItem : accountItems.values()) { setStatus( accountItem, statusMode, statusText == null ? accountItem.getStatusText() : statusText); } resendPresence(); onAccountsChanged(new ArrayList<String>(AccountManager.getInstance().getAllAccounts())); }
/** * Sets status for account. * * @param account * @param statusMode * @param statusText */ public void setStatus(String account, StatusMode statusMode, String statusText) { addSavedStatus(statusMode, statusText); AccountItem accountItem = getAccount(account); setStatus(accountItem, statusMode, statusText); try { PresenceManager.getInstance().resendPresence(account); } catch (NetworkException e) { } boolean found = false; for (AccountItem check : accountItems.values()) if (check.isEnabled() && SettingsManager.statusMode() == check.getRawStatusMode()) { found = true; break; } if (!found) SettingsManager.setStatusMode(statusMode); found = false; for (AccountItem check : accountItems.values()) if (check.isEnabled() && SettingsManager.statusText().equals(check.getStatusText())) { found = true; break; } if (!found) SettingsManager.setStatusText(statusText); onAccountChanged(account); }