git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9222 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-08-04 22:51:03 +00:00
parent f035998ecb
commit 12b3a4f451
2 changed files with 9 additions and 4 deletions

View File

@ -4718,8 +4718,11 @@ static switch_status_t chat_send(char *proto, char *from, char *to, char *subjec
}
#endif
}
switch_safe_free(lbuf);
ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", stream.data, NULL);
//ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
switch_safe_free(stream.data);
return SWITCH_STATUS_SUCCESS;

View File

@ -1653,7 +1653,7 @@ void sofia_presence_handle_sip_i_message(int status,
switch_copy_string(proto, to_user, sizeof(proto));
p = strchr(proto, '+');
*p++ = '\0';
if ((to_addr = strdup(p))) {
if ((p = strchr(to_addr, '+'))) {
*p = '@';
@ -1665,18 +1665,21 @@ void sofia_presence_handle_sip_i_message(int status,
from_addr = switch_mprintf("%s@%s", from_user, from_host);
sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
if ((tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) {
channel = switch_core_session_get_channel(tech_pvt->session);
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", tech_pvt->hash_key);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", from_addr);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "hint", "%s", full_from);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s", to_addr);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "subject", "SIMPLE MESSAGE");
if (msg) {
switch_event_add_body(event, "%s", msg);
}
if (switch_core_session_queue_event(tech_pvt->session, &event) != SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
switch_event_fire(&event);
@ -1684,7 +1687,6 @@ void sofia_presence_handle_sip_i_message(int status,
}
} else {
switch_chat_interface_t *ci;
if ((ci = switch_loadable_module_get_chat_interface(proto))) {
ci->chat_send(SOFIA_CHAT_PROTO, from_addr, to_addr, "", msg, full_from);
} else {