about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorAdam Ehlers Nyholm Thomsen <adament@adament.net>2015-05-17 13:29:08 +0200
committerAdam Ehlers Nyholm Thomsen <adament@adament.net>2015-05-17 13:29:08 +0200
commit882ca85aca1a7887dcf571385a16be70679d2387 (patch)
treee7bb28b0f4c90035c751e597fa741034041202ff /src
parentaeffca496c338e91cacb4af1ebf0d8ca3160bf31 (diff)
downloadprofani-tty-882ca85aca1a7887dcf571385a16be70679d2387.tar.gz
allow enabling / disabling carbons without being connected.
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 0c341880..b942acd4 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -3980,23 +3980,21 @@ cmd_history(gchar **args, struct cmd_help_t help)
 gboolean
 cmd_carbons(gchar **args, struct cmd_help_t help)
 {
-    jabber_conn_status_t conn_status = jabber_get_connection_status();
-
-    if (conn_status != JABBER_CONNECTED) {
-        cons_show("You are not currently connected.");
-        return TRUE;
-    }
-
     gboolean result = _cmd_set_boolean_preference(args[0], help,
         "Message carbons preference", PREF_CARBONS);
 
-    // enable carbons
-    if (strcmp(args[0], "on") == 0) {
-        iq_enable_carbons();
-    }
-    else if (strcmp(args[0], "off") == 0){
-        iq_disable_carbons();
+    jabber_conn_status_t conn_status = jabber_get_connection_status();
+
+    if (conn_status == JABBER_CONNECTED) {
+        // enable carbons
+        if (strcmp(args[0], "on") == 0) {
+            iq_enable_carbons();
+        }
+        else if (strcmp(args[0], "off") == 0){
+            iq_disable_carbons();
+        }
     }
+
     return result;
 }
 
@@ -4411,4 +4409,4 @@ gint _compare_commands(Command *a, Command *b)
     g_free(key_b);
 
     return result;
-}
\ No newline at end of file
+}