[Asterisk-cvs] asterisk/channels chan_sip.c,1.655,1.656
markster at lists.digium.com
markster at lists.digium.com
Sun Feb 13 10:56:42 CST 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv32202/channels
Modified Files:
chan_sip.c
Log Message:
Add sip show user completion (bug #3574)
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.655
retrieving revision 1.656
diff -u -d -r1.655 -r1.656
--- chan_sip.c 13 Feb 2005 16:40:56 -0000 1.655
+++ chan_sip.c 13 Feb 2005 16:56:20 -0000 1.656
@@ -6497,6 +6497,33 @@
return NULL;
}
+/*--- complete_sip_user: Do completion on user name ---*/
+static char *complete_sip_user(char *word, int state)
+{
+ char *result = NULL;
+ int wordlen = strlen(word);
+ int which = 0;
+
+ ASTOBJ_CONTAINER_TRAVERSE(&userl, !result, do {
+ /* locking of the object is not required because only the name is being compared */
+ if (!strncasecmp(word, iterator->name, wordlen)) {
+ if (++which > state) {
+ result = strdup(iterator->name);
+ }
+ }
+ } while(0) );
+ return result;
+}
+
+/*--- complete_sip_show_user: Support routine for 'sip show user' CLI ---*/
+static char *complete_sip_show_user(char *line, char *word, int pos, int state)
+{
+ if (pos == 3)
+ return complete_sip_user(word, state);
+
+ return NULL;
+}
+
/*--- complete_sipnotify: Support routine for 'sip notify' CLI ---*/
static char *complete_sipnotify(char *line, char *word, int pos, int state)
{
@@ -7152,7 +7179,7 @@
static struct ast_cli_entry cli_show_users =
{ { "sip", "show", "users", NULL }, sip_show_users, "Show defined SIP users", show_users_usage };
static struct ast_cli_entry cli_show_user =
- { { "sip", "show", "user", NULL }, sip_show_user, "Show details on specific SIP user", show_user_usage };
+ { { "sip", "show", "user", NULL }, sip_show_user, "Show details on specific SIP user", show_user_usage, complete_sip_show_user };
static struct ast_cli_entry cli_show_subscriptions =
{ { "sip", "show", "subscriptions", NULL }, sip_show_subscriptions, "Show active SIP subscriptions", show_subscriptions_usage};
static struct ast_cli_entry cli_show_channels =
More information about the svn-commits
mailing list