From 5bcf70a662244dc77af09d2fffbe913ec6f19393 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 21 Sep 2006 20:44:34 +0200 Subject: Now also sending tag on disconnect, as recommended by rfc3921/5.1.5. --- protocols/jabber/io.c | 20 ++++++++++++++------ protocols/jabber/jabber.h | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'protocols') diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index 8c0b239e..b11ef17d 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -234,15 +234,23 @@ gboolean jabber_start_stream( struct gaim_connection *gc ) return st; } -gboolean jabber_end_stream( struct gaim_connection *gc ) +void jabber_end_stream( struct gaim_connection *gc ) { struct jabber_data *jd = gc->proto_data; - char eos[] = ""; /* Let's only do this if the queue is currently empty, otherwise it'd take too long anyway. */ - if( jd->tx_len > 0 ) - return TRUE; - else - return jabber_write( gc, eos, strlen( eos ) ); + if( jd->tx_len == 0 ) + { + char eos[] = ""; + struct xt_node *node; + int st; + + node = jabber_make_packet( "presence", "unavailable", NULL, NULL ); + st = jabber_write_packet( gc, node ); + xt_free_node( node ); + + if( st ) + jabber_write( gc, eos, strlen( eos ) ); + } } diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 93e2baab..45747fcb 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -56,7 +56,7 @@ int jabber_write_packet( struct gaim_connection *gc, struct xt_node *node ); int jabber_write( struct gaim_connection *gc, char *buf, int len ); gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond ); gboolean jabber_start_stream( struct gaim_connection *gc ); -gboolean jabber_end_stream( struct gaim_connection *gc ); +void jabber_end_stream( struct gaim_connection *gc ); struct jabber_data { -- cgit v1.2.3