about summary refs log tree commit diff stats
path: root/src/command/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-01 19:50:13 +0000
committerJames Booth <boothj5@gmail.com>2016-01-01 19:50:13 +0000
commitf27cae68c507c6def2591ec43c130f92f485fbec (patch)
treeac028a3e6ab8a3090c32503706485b479a574665 /src/command/command.c
parent94b0d2c6da7e36c29ee091ae6212d70e9a9294e4 (diff)
downloadprofani-tty-f27cae68c507c6def2591ec43c130f92f485fbec.tar.gz
Added autoping timeout preference
Diffstat (limited to 'src/command/command.c')
-rw-r--r--src/command/command.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 91c25131..36579990 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1490,15 +1490,17 @@ static struct cmd_t command_defs[] =
     },
 
     { "/autoping",
-        cmd_autoping, parse_args, 1, 1, &cons_autoping_setting,
+        cmd_autoping, parse_args, 2, 2, &cons_autoping_setting,
         CMD_TAGS(
             CMD_TAG_CONNECTION)
         CMD_SYN(
-            "/autoping <seconds>")
+            "/autoping set <seconds>",
+            "/autoping timeout <seconds>")
         CMD_DESC(
             "Set the interval between sending ping requests to the server to ensure the connection is kept alive.")
         CMD_ARGS(
-            { "<seconds>", "Number of seconds between sending pings, a value of 0 disables autoping." })
+            { "set <seconds>",      "Number of seconds between sending pings, a value of 0 disables autoping." },
+            { "timeout <seconds>",  "Seconds to wait for autoping responses, after which the connection is considered broken." })
         CMD_NOEXAMPLES
     },
 
@@ -1908,6 +1910,7 @@ static Autocomplete script_ac;
 static Autocomplete script_show_ac;
 static Autocomplete console_ac;
 static Autocomplete console_muc_ac;
+static Autocomplete autoping_ac;
 
 /*
  * Initialise command autocompleter and history
@@ -2401,6 +2404,10 @@ cmd_init(void)
     autocomplete_add(console_muc_ac, "all");
     autocomplete_add(console_muc_ac, "first");
     autocomplete_add(console_muc_ac, "none");
+
+    autoping_ac = autocomplete_new();
+    autocomplete_add(autoping_ac, "set");
+    autocomplete_add(autoping_ac, "timeout");
 }
 
 void
@@ -2480,6 +2487,7 @@ cmd_uninit(void)
     autocomplete_free(script_show_ac);
     autocomplete_free(console_ac);
     autocomplete_free(console_muc_ac);
+    autocomplete_free(autoping_ac);
 }
 
 gboolean
@@ -2674,6 +2682,7 @@ cmd_reset_autocomplete(ProfWin *window)
     autocomplete_reset(tls_certpath_ac);
     autocomplete_reset(console_ac);
     autocomplete_reset(console_muc_ac);
+    autocomplete_reset(autoping_ac);
     autocomplete_reset(script_ac);
     if (script_show_ac) {
         autocomplete_free(script_show_ac);
@@ -2892,8 +2901,8 @@ _cmd_complete_parameters(ProfWin *window, const char *const input)
         }
     }
 
-    gchar *cmds[] = { "/prefs", "/disco", "/close", "/room" };
-    Autocomplete completers[] = { prefs_ac, disco_ac, close_ac, room_ac };
+    gchar *cmds[] = { "/prefs", "/disco", "/close", "/room", "/autoping" };
+    Autocomplete completers[] = { prefs_ac, disco_ac, close_ac, room_ac, autoping_ac };
 
     for (i = 0; i < ARRAY_SIZE(cmds); i++) {
         result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE);