aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/message.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-09-21 09:32:39 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-09-21 09:32:39 +0200
commitdd788bb0b18684be993cc7edf1f0da6f8e36449d (patch)
tree2bd9bcc275f6445d5af4b010877af306ce8e34aa /protocols/jabber/message.c
parent0b4a0db448d033b8f35f32060bf261374fd81bd8 (diff)
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...
Diffstat (limited to 'protocols/jabber/message.c')
-rw-r--r--protocols/jabber/message.c25
1 files changed, 23 insertions, 2 deletions
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 : "<null>" );
- 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 : "<null>" );
+ xt_print( node );
+ }
return XT_HANDLED;
}