Changeset fe7a554 for protocols/jabber/jabber_util.c
- Timestamp:
- 2006-09-22T18:39:31Z (18 years ago)
- Branches:
- master
- Children:
- d8e0484
- Parents:
- 8d74291
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber_util.c
r8d74291 rfe7a554 52 52 struct xt_node *jabber_make_packet( char *name, char *type, char *to, struct xt_node *children ) 53 53 { 54 char *id = g_strdup_printf( "BeeX%04x", next_id++ );55 54 struct xt_node *node; 56 55 57 56 node = xt_new_node( name, NULL, children ); 58 57 59 xt_add_attr( node, "id", id );60 58 if( type ) 61 59 xt_add_attr( node, "type", type ); … … 63 61 xt_add_attr( node, "to", to ); 64 62 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! */ 69 void 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 ); 65 78 g_free( id ); 79 } 80 81 /* Emptying this cache is a BIG TODO! */ 82 struct 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; 66 91 67 92 return node;
Note: See TracChangeset
for help on using the changeset viewer.