From 1bb1e012f1d62db84d331a484abf9cb4c191e8e0 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Aug 2010 13:15:53 +0100 Subject: Fixed a misuse of xt_find_node() that could get into an infinite loop. --- protocols/jabber/si.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'protocols/jabber') diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c index 58c0e17f..cd937c4a 100644 --- a/protocols/jabber/si.c +++ b/protocols/jabber/si.c @@ -261,6 +261,10 @@ int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, st requestok = TRUE; break; } + else + { + c = c->next; + } if ( !requestok ) imcb_log( ic, "WARNING: Unsupported file transfer request from %s", ini_jid); -- cgit v1.2.3 From 1aa74f559af18e06195f34b721d65d69c29fcc0f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 23 Aug 2010 11:34:36 +0100 Subject: Process incoming XMPP groupchat invites in a saner way: Create a temporary channel the user can easily /join. --- protocols/jabber/message.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index ce5017fb..6e40e521 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -30,7 +30,7 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) 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; + char *s, *room = NULL, *reason = NULL; if( !from ) return XT_HANDLED; /* Consider this packet corrupted. */ @@ -51,19 +51,19 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) { - char *ns = xt_find_attr( c, "xmlns" ), *room; - struct xt_node *inv, *reason; + char *ns = xt_find_attr( c, "xmlns" ); + struct xt_node *inv; if( ns && strcmp( ns, XMLNS_MUC_USER ) == 0 && ( inv = xt_find_node( c->children, "invite" ) ) ) { + /* This is an invitation. Set some vars which + will be passed to imcb_chat_invite() below. */ room = from; if( ( from = xt_find_attr( inv, "from" ) ) == NULL ) from = room; - - g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); - if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) - g_string_append( fullmsg, reason->text ); + if( ( inv = xt_find_node( inv->children, "reason" ) ) && inv->text_len > 0 ) + reason = inv->text; } } @@ -103,6 +103,8 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) if( fullmsg->len > 0 ) imcb_buddy_msg( ic, from, fullmsg->str, 0, jabber_get_timestamp( node ) ); + if( room ) + imcb_chat_invite( ic, room, from, reason ); g_string_free( fullmsg, TRUE ); -- cgit v1.2.3 From bd599b9aeabee36ac6fdb379ca09aec27cce13a4 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Aug 2010 09:07:48 +0100 Subject: Fix two compiler warnings. --- protocols/jabber/si.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/si.c b/protocols/jabber/si.c index cd937c4a..4b0e57c4 100644 --- a/protocols/jabber/si.c +++ b/protocols/jabber/si.c @@ -376,7 +376,7 @@ void jabber_si_answer_request( file_transfer_t *ft ) { static xt_status jabber_si_handle_response(struct im_connection *ic, struct xt_node *node, struct xt_node *orig ) { struct xt_node *c, *d; - char *ini_jid, *tgt_jid, *iq_id, *cmp; + char *ini_jid = NULL, *tgt_jid, *iq_id, *cmp; GSList *tflist; struct jabber_transfer *tf=NULL; struct jabber_data *jd = ic->proto_data; -- cgit v1.2.3 From b0a89cc6e5ffff050ddecd09e9af8eb6723f9ba6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 27 Aug 2010 09:48:18 +0100 Subject: Use nifty gcc -MD feature to automatically track .h dependencies of all C files, this finally gives proper dependencies, which means the end of getting broken binaries around headerfile changes, etc. Sure, this may not work on obscurux with superawesomeincompatiblecc while autoconf does, but at least BitlBee's configure script still runs in <1s. :-) --- protocols/jabber/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'protocols/jabber') diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile index efbd81fb..32946b18 100644 --- a/protocols/jabber/Makefile +++ b/protocols/jabber/Makefile @@ -29,6 +29,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -41,3 +42,5 @@ $(objects): %.o: $(SRCDIR)%.c jabber_mod.o: $(objects) @echo '*' Linking jabber_mod.o @$(LD) $(LFLAGS) $(objects) -o jabber_mod.o + +-include .depend/*.d -- cgit v1.2.3 From 31dbb90a2d32d6988706ae4b5c2292cd43d89595 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 31 Aug 2010 00:02:46 +0200 Subject: Suppress subjects in Jabber conversations after showing them once. --- protocols/jabber/jabber.h | 2 ++ protocols/jabber/message.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 45a1c5c1..1523e096 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -58,6 +58,8 @@ typedef enum groupchat state info too. */ JBFLAG_IS_ANONYMOUS = 8, /* For anonymous chatrooms, when we don't have have a real JID. */ + JBFLAG_HIDE_SUBJECT = 16, /* Hide the subject field since we probably + showed it already. */ } jabber_buddy_flags_t; /* Stores a streamhost's (a.k.a. proxy) data */ diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index 6e40e521..85c71c9d 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -92,9 +92,20 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) g_string_append_printf( fullmsg, "URL: %s\n", url->text ); } } - else if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 ) + else if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 && + ( !bud || !( bud->flags & JBFLAG_HIDE_SUBJECT ) ) ) { g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Message with subject: %s >>\n", c->text ); + if( bud ) + bud->flags |= JBFLAG_HIDE_SUBJECT; + } + else if( bud && !c ) + { + /* Yeah, possibly we're hiding changes to this field now. But nobody uses + this for anything useful anyway, except GMail when people reply to an + e-mail via chat, repeating the same subject all the time. I don't want + to have to remember full subject strings for everyone. */ + bud->flags &= ~JBFLAG_HIDE_SUBJECT; } if( body && body->text_len > 0 ) /* Could be just a typing notification. */ -- cgit v1.2.3