summary refs log tree commit diff stats
path: root/src/common/outbound.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-12-31 17:06:58 -0500
committerTingPing <tingping@tingping.se>2014-02-04 20:46:43 -0500
commit10d3c151438c5580756b6a66a059742ace51333b (patch)
tree04b9293bcd65978d0a11d719902ec79f6820be9c /src/common/outbound.c
parent3a7fb4d8e1896eced87e3ccbf9369d76fa10d7e0 (diff)
Add /getbool command
Diffstat (limited to 'src/common/outbound.c')
-rw-r--r--src/common/outbound.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index d63f8532..db6b3d5b 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -1941,6 +1941,36 @@ typedef struct
 } getvalinfo;
 
 static void
+get_bool_cb (int val, getvalinfo *info)
+{
+	char buf[512];
+
+	snprintf (buf, sizeof (buf), "%s %d", info->cmd, val);
+	if (is_session (info->sess))
+		handle_command (info->sess, buf, FALSE);
+
+	free (info->cmd);
+	free (info);
+}
+
+static int
+cmd_getbool (struct session *sess, char *tbuf, char *word[], char *word_eol[])
+{
+	getvalinfo *info;
+
+	if (!word[4][0])
+		return FALSE;
+
+	info = malloc (sizeof (*info));
+	info->cmd = strdup (word[2]);
+	info->sess = sess;
+
+	fe_get_bool (word[3], word_eol[4], get_bool_cb, info);
+
+	return TRUE;
+}
+
+static void
 get_int_cb (int cancel, int val, getvalinfo *info)
 {
 	char buf[512];
@@ -3934,6 +3964,7 @@ const struct commands xc_cmds[] = {
 	 N_("FLUSHQ, flushes the current server's send queue")},
 	{"GATE", cmd_gate, 0, 0, 1,
 	 N_("GATE <host> [<port>], proxies through a host, port defaults to 23")},
+	{"GETBOOL", cmd_getbool, 0, 0, 1, "GETBOOL <command> <title> <text>"},
 	{"GETFILE", cmd_getfile, 0, 0, 1, "GETFILE [-folder] [-multi] [-save] <command> <title> [<initial>]"},
 	{"GETINT", cmd_getint, 0, 0, 1, "GETINT <default> <command> <prompt>"},
 	{"GETSTR", cmd_getstr, 0, 0, 1, "GETSTR <default> <command> <prompt>"},