diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-09-05 13:08:12 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-09-05 13:08:12 +0100 | 
| commit | 975708ae9af7e0b0212e7852bb8d3fc93488ac49 (patch) | |
| tree | 59dab0da8a550f143023805955b1c7ce62caf047 | |
| parent | 4e1be76617060e89795e381d356f81cd2cbf32dc (diff) | |
| parent | ed320e88b1677266f70b8b163c638bebe2a81e0a (diff) | |
Mainline merge.
| -rw-r--r-- | bitlbee.c | 3 | ||||
| -rw-r--r-- | doc/user-guide/commands.xml | 18 | ||||
| -rw-r--r-- | doc/user-guide/misc.xml | 36 | ||||
| -rw-r--r-- | help.c | 5 | ||||
| -rw-r--r-- | irc_im.c | 8 | ||||
| -rw-r--r-- | irc_send.c | 21 | ||||
| -rw-r--r-- | motd.txt | 1 | ||||
| -rw-r--r-- | protocols/jabber/conference.c | 18 | ||||
| -rw-r--r-- | protocols/jabber/jabber.h | 2 | ||||
| -rw-r--r-- | protocols/jabber/message.c | 13 | ||||
| -rw-r--r-- | protocols/oscar/oscar.c | 8 | ||||
| -rw-r--r-- | protocols/oscar/ssi.c | 2 | ||||
| -rw-r--r-- | protocols/twitter/twitter.c | 2 | ||||
| -rw-r--r-- | unix.c | 2 | 
14 files changed, 107 insertions, 32 deletions
| @@ -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/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index a1554645..6adc4001 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -72,7 +72,7 @@  					</para>  					<para> -						By default all your Twitter contacts will come from a contact called twitter_(yourusername). You can change this behaviour using the <emphasis>mode</emphasis> setting (see <emphasis>help set mode</emphasis>). +						By default all your Twitter contacts will appear in a new channel called #twitter_yourusername. You can change this behaviour using the <emphasis>mode</emphasis> setting (see <emphasis>help set mode</emphasis>).  					</para>  					<para> @@ -810,19 +810,23 @@  	<bitlbee-setting name="mode" type="string" scope="account">  		<possible-values>one, many, chat</possible-values> -		<default>one</default> +		<default>chat</default>  		<description>  			<para> -				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. +			</para> + +			<para> +				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).  			</para>  			<para> -				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.  			</para>  			<para> -				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.  			</para>  		</description> @@ -1460,6 +1464,10 @@  			<para>  				Only the <emphasis>group list</emphasis> command is supported at the moment, which shows a list of all groups defined so far.  			</para> +			 +			<para> +				If you want to move contacts between groups, you can use the IRC <emphasis>/invite</emphasis> command. Also, if you use the <emphasis>add</emphasis> command in a control channel configured to show just one group, the new contact will automatically be added to that group. +			</para>  		</description>  	</bitlbee-command> 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  </para>  <para> -If you want to configure your own channels, you can use the <emphasis>channel set</emphasis>. +If you want to configure your own channels, you can use the <emphasis>channel set</emphasis> command. See <emphasis>help channels3</emphasis> for more information. +</para> + +</sect1> + +<sect1 id="channels3"> +<title>Configuring a control channel</title> + +<para> +The most important setting for a control channel is <emphasis>fill_by</emphasis>. 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, <emphasis>account</emphasis>, you +also have to set the <emphasis>account</emphasis> setting. Example: +</para> + +<ircexample> +	<ircline nick="wilmer">chan set &wlm fill_by account</ircline> +	<ircline nick="root">fill_by = `account'</ircline> +	<ircline nick="wilmer">chan set &wlm account msn</ircline> +	<ircline nick="root">account = `msn'</ircline> +</ircexample> + +<para> +Also, each channel has a <emphasis>show_users</emphasis> setting which lets you +choose, for example, if you want to see only online contacts in a channel, or +also/just offline contacts. Example: +</para> + +<ircexample> +	<ircline nick="wilmer">chan set &offline show_users offline</ircline> +	<ircline nick="root">show_users = `offline'</ircline> +</ircexample> + +<para> +See the help information for all these settings for more information.  </para>  </sect1> @@ -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  		{ @@ -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 ); @@ -690,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 ); @@ -795,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;  } @@ -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, ... ) @@ -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/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, '/' ); 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. */ 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: 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/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 ); @@ -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 ) | 
