diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | bitlbee.conf | 7 | ||||
| -rw-r--r-- | conf.c | 6 | ||||
| -rw-r--r-- | conf.h | 1 | ||||
| -rw-r--r-- | irc.c | 28 | ||||
| -rw-r--r-- | welcome.txt | 5 | 
6 files changed, 45 insertions, 4 deletions
| @@ -84,10 +84,12 @@ uninstall-dev:  install-etc:  	mkdir -p $(DESTDIR)$(ETCDIR)  	install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt +	install -m 0644 welcome.txt $(DESTDIR)$(ETCDIR)/welcome.txt  	install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf  uninstall-etc:  	rm -f $(DESTDIR)$(ETCDIR)/motd.txt +	rm -f $(DESTDIR)$(ETCDIR)/welcome.txt  	rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf  	-rmdir $(DESTDIR)$(ETCDIR) diff --git a/bitlbee.conf b/bitlbee.conf index d9f878c8..d2d8b559 100644 --- a/bitlbee.conf +++ b/bitlbee.conf @@ -72,6 +72,13 @@  ##  # MotdFile = /etc/bitlbee/motd.txt +## WelcomeFile +## +## Specify an alternative file for the welcome message displayed when joining the +## control channel. Default value depends on the --etcdir argument to configure. +## +# WelcomeFile = /etc/bitlbee/welcome.txt +  ## ConfigDir  ##  ## Specify an alternative directory to store all the per-user configuration @@ -60,6 +60,7 @@ conf_t *conf_load( int argc, char *argv[] )  	conf->plugindir = g_strdup( PLUGINDIR );  	conf->pidfile = g_strdup( PIDFILE );  	conf->motdfile = g_strdup( ETCDIR "/motd.txt" ); +	conf->welcomefile = g_strdup( ETCDIR "/welcome.txt" );  	conf->ping_interval = 180;  	conf->ping_timeout = 300;  	conf->user = NULL; @@ -240,6 +241,11 @@ static int conf_loadini( conf_t *conf, char *file )  				g_free( conf->motdfile );  				conf->motdfile = g_strdup( ini->value );  			} +			else if( g_strcasecmp( ini->key, "welcomefile" ) == 0 ) +			{ +				g_free( conf->welcomefile ); +				conf->welcomefile = g_strdup( ini->value ); +			}  			else if( g_strcasecmp( ini->key, "account_storage" ) == 0 )  			{  				g_free( conf->primary_storage ); @@ -44,6 +44,7 @@ typedef struct conf  	char *plugindir;  	char *pidfile;  	char *motdfile; +	char *welcomefile;  	char *primary_storage;  	char **migrate_storage;  	int ping_interval; @@ -31,6 +31,7 @@  #include <sys/wait.h>  static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond ); +static void irc_welcome( irc_t *irc );  GSList *irc_connection_list = NULL; @@ -786,10 +787,7 @@ void irc_login( irc_t *irc )  	u->online = 1;  	irc_spawn( irc, u ); -	irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQs are answered there." ); -	#ifdef WITH_OTR -	irc_usermsg( irc, "\nOTR users please note: Private key files are owned by the user BitlBee is running as." ); -	#endif +	irc_welcome( irc );  	if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )  		ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname ); @@ -797,6 +795,28 @@ void irc_login( irc_t *irc )  	irc->status |= USTATUS_LOGGED_IN;  } +static void irc_welcome( irc_t *irc ) +{ +	FILE *f; +	 +	f = fopen( global.conf->welcomefile, "r" ); +	if( !f ) +	{ +		irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQs are answered there.\n\nOTR users please note: Private key files are owned by the user BitlBee is running as." ); +	} +	else +	{ +		char linebuf[380]; +		 +		while( fgets( linebuf, 380, f ) ) +		{ +			irc_usermsg( irc, linebuf ); +		} +		 +		fclose( f ); +	} +} +  void irc_motd( irc_t *irc )  {  	int fd; diff --git a/welcome.txt b/welcome.txt new file mode 100644 index 00000000..3216efc0 --- /dev/null +++ b/welcome.txt @@ -0,0 +1,5 @@ +Welcome to the BitlBee gateway! + +If you've never used BitlBee before, please do read the help information using the help command. Lots of FAQs are answered there. + +OTR users please note: Private key files are owned by the user BitlBee is running as. | 
