aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/io.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-09-21 11:37:03 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-09-21 11:37:03 +0200
commit4a0614e65b45364d4d1f631aeaae047a92c752c5 (patch)
tree5c40d52c08eaba7b26c2d9567babf4ea45770190 /protocols/jabber/io.c
parentdd788bb0b18684be993cc7edf1f0da6f8e36449d (diff)
Added simple parsing of incoming <presence> tags, a nice </stream:stream>
at the end of sessions, support for sending messages, and restored the old (and leaking) xt_print(), which I'll only use for debugging.
Diffstat (limited to 'protocols/jabber/io.c')
-rw-r--r--protocols/jabber/io.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c
index db869714..8c0b239e 100644
--- a/protocols/jabber/io.c
+++ b/protocols/jabber/io.c
@@ -169,8 +169,6 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition
return TRUE;
}
-static gboolean jabber_start_stream( struct gaim_connection *gc );
-
gboolean jabber_connected_plain( gpointer data, gint source, b_input_condition cond )
{
struct gaim_connection *gc = data;
@@ -209,7 +207,7 @@ static const struct xt_handler_entry jabber_handlers[] = {
{ NULL, NULL, NULL }
};
-static gboolean jabber_start_stream( struct gaim_connection *gc )
+gboolean jabber_start_stream( struct gaim_connection *gc )
{
struct jabber_data *jd = gc->proto_data;
int st;
@@ -235,3 +233,16 @@ static gboolean jabber_start_stream( struct gaim_connection *gc )
return st;
}
+
+gboolean 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 ) );
+}