Changeset 8961950


Ignore:
Timestamp:
2008-02-16T16:25:24Z (17 years ago)
Author:
Sven Moritz Hallberg <sm@…>
Branches:
master
Children:
4eb4c0f
Parents:
903a2fc
Message:

read root's welcome message from a file (like tho MOTD)

Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r903a2fc r8961950  
    8585        mkdir -p $(DESTDIR)$(ETCDIR)
    8686        install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
     87        install -m 0644 welcome.txt $(DESTDIR)$(ETCDIR)/welcome.txt
    8788        install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
    8889
    8990uninstall-etc:
    9091        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
     92        rm -f $(DESTDIR)$(ETCDIR)/welcome.txt
    9193        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
    9294        -rmdir $(DESTDIR)$(ETCDIR)
  • bitlbee.conf

    r903a2fc r8961950  
    7373# MotdFile = /etc/bitlbee/motd.txt
    7474
     75## WelcomeFile
     76##
     77## Specify an alternative file for the welcome message displayed when joining the
     78## control channel. Default value depends on the --etcdir argument to configure.
     79##
     80# WelcomeFile = /etc/bitlbee/welcome.txt
     81
    7582## ConfigDir
    7683##
  • conf.c

    r903a2fc r8961950  
    6161        conf->pidfile = g_strdup( PIDFILE );
    6262        conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
     63        conf->welcomefile = g_strdup( ETCDIR "/welcome.txt" );
    6364        conf->ping_interval = 180;
    6465        conf->ping_timeout = 300;
     
    240241                                g_free( conf->motdfile );
    241242                                conf->motdfile = g_strdup( ini->value );
     243                        }
     244                        else if( g_strcasecmp( ini->key, "welcomefile" ) == 0 )
     245                        {
     246                                g_free( conf->welcomefile );
     247                                conf->welcomefile = g_strdup( ini->value );
    242248                        }
    243249                        else if( g_strcasecmp( ini->key, "account_storage" ) == 0 )
  • conf.h

    r903a2fc r8961950  
    4545        char *pidfile;
    4646        char *motdfile;
     47        char *welcomefile;
    4748        char *primary_storage;
    4849        char **migrate_storage;
  • irc.c

    r903a2fc r8961950  
    3232
    3333static gboolean irc_userping( gpointer _irc, int fd, b_input_condition cond );
     34static void irc_welcome( irc_t *irc );
    3435
    3536GSList *irc_connection_list = NULL;
     
    787788        irc_spawn( irc, u );
    788789       
    789         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." );
    790         #ifdef WITH_OTR
    791         irc_usermsg( irc, "\nOTR users please note: Private key files are owned by the user BitlBee is running as." );
    792         #endif
     790        irc_welcome( irc );
    793791       
    794792        if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )
     
    796794       
    797795        irc->status |= USTATUS_LOGGED_IN;
     796}
     797
     798static void irc_welcome( irc_t *irc )
     799{
     800        FILE *f;
     801       
     802        f = fopen( global.conf->welcomefile, "r" );
     803        if( !f )
     804        {
     805                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." );
     806        }
     807        else
     808        {
     809                char linebuf[380];
     810               
     811                while( fgets( linebuf, 380, f ) )
     812                {
     813                        irc_usermsg( irc, linebuf );
     814                }
     815               
     816                fclose( f );
     817        }
    798818}
    799819
Note: See TracChangeset for help on using the changeset viewer.