@ -1284,7 +1284,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
tmp = buddy - > resources ;
tmp = buddy - > resources ;
descrip = ast_strdup ( iks_find_cdata ( pak - > x , " status " ) ) ;
descrip = ast_strdup ( iks_find_cdata ( pak - > x , " status " ) ) ;
while ( tmp ) {
while ( tmp & & pak - > from - > resource ) {
if ( ! strcasecmp ( tmp - > resource , pak - > from - > resource ) ) {
if ( ! strcasecmp ( tmp - > resource , pak - > from - > resource ) ) {
tmp - > status = status ;
tmp - > status = status ;
if ( tmp - > description ) ast_free ( tmp - > description ) ;
if ( tmp - > description ) ast_free ( tmp - > description ) ;
@ -1357,7 +1357,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
}
}
/* resource not found in our list, create it */
/* resource not found in our list, create it */
if ( ! found & & status ! = 6 ) {
if ( ! found & & status ! = 6 & & pak - > from - > resource ) {
found = ast_calloc ( 1 , sizeof ( * found ) ) ;
found = ast_calloc ( 1 , sizeof ( * found ) ) ;
if ( ! found ) {
if ( ! found ) {
@ -1391,12 +1391,6 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
buddy - > resources = found ;
buddy - > resources = found ;
}
}
/* if 'from' attribute does not contain 'resource' string
point to the top of our resource list */
if ( ! found & & ! pak - > from - > resource & & buddy - > resources ) {
found = buddy - > resources ;
}
ASTOBJ_UNLOCK ( buddy ) ;
ASTOBJ_UNLOCK ( buddy ) ;
ASTOBJ_UNREF ( buddy , aji_buddy_destroy ) ;
ASTOBJ_UNREF ( buddy , aji_buddy_destroy ) ;
@ -1409,7 +1403,8 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
ver = iks_find_attrib ( iks_find ( pak - > x , " caps:c " ) , " ver " ) ;
ver = iks_find_attrib ( iks_find ( pak - > x , " caps:c " ) , " ver " ) ;
}
}
if ( status ! = 6 & & ! found - > cap ) {
/* retrieve capabilites of the new resource */
if ( status ! = 6 & & found & & ! found - > cap ) {
found - > cap = aji_find_version ( node , ver , pak ) ;
found - > cap = aji_find_version ( node , ver , pak ) ;
if ( gtalk_yuck ( pak - > x ) ) /* gtalk should do discover */
if ( gtalk_yuck ( pak - > x ) ) /* gtalk should do discover */
found - > cap - > jingle = 1 ;
found - > cap - > jingle = 1 ;