about summary refs log tree commit diff stats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 52f7fac9..facecd62 100644
--- a/src/command.c
+++ b/src/command.c
@@ -109,6 +109,7 @@ static gboolean _cmd_set_beep(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_set_notify(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_set_log(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_set_priority(gchar **args, struct cmd_help_t help);
+static gboolean _cmd_set_reconnect(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_set_intype(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_set_flash(gchar **args, struct cmd_help_t help);
 static gboolean _cmd_set_showsplash(gchar **args, struct cmd_help_t help);
@@ -485,6 +486,18 @@ static struct cmd_t setting_commands[] =
           "Config file value :   maxsize=bytes",
           NULL } } },
 
+    { "/reconnect",
+        _cmd_set_reconnect, parse_args, 1, 1,
+        { "/reconnect seconds", "Set reconnect interval.",
+        { "/reconnect seconds",
+          "--------------------",
+          "Set the reconnect attempt interval in seconds for when the connection is lost.",
+          "A value of 0 will switch of reconnect attempts.",
+          "",
+          "Config file section : [jabber]",
+          "Config file value :   reconnect=seconds",
+          NULL } } },
+
     { "/priority",
         _cmd_set_priority, parse_args, 1, 1,
         { "/priority <value>", "Set priority for connection.",
@@ -1468,6 +1481,28 @@ _cmd_set_log(gchar **args, struct cmd_help_t help)
 }
 
 static gboolean
+_cmd_set_reconnect(gchar **args, struct cmd_help_t help)
+{
+    char *value = args[0];
+    int intval;
+
+    if (_strtoi(value, &intval, 0, INT_MAX) == 0) {
+        prefs_set_reconnect(intval);
+        if (intval == 0) {
+            cons_show("Reconnect disabled.", intval);
+        } else {
+            cons_show("Reconnect interval set to %d seconds.", intval);
+        }
+    } else {
+        cons_show("Usage: %s", help.usage);
+    }
+
+    /* TODO: make 'level' subcommand for debug level */
+
+    return TRUE;
+}
+
+static gboolean
 _cmd_set_priority(gchar **args, struct cmd_help_t help)
 {
     char *value = args[0];