about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-18 00:36:05 +0000
committerJames Booth <boothj5@gmail.com>2013-12-18 00:36:05 +0000
commitbc700fbfeac560946991063313f293a9861d4d1d (patch)
treee7fbc9e7c199604d31e0df7bcc427efb42849035 /src/command
parent95d08db2925dbaabf5ff88323554ba1afd1fc1cf (diff)
parentf47bd58a1cde062e9f7ee5ef7b504bc543bed727 (diff)
downloadprofani-tty-bc700fbfeac560946991063313f293a9861d4d1d.tar.gz
Merge branch 'master' into otr
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 147ccf42..d962ce6d 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -260,10 +260,15 @@ cmd_account(gchar **args, struct cmd_help_t help)
                                     accounts_set_priority_dnd(account_name, intval);
                                     break;
                             }
+
                             jabber_conn_status_t conn_status = jabber_get_connection_status();
-                            resource_presence_t last_presence = accounts_get_last_presence(jabber_get_account_name());
-                            if (conn_status == JABBER_CONNECTED && presence_type == last_presence) {
-                                presence_update(last_presence, jabber_get_presence_message(), 0);
+                            if (conn_status == JABBER_CONNECTED) {
+                                char *connected_account = jabber_get_account_name();
+                                resource_presence_t last_presence = accounts_get_last_presence(connected_account);
+
+                                if (presence_type == last_presence) {
+                                    presence_update(last_presence, jabber_get_presence_message(), 0);
+                                }
                             }
                             cons_show("Updated %s priority for account %s: %s", property, account_name, value);
                             cons_show("");