aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/message.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-04-22 13:44:27 -0700
committerWilmer van der Gaast <wilmer@gaast.net>2007-04-22 13:44:27 -0700
commite35d1a121d5fb2da3698fbe4a365fe38d0097665 (patch)
tree390223f2df5aaaebb35c1bb118cbf2fbd69ecab9 /protocols/jabber/message.c
parentc737ba70c7b3510ffb6bed8f9373e63b1a150c1b (diff)
Read-only support for Jabber conferences (non-anonymous rooms only).
Just don't use this, you're really not going to like it. :-)
Diffstat (limited to 'protocols/jabber/message.c')
-rw-r--r--protocols/jabber/message.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c
index 19edbdfd..8a4ecaf4 100644
--- a/protocols/jabber/message.c
+++ b/protocols/jabber/message.c
@@ -29,24 +29,29 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data )
char *from = xt_find_attr( node, "from" );
char *type = xt_find_attr( node, "type" );
struct xt_node *body = xt_find_node( node->children, "body" ), *c;
+ struct jabber_buddy *bud = NULL;
char *s;
+ if( !from )
+ return XT_HANDLED; /* Consider this packet corrupted. */
+
+ bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT );
+
if( type && strcmp( type, "error" ) == 0 )
{
/* Handle type=error packet. */
}
- else if( type && strcmp( type, "groupchat" ) == 0 )
+ else if( type && from && strcmp( type, "groupchat" ) == 0 )
{
- /* TODO! */
+ jabber_chat_pkt_message( ic, bud, node );
}
else /* "chat", "normal", "headline", no-type or whatever. Should all be pretty similar. */
{
- struct jabber_buddy *bud = NULL;
GString *fullmsg = g_string_new( "" );
if( ( s = strchr( from, '/' ) ) )
{
- if( ( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT ) ) )
+ if( bud )
bud->last_act = time( NULL );
else
*s = 0; /* We need to generate a bare JID now. */