[Freeswitch-svn] [commit] r3164 - in freeswitch/trunk/src/mod: applications/mod_conference endpoints/mod_dingaling

Freeswitch SVN anthm at freeswitch.org
Mon Oct 23 13:34:04 EDT 2006


Author: anthm
Date: Mon Oct 23 13:34:03 2006
New Revision: 3164

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c

Log:
tweeks

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Mon Oct 23 13:34:03 2006
@@ -815,16 +815,22 @@
 		switch_event_t *event;
 
 		if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
-			char *p;
 			char *from = switch_event_get_header(event, "from");
 			char *to = switch_event_get_header(event, "to");
 			char *proto = switch_event_get_header(event, "proto");
 			char *subject = switch_event_get_header(event, "subject");
+			char *hint = switch_event_get_header(event, "hint");
 			char *body = switch_event_get_body(event);
-			if ((p = strchr(to, '+'))) {
-				to = ++p;
+			char *p, *freeme = NULL;
+
+			if ((p = strchr(to, '+')) && 
+				strncmp(to, CONF_CHAT_PROTO, strlen(CONF_CHAT_PROTO))) {
+				freeme = switch_mprintf("%s+%s@%s", CONF_CHAT_PROTO, member->conference->name, member->conference->domain);
+				to = freeme;
 			}
-			chat_send(proto, from, to, subject, body, "");
+
+			chat_send(proto, from, to, subject, body, hint);
+			switch_safe_free(freeme);
 			switch_event_destroy(&event);
 		}
 
@@ -3100,6 +3106,10 @@
 	conference_obj_t *conference = NULL;
 	switch_stream_handle_t stream = {0};
 
+	if ((p = strchr(to, '+'))) {
+		to = ++p;
+	}
+
 	if (!body) {
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -3108,6 +3118,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
 	}
 
+
 	if ((p = strchr(to, '@'))) {
 		switch_copy_string(name, to, ++p-to);
 	} else {
@@ -3115,7 +3126,7 @@
 	}
 
 	if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
-		ci->chat_send(CONF_CHAT_PROTO, to, from, "", "Sorry, We're Closed", "");
+		ci->chat_send(CONF_CHAT_PROTO, to, hint ? hint : from, "", "Sorry, We're Closed", NULL);
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -3124,11 +3135,12 @@
 	if (strstr(body, "list")) {
 		conference_list_pretty(conference, &stream);
 	} else {
-		stream.write_function(&stream, "The only command we have is so far is 'list' Get coding or go press PayPal!!\n");
+		stream.write_function(&stream, "The only command we have so far is 'list'.\nGet coding or go press PayPal!!\n");
 	}
 
-	ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, "");
+	ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
 	switch_safe_free(stream.data);
+
 
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Mon Oct 23 13:34:03 2006
@@ -2147,6 +2147,7 @@
 			switch_chat_interface_t *ci;
 			char *proto = MDL_CHAT_PROTO;
 			char *pproto = NULL, *ffrom = NULL;
+			char *hint;
 
 			if (profile->auto_reply) {
 				ldl_handle_send_msg(handle, (profile->user_flags & LDL_FLAG_COMPONENT) ? to : profile->login, from, "", profile->auto_reply);
@@ -2159,18 +2160,19 @@
 				}
 				proto = pproto;
 			}
-			
+
+			hint = from;
+
 			if (strchr(from, '/') && (ffrom = strdup(from))) {
 				char *p;
 				if ((p = strchr(ffrom, '/'))) {
 					*p = '\0';
 				}
 				from = ffrom;
-
 			}
 
 			if ((ci = switch_loadable_module_get_chat_interface(proto))) {
-				ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, "");
+				ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, hint);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
 			}
@@ -2280,17 +2282,19 @@
 		}
 
 		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
-			char *p, *freeme = NULL;
-			
+			char *hint = NULL, *p, *freeme = NULL;
+
+			hint = from;			
 			if (strchr(from, '/')) {
 				freeme = strdup(from);
 				p = strchr(freeme, '/');
 				*p = '\0';
-				from = freeme;
+				from = freeme;				
 			}
 
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "hint", "%s", hint);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", from);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s", to);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "subject", "%s", subject);



More information about the Freeswitch-svn mailing list