public void setArchiveMode(String account, ArchiveMode archiveMode) { AccountItem accountItem = AccountManager.getInstance().getAccount(account); AccountManager.getInstance() .updateAccount( account, accountItem.getConnectionSettings().isCustom(), accountItem.getConnectionSettings().getHost(), accountItem.getConnectionSettings().getPort(), accountItem.getConnectionSettings().getServerName(), accountItem.getConnectionSettings().getUserName(), accountItem.isStorePassword(), accountItem.getConnectionSettings().getPassword(), accountItem.getConnectionSettings().getResource(), accountItem.getPriority(), accountItem.isEnabled(), accountItem.getConnectionSettings().isSaslEnabled(), accountItem.getConnectionSettings().getTlsMode(), accountItem.getConnectionSettings().useCompression(), accountItem.getConnectionSettings().getProxyType(), accountItem.getConnectionSettings().getProxyHost(), accountItem.getConnectionSettings().getProxyPort(), accountItem.getConnectionSettings().getProxyUser(), accountItem.getConnectionSettings().getProxyPassword(), accountItem.isSyncable(), archiveMode); }
@Override public void sendMessage(final FriendMessage message) { HashMap<String, Friend> friends = AccountManager.getInstance().getFriends(); Friend friend = friends.get(message.getTo()); Screenname buddy = new Screenname(friend.getUserName()); Conversation c = (Conversation) friend.getUserInfo(); if (c == null) { c = connection.getIcbmService().getImConversation(buddy); friend.setUserInfo(c); } Message oscarMessage = new Message() { public boolean isAutoResponse() { return false; } public String getMessageBody() { return message.getMessage(); } }; c.sendMessage(oscarMessage); Friend recipient = friends.get(message.getTo()); accountListener.didReceiveMessageForFriend(message, recipient); }
/** * 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())); }