aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/presence.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/presence.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/presence.c')
-rw-r--r--protocols/jabber/presence.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c
index 46e2b3b2..8004ed40 100644
--- a/protocols/jabber/presence.c
+++ b/protocols/jabber/presence.c
@@ -25,10 +25,30 @@
xt_status jabber_pkt_presence( struct xt_node *node, gpointer data )
{
+ struct gaim_connection *gc = data;
char *from = xt_find_attr( node, "from" );
+ char *type = xt_find_attr( node, "type" ); /* NULL should mean the person is online. */
+ char *s;
- printf( "Received PRES from %s:\n", from );
- xt_print( node );
+ if( !from )
+ return XT_HANDLED;
+
+ s = strchr( from, '/' );
+ if( s )
+ *s = 0;
+
+ if( type == NULL )
+ serv_got_update( gc, from, 1, 0, 0, 0, 0, 0 );
+ else if( strcmp( type, "unavailable" ) == 0 )
+ serv_got_update( gc, from, 0, 0, 0, 0, 0, 0 );
+ else
+ {
+ printf( "Received PRES from %s:\n", from );
+ xt_print( node );
+ }
+
+ if( s )
+ *s = '/';
return XT_HANDLED;
}