From dd788bb0b18684be993cc7edf1f0da6f8e36449d Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 21 Sep 2006 09:32:39 +0200 Subject: Added enough to not make it crash on login, and it can properly receive messages now. Just try to figure out why it doesn't get typing notifications... --- protocols/jabber/message.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'protocols/jabber/message.c') diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index e5f75464..b41522fd 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -25,11 +25,32 @@ xt_status jabber_pkt_message( 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" ); struct xt_node *msg = xt_find_node( node->children, "body" ); - printf( "Received MSG from %s: %s\n", from, msg ? msg->text : "" ); - xt_print( node ); + if( !type || !msg ) + return XT_HANDLED; /* Grmbl... FIXME */ + + if( strcmp( type, "chat" ) == 0 ) + { + char *s; + + s = strchr( from, '/' ); + if( s ) + *s = 0; + + serv_got_im( gc, from, msg->text, 0, 0, 0 ); + + if( s ) + *s = '/'; + } + else + { + printf( "Received MSG from %s: %s\n", from, msg ? msg->text : "" ); + xt_print( node ); + } return XT_HANDLED; } -- cgit v1.2.3