- "Code Cleanups".

This commit is contained in:
Alexander Barton 2001-12-26 14:45:37 +00:00
parent 6cb785e0a7
commit 08cf560734
12 changed files with 136 additions and 83 deletions

View File

@ -9,7 +9,7 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: client.c,v 1.6 2001/12/26 03:19:16 alex Exp $
* $Id: client.c,v 1.7 2001/12/26 14:45:37 alex Exp $
*
* client.c: Management aller Clients
*
@ -21,6 +21,9 @@
* Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
*
* $Log: client.c,v $
* Revision 1.7 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.6 2001/12/26 03:19:16 alex
* - neue Funktion Client_Name().
*
@ -39,7 +42,6 @@
*
* Revision 1.1 2001/12/14 08:13:43 alex
* - neues Modul begonnen :-)
*
*/
@ -51,13 +53,21 @@
#include <unistd.h>
#include <string.h>
#include "channel.h"
#include "conn.h"
#include "log.h"
#include <exp.h>
#include "client.h"
#include <imp.h>
#include "channel.h"
#include "conn.h"
#include "irc.h"
#include "log.h"
#include "messages.h"
#include <exp.h>
GLOBAL CLIENT *My_Clients;
LOCAL CLIENT *New_Client_Struct( VOID );
@ -103,7 +113,7 @@ GLOBAL VOID Client_Exit( VOID )
} /* Client Exit */
GLOBAL CLIENT *Client_New_Local( CONN_ID Idx, CHAR *Hostname )
GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname )
{
/* Neuen lokalen Client erzeugen. */
@ -126,7 +136,7 @@ GLOBAL CLIENT *Client_New_Local( CONN_ID Idx, CHAR *Hostname )
My_Clients = client;
return client;
} /* Client_New_Local */
} /* Client_NewLocal */
GLOBAL VOID Client_Destroy( CLIENT *Client )
@ -182,6 +192,35 @@ GLOBAL CHAR *Client_Name( CLIENT *Client )
} /* Client_Name */
GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick )
{
/* Nick ueberpruefen */
CLIENT *c;
assert( Client != NULL );
assert( Nick != NULL );
/* Nick zu lang? */
if( strlen( Nick ) > CLIENT_NICK_LEN ) return IRC_WriteStrClient( Client, This_Server, ERR_ERRONEUSNICKNAME_MSG, Client_Name( Client ), Nick );
/* Nick bereits vergeben? */
c = My_Clients;
while( c )
{
if( strcasecmp( c->nick, Nick ) == 0 )
{
/* den Nick gibt es bereits */
IRC_WriteStrClient( Client, This_Server, ERR_NICKNAMEINUSE_MSG, Client_Name( Client ), Nick );
return FALSE;
}
c = c->next;
}
return TRUE;
} /* Client_CheckNick */
LOCAL CLIENT *New_Client_Struct( VOID )
{
/* Neue CLIENT-Struktur pre-initialisieren */

View File

@ -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: client.h,v 1.4 2001/12/26 03:19:16 alex Exp $
* $Id: client.h,v 1.5 2001/12/26 14:45:37 alex Exp $
*
* client.h: Konfiguration des ngircd (Header)
*
* $Log: client.h,v $
* Revision 1.5 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.4 2001/12/26 03:19:16 alex
* - neue Funktion Client_Name().
*
@ -58,10 +61,6 @@ typedef enum
} CLIENT_TYPE;
/* Das Verfahren, mit dem neue Client-Verbindungen beim Server registriert
* werden, ist in RFC 2812, Abschnitt 3.1 ff. definiert. */
typedef struct _CLIENT
{
POINTER *next; /* Zeiger auf naechste Client-Struktur */
@ -78,16 +77,16 @@ typedef struct _CLIENT
GLOBAL CLIENT *This_Server;
GLOBAL CLIENT *My_Clients;
GLOBAL VOID Client_Init( VOID );
GLOBAL VOID Client_Exit( VOID );
GLOBAL CLIENT *Client_New_Local( CONN_ID Idx, CHAR *Hostname );
GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname );
GLOBAL VOID Client_Destroy( CLIENT *Client );
GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx );
GLOBAL CHAR *Client_Name( CLIENT *Client );
GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick );
#endif

View File

@ -9,17 +9,19 @@
* 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.2 2001/12/26 03:19:57 alex Exp $
* $Id: conf.c,v 1.3 2001/12/26 14:45:37 alex Exp $
*
* conf.h: Konfiguration des ngircd
*
* $Log: conf.c,v $
* Revision 1.3 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.2 2001/12/26 03:19:57 alex
* - erste Konfigurations-Variablen definiert: PING/PONG-Timeout.
*
* Revision 1.1 2001/12/12 17:18:20 alex
* - Modul fuer Server-Konfiguration begonnen.
*
*/
@ -35,8 +37,8 @@
GLOBAL VOID Conf_Init( VOID )
{
Conf_PING_Timeout = 120;
Conf_PONG_Timeout = 10;
Conf_PingTimeout = 120;
Conf_PongTimeout = 10;
} /* Config_Init */

View File

@ -9,17 +9,19 @@
* 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.2 2001/12/26 03:19:57 alex Exp $
* $Id: conf.h,v 1.3 2001/12/26 14:45:37 alex Exp $
*
* conf.h: Konfiguration des ngircd (Header)
*
* $Log: conf.h,v $
* Revision 1.3 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.2 2001/12/26 03:19:57 alex
* - erste Konfigurations-Variablen definiert: PING/PONG-Timeout.
*
* Revision 1.1 2001/12/12 17:18:20 alex
* - Modul fuer Server-Konfiguration begonnen.
*
*/
@ -27,8 +29,8 @@
#define __conf_h__
GLOBAL INT Conf_PING_Timeout;
GLOBAL INT Conf_PONG_Timeout;
GLOBAL INT Conf_PingTimeout;
GLOBAL INT Conf_PongTimeout;
GLOBAL VOID Conf_Init( VOID );

View File

@ -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: conn.c,v 1.13 2001/12/26 03:36:57 alex Exp $
* $Id: conn.c,v 1.14 2001/12/26 14:45:37 alex Exp $
*
* connect.h: Verwaltung aller Netz-Verbindungen ("connections")
*
* $Log: conn.c,v $
* Revision 1.14 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.13 2001/12/26 03:36:57 alex
* - Verbindungen mit Lesefehlern werden nun korrekt terminiert.
*
@ -181,7 +184,7 @@ GLOBAL VOID Conn_Exit( VOID )
} /* Conn_Exit */
GLOBAL BOOLEAN Conn_New_Listener( CONST INT Port )
GLOBAL BOOLEAN Conn_NewListener( CONST INT Port )
{
/* Neuen Listen-Socket erzeugen: der Server wartet dann
* auf dem angegebenen Port auf Verbindungen. */
@ -241,7 +244,7 @@ GLOBAL BOOLEAN Conn_New_Listener( CONST INT Port )
Log( LOG_INFO, "Now listening on port %d, socket %d.", Port, sock );
return TRUE;
} /* Conn_New_Listener */
} /* Conn_NewListener */
GLOBAL VOID Conn_Handler( INT Timeout )
@ -510,7 +513,7 @@ LOCAL VOID New_Connection( INT Sock )
}
/* Client-Struktur initialisieren */
if( ! Client_New_Local( idx, inet_ntoa( new_addr.sin_addr )))
if( ! Client_NewLocal( idx, inet_ntoa( new_addr.sin_addr )))
{
Log( LOG_ALERT, "Can't accept connection: can't create client structure!" );
close( new_sock );
@ -654,14 +657,14 @@ LOCAL VOID Check_Connections( VOID )
if( My_Connections[i].lastping > My_Connections[i].lastdata )
{
/* es wurde bereits ein PING gesendet */
if( My_Connections[i].lastping < time( NULL ) - Conf_PONG_Timeout )
if( My_Connections[i].lastping < time( NULL ) - Conf_PongTimeout )
{
/* Timeout */
Log( LOG_NOTICE, "Connection %d: Ping timeout." );
Conn_Close( i, "Ping timeout" );
}
}
else if( My_Connections[i].lastdata < time( NULL ) - Conf_PING_Timeout )
else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout )
{
/* es muss ein PING gesendet werden */
Log( LOG_DEBUG, "Connection %d: sending PING ...", i );

View File

@ -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: conn.h,v 1.6 2001/12/25 22:03:47 alex Exp $
* $Id: conn.h,v 1.7 2001/12/26 14:45:37 alex Exp $
*
* conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
*
* $Log: conn.h,v $
* Revision 1.7 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.6 2001/12/25 22:03:47 alex
* - Conn_Close() eingefuehrt: war die lokale Funktion Close_Connection().
*
@ -44,7 +47,7 @@ typedef INT CONN_ID;
GLOBAL VOID Conn_Init( VOID );
GLOBAL VOID Conn_Exit( VOID );
GLOBAL BOOLEAN Conn_New_Listener( CONST INT Port );
GLOBAL BOOLEAN Conn_NewListener( CONST INT Port );
GLOBAL VOID Conn_Handler( INT Timeout );

View File

@ -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.8 2001/12/26 03:21:46 alex Exp $
* $Id: irc.c,v 1.9 2001/12/26 14:45:37 alex Exp $
*
* irc.c: IRC-Befehle
*
* $Log: irc.c,v $
* Revision 1.9 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.8 2001/12/26 03:21:46 alex
* - PING/PONG-Befehle implementiert,
* - Meldungen ueberarbeitet: enthalten nun (fast) immer den Nick.
@ -82,7 +85,7 @@ GLOBAL VOID IRC_Exit( VOID )
} /* IRC_Exit */
GLOBAL BOOLEAN IRC_WriteStr_Client( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )
GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )
{
/* Text an Clients, lokal bzw. remote, senden. */
@ -105,12 +108,12 @@ GLOBAL BOOLEAN IRC_WriteStr_Client( CLIENT *Client, CLIENT *Prefix, CHAR *Format
else
{
/* Remote-Client */
Log( LOG_EMERG, "not implemented: IRC_WriteStr_Client()" );
Log( LOG_EMERG, "not implemented: IRC_WriteStrClient()" );
}
va_end( ap );
return ok;
} /* IRC_WriteStr_Client */
} /* IRC_WriteStrClient */
GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req )
@ -121,38 +124,24 @@ GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req )
if( Client->type == CLIENT_UNKNOWN )
{
Log( LOG_DEBUG, "Connection %d: got PASS command ...", Client->conn_id );
return IRC_WriteStr_Client( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( Client ), Req->command );
return IRC_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( Client ), Req->command );
}
else return IRC_WriteStr_Client( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
} /* IRC_PASS */
GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
{
CLIENT *c;
assert( Client != NULL );
assert( Req != NULL );
if( Client->type != CLIENT_SERVER && Client->type != CLIENT_SERVICE )
{
/* Falsche Anzahl Parameter? */
if( Req->argc != 1 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
/* Nick zu lang? */
if( strlen( Req->argv[0] ) > CLIENT_NICK_LEN ) return IRC_WriteStr_Client( Client, This_Server, ERR_ERRONEUSNICKNAME_MSG, Client_Name( Client ), Req->argv[0] );
if( Req->argc != 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
/* pruefen, ob Nick bereits vergeben */
c = My_Clients;
while( c )
{
if( strcasecmp( c->nick, Req->argv[0] ) == 0 )
{
/* den Nick gibt es bereits */
return IRC_WriteStr_Client( Client, This_Server, ERR_NICKNAMEINUSE_MSG, Client_Name( Client ), Req->argv[0] );
}
c = c->next;
}
if( ! Client_CheckNick( Client, Req->argv[0] )) return CONNECTED;
/* Client-Nick registrieren */
strcpy( Client->nick, Req->argv[0] );
@ -166,7 +155,7 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
}
return CONNECTED;
}
else return IRC_WriteStr_Client( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
} /* IRC_NICK */
@ -178,7 +167,7 @@ GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req )
if( Client->type == CLIENT_UNKNOWN || Client->type == CLIENT_GOTNICK || Client->type == CLIENT_GOTPASS )
{
/* Falsche Anzahl Parameter? */
if( Req->argc != 4 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
if( Req->argc != 4 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
strncpy( Client->user, Req->argv[0], CLIENT_USER_LEN );
Client->user[CLIENT_USER_LEN] = '\0';
@ -192,9 +181,9 @@ GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req )
}
else if( Client->type == CLIENT_USER || Client->type == CLIENT_SERVER || Client->type == CLIENT_SERVICE )
{
return IRC_WriteStr_Client( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
}
else return IRC_WriteStr_Client( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
else return IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
} /* IRC_USER */
@ -206,12 +195,12 @@ GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req )
if( Client->type != CLIENT_SERVER && Client->type != CLIENT_SERVICE )
{
/* Falsche Anzahl Parameter? */
if( Req->argc > 1 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
Conn_Close( Client->conn_id, "Client wants to quit." );
return DISCONNECTED;
}
else return IRC_WriteStr_Client( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
else return IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
} /* IRC_QUIT */
@ -220,7 +209,7 @@ GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
assert( Client != NULL );
assert( Req != NULL );
return IRC_WriteStr_Client( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( Client ), Req->command );
return IRC_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( Client ), Req->command );
} /* IRC_PING */
@ -232,8 +221,8 @@ GLOBAL BOOLEAN IRC_PONG( CLIENT *Client, REQUEST *Req )
if( ! Check_Valid_User( Client )) return CONNECTED;
/* Falsche Anzahl Parameter? */
if( Req->argc < 1 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NOORIGIN_MSG, Client_Name( Client ));
if( Req->argc > 1 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOORIGIN_MSG, Client_Name( Client ));
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
/* Der Connection-Timestamp wurde schon beim Lesen aus dem Socket
* aktualisiert, daher muss das hier nicht mehr gemacht werden. */
@ -251,7 +240,7 @@ GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req )
if( ! Check_Valid_User( Client )) return CONNECTED;
/* Falsche Anzahl Parameter? */
if( Req->argc != 0 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
return Show_MOTD( Client );
} /* IRC_MOTD */
@ -263,7 +252,7 @@ LOCAL BOOLEAN Check_Valid_User( CLIENT *Client )
if( Client->type != CLIENT_USER )
{
IRC_WriteStr_Client( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
return FALSE;
}
else return TRUE;
@ -277,10 +266,10 @@ LOCAL BOOLEAN Hello_User( CLIENT *Client )
Log( LOG_NOTICE, "User \"%s!%s@%s\" (%s) registered.", Client->nick, Client->user, Client->host, Client->name );
IRC_WriteStr_Client( Client, This_Server, RPL_WELCOME_MSG, Client->nick, Client->nick, Client->user, Client->host );
IRC_WriteStr_Client( Client, This_Server, RPL_YOURHOST_MSG, Client->nick, This_Server->host );
IRC_WriteStr_Client( Client, This_Server, RPL_CREATED_MSG, Client->nick );
IRC_WriteStr_Client( Client, This_Server, RPL_MYINFO_MSG, Client->nick, This_Server->host );
IRC_WriteStrClient( Client, This_Server, RPL_WELCOME_MSG, Client->nick, Client->nick, Client->user, Client->host );
IRC_WriteStrClient( Client, This_Server, RPL_YOURHOST_MSG, Client->nick, This_Server->host );
IRC_WriteStrClient( Client, This_Server, RPL_CREATED_MSG, Client->nick );
IRC_WriteStrClient( Client, This_Server, RPL_MYINFO_MSG, Client->nick, This_Server->host );
Client->type = CLIENT_USER;
@ -293,9 +282,9 @@ LOCAL BOOLEAN Show_MOTD( CLIENT *Client )
assert( Client != NULL );
assert( Client->nick[0] );
IRC_WriteStr_Client( Client, This_Server, RPL_MOTDSTART_MSG, Client->nick, This_Server->host );
IRC_WriteStr_Client( Client, This_Server, RPL_MOTD_MSG, Client->nick, "Some cool IRC server welcome message ;-)" );
return IRC_WriteStr_Client( Client, This_Server, RPL_ENDOFMOTD_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 );
} /* Show_MOTD */

View File

@ -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.h,v 1.5 2001/12/26 03:21:46 alex Exp $
* $Id: irc.h,v 1.6 2001/12/26 14:45:37 alex Exp $
*
* irc.h: IRC-Befehle (Header)
*
* $Log: irc.h,v $
* Revision 1.6 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.5 2001/12/26 03:21:46 alex
* - PING/PONG-Befehle implementiert,
* - Meldungen ueberarbeitet: enthalten nun (fast) immer den Nick.
@ -43,7 +46,7 @@
GLOBAL VOID IRC_Init( VOID );
GLOBAL VOID IRC_Exit( VOID );
GLOBAL BOOLEAN IRC_WriteStr_Client( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... );
GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req );
GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req );

View File

@ -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: ngircd.c,v 1.10 2001/12/24 01:34:38 alex Exp $
* $Id: ngircd.c,v 1.11 2001/12/26 14:45:37 alex Exp $
*
* ngircd.c: Hier beginnt alles ;-)
*
* $Log: ngircd.c,v $
* Revision 1.11 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.10 2001/12/24 01:34:38 alex
* - Signal-Handler aufgeraeumt; u.a. SIGPIPE wird nun korrekt ignoriert.
*
@ -96,10 +99,11 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] )
Client_Init( );
Conn_Init( );
/* Signal-Handler initialisieren */
Initialize_Signal_Handler( );
if( ! Conn_New_Listener( 6668 )) exit( 1 );
if( ! Conn_New_Listener( 6669 )) Log( LOG_WARNING, "Can't create second listening socket!" );
if( ! Conn_NewListener( 6668 )) exit( 1 );
if( ! Conn_NewListener( 6669 )) Log( LOG_WARNING, "Can't create second listening socket!" );
/* Hauptschleife */
while( ! NGIRCd_Quit )
@ -122,7 +126,8 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] )
LOCAL VOID Initialize_Signal_Handler( VOID )
{
/* Signal-Handler initialisieren: Strukturen anlegen und einhaengen :-) */
/* Signal-Handler initialisieren: einige Signale
* werden ignoriert, andere speziell behandelt. */
struct sigaction saction;

View File

@ -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: parse.c,v 1.5 2001/12/26 03:23:03 alex Exp $
* $Id: parse.c,v 1.6 2001/12/26 14:45:37 alex Exp $
*
* parse.c: Parsen der Client-Anfragen
*
* $Log: parse.c,v $
* Revision 1.6 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.5 2001/12/26 03:23:03 alex
* - PING/PONG-Befehle implementiert.
*
@ -227,7 +230,7 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
else if( strcasecmp( Req->command, "MOTD" ) == 0 ) return IRC_MOTD( client, Req );
/* Unbekannter Befehl */
IRC_WriteStr_Client( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( client ), Req->command );
IRC_WriteStrClient( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( client ), Req->command );
Log( LOG_DEBUG, "Connection %d: Unknown command '%s', %d %s,%s prefix.", Idx, Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );

View File

@ -9,14 +9,16 @@
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
*
* $Id: parse.h,v 1.1 2001/12/21 23:53:16 alex Exp $
* $Id: parse.h,v 1.2 2001/12/26 14:45:37 alex Exp $
*
* parse.h: Parsen der Client-Anfragen (Header)
*
* $Log: parse.h,v $
* Revision 1.2 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.1 2001/12/21 23:53:16 alex
* - Modul zum Parsen von Client-Requests begonnen.
*
*/

View File

@ -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: tool.h,v 1.2 2001/12/12 17:20:33 alex Exp $
* $Id: tool.h,v 1.3 2001/12/26 14:45:37 alex Exp $
*
* log.h: Hilfsfunktionen (Header)
*
* $Log: tool.h,v $
* Revision 1.3 2001/12/26 14:45:37 alex
* - "Code Cleanups".
*
* Revision 1.2 2001/12/12 17:20:33 alex
* - Tool-Funktionen haben nun das Praefix "ngt_".
*
@ -26,7 +29,7 @@
#define __tool_h__
GLOBAL VOID ngt_Trim_Str( CHAR *String );
GLOBAL VOID ngt_TrimStr( CHAR *String );
#endif