add console_complete_xml api

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15967 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene
2009-12-15 18:26:06 +00:00
parent 7d6ff98fc6
commit d2c72cf569
3 changed files with 55 additions and 4 deletions
@@ -785,10 +785,40 @@ SWITCH_STANDARD_API(console_complete_function)
}
}
switch_console_complete(cmd, cursor, NULL, stream);
switch_console_complete(cmd, cursor, NULL, stream, NULL);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(console_complete_xml_function)
{
const char *p, *cursor = NULL;
int c;
switch_xml_t xml = switch_xml_new("complete");
char *sxml;
if (zstr(cmd)) {
cmd = " ";
}
if ((p = strstr(cmd, "c="))) {
p += 2;
c = atoi(p);
if ((p = strchr(p, ';'))) {
cmd = p + 1;
cursor = cmd + c;
}
}
switch_console_complete(cmd, cursor, NULL, NULL, xml);
sxml = switch_xml_toxml(xml, SWITCH_TRUE);
stream->write_function(stream, "%s", sxml);
free(sxml);
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(eval_function)
{
@@ -3814,6 +3844,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API(commands_api_interface, "complete", "Complete", complete_function, COMPLETE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "cond", "Eval a conditional", cond_function, "<expr> ? <true val> : <false val>");
SWITCH_ADD_API(commands_api_interface, "console_complete", "", console_complete_function, "<line>");
SWITCH_ADD_API(commands_api_interface, "console_complete_xml", "", console_complete_xml_function, "<line>");
SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "db_cache", "db cache management", db_cache_function, "status");
SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<domain>");