diff options
Diffstat (limited to 'protocols/jabber/presence.c')
-rw-r--r-- | protocols/jabber/presence.c | 24 |
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; } |