source: protocols/jabber/message.c @ 5997488

Last change on this file since 5997488 was dd788bb, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-09-21T07:32:39Z

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...

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/***************************************************************************\
2*                                                                           *
3*  BitlBee - An IRC to IM gateway                                           *
4*  Jabber module - Handling of message(s) (tags), etc                       *
5*                                                                           *
6*  Copyright 2006 Wilmer van der Gaast <wilmer@gaast.net>                   *
7*                                                                           *
8*  This program is free software; you can redistribute it and/or modify     *
9*  it under the terms of the GNU General Public License as published by     *
10*  the Free Software Foundation; either version 2 of the License, or        *
11*  (at your option) any later version.                                      *
12*                                                                           *
13*  This program is distributed in the hope that it will be useful,          *
14*  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
15*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
16*  GNU General Public License for more details.                             *
17*                                                                           *
18*  You should have received a copy of the GNU General Public License along  *
19*  with this program; if not, write to the Free Software Foundation, Inc.,  *
20*  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.              *
21*                                                                           *
22\***************************************************************************/
23
24#include "jabber.h"
25
26xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
27{
28        struct gaim_connection *gc = data;
29        char *from = xt_find_attr( node, "from" );
30        char *type = xt_find_attr( node, "type" );
31        struct xt_node *msg = xt_find_node( node->children, "body" );
32       
33        if( !type || !msg )
34                return XT_HANDLED;      /* Grmbl... FIXME */
35       
36        if( strcmp( type, "chat" ) == 0 )
37        {
38                char *s;
39               
40                s = strchr( from, '/' );
41                if( s )
42                        *s = 0;
43               
44                serv_got_im( gc, from, msg->text, 0, 0, 0 );
45               
46                if( s )
47                        *s = '/';
48        }
49        else
50        {
51                printf( "Received MSG from %s: %s\n", from, msg ? msg->text : "<null>" );
52                xt_print( node );
53        }
54       
55        return XT_HANDLED;
56}
57
Note: See TracBrowser for help on using the repository browser.