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(+) 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. --- doc/user-guide/commands.xml | 14 +++++++++----- protocols/twitter/twitter.c | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index a1554645..609ee6fe 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -72,7 +72,7 @@ - By default all your Twitter contacts will come from a contact called twitter_(yourusername). You can change this behaviour using the mode setting (see help set mode). + By default all your Twitter contacts will appear in a new channel called #twitter_yourusername. You can change this behaviour using the mode setting (see help set mode). @@ -810,19 +810,23 @@ one, many, chat - one + chat - By default, everything from the Twitter module will come from one nick, twitter_(yourusername). If you prefer to have individual nicks for everyone, you can set this setting to "many" instead. + By default, BitlBee will create a separate channel (called #twitter_yourusername) for all your Twitter contacts/messages. + + + + If you don't want an extra channel, you can set this setting to "one" (everything will come from one nick, twitter_yourusername), or to "many" (individual nicks for everyone). - If you prefer to have all your Twitter things in a separate channel, you can set this setting to "chat". + With modes "chat" and "many", you can send direct messages by /msg'ing your contacts directly. Note, however, that incoming DMs are not fetched yet. - In the last two modes, you can send direct messages by /msg'ing your contacts directly. Note, however, that incoming DMs are not fetched yet. + With modes "many" and "one", you can post tweets by /msg'ing the twitter_yourusername contact. In mode "chat", messages posted in the Twitter channel will also be posted as tweets. 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 fda55fa31f4e5bbf040c712c22f744916c01fca1 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 30 Aug 2010 22:12:34 +0200 Subject: Revert to the old control channel messages for fullname changes, the /notices were probably just a bad idea. --- irc_im.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/irc_im.c b/irc_im.c index 6ddcb432..662a5bf2 100644 --- a/irc_im.c +++ b/irc_im.c @@ -251,7 +251,6 @@ static gboolean bee_irc_user_nick_update( irc_user_t *iu ); static gboolean bee_irc_user_fullname( bee_t *bee, bee_user_t *bu ) { irc_user_t *iu = (irc_user_t *) bu->ui_data; - irc_t *irc = (irc_t *) bee->ui_data; char *s; if( iu->fullname != iu->nick ) @@ -265,8 +264,11 @@ static gboolean bee_irc_user_fullname( bee_t *bee, bee_user_t *bu ) if( ( bu->ic->flags & OPT_LOGGED_IN ) && set_getbool( &bee->set, "display_namechanges" ) ) { + /* People don't like this /NOTICE. Meh, let's go back to the old one. char *msg = g_strdup_printf( "<< \002BitlBee\002 - Changed name to `%s' >>", iu->fullname ); irc_send_msg( iu, "NOTICE", irc->user->nick, msg, NULL ); + */ + imcb_log( bu->ic, "User `%s' changed name to `%s'", iu->nick, iu->fullname ); } bee_irc_user_nick_update( iu ); -- 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(-) 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 From 4c737ebd1a0224d325ee0ab6b3b374861c708452 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 2 Sep 2010 00:06:56 +0100 Subject: Fixed NULL ptr dereference when hilighting non-IM users in chatrooms. --- irc_im.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc_im.c b/irc_im.c index 662a5bf2..f6229207 100644 --- a/irc_im.c +++ b/irc_im.c @@ -692,7 +692,7 @@ static gboolean bee_irc_channel_chat_privmsg( irc_channel_t *ic, const char *msg if( ( s = strchr( nick, ':' ) ) || ( s = strchr( nick, ',' ) ) ) { *s = '\0'; - if( ( iu = irc_user_by_name( ic->irc, nick ) ) && + if( ( iu = irc_user_by_name( ic->irc, nick ) ) && iu->bu && iu->bu->nick && irc_channel_has_user( ic, iu ) ) { trans = g_strconcat( iu->bu->nick, msg + ( s - nick ), NULL ); -- cgit v1.2.3 From 52d63dc804571c63069a7c1e42e8c3f1f2a76527 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 5 Sep 2010 00:31:47 +0100 Subject: Slightly better documentation of control channels and groups. --- doc/user-guide/commands.xml | 4 ++++ doc/user-guide/misc.xml | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index 609ee6fe..6adc4001 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1464,6 +1464,10 @@ Only the group list command is supported at the moment, which shows a list of all groups defined so far. + + + If you want to move contacts between groups, you can use the IRC /invite command. Also, if you use the add command in a control channel configured to show just one group, the new contact will automatically be added to that group. + diff --git a/doc/user-guide/misc.xml b/doc/user-guide/misc.xml index dc0ce5ed..979ad026 100644 --- a/doc/user-guide/misc.xml +++ b/doc/user-guide/misc.xml @@ -174,7 +174,41 @@ To start a simple group chat, you simply join a channel which a name starting wi -If you want to configure your own channels, you can use the channel set. +If you want to configure your own channels, you can use the channel set command. See help channels3 for more information. + + + + + +Configuring a control channel + + +The most important setting for a control channel is fill_by. It +tells BitlBee what information should be used to decide if someone should be shown +in the channel or not. After setting this setting to, for example, account, you +also have to set the account setting. Example: + + + + chan set &wlm fill_by account + fill_by = `account' + chan set &wlm account msn + account = `msn' + + + +Also, each channel has a show_users setting which lets you +choose, for example, if you want to see only online contacts in a channel, or +also/just offline contacts. Example: + + + + chan set &offline show_users offline + show_users = `offline' + + + +See the help information for all these settings for more information. -- cgit v1.2.3 From 41e0c00fd22d1cdace2040be5912d64f51f12ab8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 5 Sep 2010 11:27:12 +0100 Subject: Fixing handling of (Jabber) chatroom topic changes done by the user. --- irc_im.c | 2 +- protocols/jabber/conference.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/irc_im.c b/irc_im.c index f6229207..7fa70350 100644 --- a/irc_im.c +++ b/irc_im.c @@ -797,9 +797,9 @@ static gboolean bee_irc_channel_chat_topic( irc_channel_t *ic, const char *new ) char *topic = g_strdup( new ); c->ic->acc->prpl->chat_topic( c, topic ); g_free( topic ); - return TRUE; } + /* Whatever happened, the IM module should ack the topic change. */ return FALSE; } diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index e04b9792..0c2db0b3 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -311,6 +311,15 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud struct jabber_chat *jc = chat ? chat->data : NULL; char *s; + if( subject && chat ) + { + s = bud ? strchr( bud->ext_jid, '/' ) : NULL; + if( s ) *s = 0; + imcb_chat_topic( chat, bud ? bud->ext_jid : NULL, subject->text_len > 0 ? + subject->text : NULL, jabber_get_timestamp( node ) ); + if( s ) *s = '/'; + } + if( bud == NULL || ( jc && ~jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me ) ) { char *nick; @@ -365,15 +374,6 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud now or just wait for the OS to do it. :-) */ return; } - - if( subject ) - { - s = strchr( bud->ext_jid, '/' ); - if( s ) *s = 0; - imcb_chat_topic( chat, bud->ext_jid, subject->text_len > 0 ? - subject->text : NULL, jabber_get_timestamp( node ) ); - if( s ) *s = '/'; - } if( body && body->text_len > 0 ) { s = strchr( bud->ext_jid, '/' ); -- cgit v1.2.3 From fef78131a46462ee1d1457aa690c52a52b23151a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 5 Sep 2010 12:31:22 +0100 Subject: Fix compiler warnings. Also fixing irc_send_motd(), which so far got away with a horrible practice of reading the MOTD file one by one. --- bitlbee.c | 3 ++- help.c | 5 +++-- irc_send.c | 21 ++++++++++++++------- motd.txt | 1 + protocols/oscar/ssi.c | 2 +- unix.c | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/bitlbee.c b/bitlbee.c index ac22932f..d53bfe71 100644 --- a/bitlbee.c +++ b/bitlbee.c @@ -135,7 +135,8 @@ int bitlbee_daemon_init() exit( 0 ); setsid(); - chdir( "/" ); + i = chdir( "/" ); + /* Don't use i, just make gcc happy. :-/ */ if( getenv( "_BITLBEE_RESTART_STATE" ) == NULL ) for( i = 0; i < 3; i ++ ) diff --git a/help.c b/help.c index c43d0459..14156eaf 100644 --- a/help.c +++ b/help.c @@ -156,8 +156,9 @@ char *help_get( help_t **help, char *title ) return NULL; } - lseek( h->fd, h->offset.file_offset, SEEK_SET ); - read( h->fd, s, h->length ); + if( lseek( h->fd, h->offset.file_offset, SEEK_SET ) == -1 || + read( h->fd, s, h->length ) != h->length ) + return NULL; } else { diff --git a/irc_send.c b/irc_send.c index fa4e6815..76b88118 100644 --- a/irc_send.c +++ b/irc_send.c @@ -52,24 +52,27 @@ void irc_send_login( irc_t *irc ) void irc_send_motd( irc_t *irc ) { + char motd[2048]; + size_t len; int fd; fd = open( global.conf->motdfile, O_RDONLY ); - if( fd == -1 ) + if( fd == -1 || ( len = read( fd, motd, sizeof( motd ) - 1 ) ) <= 0 ) { irc_send_num( irc, 422, ":We don't need MOTDs." ); } else { - char linebuf[80]; /* Max. line length for MOTD's is 79 chars. It's what most IRC networks seem to do. */ - char *add, max; - int len; + char linebuf[80]; + char *add, max, *in; + in = motd; + motd[len] = '\0'; linebuf[79] = len = 0; max = sizeof( linebuf ) - 1; irc_send_num( irc, 375, ":- %s Message Of The Day - ", irc->root->host ); - while( read( fd, linebuf + len, 1 ) == 1 ) + while( ( linebuf[len] = *(in++) ) ) { if( linebuf[len] == '\n' || len == max ) { @@ -79,13 +82,15 @@ void irc_send_motd( irc_t *irc ) } else if( linebuf[len] == '%' ) { - read( fd, linebuf + len, 1 ); + linebuf[len] = *(in++); if( linebuf[len] == 'h' ) add = irc->root->host; else if( linebuf[len] == 'v' ) add = BITLBEE_VERSION; else if( linebuf[len] == 'n' ) add = irc->user->nick; + else if( linebuf[len] == '\0' ) + in --; else add = "%"; @@ -98,8 +103,10 @@ void irc_send_motd( irc_t *irc ) } } irc_send_num( irc, 376, ":End of MOTD" ); - close( fd ); } + + if( fd != -1 ) + close( fd ); } void irc_usermsg( irc_t *irc, char *format, ... ) diff --git a/motd.txt b/motd.txt index 9e854d54..a15067ab 100644 --- a/motd.txt +++ b/motd.txt @@ -16,3 +16,4 @@ The developers of the Bee hope you have a buzzing time. * BitlBee development team: wilmer, jelmer, Maurits ... Buzzing, haha, get it? +% \ No newline at end of file diff --git a/protocols/oscar/ssi.c b/protocols/oscar/ssi.c index 76b5b427..f37d98e5 100644 --- a/protocols/oscar/ssi.c +++ b/protocols/oscar/ssi.c @@ -414,7 +414,7 @@ int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn) for (parentgroup=sess->ssi.items; ((parentgroup) && (parentgroup->type!=AIM_SSI_TYPE_GROUP) && (parentgroup->gid==0x0000)); parentgroup=parentgroup->next); if (!parentgroup) { char *newgroup; - newgroup = (char*)g_malloc(strlen("Unknown")*sizeof(char)); + newgroup = (char*)g_malloc(strlen("Unknown")+1); strcpy(newgroup, "Unknown"); aim_ssi_addgroups(sess, conn, &newgroup, 1); } diff --git a/unix.c b/unix.c index c3ecbc99..0d373234 100644 --- a/unix.c +++ b/unix.c @@ -166,7 +166,7 @@ int main( int argc, char *argv[] ) /* Looks like env should *not* be freed here as putenv doesn't make a copy. Odd. */ - chdir( old_cwd ); + i = chdir( old_cwd ); close( global.listen_socket ); if( execv( argv[0], argv ) == -1 ) -- cgit v1.2.3 From ed320e88b1677266f70b8b163c638bebe2a81e0a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 5 Sep 2010 12:48:26 +0100 Subject: Oops. One more compiler warning. I wish GCC would give the same warnings with or without -O2. --- irc_send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc_send.c b/irc_send.c index 76b88118..791ecc75 100644 --- a/irc_send.c +++ b/irc_send.c @@ -64,7 +64,7 @@ void irc_send_motd( irc_t *irc ) else { char linebuf[80]; - char *add, max, *in; + char *add = "", max, *in; in = motd; motd[len] = '\0'; -- cgit v1.2.3