Changeset 8961950 for irc.c


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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.