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') 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 241f9f6d9135048578ad603485740b73402edd8a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Aug 2010 14:31:53 +0100 Subject: Better handling of yahoo add responses: libyahoo2 seems to (IMHO) wrongly assume that a non-0 status means the contact is on the list already and on-line. This causes ugly "imcb_buddy_status() for unknown handle" msgs. --- protocols/yahoo/libyahoo2.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'protocols') diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index b062e7f9..07689809 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -2168,6 +2168,18 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid, yd->buddies = y_list_append(yd->buddies, bud); +#if 0 + /* BitlBee: This seems to be wrong in my experience. I think: + status = 0: Success + status = 2: Already on list + status = 3: Doesn't exist + status = 42: Invalid handle (possibly banned/reserved, I get it for + handles like joe or jjjjjj) + Haven't seen others yet. But whenever the add is successful, there + will be a separate "went online" packet when the auth. request is + accepted. Couldn't find any test account that doesn't require auth. + unfortunately (if there is even such a thing?) */ + /* A non-zero status (i've seen 2) seems to mean the buddy is already * added and is online */ if (status) { @@ -2176,6 +2188,13 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid, YAHOO_CALLBACK(ext_yahoo_status_changed) (yd->client_id, who, YAHOO_STATUS_AVAILABLE, NULL, 0, 0, 0); } +#endif + /* BitlBee: Need ACK of added buddy, if it was successful. */ + if (status == 0) { + YList *tmp = y_list_append(NULL, bud); + YAHOO_CALLBACK(ext_yahoo_got_buddies) (yd->client_id, tmp); + y_list_free(tmp); + } } static void yahoo_process_buddydel(struct yahoo_input_data *yid, -- 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/bee.h | 2 ++ protocols/bee_chat.c | 8 ++++++++ protocols/jabber/message.c | 16 +++++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'protocols') diff --git a/protocols/bee.h b/protocols/bee.h index 2fd3562e..b99c8de7 100644 --- a/protocols/bee.h +++ b/protocols/bee.h @@ -122,6 +122,7 @@ typedef struct bee_ui_funcs gboolean (*chat_remove_user)( bee_t *bee, struct groupchat *c, bee_user_t *bu ); gboolean (*chat_topic)( bee_t *bee, struct groupchat *c, const char *new, bee_user_t *bu ); gboolean (*chat_name_hint)( bee_t *bee, struct groupchat *c, const char *name ); + gboolean (*chat_invite)( bee_t *bee, bee_user_t *bu, const char *name, const char *msg ); struct file_transfer* (*ft_in_start)( bee_t *bee, bee_user_t *bu, const char *file_name, size_t file_size ); gboolean (*ft_out_start)( struct im_connection *ic, struct file_transfer *ft ); @@ -174,5 +175,6 @@ G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *c, const char *handl G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *c, const char *handle, const char *reason ); G_MODULE_EXPORT int bee_chat_msg( bee_t *bee, struct groupchat *c, const char *msg, int flags ); G_MODULE_EXPORT struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const char *title ); +G_MODULE_EXPORT void imcb_chat_invite( struct im_connection *ic, const char *name, const char *who, const char *msg ); #endif /* __BEE_H__ */ diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index 3be6f189..0314cae5 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -232,3 +232,11 @@ struct groupchat *bee_chat_by_title( bee_t *bee, struct im_connection *ic, const return NULL; } + +void imcb_chat_invite( struct im_connection *ic, const char *name, const char *who, const char *msg ) +{ + bee_user_t *bu = bee_user_by_handle( ic->bee, ic, who ); + + if( bu && ic->bee->ui->chat_invite ) + ic->bee->ui->chat_invite( ic->bee, bu, name, msg ); +} 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 +- protocols/twitter/twitter_lib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols') 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; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 22d2a3bd..f86e1f15 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -372,7 +372,7 @@ static xt_status twitter_xt_get_user_list( struct xt_node *node, struct twitter_ */ static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml_status *txs ) { - struct xt_node *child, *rt; + struct xt_node *child, *rt = NULL; gboolean truncated = FALSE; // Walk over the nodes children. -- 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/Makefile | 3 +++ protocols/jabber/Makefile | 3 +++ protocols/msn/Makefile | 3 ++- protocols/oscar/Makefile | 3 +++ protocols/purple/Makefile | 3 +++ protocols/twitter/Makefile | 3 ++- protocols/yahoo/Makefile | 3 +++ 7 files changed, 19 insertions(+), 2 deletions(-) (limited to 'protocols') diff --git a/protocols/Makefile b/protocols/Makefile index 1c7816bc..9e8d3fb9 100644 --- a/protocols/Makefile +++ b/protocols/Makefile @@ -39,6 +39,7 @@ clean: $(subdirs) rm -f *.o $(OUTFILE) core distclean: clean $(subdirs) + rm -rf .depend $(subdirs): @$(MAKE) -C $@ $(MAKECMDGOALS) @@ -54,3 +55,5 @@ $(objects): ../Makefile.settings Makefile $(objects): %.o: $(SRCDIR)%.c @echo '*' Compiling $< @$(CC) -c $(CFLAGS) $< -o $@ + +-include .depend/*.d 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 diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile index 781482f5..068d7e98 100644 --- a/protocols/msn/Makefile +++ b/protocols/msn/Makefile @@ -29,6 +29,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -41,5 +42,5 @@ $(objects): %.o: $(SRCDIR)%.c msn_mod.o: $(objects) @echo '*' Linking msn_mod.o @$(LD) $(LFLAGS) $(objects) -o msn_mod.o - +-include .depend/*.d diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile index c1a966ad..a83830df 100644 --- a/protocols/oscar/Makefile +++ b/protocols/oscar/Makefile @@ -30,6 +30,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,3 +43,5 @@ $(objects): %.o: $(SRCDIR)%.c oscar_mod.o: $(objects) @echo '*' Linking oscar_mod.o @$(LD) $(LFLAGS) $(objects) -o oscar_mod.o + +-include .depend/*.d diff --git a/protocols/purple/Makefile b/protocols/purple/Makefile index 97a5bb6a..62115abf 100644 --- a/protocols/purple/Makefile +++ b/protocols/purple/Makefile @@ -30,6 +30,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,3 +43,5 @@ $(objects): %.o: $(SRCDIR)%.c purple_mod.o: $(objects) @echo '*' Linking purple_mod.o $(LD) $(LFLAGS) $(objects) -o purple_mod.o + +-include .depend/*.d diff --git a/protocols/twitter/Makefile b/protocols/twitter/Makefile index 3fa9b61e..74f0ea11 100644 --- a/protocols/twitter/Makefile +++ b/protocols/twitter/Makefile @@ -29,6 +29,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,4 +43,4 @@ twitter_mod.o: $(objects) @echo '*' Linking twitter_mod.o @$(LD) $(LFLAGS) $(objects) -o twitter_mod.o - +-include .depend/*.d diff --git a/protocols/yahoo/Makefile b/protocols/yahoo/Makefile index a8021ffb..7908b773 100644 --- a/protocols/yahoo/Makefile +++ b/protocols/yahoo/Makefile @@ -30,6 +30,7 @@ clean: rm -f *.o core distclean: clean + rm -rf .depend ### MAIN PROGRAM @@ -42,3 +43,5 @@ $(objects): %.o: $(SRCDIR)%.c yahoo_mod.o: $(objects) @echo '*' Linking yahoo_mod.o @$(LD) $(LFLAGS) $(objects) -o yahoo_mod.o + +-include .depend/*.d -- cgit v1.2.3 From df61c35ad36e18965b3b0fdccf0fa830b0768108 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 30 Aug 2010 21:24:28 +0200 Subject: Warn the user when his/her AIM/ICQ password seems to be too long. For some people with long passwords the removal of old ICQ-only authentication introduced login issues since the extra chars in the password upset the server. --- protocols/oscar/oscar.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'protocols') diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index db6a28f4..9283628a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -516,6 +516,14 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { case 0x05: /* Incorrect nick/password */ imcb_error(ic, _("Incorrect nickname or password.")); + { + int max = od->icq ? 8 : 16; + if (strlen(ic->acc->pass) > max) + imcb_log(ic, "Note that the maximum password " + "length supported by this protocol is " + "%d characters, try logging in using " + "a shorter password.", max); + } // plugin_event(event_error, (void *)980, 0, 0, 0); break; case 0x11: -- cgit v1.2.3 From c55701ecf0b0a9e0c0cb9a4514c90bf426aa5d92 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 30 Aug 2010 21:58:33 +0200 Subject: Due to popular demand, now using mode=chat by default. --- protocols/twitter/twitter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index d5b71bc3..d5127415 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -194,7 +194,7 @@ static void twitter_init( account_t *acc ) s = set_add( &acc->set, "message_length", "140", set_eval_int, acc ); - s = set_add( &acc->set, "mode", "one", set_eval_mode, acc ); + s = set_add( &acc->set, "mode", "chat", set_eval_mode, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; s = set_add( &acc->set, "oauth", def_oauth, set_eval_bool, acc ); -- 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') 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