about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorOlivier LE MOAL <olivier.lemoal@winamax.fr>2015-02-03 15:27:56 +0100
committerOlivier LE MOAL <olivier.lemoal@winamax.fr>2015-02-03 15:27:56 +0100
commit2a12a4d93bcb898225003a8d38e7f28662075b70 (patch)
tree9129b8e42f5ae3563e3000fc45783a0788dde16a /src/command
parente3feacddd6667fd8e111d0ee54846c6aeabe3a7d (diff)
downloadprofani-tty-2a12a4d93bcb898225003a8d38e7f28662075b70.tar.gz
Add preference/commands for carbons message
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c10
-rw-r--r--src/command/commands.c16
-rw-r--r--src/command/commands.h1
3 files changed, 27 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 7be6603d..f44a21f5 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -858,6 +858,16 @@ static struct cmd_t command_defs[] =
           "shared  : Share logs between all instances, accepts 'on' or 'off', defaults to 'on'.",
           NULL } } },
 
+    { "/carbons",
+      cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
+      { "/carbons on|off", "Message carbons.",
+      { "/carbons on|off",
+        "---------------",
+        "Enable or disable message carbons.",
+        "",
+        "Example : /carbons on",
+        NULL  } } },
+
     { "/reconnect",
         cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
         { "/reconnect seconds", "Set reconnect interval.",
diff --git a/src/command/commands.c b/src/command/commands.c
index 2059c982..477471d5 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -3883,6 +3883,22 @@ cmd_history(gchar **args, struct cmd_help_t help)
 }
 
 gboolean
+cmd_carbons(gchar **args, struct cmd_help_t help)
+{
+    gboolean result = _cmd_set_boolean_preference(args[0], help,
+        "Carbons message", PREF_CARBONS);
+
+    // enable carbons
+    if (strcmp(args[0], "on") == 0) {
+        iq_enable_carbons();
+    }
+    else if (strcmp(args[0], "off") == 0){
+        iq_disable_carbons();
+    }
+    return result;
+}
+
+gboolean
 cmd_away(gchar **args, struct cmd_help_t help)
 {
     _update_presence(RESOURCE_AWAY, "away", args);
diff --git a/src/command/commands.h b/src/command/commands.h
index f4e040a9..1c16d635 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -85,6 +85,7 @@ gboolean cmd_grlog(gchar **args, struct cmd_help_t help);
 gboolean cmd_group(gchar **args, struct cmd_help_t help);
 gboolean cmd_help(gchar **args, struct cmd_help_t help);
 gboolean cmd_history(gchar **args, struct cmd_help_t help);
+gboolean cmd_carbons(gchar **args, struct cmd_help_t help);
 gboolean cmd_info(gchar **args, struct cmd_help_t help);
 gboolean cmd_intype(gchar **args, struct cmd_help_t help);
 gboolean cmd_invite(gchar **args, struct cmd_help_t help);