diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-10-12 23:01:51 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-10-12 23:01:51 +0200 |
commit | a4effbf8f749459340cb353a29053e6f69850f63 (patch) | |
tree | 8fff426f4639fb806d828a66be2371cd974be868 /protocols/jabber/iq.c | |
parent | 259edd40f5e332791a44f7547346bf799f1f7327 (diff) |
Replies to jabber:iq:time packets.
Diffstat (limited to 'protocols/jabber/iq.c')
-rw-r--r-- | protocols/jabber/iq.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 265fae53..8a7b3192 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -78,6 +78,20 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) xt_add_child( reply, xt_new_node( "version", BITLBEE_VERSION, NULL ) ); xt_add_child( reply, xt_new_node( "os", ARCH, NULL ) ); } + else if( strcmp( s, "jabber:iq:time" ) == 0 ) + { + time_t time_ep; + char buf[1024]; + + buf[sizeof(buf)-1] = 0; + time_ep = time( NULL ); + + strftime( buf, sizeof( buf ) - 1, "%Y%m%dT%H:%M:%S", gmtime( &time_ep ) ); + xt_add_child( reply, xt_new_node( "utc", buf, NULL ) ); + + strftime( buf, sizeof( buf ) - 1, "%Z", localtime( &time_ep ) ); + xt_add_child( reply, xt_new_node( "tz", buf, NULL ) ); + } else if( strcmp( s, "http://jabber.org/protocol/disco#info" ) == 0 ) { c = xt_new_node( "identity", NULL, NULL ); @@ -91,6 +105,10 @@ xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) xt_add_child( reply, c ); c = xt_new_node( "feature", NULL, NULL ); + xt_add_attr( c, "var", "jabber:iq:time" ); + xt_add_child( reply, c ); + + c = xt_new_node( "feature", NULL, NULL ); xt_add_attr( c, "var", "http://jabber.org/protocol/chatstates" ); xt_add_child( reply, c ); |