diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-14 13:20:59 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-14 13:20:59 +0100 |
commit | d93c0eb9f3f5d2d2cd78f02422d0c0ed25743e3a (patch) | |
tree | 9e74aa23cefbe17dc4ab519ef113d7537d91342d /lib | |
parent | 12767e39dbafc36d54995727ff2c6043e8292f16 (diff) |
Read incoming MSN status/away messages.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/xmltree.c | 16 | ||||
-rw-r--r-- | lib/xmltree.h | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/xmltree.c b/lib/xmltree.c index 00b37ae6..f413b8f7 100644 --- a/lib/xmltree.c +++ b/lib/xmltree.c @@ -140,7 +140,7 @@ void xt_reset( struct xt_parser *xt ) /* Feed the parser, don't execute any handler. Returns -1 on errors, 0 on end-of-stream and 1 otherwise. */ -int xt_feed( struct xt_parser *xt, char *text, int text_len ) +int xt_feed( struct xt_parser *xt, const char *text, int text_len ) { if( !g_markup_parse_context_parse( xt->parser, text, text_len, &xt->gerr ) ) { @@ -259,6 +259,20 @@ void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ) } } +struct xt_node *xt_from_string( const char *in ) +{ + struct xt_parser *parser; + struct xt_node *ret; + + parser = xt_new( NULL, NULL ); + xt_feed( parser, in, strlen( in ) ); + ret = parser->root; + parser->root = NULL; + xt_free( parser ); + + return ret; +} + static void xt_to_string_real( struct xt_node *node, GString *str ) { char *buf; diff --git a/lib/xmltree.h b/lib/xmltree.h index ddb3f02f..c1697ff5 100644 --- a/lib/xmltree.h +++ b/lib/xmltree.h @@ -78,9 +78,10 @@ struct xt_parser struct xt_parser *xt_new( const struct xt_handler_entry *handlers, gpointer data ); void xt_reset( struct xt_parser *xt ); -int xt_feed( struct xt_parser *xt, char *text, int text_len ); +int xt_feed( struct xt_parser *xt, const char *text, int text_len ); int xt_handle( struct xt_parser *xt, struct xt_node *node, int depth ); void xt_cleanup( struct xt_parser *xt, struct xt_node *node, int depth ); +struct xt_node *xt_from_string( const char *in ); char *xt_to_string( struct xt_node *node ); void xt_print( struct xt_node *node ); struct xt_node *xt_dup( struct xt_node *node ); |