mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
- viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
- neuen Header "defines.h" mit (fast) allen Konstanten. - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
This commit is contained in:
parent
9856253dc4
commit
804b1ec498
@ -1,6 +1,11 @@
|
||||
# $Id: Makefile.am,v 1.8 2001/12/30 19:25:03 alex Exp $
|
||||
# $Id: Makefile.am,v 1.9 2001/12/31 02:18:51 alex Exp $
|
||||
|
||||
# $Log: Makefile.am,v $
|
||||
# Revision 1.9 2001/12/31 02:18:51 alex
|
||||
# - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
# - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
# - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
#
|
||||
# Revision 1.8 2001/12/30 19:25:03 alex
|
||||
# - in "noinst_HEADERS" waren einige Dateien als .c anstelle .h aufgefuehrt.
|
||||
#
|
||||
@ -27,9 +32,11 @@
|
||||
|
||||
sbin_PROGRAMS = ngircd
|
||||
|
||||
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c irc.c log.c parse.c tool.c
|
||||
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c irc.c log.c \
|
||||
parse.c tool.c
|
||||
|
||||
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h irc.h log.h parse.h tool.h global.h messages.h
|
||||
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h irc.h log.h \
|
||||
parse.h tool.h global.h messages.h defines.h
|
||||
|
||||
maintainer-clean-local:
|
||||
rm -f Makefile Makefile.in
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: channel.c,v 1.1 2001/12/14 08:13:43 alex Exp $
|
||||
* $Id: channel.c,v 1.2 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* channel.c: Management der Channels
|
||||
*
|
||||
* $Log: channel.c,v $
|
||||
* Revision 1.2 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.1 2001/12/14 08:13:43 alex
|
||||
* - neues Modul begonnen :-)
|
||||
*
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: channel.h,v 1.2 2001/12/23 21:54:30 alex Exp $
|
||||
* $Id: channel.h,v 1.3 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* channel.h: Management der Channels (Header)
|
||||
*
|
||||
* $Log: channel.h,v $
|
||||
* Revision 1.3 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.2 2001/12/23 21:54:30 alex
|
||||
* - Konstanten um Prefix "CHANNEL_" erweitert.
|
||||
*
|
||||
@ -27,12 +32,9 @@
|
||||
#define __channel_h__
|
||||
|
||||
|
||||
#define CHANNEL_NAME_LEN 50 /* vgl. RFC 2812, 1.3 */
|
||||
|
||||
|
||||
typedef struct _CHANNEL
|
||||
{
|
||||
CHAR name[CHANNEL_NAME_LEN + 1]; /* Name */
|
||||
CHAR name[CHANNEL_NAME_LEN]; /* Name */
|
||||
} CHANNEL;
|
||||
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: client.c,v 1.13 2001/12/30 19:26:11 alex Exp $
|
||||
* $Id: client.c,v 1.14 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* client.c: Management aller Clients
|
||||
*
|
||||
@ -21,6 +21,11 @@
|
||||
* Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
|
||||
*
|
||||
* $Log: client.c,v $
|
||||
* Revision 1.14 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.13 2001/12/30 19:26:11 alex
|
||||
* - Unterstuetzung fuer die Konfigurationsdatei eingebaut.
|
||||
*
|
||||
@ -43,7 +48,7 @@
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
* Revision 1.6 2001/12/26 03:19:16 alex
|
||||
* - neue Funktion Client_Name().
|
||||
* - neue Funktion Client_Nick().
|
||||
*
|
||||
* Revision 1.5 2001/12/25 22:04:26 alex
|
||||
* - Aenderungen an den Debug- und Logging-Funktionen.
|
||||
@ -117,6 +122,7 @@ GLOBAL VOID Client_Init( VOID )
|
||||
if( h ) strcpy( This_Server->host, h->h_name );
|
||||
|
||||
strcpy( This_Server->nick, Conf_ServerName );
|
||||
strcpy( This_Server->info, Conf_ServerInfo );
|
||||
|
||||
My_Clients = This_Server;
|
||||
} /* Client_Init */
|
||||
@ -201,13 +207,13 @@ GLOBAL VOID Client_SetHostname( CLIENT *Client, CHAR *Hostname )
|
||||
|
||||
assert( Client != NULL );
|
||||
strncpy( Client->host, Hostname, CLIENT_HOST_LEN );
|
||||
Client->host[CLIENT_HOST_LEN] = '\0';
|
||||
Client->host[CLIENT_HOST_LEN - 1] = '\0';
|
||||
} /* Client_SetHostname */
|
||||
|
||||
|
||||
GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx )
|
||||
{
|
||||
/* Client-Struktur, die zur lokalen Verbindung Idx gehoert
|
||||
/* Client-Struktur, die zur lokalen Verbindung Idx gehoert,
|
||||
* liefern. Wird keine gefunden, so wird NULL geliefert. */
|
||||
|
||||
CLIENT *c;
|
||||
@ -224,7 +230,26 @@ GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx )
|
||||
} /* Client_GetFromConn */
|
||||
|
||||
|
||||
GLOBAL CHAR *Client_Name( CLIENT *Client )
|
||||
GLOBAL CLIENT *Client_GetFromNick( CHAR *Nick )
|
||||
{
|
||||
/* Client-Struktur, die den entsprechenden Nick hat,
|
||||
* liefern. Wird keine gefunden, so wird NULL geliefert. */
|
||||
|
||||
CLIENT *c;
|
||||
|
||||
assert( Nick != NULL );
|
||||
|
||||
c = My_Clients;
|
||||
while( c )
|
||||
{
|
||||
if( strcasecmp( c->nick, Nick ) == 0 ) return c;
|
||||
c = c->next;
|
||||
}
|
||||
return NULL;
|
||||
} /* Client_GetFromNick */
|
||||
|
||||
|
||||
GLOBAL CHAR *Client_Nick( CLIENT *Client )
|
||||
{
|
||||
assert( Client != NULL );
|
||||
|
||||
@ -243,7 +268,7 @@ GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick )
|
||||
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 );
|
||||
if( strlen( Nick ) > CLIENT_NICK_LEN ) return IRC_WriteStrClient( Client, This_Server, ERR_ERRONEUSNICKNAME_MSG, Client_Nick( Client ), Nick );
|
||||
|
||||
/* Nick bereits vergeben? */
|
||||
c = My_Clients;
|
||||
@ -252,7 +277,7 @@ GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick )
|
||||
if( strcasecmp( c->nick, Nick ) == 0 )
|
||||
{
|
||||
/* den Nick gibt es bereits */
|
||||
IRC_WriteStrClient( Client, This_Server, ERR_NICKNAMEINUSE_MSG, Client_Name( Client ), Nick );
|
||||
IRC_WriteStrClient( Client, This_Server, ERR_NICKNAMEINUSE_MSG, Client_Nick( Client ), Nick );
|
||||
return FALSE;
|
||||
}
|
||||
c = c->next;
|
||||
@ -318,8 +343,10 @@ LOCAL CLIENT *New_Client_Struct( VOID )
|
||||
strcpy( c->host, "" );
|
||||
strcpy( c->user, "" );
|
||||
strcpy( c->name, "" );
|
||||
strcpy( c->info, "" );
|
||||
for( i = 0; i < MAX_CHANNELS; c->channels[i++] = NULL );
|
||||
strcpy( c->modes, "" );
|
||||
c->oper_by_me = FALSE;
|
||||
|
||||
return c;
|
||||
} /* New_Client */
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: client.h,v 1.9 2001/12/29 20:18:18 alex Exp $
|
||||
* $Id: client.h,v 1.10 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* client.h: Konfiguration des ngircd (Header)
|
||||
*
|
||||
* $Log: client.h,v $
|
||||
* Revision 1.10 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.9 2001/12/29 20:18:18 alex
|
||||
* - neue Funktion Client_SetHostname().
|
||||
*
|
||||
@ -30,7 +35,7 @@
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
* Revision 1.4 2001/12/26 03:19:16 alex
|
||||
* - neue Funktion Client_Name().
|
||||
* - neue Funktion Client_Nick().
|
||||
*
|
||||
* Revision 1.3 2001/12/25 19:21:26 alex
|
||||
* - Client-Typ ("Status") besser unterteilt, My_Clients ist zudem nun global.
|
||||
@ -51,17 +56,6 @@
|
||||
#include "conn.h"
|
||||
|
||||
|
||||
#define CLIENT_ID_LEN 63 /* max. ID-Laenge; vgl. RFC 2812, 1.1 und 1.2.1 */
|
||||
#define CLIENT_NICK_LEN 9 /* max. Nick-Laenge; vgl. RFC 2812, 1.2.1 */
|
||||
#define CLIENT_PASS_LEN 9 /* max. Laenge des Passwortes */
|
||||
#define CLIENT_USER_LEN 8 /* max. Laenge des Benutzernamen ("Login") */
|
||||
#define CLIENT_NAME_LEN 32 /* max. Laenge des "langen Benutzernamen" */
|
||||
#define CLIENT_HOST_LEN 63 /* max. Laenge des Hostname */
|
||||
#define CLIENT_MODE_LEN 16 /* max. Laenge der Client-Modes */
|
||||
|
||||
#define MAX_CHANNELS 32 /* max. Anzahl Channels pro Nick */
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CLIENT_UNKNOWN, /* Verbindung mit (noch) unbekanntem Typ */
|
||||
@ -80,13 +74,15 @@ typedef struct _CLIENT
|
||||
CLIENT_TYPE type; /* Typ des Client, vgl. CLIENT_TYPE */
|
||||
CONN_ID conn_id; /* ID der Connection (wenn lokal) bzw. NONE (remote) */
|
||||
struct _CLIENT *introducer; /* ID des Servers, der die Verbindung hat */
|
||||
CHAR nick[CLIENT_ID_LEN + 1]; /* Nick (bzw. Server-ID, daher auch IDLEN!) */
|
||||
CHAR pass[CLIENT_PASS_LEN + 1]; /* Passwort, welches der Client angegeben hat */
|
||||
CHAR host[CLIENT_HOST_LEN + 1]; /* Hostname des Client */
|
||||
CHAR user[CLIENT_USER_LEN + 1]; /* Benutzername ("Login") */
|
||||
CHAR name[CLIENT_NAME_LEN + 1]; /* Langer Benutzername */
|
||||
CHAR nick[CLIENT_ID_LEN]; /* Nick (bzw. Server-ID, daher auch IDLEN!) */
|
||||
CHAR pass[CLIENT_PASS_LEN]; /* Passwort, welches der Client angegeben hat */
|
||||
CHAR host[CLIENT_HOST_LEN]; /* Hostname des Client */
|
||||
CHAR user[CLIENT_USER_LEN]; /* Benutzername ("Login") */
|
||||
CHAR name[CLIENT_NAME_LEN]; /* Langer Benutzername */
|
||||
CHAR info[CLIENT_INFO_LEN]; /* Infotext (Server) */
|
||||
CHANNEL *channels[MAX_CHANNELS];/* IDs der Channel, bzw. NULL */
|
||||
CHAR modes[CLIENT_MODE_LEN]; /* Client Modes */
|
||||
BOOLEAN oper_by_me; /* Operator-Status durch diesen Server? */
|
||||
} CLIENT;
|
||||
|
||||
|
||||
@ -100,7 +96,8 @@ GLOBAL CLIENT *Client_NewLocal( CONN_ID Idx, CHAR *Hostname );
|
||||
GLOBAL VOID Client_Destroy( CLIENT *Client );
|
||||
GLOBAL VOID Client_SetHostname( CLIENT *Client, CHAR *Hostname );
|
||||
GLOBAL CLIENT *Client_GetFromConn( CONN_ID Idx );
|
||||
GLOBAL CHAR *Client_Name( CLIENT *Client );
|
||||
GLOBAL CLIENT *Client_GetFromNick( CHAR *Nick );
|
||||
GLOBAL CHAR *Client_Nick( CLIENT *Client );
|
||||
GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick );
|
||||
GLOBAL CHAR *Client_GetID( CLIENT *Client );
|
||||
GLOBAL CLIENT *Client_Search( CHAR *ID );
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: conf.c,v 1.5 2001/12/30 19:26:11 alex Exp $
|
||||
* $Id: conf.c,v 1.6 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* conf.h: Konfiguration des ngircd
|
||||
*
|
||||
* $Log: conf.c,v $
|
||||
* Revision 1.6 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.5 2001/12/30 19:26:11 alex
|
||||
* - Unterstuetzung fuer die Konfigurationsdatei eingebaut.
|
||||
*
|
||||
@ -48,9 +53,6 @@
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
#define MAX_LINE_LEN 246 /* max. Laenge einer Konfigurationszeile */
|
||||
|
||||
|
||||
LOCAL VOID Read_Config( VOID );
|
||||
LOCAL VOID Validate_Config( VOID );
|
||||
|
||||
@ -63,6 +65,10 @@ GLOBAL VOID Conf_Init( VOID )
|
||||
strcpy( Conf_File, "/usr/local/etc/ngircd.conf" );
|
||||
|
||||
strcpy( Conf_ServerName, "" );
|
||||
strcpy( Conf_ServerInfo, PACKAGE" "VERSION );
|
||||
|
||||
strcpy( Conf_Oper, "" );
|
||||
strcpy( Conf_OperPwd, "" );
|
||||
|
||||
strcpy( Conf_MotdFile, "/usr/local/etc/ngircd.motd" );
|
||||
|
||||
@ -87,7 +93,7 @@ LOCAL VOID Read_Config( VOID )
|
||||
{
|
||||
/* Konfigurationsdatei einlesen. */
|
||||
|
||||
CHAR str[MAX_LINE_LEN], *var, *arg, *ptr;
|
||||
CHAR str[LINE_LEN], *var, *arg, *ptr;
|
||||
BOOLEAN ok;
|
||||
INT32 port;
|
||||
INT line;
|
||||
@ -105,15 +111,15 @@ LOCAL VOID Read_Config( VOID )
|
||||
line = 0;
|
||||
while( TRUE )
|
||||
{
|
||||
if( ! fgets( str, MAX_LINE_LEN, fd )) break;
|
||||
ok = FALSE;
|
||||
|
||||
if( ! fgets( str, LINE_LEN, fd )) break;
|
||||
ngt_TrimStr( str );
|
||||
line++;
|
||||
|
||||
/* Kommentarzeilen und leere Zeilen ueberspringen */
|
||||
if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
|
||||
|
||||
ok = FALSE;
|
||||
|
||||
ptr = strchr( str, '=' );
|
||||
if( ! ptr )
|
||||
{
|
||||
@ -129,7 +135,28 @@ LOCAL VOID Read_Config( VOID )
|
||||
{
|
||||
/* Der Server-Name */
|
||||
strncpy( Conf_ServerName, arg, CLIENT_ID_LEN );
|
||||
Conf_ServerName[CLIENT_ID_LEN] = '\0';
|
||||
Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
|
||||
ok = TRUE;
|
||||
}
|
||||
else if( strcasecmp( str, "ServerInfo" ) == 0 )
|
||||
{
|
||||
/* Server-Info-Text */
|
||||
strncpy( Conf_ServerInfo, arg, CLIENT_INFO_LEN );
|
||||
Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
|
||||
ok = TRUE;
|
||||
}
|
||||
else if( strcasecmp( str, "Operator" ) == 0 )
|
||||
{
|
||||
/* Name des IRC Operator */
|
||||
strncpy( Conf_Oper, arg, CLIENT_PASS_LEN );
|
||||
Conf_Oper[CLIENT_PASS_LEN - 1] = '\0';
|
||||
ok = TRUE;
|
||||
}
|
||||
else if( strcasecmp( str, "OperatorPwd" ) == 0 )
|
||||
{
|
||||
/* Passwort des IRC Operator */
|
||||
strncpy( Conf_OperPwd, arg, CLIENT_PASS_LEN );
|
||||
Conf_OperPwd[CLIENT_PASS_LEN - 1] = '\0';
|
||||
ok = TRUE;
|
||||
}
|
||||
else if( strcasecmp( str, "ListenPorts" ) == 0 )
|
||||
@ -152,7 +179,7 @@ LOCAL VOID Read_Config( VOID )
|
||||
{
|
||||
/* Datei mit der "message of the day" (MOTD) */
|
||||
strncpy( Conf_MotdFile, arg, FNAME_LEN );
|
||||
Conf_MotdFile[FNAME_LEN] = '\0';
|
||||
Conf_MotdFile[FNAME_LEN - 1] = '\0';
|
||||
ok = TRUE;
|
||||
}
|
||||
else if( strcasecmp( str, "PingTimeout" ) == 0 )
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: conf.h,v 1.5 2001/12/30 19:26:11 alex Exp $
|
||||
* $Id: conf.h,v 1.6 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* conf.h: Konfiguration des ngircd (Header)
|
||||
*
|
||||
* $Log: conf.h,v $
|
||||
* Revision 1.6 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.5 2001/12/30 19:26:11 alex
|
||||
* - Unterstuetzung fuer die Konfigurationsdatei eingebaut.
|
||||
*
|
||||
@ -35,19 +40,19 @@
|
||||
#define __conf_h__
|
||||
|
||||
|
||||
#define FNAME_LEN 256
|
||||
#define LISTEN_PORTS 16
|
||||
|
||||
|
||||
GLOBAL CHAR Conf_File[FNAME_LEN]; /* Konfigurationsdatei */
|
||||
|
||||
GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN]; /* Name ("Nick") des Servers */
|
||||
GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN]; /* Servers-Info-Text */
|
||||
|
||||
GLOBAL CHAR Conf_MotdFile[FNAME_LEN]; /* Datei mit MOTD-Text */
|
||||
|
||||
GLOBAL INT Conf_ListenPorts[LISTEN_PORTS]; /* Ports, auf denen der Server Verbindungen */
|
||||
GLOBAL INT Conf_ListenPorts_Count; /* entgegen nimmt sowie deren Anzahl */
|
||||
|
||||
GLOBAL CHAR Conf_Oper[CLIENT_PASS_LEN]; /* Operator Name */
|
||||
GLOBAL CHAR Conf_OperPwd[CLIENT_PASS_LEN]; /* Operator Passwort */
|
||||
|
||||
GLOBAL INT Conf_PingTimeout; /* Ping Timeout */
|
||||
GLOBAL INT Conf_PongTimeout; /* Pong Timeout */
|
||||
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: conn.c,v 1.22 2001/12/30 19:26:11 alex Exp $
|
||||
* $Id: conn.c,v 1.23 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* connect.h: Verwaltung aller Netz-Verbindungen ("connections")
|
||||
*
|
||||
* $Log: conn.c,v $
|
||||
* Revision 1.23 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.22 2001/12/30 19:26:11 alex
|
||||
* - Unterstuetzung fuer die Konfigurationsdatei eingebaut.
|
||||
*
|
||||
@ -126,16 +131,6 @@
|
||||
#include "conn.h"
|
||||
|
||||
|
||||
#define MAX_CONNECTIONS 100 /* max. Anzahl von Verbindungen an diesem Server */
|
||||
|
||||
#define MAX_CMDLEN 512 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */
|
||||
|
||||
#define READBUFFER_LEN 2 * MAX_CMDLEN /* Laenge des Lesepuffers je Verbindung (Bytes) */
|
||||
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
|
||||
|
||||
#define HOST_LEN 256 /* max. Laenge eines Hostnamen */
|
||||
|
||||
|
||||
typedef struct _Res_Stat
|
||||
{
|
||||
INT pid; /* PID des Child-Prozess */
|
||||
@ -149,12 +144,13 @@ typedef struct _Connection
|
||||
struct sockaddr_in addr; /* Adresse des Client */
|
||||
RES_STAT *res_stat; /* "Resolver-Status", s.o. */
|
||||
CHAR host[HOST_LEN]; /* Hostname */
|
||||
CHAR rbuf[READBUFFER_LEN + 1]; /* Lesepuffer */
|
||||
CHAR rbuf[READBUFFER_LEN]; /* Lesepuffer */
|
||||
INT rdatalen; /* Laenge der Daten im Lesepuffer */
|
||||
CHAR wbuf[WRITEBUFFER_LEN + 1]; /* Schreibpuffer */
|
||||
CHAR wbuf[WRITEBUFFER_LEN]; /* Schreibpuffer */
|
||||
INT wdatalen; /* Laenge der Daten im Schreibpuffer */
|
||||
time_t lastdata; /* Letzte Aktivitaet */
|
||||
time_t lastping; /* Letzter PING */
|
||||
time_t lastprivmsg; /* Letzte PRIVMSG */
|
||||
} CONNECTION;
|
||||
|
||||
|
||||
@ -391,12 +387,12 @@ GLOBAL BOOLEAN Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... )
|
||||
* automatisch angehaengt. Im Fehlerfall wird dir Verbindung
|
||||
* getrennt und FALSE geliefert. */
|
||||
|
||||
CHAR buffer[MAX_CMDLEN];
|
||||
CHAR buffer[COMMAND_LEN];
|
||||
BOOLEAN ok;
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, Format );
|
||||
if( vsnprintf( buffer, MAX_CMDLEN - 2, Format, ap ) == MAX_CMDLEN - 2 )
|
||||
if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) == COMMAND_LEN - 2 )
|
||||
{
|
||||
Log( LOG_ALERT, "String too long to send (connection %d)!", Idx );
|
||||
Conn_Close( Idx, "Server error: String too long to send!" );
|
||||
@ -491,6 +487,24 @@ GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *Msg )
|
||||
} /* Conn_Close */
|
||||
|
||||
|
||||
GLOBAL VOID Conn_UpdateIdle( CONN_ID Idx )
|
||||
{
|
||||
/* Idle-Timer zuruecksetzen */
|
||||
|
||||
assert( Idx >= 0 );
|
||||
My_Connections[Idx].lastprivmsg = time( NULL );
|
||||
}
|
||||
|
||||
|
||||
GLOBAL INT32 Conn_GetIdle( CONN_ID Idx )
|
||||
{
|
||||
/* Idle-Time einer Verbindung liefern (in Sekunden) */
|
||||
|
||||
assert( Idx >= 0 );
|
||||
return time( NULL ) - My_Connections[Idx].lastprivmsg;
|
||||
} /* Conn_GetIdle */
|
||||
|
||||
|
||||
LOCAL BOOLEAN Try_Write( CONN_ID Idx )
|
||||
{
|
||||
/* Versuchen, Daten aus dem Schreib-Puffer in den
|
||||
@ -670,8 +684,8 @@ LOCAL VOID Read_Request( CONN_ID Idx )
|
||||
assert( Idx >= 0 );
|
||||
assert( My_Connections[Idx].sock >= 0 );
|
||||
|
||||
len = recv( My_Connections[Idx].sock, My_Connections[Idx].rbuf + My_Connections[Idx].rdatalen, READBUFFER_LEN - My_Connections[Idx].rdatalen, 0 );
|
||||
My_Connections[Idx].rbuf[READBUFFER_LEN] = '\0';
|
||||
len = recv( My_Connections[Idx].sock, My_Connections[Idx].rbuf + My_Connections[Idx].rdatalen, READBUFFER_LEN - My_Connections[Idx].rdatalen - 1, 0 );
|
||||
My_Connections[Idx].rbuf[READBUFFER_LEN - 1] = '\0';
|
||||
|
||||
if( len == 0 )
|
||||
{
|
||||
@ -694,7 +708,7 @@ LOCAL VOID Read_Request( CONN_ID Idx )
|
||||
assert( My_Connections[Idx].rdatalen <= READBUFFER_LEN );
|
||||
My_Connections[Idx].rbuf[My_Connections[Idx].rdatalen] = '\0';
|
||||
|
||||
if( My_Connections[Idx].rdatalen > MAX_CMDLEN )
|
||||
if( My_Connections[Idx].rdatalen > COMMAND_LEN )
|
||||
{
|
||||
/* Eine Anfrage darf(!) nicht laenger als 512 Zeichen
|
||||
* (incl. CR+LF!) werden; vgl. RFC 2812. Wenn soetwas
|
||||
@ -800,6 +814,7 @@ LOCAL VOID Init_Conn_Struct( INT Idx )
|
||||
My_Connections[Idx].wdatalen = 0;
|
||||
My_Connections[Idx].lastdata = time( NULL );
|
||||
My_Connections[Idx].lastping = 0;
|
||||
My_Connections[Idx].lastprivmsg = time( NULL );
|
||||
} /* Init_Conn_Struct */
|
||||
|
||||
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: conn.h,v 1.7 2001/12/26 14:45:37 alex Exp $
|
||||
* $Id: conn.h,v 1.8 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
|
||||
*
|
||||
* $Log: conn.h,v $
|
||||
* Revision 1.8 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.7 2001/12/26 14:45:37 alex
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
@ -56,6 +61,9 @@ GLOBAL BOOLEAN Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... );
|
||||
|
||||
GLOBAL VOID Conn_Close( CONN_ID Idx, CHAR *Msg );
|
||||
|
||||
GLOBAL VOID Conn_UpdateIdle( CONN_ID Idx );
|
||||
GLOBAL INT32 Conn_GetIdle( CONN_ID Idx );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
61
src/ngircd/defines.h
Normal file
61
src/ngircd/defines.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* ngIRCd -- The Next Generation IRC Daemon
|
||||
* Copyright (c)2001 by Alexander Barton (alex@barton.de)
|
||||
*
|
||||
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: defines.h,v 1.1 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* defines.h: (globale) Konstanten
|
||||
*
|
||||
* $Log: defines.h,v $
|
||||
* Revision 1.1 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __defines_h__
|
||||
#define __defines_h__
|
||||
|
||||
|
||||
#define NONE -1
|
||||
|
||||
#define FNAME_LEN 256 /* max. Laenge eines Dateinamen */
|
||||
|
||||
#define LISTEN_PORTS 16 /* max. Anzahl von Listen-Ports */
|
||||
|
||||
#define LINE_LEN 256 /* max. Laenge einer Konfigurationszeile */
|
||||
|
||||
#define HOST_LEN 256 /* max. Laenge eines Hostnamen */
|
||||
|
||||
#define MAX_CONNECTIONS 100 /* max. Anzahl von Verbindungen an diesem Server */
|
||||
|
||||
#define MAX_CHANNELS 32 /* max. Anzahl Channels pro Nick */
|
||||
|
||||
#define CLIENT_ID_LEN 64 /* max. ID-Laenge; vgl. RFC 2812, 1.1 und 1.2.1 */
|
||||
#define CLIENT_NICK_LEN 10 /* max. Nick-Laenge; vgl. RFC 2812, 1.2.1 */
|
||||
#define CLIENT_PASS_LEN 9 /* max. Laenge des Passwortes */
|
||||
#define CLIENT_USER_LEN 9 /* max. Laenge des Benutzernamen ("Login") */
|
||||
#define CLIENT_NAME_LEN 32 /* max. Laenge des "langen Benutzernamen" */
|
||||
#define CLIENT_HOST_LEN 64 /* max. Laenge des Hostname */
|
||||
#define CLIENT_MODE_LEN 8 /* max. Laenge der Client-Modes */
|
||||
#define CLIENT_INFO_LEN 64 /* max. Infotext-Laenge (Server) */
|
||||
|
||||
#define COMMAND_LEN 513 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */
|
||||
|
||||
#define CHANNEL_NAME_LEN 51 /* max. Laenge eines Channel-Namens, vgl. RFC 2812, 1.3 */
|
||||
|
||||
#define READBUFFER_LEN 2 * COMMAND_LEN /* Laenge des Lesepuffers je Verbindung (Bytes) */
|
||||
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* -eof- */
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: global.h,v 1.3 2001/12/14 08:14:34 alex Exp $
|
||||
* $Id: global.h,v 1.4 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* global.h: Globaler Header, wir in jedes(!) Modul eingebunden.
|
||||
*
|
||||
* $Log: global.h,v $
|
||||
* Revision 1.4 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.3 2001/12/14 08:14:34 alex
|
||||
* - NONE als -1 definiert. Macht den Source lesbarer ;-)
|
||||
*
|
||||
@ -30,15 +35,13 @@
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "defines.h"
|
||||
|
||||
#ifndef HAVE_socklen_t
|
||||
#define socklen_t int /* u.a. fuer Mac OS X */
|
||||
#endif
|
||||
|
||||
|
||||
#define NONE -1
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
265
src/ngircd/irc.c
265
src/ngircd/irc.c
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.c,v 1.15 2001/12/30 19:26:11 alex Exp $
|
||||
* $Id: irc.c,v 1.16 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* irc.c: IRC-Befehle
|
||||
*
|
||||
* $Log: irc.c,v $
|
||||
* Revision 1.16 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.15 2001/12/30 19:26:11 alex
|
||||
* - Unterstuetzung fuer die Konfigurationsdatei eingebaut.
|
||||
*
|
||||
@ -79,9 +84,11 @@
|
||||
#include "ngircd.h"
|
||||
#include "client.h"
|
||||
#include "conf.h"
|
||||
#include "conn.h"
|
||||
#include "log.h"
|
||||
#include "messages.h"
|
||||
#include "parse.h"
|
||||
#include "tool.h"
|
||||
|
||||
#include <exp.h>
|
||||
#include "irc.h"
|
||||
@ -161,9 +168,9 @@ 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_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( Client ), Req->command );
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Nick( Client ), Req->command );
|
||||
}
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Nick( Client ));
|
||||
} /* IRC_PASS */
|
||||
|
||||
|
||||
@ -180,10 +187,10 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
|
||||
#endif
|
||||
{
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc != 1 ) return IRC_WriteStrClient( 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_Nick( Client ), Req->command );
|
||||
|
||||
/* Ist der Client "restricted"? */
|
||||
if( strchr( Client->modes, 'r' )) return IRC_WriteStrClient( Client, This_Server, ERR_RESTRICTED_MSG, Client_Name( Client ));
|
||||
if( strchr( Client->modes, 'r' )) return IRC_WriteStrClient( Client, This_Server, ERR_RESTRICTED_MSG, Client_Nick( Client ));
|
||||
|
||||
/* Wenn der Client zu seinem eigenen Nick wechseln will, so machen
|
||||
* wir nichts. So macht es das Original und mind. Snak hat probleme,
|
||||
@ -214,7 +221,7 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
|
||||
}
|
||||
return CONNECTED;
|
||||
}
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Nick( Client ));
|
||||
} /* IRC_NICK */
|
||||
|
||||
|
||||
@ -230,12 +237,12 @@ GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req )
|
||||
#endif
|
||||
{
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc != 4 ) return IRC_WriteStrClient( 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_Nick( Client ), Req->command );
|
||||
|
||||
strncpy( Client->user, Req->argv[0], CLIENT_USER_LEN );
|
||||
Client->user[CLIENT_USER_LEN] = '\0';
|
||||
Client->user[CLIENT_USER_LEN - 1] = '\0';
|
||||
strncpy( Client->name, Req->argv[3], CLIENT_NAME_LEN );
|
||||
Client->name[CLIENT_NAME_LEN] = '\0';
|
||||
Client->name[CLIENT_NAME_LEN - 1] = '\0';
|
||||
|
||||
Log( LOG_DEBUG, "Connection %d: got USER command ...", Client->conn_id );
|
||||
if( Client->type == CLIENT_GOTNICK ) return Hello_User( Client );
|
||||
@ -244,9 +251,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_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Name( Client ));
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_ALREADYREGISTRED_MSG, Client_Nick( Client ));
|
||||
}
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Nick( Client ));
|
||||
} /* IRC_USER */
|
||||
|
||||
|
||||
@ -258,12 +265,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_WriteStrClient( 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_Nick( Client ), Req->command );
|
||||
|
||||
Conn_Close( Client->conn_id, "Client wants to quit." );
|
||||
return DISCONNECTED;
|
||||
}
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Nick( Client ));
|
||||
} /* IRC_QUIT */
|
||||
|
||||
|
||||
@ -277,13 +284,13 @@ GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
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 );
|
||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOORIGIN_MSG, Client_Nick( Client ));
|
||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
to = Client_Search( Req->argv[0] );
|
||||
|
||||
if( to ) return IRC_WriteStrClient( Client, This_Server, "PONG :%s", Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Name( Client ), Req->argv[0] );
|
||||
if( to ) return IRC_WriteStrClient( Client, This_Server, "PONG :%s", Client_Nick( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Nick( Client ), Req->argv[0] );
|
||||
} /* IRC_PING */
|
||||
|
||||
|
||||
@ -295,8 +302,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_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 );
|
||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOORIGIN_MSG, Client_Nick( Client ));
|
||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
/* Der Connection-Timestamp wurde schon beim Lesen aus dem Socket
|
||||
* aktualisiert, daher muss das hier nicht mehr gemacht werden. */
|
||||
@ -314,7 +321,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_WriteStrClient( 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_Nick( Client ), Req->command );
|
||||
|
||||
return Show_MOTD( Client );
|
||||
} /* IRC_MOTD */
|
||||
@ -330,18 +337,19 @@ GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc == 0 ) return IRC_WriteStrClient( Client, This_Server, ERR_NORECIPIENT_MSG, Client_Name( Client ), Req->command );
|
||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOTEXTTOSEND_MSG, Client_Name( Client ));
|
||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
|
||||
if( Req->argc == 0 ) return IRC_WriteStrClient( Client, This_Server, ERR_NORECIPIENT_MSG, Client_Nick( Client ), Req->command );
|
||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOTEXTTOSEND_MSG, Client_Nick( Client ));
|
||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
to = Client_Search( Req->argv[0] );
|
||||
if( to )
|
||||
{
|
||||
/* Okay, Ziel ist ein User */
|
||||
if( Client->conn_id >= 0 ) Conn_UpdateIdle( Client->conn_id );
|
||||
return IRC_WriteStrClient( to, Client, "PRIVMSG %s :%s", to->nick, Req->argv[1] );
|
||||
}
|
||||
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Name( Client ), Req->argv[0] );
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Nick( Client ), Req->argv[0] );
|
||||
} /* IRC_PRIVMSG */
|
||||
|
||||
|
||||
@ -379,20 +387,20 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if(( Req->argc > 2 ) || ( Req->argc < 1 )) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
|
||||
if(( Req->argc > 2 ) || ( Req->argc < 1 )) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
/* MODE ist nur fuer sich selber zulaessig */
|
||||
if( Client_Search( Req->argv[0] ) != Client ) return IRC_WriteStrClient( Client, This_Server, ERR_USERSDONTMATCH_MSG, Client_Name( Client ));
|
||||
if( Client_Search( Req->argv[0] ) != Client ) return IRC_WriteStrClient( Client, This_Server, ERR_USERSDONTMATCH_MSG, Client_Nick( Client ));
|
||||
|
||||
/* Werden die Modes erfragt? */
|
||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, This_Server, RPL_UMODEIS_MSG, Client_Name( Client ), Client->modes );
|
||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, This_Server, RPL_UMODEIS_MSG, Client_Nick( Client ), Client->modes );
|
||||
|
||||
ptr = Req->argv[1];
|
||||
|
||||
/* Sollen Modes gesetzt oder geloescht werden? */
|
||||
if( *ptr == '+' ) set = TRUE;
|
||||
else if( *ptr == '-' ) set = FALSE;
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_UMODEUNKNOWNFLAG_MSG, Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_UMODEUNKNOWNFLAG_MSG, Client_Nick( Client ));
|
||||
|
||||
/* Reply-String mit Aenderungen vorbereiten */
|
||||
if( set ) strcpy( new_modes, "+" );
|
||||
@ -413,10 +421,19 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
|
||||
case 'r':
|
||||
/* restricted (kann nur gesetzt werden) */
|
||||
if( set ) x[0] = 'r';
|
||||
else ok = IRC_WriteStrClient( Client, This_Server, ERR_RESTRICTED_MSG, Client_Name( Client ));
|
||||
else ok = IRC_WriteStrClient( Client, This_Server, ERR_RESTRICTED_MSG, Client_Nick( Client ));
|
||||
break;
|
||||
case 'o':
|
||||
/* operator (kann nur geloescht werden) */
|
||||
if( ! set )
|
||||
{
|
||||
Client->oper_by_me = FALSE;
|
||||
x[0] = 'o';
|
||||
}
|
||||
else ok = IRC_WriteStrClient( Client, This_Server, ERR_UMODEUNKNOWNFLAG_MSG, Client_Nick( Client ));
|
||||
break;
|
||||
default:
|
||||
ok = IRC_WriteStrClient( Client, This_Server, ERR_UMODEUNKNOWNFLAG_MSG, Client_Name( Client ));
|
||||
ok = IRC_WriteStrClient( Client, This_Server, ERR_UMODEUNKNOWNFLAG_MSG, Client_Nick( Client ));
|
||||
x[0] = '\0';
|
||||
}
|
||||
if( ! ok ) break;
|
||||
@ -462,13 +479,197 @@ GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req )
|
||||
} /* IRC_MODE */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_OPER( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
/* Ist ueberhaupt ein Operator gesetzt? */
|
||||
if(( ! Conf_Oper[0] ) || ( ! Conf_OperPwd[0] )) return IRC_WriteStrClient( Client, This_Server, ERR_PASSWDMISMATCH_MSG, Client_Nick( Client ));
|
||||
|
||||
/* Stimmt der Name und das Passwort? */
|
||||
if(( strcmp( Conf_Oper, Req->argv[0] ) != 0 ) || ( strcmp( Conf_OperPwd, Req->argv[1] ) != 0 )) return IRC_WriteStrClient( Client, This_Server, ERR_PASSWDMISMATCH_MSG, Client_Nick( Client ));
|
||||
|
||||
if( ! strchr( Client->modes, 'o' ))
|
||||
{
|
||||
/* noch kein o-Mode gesetzt */
|
||||
strcat( Client->modes, "o" );
|
||||
if( ! IRC_WriteStrRelated( Client, "MODE %s :+o", Client->nick )) return DISCONNECTED;
|
||||
}
|
||||
|
||||
if( ! Client->oper_by_me ) Log( LOG_NOTICE, "User \"%s!%s@%s\" is now an IRC Operator.", Client->nick, Client->user, Client->host );
|
||||
|
||||
Client->oper_by_me = TRUE;
|
||||
return IRC_WriteStrClient( Client, This_Server, RPL_YOUREOPER_MSG, Client_Nick( Client ));
|
||||
} /* IRC_OPER */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_DIE( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
if(( ! strchr( Client->modes, 'o' )) || ( ! Client->oper_by_me )) return IRC_WriteStrClient( Client, This_Server, ERR_NOPRIVILEGES_MSG, Client_Nick( Client ));
|
||||
|
||||
Log( LOG_NOTICE, "Got DIE command from \"%s!%s@%s\", going down!", Client->nick, Client->user, Client->host );
|
||||
NGIRCd_Quit = TRUE;
|
||||
return CONNECTED;
|
||||
} /* IRC_DIE */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_RESTART( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
if(( ! strchr( Client->modes, 'o' )) || ( ! Client->oper_by_me )) return IRC_WriteStrClient( Client, This_Server, ERR_NOPRIVILEGES_MSG, Client_Nick( Client ));
|
||||
|
||||
Log( LOG_NOTICE, "Got RESTART command from \"%s!%s@%s\", going down!", Client->nick, Client->user, Client->host );
|
||||
NGIRCd_Restart = TRUE;
|
||||
return CONNECTED;
|
||||
} /* IRC_RESTART */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CHAR rpl[COMMAND_LEN];
|
||||
CLIENT *c;
|
||||
CHAR *ptr;
|
||||
INT i;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
strcpy( rpl, RPL_ISON_MSG );
|
||||
for( i = 0; i < Req->argc; i++ )
|
||||
{
|
||||
ptr = strtok( Req->argv[i], " " );
|
||||
while( ptr )
|
||||
{
|
||||
ngt_TrimStr( ptr );
|
||||
c = Client_GetFromNick( ptr );
|
||||
if( c && ( c->type == CLIENT_USER ))
|
||||
{
|
||||
/* Dieser Nick ist "online" */
|
||||
strcat( rpl, ptr );
|
||||
strcat( rpl, " " );
|
||||
}
|
||||
ptr = strtok( NULL, " " );
|
||||
}
|
||||
}
|
||||
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
|
||||
|
||||
return IRC_WriteStrClient( Client, This_Server, rpl, Client->nick );
|
||||
} /* IRC_ISON */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CLIENT *c;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
/* Client suchen */
|
||||
c = Client_GetFromNick( Req->argv[0] );
|
||||
if(( ! c ) || ( c->type != CLIENT_USER )) return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Nick( Client ), Req->argv[0] );
|
||||
|
||||
/* Nick, User und Name */
|
||||
if( ! IRC_WriteStrClient( Client, This_Server, RPL_WHOISUSER_MSG, Client_Nick( Client ), c->nick, c->user, c->host, c->name )) return DISCONNECTED;
|
||||
|
||||
/* Server */
|
||||
if( ! IRC_WriteStrClient( Client, This_Server, RPL_WHOISSERVER_MSG, Client_Nick( Client ), c->nick, c->introducer->nick, c->introducer->info )) return DISCONNECTED;
|
||||
|
||||
/* IRC-Operator? */
|
||||
if( strchr( c->modes, 'o' ))
|
||||
{
|
||||
if( ! IRC_WriteStrClient( Client, This_Server, RPL_WHOISOPERATOR_MSG, Client_Nick( Client ), c->nick )) return DISCONNECTED;
|
||||
}
|
||||
|
||||
/* Idle (nur lokale Clients) */
|
||||
if( c->conn_id >= 0 )
|
||||
{
|
||||
if( ! IRC_WriteStrClient( Client, This_Server, RPL_WHOISIDLE_MSG, Client_Nick( Client ), c->nick, Conn_GetIdle( c->conn_id ))) return DISCONNECTED;
|
||||
}
|
||||
|
||||
/* End of Whois */
|
||||
return IRC_WriteStrClient( Client, This_Server, RPL_ENDOFWHOIS_MSG, Client_Nick( Client ), c->nick );
|
||||
} /* IRC_WHOIS */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CHAR rpl[COMMAND_LEN];
|
||||
CLIENT *c;
|
||||
INT max, i;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
if( Req->argc > 5 ) max = 5;
|
||||
else max = Req->argc;
|
||||
|
||||
strcpy( rpl, RPL_USERHOST_MSG );
|
||||
for( i = 0; i < max; i++ )
|
||||
{
|
||||
c = Client_GetFromNick( Req->argv[i] );
|
||||
if( c && ( c->type == CLIENT_USER ))
|
||||
{
|
||||
/* Dieser Nick ist "online" */
|
||||
strcat( rpl, c->nick );
|
||||
if( strchr( c->modes, 'o' )) strcat( rpl, "*" );
|
||||
strcat( rpl, "=" );
|
||||
if( strchr( c->modes, 'a' )) strcat( rpl, "-" );
|
||||
else strcat( rpl, "+" );
|
||||
strcat( rpl, c->user );
|
||||
strcat( rpl, "@" );
|
||||
strcat( rpl, c->host );
|
||||
strcat( rpl, " " );
|
||||
}
|
||||
}
|
||||
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
|
||||
|
||||
return IRC_WriteStrClient( Client, This_Server, rpl, Client->nick );
|
||||
} /* IRC_USERHOST */
|
||||
|
||||
|
||||
LOCAL BOOLEAN Check_Valid_User( CLIENT *Client )
|
||||
{
|
||||
assert( Client != NULL );
|
||||
|
||||
if( Client->type != CLIENT_USER )
|
||||
{
|
||||
IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Name( Client ));
|
||||
IRC_WriteStrClient( Client, This_Server, ERR_NOTREGISTERED_MSG, Client_Nick( Client ));
|
||||
return FALSE;
|
||||
}
|
||||
else return TRUE;
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.h,v 1.9 2001/12/29 03:09:31 alex Exp $
|
||||
* $Id: irc.h,v 1.10 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: irc.h,v $
|
||||
* Revision 1.10 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.9 2001/12/29 03:09:31 alex
|
||||
* - Neue Funktion IRC_MODE() implementiert.
|
||||
*
|
||||
@ -72,6 +77,14 @@ GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_OPER( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_DIE( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_RESTART( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: log.c,v 1.12 2001/12/29 20:16:31 alex Exp $
|
||||
* $Id: log.c,v 1.13 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* log.c: Logging-Funktionen
|
||||
*
|
||||
* $Log: log.c,v $
|
||||
* Revision 1.13 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.12 2001/12/29 20:16:31 alex
|
||||
* - Log-Funktionen fuer Resolver-Sub-Prozess implementiert.
|
||||
*
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: log.h,v 1.5 2001/12/29 20:16:31 alex Exp $
|
||||
* $Id: log.h,v 1.6 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* log.h: Logging-Funktionen (Header)
|
||||
*
|
||||
* $Log: log.h,v $
|
||||
* Revision 1.6 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.5 2001/12/29 20:16:31 alex
|
||||
* - Log-Funktionen fuer Resolver-Sub-Prozess implementiert.
|
||||
*
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: messages.h,v 1.11 2001/12/30 19:25:39 alex Exp $
|
||||
* $Id: messages.h,v 1.12 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: messages.h,v $
|
||||
* Revision 1.12 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.11 2001/12/30 19:25:39 alex
|
||||
* - RPL_MYINFO_MSG um unterstuetzte User-Modes ergaengz.
|
||||
*
|
||||
@ -80,6 +85,33 @@
|
||||
#define RPL_UMODEIS "211"
|
||||
#define RPL_UMODEIS_MSG RPL_UMODEIS" %s +%s"
|
||||
|
||||
#define RPL_USERHOST "302"
|
||||
#define RPL_USERHOST_MSG RPL_USERHOST" %s :"
|
||||
|
||||
#define RPL_ISON "303"
|
||||
#define RPL_ISON_MSG RPL_ISON" %s :"
|
||||
|
||||
#define RPL_WHOISUSER "311"
|
||||
#define RPL_WHOISUSER_MSG RPL_WHOISUSER" %s %s %s %s * :%s"
|
||||
|
||||
#define RPL_WHOISSERVER "312"
|
||||
#define RPL_WHOISSERVER_MSG RPL_WHOISSERVER" %s %s %s :%s"
|
||||
|
||||
#define RPL_WHOISOPERATOR "313"
|
||||
#define RPL_WHOISOPERATOR_MSG RPL_WHOISOPERATOR" %s %s :is an IRC operator"
|
||||
|
||||
#define RPL_WHOISIDLE "317"
|
||||
#define RPL_WHOISIDLE_MSG RPL_WHOISIDLE" %s %s %ld :seconds idle"
|
||||
|
||||
#define RPL_ENDOFWHOIS "318"
|
||||
#define RPL_ENDOFWHOIS_MSG RPL_ENDOFWHOIS" %s %s :End of WHOIS list"
|
||||
|
||||
#define RPL_WHOISCHANNELS "319"
|
||||
#define RPL_WHOISCHANNELS_MSG RPL_WHOISCHANNELS" %s :"
|
||||
|
||||
#define RPL_YOUREOPER "381"
|
||||
#define RPL_YOUREOPER_MSG RPL_YOUREOPER" %s :You are now an IRC Operator"
|
||||
|
||||
|
||||
#define ERR_NOSUCHNICK "401"
|
||||
#define ERR_NOSUCHNICK_MSG ERR_NOSUCHNICK" %s %s :No such nick or channel name"
|
||||
@ -111,12 +143,21 @@
|
||||
#define ERR_ALREADYREGISTRED "462"
|
||||
#define ERR_ALREADYREGISTRED_MSG ERR_ALREADYREGISTRED" %s :Connection already registered"
|
||||
|
||||
#define ERR_PASSWDMISMATCH "464"
|
||||
#define ERR_PASSWDMISMATCH_MSG ERR_PASSWDMISMATCH" %s: Invalid password"
|
||||
|
||||
#define ERR_NOTREGISTERED "451"
|
||||
#define ERR_NOTREGISTERED_MSG ERR_NOTREGISTERED" %s :Connection not registered"
|
||||
|
||||
#define ERR_NOPRIVILEGES "481"
|
||||
#define ERR_NOPRIVILEGES_MSG ERR_NOPRIVILEGES" %s :Permission denied"
|
||||
|
||||
#define ERR_RESTRICTED "484"
|
||||
#define ERR_RESTRICTED_MSG ERR_RESTRICTED" %s :Your connection is restricted"
|
||||
|
||||
#define ERR_NOOPERHOST "491"
|
||||
#define ERR_NOOPERHOST_MSG ERR_NOOPERHOST" %s :Not configured for your host"
|
||||
|
||||
#define ERR_UMODEUNKNOWNFLAG "501"
|
||||
#define ERR_UMODEUNKNOWNFLAG_MSG ERR_UMODEUNKNOWNFLAG" %s :Unknown mode flag"
|
||||
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: ngircd.c,v 1.14 2001/12/30 19:26:12 alex Exp $
|
||||
* $Id: ngircd.c,v 1.15 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* ngircd.c: Hier beginnt alles ;-)
|
||||
*
|
||||
* $Log: ngircd.c,v $
|
||||
* Revision 1.15 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.14 2001/12/30 19:26:12 alex
|
||||
* - Unterstuetzung fuer die Konfigurationsdatei eingebaut.
|
||||
*
|
||||
@ -99,41 +104,45 @@ GLOBAL INT main( INT argc, CONST CHAR *argv[] )
|
||||
/* Datentypen der portab-Library ueberpruefen */
|
||||
portab_check_types( );
|
||||
|
||||
/* Globale Variablen initialisieren */
|
||||
NGIRCd_Start = time( NULL );
|
||||
strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start ));
|
||||
NGIRCd_Quit = FALSE;
|
||||
|
||||
/* Module initialisieren */
|
||||
Log_Init( );
|
||||
Conf_Init( );
|
||||
Parse_Init( );
|
||||
IRC_Init( );
|
||||
Channel_Init( );
|
||||
Client_Init( );
|
||||
Conn_Init( );
|
||||
|
||||
/* Signal-Handler initialisieren */
|
||||
Initialize_Signal_Handler( );
|
||||
|
||||
/* Listen-Ports initialisieren */
|
||||
Initialize_Listen_Ports( );
|
||||
|
||||
/* Hauptschleife */
|
||||
while( ! NGIRCd_Quit )
|
||||
{
|
||||
Conn_Handler( 5 );
|
||||
}
|
||||
/* Globale Variablen initialisieren */
|
||||
NGIRCd_Start = time( NULL );
|
||||
strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start ));
|
||||
NGIRCd_Restart = FALSE;
|
||||
NGIRCd_Quit = FALSE;
|
||||
|
||||
/* Alles abmelden */
|
||||
Conn_Exit( );
|
||||
Client_Exit( );
|
||||
Channel_Exit( );
|
||||
IRC_Exit( );
|
||||
Parse_Exit( );
|
||||
Conf_Exit( );
|
||||
Log_Exit( );
|
||||
/* Module initialisieren */
|
||||
Log_Init( );
|
||||
Conf_Init( );
|
||||
Parse_Init( );
|
||||
IRC_Init( );
|
||||
Channel_Init( );
|
||||
Client_Init( );
|
||||
Conn_Init( );
|
||||
|
||||
/* Signal-Handler initialisieren */
|
||||
Initialize_Signal_Handler( );
|
||||
|
||||
/* Listen-Ports initialisieren */
|
||||
Initialize_Listen_Ports( );
|
||||
|
||||
/* Hauptschleife */
|
||||
while( TRUE )
|
||||
{
|
||||
if( NGIRCd_Quit || NGIRCd_Restart ) break;
|
||||
Conn_Handler( 5 );
|
||||
}
|
||||
|
||||
/* Alles abmelden */
|
||||
Conn_Exit( );
|
||||
Client_Exit( );
|
||||
Channel_Exit( );
|
||||
IRC_Exit( );
|
||||
Parse_Exit( );
|
||||
Conf_Exit( );
|
||||
Log_Exit( );
|
||||
}
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: ngircd.h,v 1.3 2001/12/30 11:42:00 alex Exp $
|
||||
* $Id: ngircd.h,v 1.4 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* ngircd.h: Prototypen aus dem "Haupt-Modul"
|
||||
*
|
||||
* $Log: ngircd.h,v $
|
||||
* Revision 1.4 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.3 2001/12/30 11:42:00 alex
|
||||
* - der Server meldet nun eine ordentliche "Start-Zeit".
|
||||
*
|
||||
@ -32,7 +37,8 @@
|
||||
GLOBAL time_t NGIRCd_Start; /* Startzeitpunkt des Daemon */
|
||||
GLOBAL CHAR NGIRCd_StartStr[64];
|
||||
|
||||
GLOBAL BOOLEAN NGIRCd_Quit; /* TRUE: Hauptschleife beenden */
|
||||
GLOBAL BOOLEAN NGIRCd_Quit; /* TRUE: ngIRCd beenden */
|
||||
GLOBAL BOOLEAN NGIRCd_Restart; /* TRUE: neu starten */
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: parse.c,v 1.8 2001/12/29 03:08:19 alex Exp $
|
||||
* $Id: parse.c,v 1.9 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* parse.c: Parsen der Client-Anfragen
|
||||
*
|
||||
* $Log: parse.c,v $
|
||||
* Revision 1.9 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.8 2001/12/29 03:08:19 alex
|
||||
* - Fuehrende und folgende Leerzeichen etc. in Requests werden geloescht.
|
||||
* - Logmeldungen (mal wieder) ein wenig angepasst.
|
||||
@ -239,9 +244,15 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
|
||||
else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
|
||||
else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
|
||||
else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
|
||||
else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req );
|
||||
else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req );
|
||||
else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req );
|
||||
else if( strcasecmp( Req->command, "OPER" ) == 0 ) return IRC_OPER( client, Req );
|
||||
else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
|
||||
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
|
||||
|
||||
/* Unbekannter Befehl */
|
||||
IRC_WriteStrClient( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( client ), Req->command );
|
||||
IRC_WriteStrClient( client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Nick( client ), Req->command );
|
||||
Log( LOG_DEBUG, "User \"%s!%s@%s\": Unknown command \"%s\", %d %s,%s prefix.", client->nick, client->user, client->host, Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
|
||||
|
||||
return TRUE;
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: parse.h,v 1.2 2001/12/26 14:45:37 alex Exp $
|
||||
* $Id: parse.h,v 1.3 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* parse.h: Parsen der Client-Anfragen (Header)
|
||||
*
|
||||
* $Log: parse.h,v $
|
||||
* Revision 1.3 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.2 2001/12/26 14:45:37 alex
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: tool.c,v 1.3 2001/12/29 03:05:34 alex Exp $
|
||||
* $Id: tool.c,v 1.4 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* tool.c: Hilfsfunktionen, ggf. Platformabhaengig
|
||||
*
|
||||
* $Log: tool.c,v $
|
||||
* Revision 1.4 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.3 2001/12/29 03:05:34 alex
|
||||
* - Funktionsnamen etwas konsequenter umbenannt :-)
|
||||
*
|
||||
|
@ -7,13 +7,18 @@
|
||||
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: tool.h,v 1.3 2001/12/26 14:45:37 alex Exp $
|
||||
* $Id: tool.h,v 1.4 2001/12/31 02:18:51 alex Exp $
|
||||
*
|
||||
* log.h: Hilfsfunktionen (Header)
|
||||
*
|
||||
* $Log: tool.h,v $
|
||||
* Revision 1.4 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
* - Code Cleanups und viele "kleine" Aenderungen & Bugfixes.
|
||||
*
|
||||
* Revision 1.3 2001/12/26 14:45:37 alex
|
||||
* - "Code Cleanups".
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user