about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 c48dc1a1..67458c79 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -259,10 +259,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("");