From f66f3902b6f9a3dbdece1d5e2fd9eb26bd23612c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 Apr 2008 17:07:06 +0000 Subject: [PATCH] fix ODBC issue git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8088 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 23 +++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index aba7d55236..edd62b6e31 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -469,12 +469,25 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_presence_sub_callback, &helper); - if (switch_strlen_zero((char *)helper.stream.data)) { - switch_safe_free(helper.stream.data); - } else { - char *ssql = (char *)helper.stream.data; - sofia_glue_execute_sql(profile, &ssql, SWITCH_TRUE); + if (!switch_strlen_zero((char *)helper.stream.data)) { + char *this = (char *)helper.stream.data; + char *next = NULL; + + do { + if ((next = strchr(this, ';'))) { + *next++ = '\0'; + while(*next == '\n' || *next == ' ' || *next == '\r') { + *next++ = '\0'; + } + } + + if (!switch_strlen_zero(this)) { + sofia_glue_execute_sql(profile, &this, SWITCH_FALSE); + } + this = next; + } while (this); } + switch_safe_free(helper.stream.data); helper.stream.data = NULL; } }