]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
xmas presence
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 19 Dec 2006 18:04:07 +0000 (18:04 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 19 Dec 2006 18:04:07 +0000 (18:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3722 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index cb1aeca664d8522b7ece93b19706e00200c1a0e1..929f94567fd7d39a936e7057fb1b73171f774a8f 100644 (file)
@@ -312,17 +312,25 @@ static void pres_event_handler(switch_event_t *event)
             switch_core_db_t *db;
             char *errmsg;
             char *to = switch_event_get_header(event, "to");
+            char *f_host = NULL;
+            if (to) {
+                if ((f_host = strchr(to, '@'))) {
+                    f_host++;
+                }
+            }
 
-            if (to && (sql = switch_mprintf("select * from subscriptions where sub_to='%q'", to))) {
-                if (!(db = switch_core_db_open_file(profile->dbname))) {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
-                    return;
+            if (f_host && (profile = switch_core_hash_find(globals.profile_hash, f_host))) {
+                if (to && (sql = switch_mprintf("select * from subscriptions where sub_to='%q'", to))) {
+                    if (!(db = switch_core_db_open_file(profile->dbname))) {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
+                        return;
+                    }
+                    switch_mutex_lock(profile->mutex);
+                    switch_core_db_exec(db, sql, sin_callback, profile, &errmsg);
+                    switch_mutex_unlock(profile->mutex);
+                    switch_core_db_close(db);
+                    switch_safe_free(sql);
                 }
-                switch_mutex_lock(profile->mutex);
-                switch_core_db_exec(db, sql, sin_callback, profile, &errmsg);
-                switch_mutex_unlock(profile->mutex);
-                switch_core_db_close(db);
-                switch_safe_free(sql);
             }
         }
         return;
index 205c553c674e8d9439cc40f85ea2730a3d969fb6..c176a96db8e1aa798c3a4e81bc61d50cdda9802d 100644 (file)
@@ -5346,7 +5346,7 @@ static void pres_event_handler(switch_event_t *event)
                 *host++ = '\0';
             }
             if (user && host && 
-                (sql = switch_mprintf("select user,host,'Registered','unknown','' from sip_registrations where user='%q' and host='%q'", user, host))) {
+                (sql = switch_mprintf("select user,host,status,rpid,'' from sip_registrations where user='%q' and host='%q'", user, host))) {
                 switch_mutex_lock(profile->ireg_mutex);
                 switch_core_db_exec(db, sql, resub_callback, profile, &errmsg);
                 switch_mutex_unlock(profile->ireg_mutex);