提交 8311ec12 authored 作者: Michael Jerris's avatar Michael Jerris

tweak

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7518 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 c53adbb4
...@@ -125,6 +125,8 @@ void sofia_presence_cancel(void) ...@@ -125,6 +125,8 @@ void sofia_presence_cancel(void)
void *val; void *val;
struct presence_helper helper = { 0 }; struct presence_helper helper = { 0 };
if (!mod_sofia_globals.profile_hash) return;
if ((sql = switch_mprintf("select *,-1,'unavailable','unavailable' from sip_subscriptions where event='presence'"))) { if ((sql = switch_mprintf("select *,-1,'unavailable','unavailable' from sip_subscriptions where event='presence'"))) {
switch_mutex_lock(mod_sofia_globals.hash_mutex); switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
...@@ -320,6 +322,8 @@ void sofia_presence_event_handler(switch_event_t *event) ...@@ -320,6 +322,8 @@ void sofia_presence_event_handler(switch_event_t *event)
if (event->event_id == SWITCH_EVENT_ROSTER) { if (event->event_id == SWITCH_EVENT_ROSTER) {
struct presence_helper helper = { 0 }; struct presence_helper helper = { 0 };
if (!mod_sofia_globals.profile_hash) return;
if (from) { if (from) {
sql = switch_mprintf("select *,1,'%q','%q' from sip_subscriptions where event='presence' and full_from like '%%%q%%'", status, rpid, from); sql = switch_mprintf("select *,1,'%q','%q' from sip_subscriptions where event='presence' and full_from like '%%%q%%'", status, rpid, from);
} else { } else {
...@@ -433,6 +437,8 @@ void sofia_presence_event_handler(switch_event_t *event) ...@@ -433,6 +437,8 @@ void sofia_presence_event_handler(switch_event_t *event)
break; break;
} }
if (!mod_sofia_globals.profile_hash) goto done;
switch_mutex_lock(mod_sofia_globals.hash_mutex); switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val); switch_hash_this(hi, NULL, NULL, &val);
...@@ -463,6 +469,7 @@ void sofia_presence_event_handler(switch_event_t *event) ...@@ -463,6 +469,7 @@ void sofia_presence_event_handler(switch_event_t *event)
} }
switch_mutex_unlock(mod_sofia_globals.hash_mutex); switch_mutex_unlock(mod_sofia_globals.hash_mutex);
done:
switch_safe_free(sql); switch_safe_free(sql);
switch_safe_free(user); switch_safe_free(user);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论