Changeset 101d84f for protocols/jabber
- Timestamp:
- 2006-10-05T22:55:54Z (18 years ago)
- Branches:
- master
- Children:
- 090f1cb
- Parents:
- cc2cb2d
- Location:
- protocols/jabber
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/io.c
rcc2cb2d r101d84f 170 170 171 171 /* Execute all handlers. */ 172 if( !xt_handle( jd->xt, NULL ) )172 if( !xt_handle( jd->xt, NULL, 1 ) ) 173 173 { 174 174 /* Don't do anything, the handlers should have … … 184 184 185 185 /* Garbage collection. */ 186 xt_cleanup( jd->xt, NULL );186 xt_cleanup( jd->xt, NULL, 1 ); 187 187 188 188 /* This is a bit hackish, unfortunately. Although xmltree -
protocols/jabber/xmltree.c
rcc2cb2d r101d84f 152 152 /* Find completed nodes and see if a handler has to be called. Passing 153 153 a node isn't necessary if you want to start at the root, just pass 154 NULL. This second argument is needed for recursive calls. FIXME: Retval?*/155 int xt_handle( struct xt_parser *xt, struct xt_node *node )154 NULL. This second argument is needed for recursive calls. */ 155 int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ) 156 156 { 157 157 struct xt_node *c; … … 159 159 int i; 160 160 161 /* Let's just hope xt->root isn't NULL! */ 161 /* Just in case someone likes infinite loops... */ 162 if( xt->root == NULL ) 163 return 0; 164 162 165 if( node == NULL ) 163 return xt_handle( xt, xt->root ); 164 165 for( c = node->children; c; c = c->next ) 166 if( !xt_handle( xt, c ) ) 167 return 0; 166 return xt_handle( xt, xt->root, depth ); 167 168 if( depth != 0 ) 169 for( c = node->children; c; c = c->next ) 170 if( !xt_handle( xt, c, depth > 0 ? depth - 1 : depth ) ) 171 return 0; 168 172 169 173 if( node->flags & XT_COMPLETE && !( node->flags & XT_SEEN ) ) … … 202 206 streams because there's no reason to keep a complete packet history 203 207 in memory. */ 204 void xt_cleanup( struct xt_parser *xt, struct xt_node *node )208 void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) 205 209 { 206 210 struct xt_node *c, *prev; … … 210 214 211 215 if( node == NULL ) 212 return xt_cleanup( xt, xt->root );216 return xt_cleanup( xt, xt->root, depth ); 213 217 214 218 if( node->flags & XT_SEEN && node == xt->root ) … … 246 250 /* This node can't be cleaned up yet, but maybe a 247 251 subnode can. */ 248 xt_cleanup( xt, c ); 252 if( depth != 0 ) 253 xt_cleanup( xt, c, depth > 0 ? depth - 1 : depth ); 249 254 } 250 255 } -
protocols/jabber/xmltree.h
rcc2cb2d r101d84f 80 80 void xt_reset( struct xt_parser *xt ); 81 81 int xt_feed( struct xt_parser *xt, char *text, int text_len ); 82 int xt_handle( struct xt_parser *xt, struct xt_node *node );83 void xt_cleanup( struct xt_parser *xt, struct xt_node *node );82 int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ); 83 void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ); 84 84 char *xt_to_string( struct xt_node *node ); 85 85 void xt_print( struct xt_node *node );
Note: See TracChangeset
for help on using the changeset viewer.