Ignore:
Timestamp:
2006-10-12T17:48:58Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a4effbf
Parents:
b56b220
Message:

Special message when the XMPP session is ended because of a concurrent
login, and now sending proper error responses to IQ packets we can't
handle.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/xmltree.c

    rb56b220 r259edd4  
    550550        node->attr[i].value = g_strdup( value );
    551551}
     552
     553int xt_remove_attr( struct xt_node *node, char *key )
     554{
     555        int i, last;
     556       
     557        for( i = 0; node->attr[i].key; i ++ )
     558                if( strcmp( node->attr[i].key, key ) == 0 )
     559                        break;
     560       
     561        /* If we didn't find the attribute... */
     562        if( node->attr[i].key == NULL )
     563                return 0;
     564       
     565        g_free( node->attr[i].key );
     566        g_free( node->attr[i].value );
     567       
     568        /* If it's the last, this is easy: */
     569        if( node->attr[i+1].key == NULL )
     570        {
     571                node->attr[i].key = node->attr[i].value = NULL;
     572        }
     573        else /* It's also pretty easy, actually. */
     574        {
     575                /* Find the last item. */
     576                for( last = i + 1; node->attr[last+1].key; last ++ );
     577               
     578                node->attr[i] = node->attr[last];
     579                node->attr[last].key = NULL;
     580                node->attr[last].value = NULL;
     581        }
     582       
     583        /* Let's not bother with reallocating memory here. It takes time and
     584           most packets don't stay in memory for long anyway. */
     585       
     586        return 1;
     587}
Note: See TracChangeset for help on using the changeset viewer.