mirror of
https://github.com/osmarks/ngircd.git
synced 2025-02-14 16:20:02 +00:00
- MOTD-Datei ist nun konfigurierbar und wird gelesen.
This commit is contained in:
parent
08cf560734
commit
574ae82ca4
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: conf.c,v 1.3 2001/12/26 14:45:37 alex Exp $
|
||||
* $Id: conf.c,v 1.4 2001/12/26 22:48:53 alex Exp $
|
||||
*
|
||||
* conf.h: Konfiguration des ngircd
|
||||
*
|
||||
* $Log: conf.c,v $
|
||||
* Revision 1.4 2001/12/26 22:48:53 alex
|
||||
* - MOTD-Datei ist nun konfigurierbar und wird gelesen.
|
||||
*
|
||||
* Revision 1.3 2001/12/26 14:45:37 alex
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
@ -35,10 +38,23 @@
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
LOCAL VOID Read_Config( VOID );
|
||||
|
||||
|
||||
GLOBAL VOID Conf_Init( VOID )
|
||||
{
|
||||
/* Konfigurationsvariablen initialisieren: zunaechst Default-
|
||||
* Werte setzen, dann Konfigurationsdtaei einlesen. */
|
||||
|
||||
strcpy( Conf_File, "/usr/local/etc/ngircd.conf" );
|
||||
|
||||
Conf_PingTimeout = 120;
|
||||
Conf_PongTimeout = 10;
|
||||
|
||||
strcpy( Conf_MotdFile, "/usr/local/etc/ngircd.motd" );
|
||||
|
||||
/* Konfigurationsdatei einlesen */
|
||||
Read_Config( );
|
||||
} /* Config_Init */
|
||||
|
||||
|
||||
@ -48,4 +64,12 @@ GLOBAL VOID Conf_Exit( VOID )
|
||||
} /* Config_Exit */
|
||||
|
||||
|
||||
LOCAL VOID Read_Config( VOID )
|
||||
{
|
||||
/* Konfigurationsdatei einlesen. */
|
||||
|
||||
/* ... */
|
||||
} /* Read_Config */
|
||||
|
||||
|
||||
/* -eof- */
|
||||
|
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: conf.h,v 1.3 2001/12/26 14:45:37 alex Exp $
|
||||
* $Id: conf.h,v 1.4 2001/12/26 22:48:53 alex Exp $
|
||||
*
|
||||
* conf.h: Konfiguration des ngircd (Header)
|
||||
*
|
||||
* $Log: conf.h,v $
|
||||
* Revision 1.4 2001/12/26 22:48:53 alex
|
||||
* - MOTD-Datei ist nun konfigurierbar und wird gelesen.
|
||||
*
|
||||
* Revision 1.3 2001/12/26 14:45:37 alex
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
@ -29,8 +32,15 @@
|
||||
#define __conf_h__
|
||||
|
||||
|
||||
GLOBAL INT Conf_PingTimeout;
|
||||
GLOBAL INT Conf_PongTimeout;
|
||||
#define FNAME_LEN 256
|
||||
|
||||
|
||||
GLOBAL CHAR Conf_File[FNAME_LEN]; /* Konfigurationsdatei */
|
||||
|
||||
GLOBAL INT Conf_PingTimeout; /* Ping Timeout */
|
||||
GLOBAL INT Conf_PongTimeout; /* Pong Timeout */
|
||||
|
||||
GLOBAL CHAR Conf_MotdFile[FNAME_LEN]; /* Datei mit MOTD-Text */
|
||||
|
||||
|
||||
GLOBAL VOID Conf_Init( VOID );
|
||||
|
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.c,v 1.9 2001/12/26 14:45:37 alex Exp $
|
||||
* $Id: irc.c,v 1.10 2001/12/26 22:48:53 alex Exp $
|
||||
*
|
||||
* irc.c: IRC-Befehle
|
||||
*
|
||||
* $Log: irc.c,v $
|
||||
* Revision 1.10 2001/12/26 22:48:53 alex
|
||||
* - MOTD-Datei ist nun konfigurierbar und wird gelesen.
|
||||
*
|
||||
* Revision 1.9 2001/12/26 14:45:37 alex
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
@ -52,11 +55,13 @@
|
||||
|
||||
#include <imp.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "conf.h"
|
||||
#include "log.h"
|
||||
#include "messages.h"
|
||||
#include "parse.h"
|
||||
@ -279,12 +284,32 @@ LOCAL BOOLEAN Hello_User( CLIENT *Client )
|
||||
|
||||
LOCAL BOOLEAN Show_MOTD( CLIENT *Client )
|
||||
{
|
||||
BOOLEAN ok;
|
||||
CHAR line[127];
|
||||
FILE *fd;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Client->nick[0] );
|
||||
|
||||
fd = fopen( Conf_MotdFile, "r" );
|
||||
if( ! fd )
|
||||
{
|
||||
Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_NOMOTD_MSG, Client->nick );
|
||||
}
|
||||
|
||||
IRC_WriteStrClient( Client, This_Server, RPL_MOTDSTART_MSG, Client->nick, This_Server->host );
|
||||
IRC_WriteStrClient( Client, This_Server, RPL_MOTD_MSG, Client->nick, "Some cool IRC server welcome message ;-)" );
|
||||
return IRC_WriteStrClient( Client, This_Server, RPL_ENDOFMOTD_MSG, Client->nick );
|
||||
while( TRUE )
|
||||
{
|
||||
if( ! fgets( line, 126, fd )) break;
|
||||
if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
|
||||
IRC_WriteStrClient( Client, This_Server, RPL_MOTD_MSG, Client->nick, line );
|
||||
}
|
||||
ok = IRC_WriteStrClient( Client, This_Server, RPL_ENDOFMOTD_MSG, Client->nick );
|
||||
|
||||
fclose( fd );
|
||||
|
||||
return ok;
|
||||
} /* Show_MOTD */
|
||||
|
||||
|
||||
|
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: messages.h,v 1.5 2001/12/26 03:51:13 alex Exp $
|
||||
* $Id: messages.h,v 1.6 2001/12/26 22:48:53 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: messages.h,v $
|
||||
* Revision 1.6 2001/12/26 22:48:53 alex
|
||||
* - MOTD-Datei ist nun konfigurierbar und wird gelesen.
|
||||
*
|
||||
* Revision 1.5 2001/12/26 03:51:13 alex
|
||||
* - in ERR_NOTREGISTERED_MSG fehlte ein "%s" - jetzt steht auch hier der Nick.
|
||||
*
|
||||
@ -66,6 +69,9 @@
|
||||
#define ERR_UNKNOWNCOMMAND "421"
|
||||
#define ERR_UNKNOWNCOMMAND_MSG ERR_UNKNOWNCOMMAND" %s %s :Unknown command"
|
||||
|
||||
#define ERR_NOMOTD "422"
|
||||
#define ERR_NOMOTD_MSG ERR_NOMOTD" %s :MOTD file is missing"
|
||||
|
||||
#define ERR_ERRONEUSNICKNAME "432"
|
||||
#define ERR_ERRONEUSNICKNAME_MSG ERR_ERRONEUSNICKNAME" %s %s :Erroneous nickname"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user