Adding switch_mprintf (broken out from sqlite)

Adding new %w to mprintf to auto escape both single quote and backslashes
Improve the tab completion a tad and fix some sqlite/odbc compat with new mprintf opts
Change the default stream writer to use switch_vmprintf so %q/%w can be used there too



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15875 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-12-10 20:51:13 +00:00
1 parent 7803a752c9
commit cd1824e119
10 files changed
+1059 -44

No files matched your search

+14
View File
@@ -3744,6 +3744,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_console_set_complete("add sofia profile");
switch_console_set_complete("add sofia profile restart all");
switch_console_set_complete("add sofia profile _any_ start reloadxml");
switch_console_set_complete("add sofia profile _any_ stop reloadxml");
switch_console_set_complete("add sofia profile _any_ rescan reloadxml");
switch_console_set_complete("add sofia profile _any_ restart reloadxml");
switch_console_set_complete("add sofia profile _any_ flush_inbound_reg");
switch_console_set_complete("add sofia profile _any_ register");
switch_console_set_complete("add sofia profile _any_ killgw");
switch_console_set_complete("add sofia profile _any_ siptrace on");
switch_console_set_complete("add sofia profile _any_ siptrace off");
SWITCH_ADD_API(api_interface, "sofia_contact", "Sofia Contacts", sofia_contact_function, "[profile/]<user>@<domain>");
SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send);
@@ -3755,6 +3767,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
{
int sanity = 0;
switch_console_set_complete("del sofia");
switch_mutex_lock(mod_sofia_globals.mutex);
if (mod_sofia_globals.running == 1) {
mod_sofia_globals.running = 0;
+8 -1
View File
@@ -1059,7 +1059,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
int sanity;
switch_thread_t *worker_thread;
switch_status_t st;
char cbuf[512] = "";
switch_mutex_lock(mod_sofia_globals.mutex);
@@ -1226,10 +1226,17 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
switch_yield(1000000);
switch_snprintf(cbuf, sizeof(cbuf), "add sofia profile %s", profile->name);
switch_console_set_complete(cbuf);
while (mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING) && sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
su_root_step(profile->s_root, 1000);
}
switch_snprintf(cbuf, sizeof(cbuf), "del sofia profile %s", profile->name);
switch_console_set_complete(cbuf);
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
+7 -2
View File
@@ -3644,10 +3644,12 @@ void sofia_glue_release_profile__(const char *file, const char *func, int line,
switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char cbuf[512] = "";
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if (!switch_core_hash_find(mod_sofia_globals.profile_hash, key)) {
status = switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
switch_snprintf(cbuf, sizeof(cbuf), "add sofia profile %s", key);
switch_console_set_complete(cbuf);
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
@@ -3716,13 +3718,16 @@ void sofia_glue_del_profile(sofia_profile_t *profile)
const void *var;
void *val;
sofia_profile_t *pptr;
char cbuf[512] = "";
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if (mod_sofia_globals.profile_hash) {
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
if ((pptr = (sofia_profile_t *) val) && pptr == profile) {
aliases[i++] = strdup((char *) var);
switch_snprintf(cbuf, sizeof(cbuf), "del sofia profile %s", var);
switch_console_set_complete(cbuf);
if (i == 512) {
abort();
}