Ignore:
Timestamp:
2006-09-22T18:39:31Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d8e0484
Parents:
8d74291
Message:

Better detection of successful IQ authentication (using packet caching),
properly working SASL authentication (although only PLAIN so far).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r8d74291 rfe7a554  
    5252struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children )
    5353{
    54         char *id = g_strdup_printf( "BeeX%04x", next_id++ );
    5554        struct xt_node *node;
    5655       
    5756        node = xt_new_node( name, NULL, children );
    5857       
    59         xt_add_attr( node, "id", id );
    6058        if( type )
    6159                xt_add_attr( node, "type", type );
     
    6361                xt_add_attr( node, "to", to );
    6462       
     63        return node;
     64}
     65
     66/* Cache a node/packet for later use. Mainly useful for IQ packets if you need
     67   them when you receive the response. Use this BEFORE sending the packet so
     68   it'll get an id= tag, and do NOT free() the packet after writing it! */
     69void jabber_cache_packet( struct gaim_connection *gc, struct xt_node *node )
     70{
     71        struct jabber_data *jd = gc->proto_data;
     72        char *id = g_strdup_printf( "BeeX%04x", next_id++ );
     73       
     74        /* FIXME: Maybe start using g_error() here if nodes still have a parent, for example? */
     75       
     76        xt_add_attr( node, "id", id );
     77        xt_add_child( jd->node_cache, node );
    6578        g_free( id );
     79}
     80
     81/* Emptying this cache is a BIG TODO! */
     82struct xt_node *jabber_packet_from_cache( struct gaim_connection *gc, char *id )
     83{
     84        struct jabber_data *jd = gc->proto_data;
     85        struct xt_node *node;
     86        char *s;
     87       
     88        for( node = jd->node_cache->children; node; node = node->next )
     89                if( ( s = xt_find_attr( node, "id" ) ) && strcmp( id, s ) == 0 )
     90                        break;
    6691       
    6792        return node;
Note: See TracChangeset for help on using the changeset viewer.