summary refs log tree commit diff stats
path: root/src/common/outbound.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-01-27 18:08:25 -0500
committerTingPing <tingping@tingping.se>2014-02-04 20:32:10 -0500
commit8e55157e6abc105ee17d80d91a291ca8e1215733 (patch)
tree4b5aa7dbd1f950db3d7fca83694b3227784b9f2e /src/common/outbound.c
parent29e01daeae94281d5c21aba01dae9123f6aa34d5 (diff)
Print help messages for user commands
Diffstat (limited to 'src/common/outbound.c')
-rw-r--r--src/common/outbound.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 34e44a7d..d63f8532 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -4084,6 +4084,31 @@ find_internal_command (char *name)
 				sizeof (xc_cmds[0])) - 1, sizeof (xc_cmds[0]), command_compare);
 }
 
+static gboolean
+usercommand_show_help (session *sess, char *name)
+{
+	struct popup *pop;
+	gboolean found = FALSE;
+	char buf[1024];
+	GSList *list;
+
+	list = command_list;
+	while (list)
+	{
+		pop = (struct popup *) list->data;
+		if (!g_ascii_strcasecmp (pop->name, name))
+		{
+			snprintf (buf, sizeof(buf), _("User Command for: %s\n"), pop->cmd);
+			PrintText (sess, buf);
+
+			found = TRUE;
+		}
+		list = list->next;
+	}
+
+	return found;
+}
+
 static void
 help (session *sess, char *tbuf, char *helpcmd, int quiet)
 {
@@ -4092,8 +4117,10 @@ help (session *sess, char *tbuf, char *helpcmd, int quiet)
 	if (plugin_show_help (sess, helpcmd))
 		return;
 
-	cmd = find_internal_command (helpcmd);
+	if (usercommand_show_help (sess, helpcmd))
+		return;
 
+	cmd = find_internal_command (helpcmd);
 	if (cmd)
 	{
 		if (cmd->help)