From 8311ec120b4760cf600049f33238757ad1ac4b8a Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 4 Feb 2008 19:01:22 +0000 Subject: [PATCH] tweak git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7518 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index e579355d28..6215bf05f8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -124,7 +124,9 @@ void sofia_presence_cancel(void) switch_hash_index_t *hi; void *val; 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'"))) { 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)) { @@ -319,6 +321,8 @@ void sofia_presence_event_handler(switch_event_t *event) if (event->event_id == SWITCH_EVENT_ROSTER) { struct presence_helper helper = { 0 }; + + if (!mod_sofia_globals.profile_hash) return; if (from) { sql = switch_mprintf("select *,1,'%q','%q' from sip_subscriptions where event='presence' and full_from like '%%%q%%'", status, rpid, from); @@ -433,6 +437,8 @@ void sofia_presence_event_handler(switch_event_t *event) break; } + if (!mod_sofia_globals.profile_hash) goto done; + 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)) { 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); +done: switch_safe_free(sql); switch_safe_free(user); }