summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/fe.h1
-rw-r--r--src/common/outbound.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/src/common/fe.h b/src/common/fe.h
index b67329ec..2ca15c60 100644
--- a/src/common/fe.h
+++ b/src/common/fe.h
@@ -122,6 +122,7 @@ void fe_set_lag (server *serv, long lag);
 void fe_set_throttle (server *serv);
 void fe_set_away (server *serv);
 void fe_serverlist_open (session *sess);
+void fe_get_bool (char *title, char *prompt, void *callback, void *userdata);
 void fe_get_str (char *prompt, char *def, void *callback, void *ud);
 void fe_get_int (char *prompt, int def, void *callback, void *ud);
 #define FRF_WRITE 1				/* save file */
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>"},