git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7518 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-02-04 19:01:22 +00:00
parent c53adbb46b
commit 8311ec120b
1 changed files with 8 additions and 1 deletions

View File

@ -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)
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)
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)
} }
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);
} }