mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-05 02:34:18 +00:00
xmas presence
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3721 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
55d0882f90
commit
375f1b38fd
@ -306,7 +306,8 @@ static void pres_event_handler(switch_event_t *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(event->event_id) {
|
switch(event->event_id) {
|
||||||
case SWITCH_EVENT_PRESENCE_PROBE: {
|
case SWITCH_EVENT_PRESENCE_PROBE:
|
||||||
|
if (proto && !strcasecmp(proto, MDL_CHAT_PROTO)) {
|
||||||
char *sql;
|
char *sql;
|
||||||
switch_core_db_t *db;
|
switch_core_db_t *db;
|
||||||
char *errmsg;
|
char *errmsg;
|
||||||
@ -323,7 +324,7 @@ static void pres_event_handler(switch_event_t *event)
|
|||||||
switch_core_db_close(db);
|
switch_core_db_close(db);
|
||||||
switch_safe_free(sql);
|
switch_safe_free(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case SWITCH_EVENT_PRESENCE_IN:
|
case SWITCH_EVENT_PRESENCE_IN:
|
||||||
if (!status) {
|
if (!status) {
|
||||||
|
@ -5326,34 +5326,35 @@ static void pres_event_handler(switch_event_t *event)
|
|||||||
|
|
||||||
|
|
||||||
switch(event->event_id) {
|
switch(event->event_id) {
|
||||||
case SWITCH_EVENT_PRESENCE_PROBE: {
|
case SWITCH_EVENT_PRESENCE_PROBE:
|
||||||
switch_core_db_t *db;
|
if (proto && !strcasecmp(proto, SOFIA_CHAT_PROTO)) {
|
||||||
char *to = switch_event_get_header(event, "to");
|
switch_core_db_t *db;
|
||||||
char *user, *host;
|
char *to = switch_event_get_header(event, "to");
|
||||||
|
char *user, *host;
|
||||||
|
|
||||||
if (!to || !(user = strdup(to))) {
|
if (!to || !(user = strdup(to))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(db = switch_core_db_open_file(profile->dbname))) {
|
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);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
|
||||||
|
switch_safe_free(user);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((host = strchr(user, '@'))) {
|
||||||
|
*host++ = '\0';
|
||||||
|
}
|
||||||
|
if (user && host &&
|
||||||
|
(sql = switch_mprintf("select user,host,'Registered','unknown','' 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);
|
||||||
|
switch_safe_free(sql);
|
||||||
|
}
|
||||||
switch_safe_free(user);
|
switch_safe_free(user);
|
||||||
return;
|
switch_core_db_close(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((host = strchr(user, '@'))) {
|
|
||||||
*host++ = '\0';
|
|
||||||
}
|
|
||||||
if (user && host &&
|
|
||||||
(sql = switch_mprintf("select user,host,'Registered','unknown','' 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);
|
|
||||||
switch_safe_free(sql);
|
|
||||||
}
|
|
||||||
switch_safe_free(user);
|
|
||||||
switch_core_db_close(db);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
case SWITCH_EVENT_PRESENCE_IN:
|
case SWITCH_EVENT_PRESENCE_IN:
|
||||||
sql = switch_mprintf("select 1,'%q','%q',* from sip_subscriptions where proto='%q' and event='%q' and sub_to_user='%q' and sub_to_host='%q'",
|
sql = switch_mprintf("select 1,'%q','%q',* from sip_subscriptions where proto='%q' and event='%q' and sub_to_user='%q' and sub_to_host='%q'",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user