From 7b40f17f9f514127c8a37c35ac3d1c3bd34c13d5 Mon Sep 17 00:00:00 2001 From: dequis Date: Fri, 10 Oct 2014 23:20:53 -0300 Subject: Add support for XEP-0203: Delayed delivery (message timestamps) Very similar to XEP-0091 which is already supported, but was marked as obsolete, replaced by XEP-0203. The main differences are the tag name and the timestamp format. Due to the similarities, both XEPs are still supported. --- lib/xmltree.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/xmltree.c') diff --git a/lib/xmltree.c b/lib/xmltree.c index 0726d387..9d84fb7c 100644 --- a/lib/xmltree.c +++ b/lib/xmltree.c @@ -523,6 +523,21 @@ char *xt_find_attr( struct xt_node *node, const char *key ) return node->attr[i].value; } +struct xt_node *xt_find_node_by_attr( struct xt_node *xt, const char *tag, const char *key, const char *value ) { + struct xt_node *c; + char *s; + + for( c = xt; ( c = xt_find_node( c, tag ) ); c = c->next ) + { + if( ( s = xt_find_attr( c, key ) ) && strcmp( s, value ) == 0 ) + { + return c; + } + } + return NULL; +} + + /* Strip a few non-printable characters that aren't allowed in XML streams (and upset some XMPP servers for example). */ void xt_strip_text( char *in ) -- cgit v1.2.3