add user_exists
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6791 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
395cdbe4bf
commit
40f1d8141e
|
@ -119,7 +119,8 @@ SWITCH_STANDARD_API(user_data_function)
|
|||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(find_user_function)
|
||||
|
||||
static switch_status_t _find_user(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream, switch_bool_t tf)
|
||||
{
|
||||
switch_xml_t x_domain = NULL, x_user = NULL, xml = NULL;
|
||||
int argc;
|
||||
|
@ -171,6 +172,10 @@ SWITCH_STANDARD_API(find_user_function)
|
|||
|
||||
end:
|
||||
|
||||
if (session || tf) {
|
||||
stream->write_function(stream, err ? "false" : "true");
|
||||
switch_xml_free(xml);
|
||||
} else {
|
||||
if (err) {
|
||||
if (host) {
|
||||
stream->write_function(stream, "<error>%s</error>\n", err);
|
||||
|
@ -186,7 +191,7 @@ SWITCH_STANDARD_API(find_user_function)
|
|||
stream->write_function(stream, "%s", xmlstr);
|
||||
free(xmlstr);
|
||||
switch_xml_free(xml);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
free(mydata);
|
||||
|
@ -194,6 +199,18 @@ SWITCH_STANDARD_API(find_user_function)
|
|||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(user_exists_function)
|
||||
{
|
||||
return _find_user(cmd, session, stream, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(find_user_function)
|
||||
{
|
||||
return _find_user(cmd, session, stream, SWITCH_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SWITCH_STANDARD_API(xml_locate_function)
|
||||
{
|
||||
|
@ -2062,6 +2079,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
|||
SWITCH_ADD_API(commands_api_interface, "regex", "Eval a regex", regex_function, "<data>|<pattern>[|<subst string>]");
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "find_user_xml", "find a user", find_user_function, "<key> <user>@<domain>");
|
||||
SWITCH_ADD_API(commands_api_interface, "user_exists", "find a user", user_exists_function, "<key> <user>@<domain>");
|
||||
SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
|
||||
SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param] <name>");
|
||||
|
||||
|
|
Loading…
Reference in New Issue