forked from Mirrors/freeswitch
Code before declaration and formatting
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14986 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
08b43d8bb1
commit
9f76dbbe6e
@ -3292,72 +3292,72 @@ done:
|
||||
#define PREFS_SYNTAX "[profile/]<user>@<domain>[|[name_path|greeting_path|password]]"
|
||||
SWITCH_STANDARD_API(prefs_api_function)
|
||||
{
|
||||
char *dup = NULL;
|
||||
const char *how = "greeting_path";
|
||||
vm_profile_t *profile = NULL;
|
||||
char *id, *domain, *p, *profilename = NULL;
|
||||
char *dup = NULL;
|
||||
const char *how = "greeting_path";
|
||||
vm_profile_t *profile = NULL;
|
||||
char *id, *domain, *p, *profilename = NULL;
|
||||
char sql[256];
|
||||
prefs_callback_t cbt = {{0}};
|
||||
|
||||
if (switch_strlen_zero(cmd)) {
|
||||
stream->write_function(stream, "%d", 0);
|
||||
goto done;
|
||||
}
|
||||
if (switch_strlen_zero(cmd)) {
|
||||
stream->write_function(stream, "%d", 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
id = dup = strdup(cmd);
|
||||
id = dup = strdup(cmd);
|
||||
|
||||
if ((p = strchr(dup, '/'))) {
|
||||
*p++ = '\0';
|
||||
id = p;
|
||||
profilename = dup;
|
||||
}
|
||||
if ((p = strchr(dup, '/'))) {
|
||||
*p++ = '\0';
|
||||
id = p;
|
||||
profilename = dup;
|
||||
}
|
||||
|
||||
if (!strncasecmp(id, "sip:", 4)) {
|
||||
id += 4;
|
||||
}
|
||||
if (!strncasecmp(id, "sip:", 4)) {
|
||||
id += 4;
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(id)) {
|
||||
stream->write_function(stream, "%d", 0);
|
||||
goto done;
|
||||
}
|
||||
if (switch_strlen_zero(id)) {
|
||||
stream->write_function(stream, "%d", 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((domain = strchr(id, '@'))) {
|
||||
*domain++ = '\0';
|
||||
if ((p = strchr(domain, '|'))) {
|
||||
*p++ = '\0';
|
||||
how = p;
|
||||
}
|
||||
if ((domain = strchr(id, '@'))) {
|
||||
*domain++ = '\0';
|
||||
if ((p = strchr(domain, '|'))) {
|
||||
*p++ = '\0';
|
||||
how = p;
|
||||
}
|
||||
|
||||
if (!switch_strlen_zero(profilename) && !(profile = get_profile(profilename))) {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
goto done;
|
||||
}
|
||||
if (!(profile = get_profile("default"))) {
|
||||
stream->write_function(stream, "-ERR profile 'default' doesn't exist\n");
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR No domain specified\n");
|
||||
goto done;
|
||||
if (!switch_strlen_zero(profilename) && !(profile = get_profile(profilename))) {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
goto done;
|
||||
}
|
||||
if (!(profile = get_profile("default"))) {
|
||||
stream->write_function(stream, "-ERR profile 'default' doesn't exist\n");
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR No domain specified\n");
|
||||
goto done;
|
||||
|
||||
}
|
||||
char sql[256];
|
||||
prefs_callback_t cbt = {{0}};
|
||||
}
|
||||
|
||||
switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain);
|
||||
vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
|
||||
switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain);
|
||||
vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
|
||||
|
||||
if (!strcasecmp(how, "greeting_path")) {
|
||||
stream->write_function(stream, "%s", cbt.greeting_path);
|
||||
} else if (!strcasecmp(how, "name_path")) {
|
||||
stream->write_function(stream, "%s", cbt.name_path);
|
||||
} else if (!strcasecmp(how, "password")) {
|
||||
stream->write_function(stream, "%s", cbt.password);
|
||||
} else {
|
||||
stream->write_function(stream, "%s:%s:%s", cbt.greeting_path, cbt.name_path, cbt.password);
|
||||
}
|
||||
profile_rwunlock(profile);
|
||||
if (!strcasecmp(how, "greeting_path")) {
|
||||
stream->write_function(stream, "%s", cbt.greeting_path);
|
||||
} else if (!strcasecmp(how, "name_path")) {
|
||||
stream->write_function(stream, "%s", cbt.name_path);
|
||||
} else if (!strcasecmp(how, "password")) {
|
||||
stream->write_function(stream, "%s", cbt.password);
|
||||
} else {
|
||||
stream->write_function(stream, "%s:%s:%s", cbt.greeting_path, cbt.name_path, cbt.password);
|
||||
}
|
||||
profile_rwunlock(profile);
|
||||
done:
|
||||
switch_safe_free(dup);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
switch_safe_free(dup);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define parse_profile() {\
|
||||
|
Loading…
Reference in New Issue
Block a user