diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-21 20:44:34 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-09-21 20:44:34 +0200 |
commit | 5bcf70a662244dc77af09d2fffbe913ec6f19393 (patch) | |
tree | 856ecf3b4bf92450f6b99e77ca9ebfaa852b8c68 | |
parent | 4a0614e65b45364d4d1f631aeaae047a92c752c5 (diff) |
Now also sending <presence type="unavailable"/> tag on disconnect, as
recommended by rfc3921/5.1.5.
-rw-r--r-- | protocols/jabber/io.c | 20 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 2 |
2 files changed, 15 insertions, 7 deletions
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[] = "</stream:stream>"; /* 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[] = "</stream:stream>"; + 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 { |