about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-12-17 23:57:06 +0000
committerJames Booth <boothj5@gmail.com>2013-12-17 23:57:06 +0000
commitf47bd58a1cde062e9f7ee5ef7b504bc543bed727 (patch)
tree06348c0501da11789c5b2765bb08d56ccd601ea6 /src/command
parentba66d6b730737bd392027899010589a79e2777df (diff)
downloadprofani-tty-f47bd58a1cde062e9f7ee5ef7b504bc543bed727.tar.gz
Added tests for setting presence priorities
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 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("");