[Freeswitch-svn] [commit] r3493 - in freeswitch/trunk/libs/libdingaling: . src

Freeswitch SVN anthm at freeswitch.org
Thu Nov 30 10:27:38 EST 2006


Author: anthm
Date: Thu Nov 30 10:27:37 2006
New Revision: 3493

Modified:
   freeswitch/trunk/libs/libdingaling/.update
   freeswitch/trunk/libs/libdingaling/src/libdingaling.c

Log:
tweak

Modified: freeswitch/trunk/libs/libdingaling/.update
==============================================================================
--- freeswitch/trunk/libs/libdingaling/.update	(original)
+++ freeswitch/trunk/libs/libdingaling/.update	Thu Nov 30 10:27:37 2006
@@ -1 +1 @@
-Thu Nov 16 16:09:31 UTC 2006
+Thu Nov 30 15:25:59 UTC 2006

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Thu Nov 30 10:27:37 2006
@@ -497,17 +497,20 @@
 			struct ldl_buffer *buffer;
 			size_t x;
 
+
+			apr_cpystrn(id, from, sizeof(id));
+			if ((resource = strchr(id, '/'))) {
+				*resource++ = '\0';
+			}
+
 			if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
 				iks *msg;
 				apr_hash_set(handle->sub_hash, 	apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
-				msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "Ding A Ling...."); 
+				msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling...."); 
 				apr_queue_push(handle->queue, msg);
 			}
 
-			apr_cpystrn(id, from, sizeof(id));
-			if ((resource = strchr(id, '/'))) {
-				*resource++ = '\0';
-			}
+			
 
 			if (resource) {
 				for (x = 0; x < strlen(resource); x++) {
@@ -705,20 +708,23 @@
 	if (!status) {
 		status = type;
 	}
+
+
+	apr_cpystrn(id, from, sizeof(id));
+	lowercase(id);
+
+	if ((resource = strchr(id, '/'))) {
+		*resource++ = '\0';
+	}
 	
 	if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) {
 		iks *msg;
 		apr_hash_set(handle->sub_hash, 	apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker);
-		msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "Ding A Ling...."); 
+		msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling...."); 
 		apr_queue_push(handle->queue, msg);
 	}
 
-	apr_cpystrn(id, from, sizeof(id));
-	lowercase(id);
 
-	if ((resource = strchr(id, '/'))) {
-		*resource++ = '\0';
-	}
 	
 	if (resource && strstr(resource, "talk") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
 		apr_cpystrn(buffer->buf, from, buffer->len);
@@ -811,14 +817,25 @@
 	ldl_handle_t *handle = user_data;
 	char *from = iks_find_attrib(pak->x, "from");
 	char *to = iks_find_attrib(pak->x, "to");
-	iks *msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "Ding A Ling...."); 
+	iks *msg = NULL;
+	char *id = strdup(from);
+	char *r;
 
+	if (!id) {
+		return -1;
+	}
+	if ((r = strchr(from, '/'))) {
+		*r++;
+	}
+
+	msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling....");
+	
 	if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) {
 		iks_insert_attrib(msg, "from", to);
 	}
 
 	apr_queue_push(handle->queue, msg);
-	msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, from, "Ding A Ling...."); 
+	msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, "Ding A Ling...."); 
 
 	if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) {
 		iks_insert_attrib(msg, "from", to);



More information about the Freeswitch-svn mailing list