From db502da8705196b5aa2dea954c0fb6aeeaa42549 Mon Sep 17 00:00:00 2001
From: Mark Spencer <markster@digium.com>
Date: Tue, 9 May 2006 08:44:50 +0000
Subject: [PATCH] Make menuselect be able to show what the modules are

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@25929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_chanspy.c              | 6 +++---
 build_tools/menuselect.c        | 1 +
 build_tools/menuselect.h        | 2 ++
 build_tools/menuselect_curses.c | 9 ++++++++-
 channels/chan_oss.c             | 3 ++-
 channels/chan_sip.c             | 4 ++--
 6 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index d42fc0c08d..8c8f5d4751 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -56,7 +56,7 @@ AST_MUTEX_DEFINE_STATIC(modlock);
 #define ALL_DONE(u, ret) LOCAL_USER_REMOVE(u); return ret;
 #define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
 
-static const char *synopsis = "Listen to the audio of an active channel";
+static const char *tdesc = "Listen to the audio of an active channel";
 static const char *app = "ChanSpy";
 static const char *desc = 
 "  ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
@@ -584,12 +584,12 @@ static int unload_module(void *mod)
 static int load_module(void *mod)
 {
 	__mod_desc = mod;
-	return ast_register_application(app, chanspy_exec, synopsis, desc);
+	return ast_register_application(app, chanspy_exec, tdesc, desc);
 }
 
 static const char *description(void)
 {
-	return (char *) synopsis;
+	return (char *) tdesc;
 }
 
 static const char *key(void)
diff --git a/build_tools/menuselect.c b/build_tools/menuselect.c
index 16570d8676..b3400ffb82 100644
--- a/build_tools/menuselect.c
+++ b/build_tools/menuselect.c
@@ -206,6 +206,7 @@ static int parse_makeopts_xml(const char *makeopts_xml)
 				return -1;
 			
 			mem->name = mxmlElementGetAttr(cur2, "name");
+			mem->displayname = mxmlElementGetAttr(cur2, "displayname");
 		
 			if (!cat->positive_output)
 				mem->enabled = 1;
diff --git a/build_tools/menuselect.h b/build_tools/menuselect.h
index 4db045da17..5fc34d0494 100644
--- a/build_tools/menuselect.h
+++ b/build_tools/menuselect.h
@@ -37,6 +37,8 @@ struct conflict;
 struct member {
 	/*! What will be sent to the makeopts file */
 	const char *name;
+	/*! Display name if known */
+	const char *displayname;
 	/*! Default setting */
 	const char *defaultenabled;
 	/*! This module is currently selected */
diff --git a/build_tools/menuselect_curses.c b/build_tools/menuselect_curses.c
index 84e85861f7..13fc86eb5e 100644
--- a/build_tools/menuselect_curses.c
+++ b/build_tools/menuselect_curses.c
@@ -128,6 +128,7 @@ void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end,
 	int j = 0;
 	struct member *mem;
 	char buf[64];
+	char *desc = NULL;
 
 	wclear(menu);
 
@@ -142,11 +143,17 @@ void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end,
 			snprintf(buf, sizeof(buf), "XXX %d.%s %s", i, i < 10 ? " " : "", mem->name);
 		else
 			snprintf(buf, sizeof(buf), "[%s] %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name);
+		if (curopt + 1== i)
+			desc = mem->displayname;
 		waddstr(menu, buf);
 		if (i == end)
 			break;
 	}
 
+	if (desc) {
+		wmove(menu, end - start + 2, max_x / 2 - 16);
+		waddstr(menu, desc);
+	}
 	wmove(menu, curopt - start, max_x / 2 - 9);
 
 	wrefresh(menu);
@@ -157,7 +164,7 @@ int run_category_menu(WINDOW *menu, int cat_num)
 	struct category *cat;
 	int i = 0;
 	int start = 0;
-	int end = max_y - TITLE_HEIGHT - 2;
+	int end = max_y - TITLE_HEIGHT - 6;
 	int c;
 	int curopt = 0;
 	int maxopt;
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 8e9bbe4f3f..5d6203e512 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -375,10 +375,11 @@ static int oss_call(struct ast_channel *c, char *dest, int timeout);
 static int oss_write(struct ast_channel *chan, struct ast_frame *f);
 static int oss_indicate(struct ast_channel *chan, int cond);
 static int oss_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+static char tdesc[] = "OSS Console Channel Driver";
 
 static const struct ast_channel_tech oss_tech = {
 	.type =	"Console",
-	.description =	"OSS Console Channel Driver",
+	.description =	tdesc,
 	.capabilities =	AST_FORMAT_SLINEAR,
 	.requester = oss_request,
 	.send_digit = oss_digit,
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8bd570455b..7ad5d8da29 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -202,7 +202,7 @@ static int expiry = DEFAULT_EXPIRY;
 
 #define	INITIAL_CSEQ		101	/*!< our initial sip sequence number */
 
-static const char desc[] = "Session Initiation Protocol (SIP)";
+static const char tdesc[] = "Session Initiation Protocol (SIP)";
 static const char config[] = "sip.conf";
 static const char notify_config[] = "sip_notify.conf";
 static int usecnt = 0;
@@ -14084,7 +14084,7 @@ static const char *key(void)
 
 static const char *description(void)
 {
-	return (char *) desc;
+	return (char *) tdesc;
 }
 
 STD_MOD(MOD_1, reload, NULL, NULL);
-- 
GitLab