]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 30 Nov 2006 15:27:37 +0000 (15:27 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 30 Nov 2006 15:27:37 +0000 (15:27 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3493 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/libdingaling/.update
libs/libdingaling/src/libdingaling.c

index 04fce42f4e1aaedfbf56be3eb9a29575a75994af..49c0de42411f77761ec1318edcdb0f8b0881523f 100644 (file)
@@ -1 +1 @@
-Thu Nov 16 16:09:31 UTC 2006
+Thu Nov 30 15:25:59 UTC 2006
index 6a2c3aee19bed04dfd53a8f6c35e6a393c8bb089..b373a3817578562afc0adb5e214a6017f35ddf41 100644 (file)
@@ -497,17 +497,20 @@ static int on_disco_info(void *user_data, ikspak *pak)
                        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 @@ static int on_presence(void *user_data, ikspak *pak)
        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 @@ static int on_subscribe(void *user_data, ikspak *pak)
        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);