mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-11-04 16:03:00 +00:00 
			
		
		
		
	Compare commits
	
		
			35 Commits
		
	
	
		
			rel-17
			...
			branch-0-6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					4726e36efc | ||
| 
						 | 
					3105bd9fff | ||
| 
						 | 
					cb8ed9d5da | ||
| 
						 | 
					a156641afd | ||
| 
						 | 
					78752bbff8 | ||
| 
						 | 
					90e6ec3f89 | ||
| 
						 | 
					9810da343c | ||
| 
						 | 
					e8b99f4d3a | ||
| 
						 | 
					84efd5e969 | ||
| 
						 | 
					33927ee854 | ||
| 
						 | 
					3d46fc6036 | ||
| 
						 | 
					ac587adc69 | ||
| 
						 | 
					2688829ddd | ||
| 
						 | 
					4294dd8043 | ||
| 
						 | 
					6b9ce1cb72 | ||
| 
						 | 
					72a4c0489f | ||
| 
						 | 
					60a4085c38 | ||
| 
						 | 
					5206ab302d | ||
| 
						 | 
					635afd660d | ||
| 
						 | 
					5b3d89312e | ||
| 
						 | 
					f7c1242979 | ||
| 
						 | 
					822d3d12c8 | ||
| 
						 | 
					7de53b1903 | ||
| 
						 | 
					9e3def72e0 | ||
| 
						 | 
					3da58202e6 | ||
| 
						 | 
					ec016a89e2 | ||
| 
						 | 
					1bcc64721f | ||
| 
						 | 
					939ec25f72 | ||
| 
						 | 
					1f7024cb36 | ||
| 
						 | 
					c2fcc98a55 | ||
| 
						 | 
					fe06c3200e | ||
| 
						 | 
					dd7ff82b8f | ||
| 
						 | 
					f84cd22fe1 | ||
| 
						 | 
					3544d1bc40 | ||
| 
						 | 
					6c88184b58 | 
							
								
								
									
										42
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,17 +1,49 @@
 | 
			
		||||
 | 
			
		||||
                     ngIRCd - Next Generation IRC Server
 | 
			
		||||
 | 
			
		||||
                      (c)2001,2002 by Alexander Barton,
 | 
			
		||||
                      (c)2001-2003 by Alexander Barton,
 | 
			
		||||
                    alex@barton.de, http://www.barton.de/
 | 
			
		||||
 | 
			
		||||
                  ngIRCd ist freie Software und steht unter
 | 
			
		||||
                       der GNU General Public License.
 | 
			
		||||
               ngIRCd is free software and published under the
 | 
			
		||||
                   terms of the GNU General Public License.
 | 
			
		||||
 | 
			
		||||
                        -- ChangeLog / Aenderungen --
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ngIRCd CVS-HEAD
 | 
			
		||||
ngIRCd 0.6.x
 | 
			
		||||
 | 
			
		||||
  - Conn_Close() now handles recurisive calls for the same link correctly.
 | 
			
		||||
 | 
			
		||||
ngIRCd 0.6.1, 2002-01-21
 | 
			
		||||
 | 
			
		||||
  - Fixed KILL: you can't crash the server by killing yourself any more,
 | 
			
		||||
    ngIRCd no longer sends a QUIT to other servers after the KILL, and you
 | 
			
		||||
    can kill only valid users now.
 | 
			
		||||
  - The server no longer forwards commands to ordinary users, instead it
 | 
			
		||||
    answers with the correct error message ("no such server") now.
 | 
			
		||||
  - WHOIS commands weren't always forwarded as requested.
 | 
			
		||||
  - The server sets a correct default AWAY message now when propagating
 | 
			
		||||
    between servers (bug introduced in 0.6.0).
 | 
			
		||||
  - Fixed up and enhanced CHANINFO command: channel keys and user limits
 | 
			
		||||
    are syncronized between servers now, too.
 | 
			
		||||
  - MODE returns the key and user limit for channel members correctly now.
 | 
			
		||||
  - Non-members of a channel could crash the server when trying to change
 | 
			
		||||
    its modes or modes of its members.
 | 
			
		||||
  - The server didn't validate weather a target user is a valid channel
 | 
			
		||||
    member when changing his channel user modes which could crash ngIRCd.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Older changes (sorry, only available in german language):
 | 
			
		||||
 | 
			
		||||
ngIRCd 0.6.0, 2002-12-24
 | 
			
		||||
 | 
			
		||||
  ngIRCd 0.6.0-pre2, 2002-12-23
 | 
			
		||||
  - neuer Numeric 005 ("Features") beim Connect.
 | 
			
		||||
  - LUSERS erweitert: nun wird die maximale Anzahl der lokalen und globalen
 | 
			
		||||
    Clients, die dem Server bzw. im Netzwerk seit dem letzten (Re-)Start
 | 
			
		||||
    dem Server gleichzeitig bekannt waren, angezeigt.
 | 
			
		||||
 | 
			
		||||
  ngIRCd 0.6.0-pre1, 2002-12-18
 | 
			
		||||
  - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
 | 
			
		||||
    noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
 | 
			
		||||
  - der Server wartet bei einer eingehenden Verbindung nun laenger auf den
 | 
			
		||||
@@ -362,4 +394,4 @@ ngIRCd 0.0.1, 31.12.2001
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: ChangeLog,v 1.147 2002/12/18 14:19:58 alex Exp $
 | 
			
		||||
$Id: ChangeLog,v 1.147.2.14 2003/03/09 20:16:57 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								NEWS
									
									
									
									
									
								
							@@ -10,7 +10,7 @@
 | 
			
		||||
                           -- NEWS / Neuigkeiten --
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ngIRCd CVS-HEAD
 | 
			
		||||
ngIRCd 0.6.0, 2002-12-24
 | 
			
		||||
 | 
			
		||||
  - beim Schliessen einer Verbindung zeigt der Server nun vor dem ERROR
 | 
			
		||||
    noch eine Statistik ueber die empfangene und gesendete Datenmenge an.
 | 
			
		||||
@@ -139,4 +139,4 @@ ngIRCd 0.0.1, 31.12.2001
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: NEWS,v 1.45 2002/12/18 12:19:07 alex Exp $
 | 
			
		||||
$Id: NEWS,v 1.45.2.2 2002/12/24 13:53:54 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								configure.in
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								configure.in
									
									
									
									
									
								
							@@ -1,15 +1,14 @@
 | 
			
		||||
#
 | 
			
		||||
# ngIRCd -- The Next Generation IRC Daemon
 | 
			
		||||
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
 | 
			
		||||
# Copyright (c)2001-2003 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.
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
# Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
#
 | 
			
		||||
# $Id: configure.in,v 1.69 2002/11/30 22:14:47 alex Exp $
 | 
			
		||||
# $Id: configure.in,v 1.69.2.6 2003/03/09 22:33:19 alex Exp $
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# -- Initialisierung --
 | 
			
		||||
@@ -18,7 +17,7 @@ AC_INIT
 | 
			
		||||
AC_PREREQ(2.50)
 | 
			
		||||
AC_CANONICAL_TARGET
 | 
			
		||||
AC_CONFIG_SRCDIR(src/config.h.in)
 | 
			
		||||
AM_INIT_AUTOMAKE(ngircd,CVSHEAD)
 | 
			
		||||
AM_INIT_AUTOMAKE(ngircd,0.6.x-CVS)
 | 
			
		||||
AM_CONFIG_HEADER(src/config.h)
 | 
			
		||||
 | 
			
		||||
# -- Templates fuer config.h --
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
%define name    ngircd
 | 
			
		||||
%define version CurrentCVS
 | 
			
		||||
%define version 0.6.1
 | 
			
		||||
%define release 1
 | 
			
		||||
%define prefix  %{_prefix}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -90,11 +90,11 @@ Folgende <serverflags> sind zur Zeit definiert:
 | 
			
		||||
II.2 Channel-Modes, persistente Channel und Topic austauschen
 | 
			
		||||
 | 
			
		||||
     Befehl: CHANINFO
 | 
			
		||||
  Parameter: <channel> +<mode> [<topic>]
 | 
			
		||||
  Parameter: <channel> +<modes> [[<key> <maxusers>] <topic>]
 | 
			
		||||
       Fuer: Server
 | 
			
		||||
 | 
			
		||||
Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen
 | 
			
		||||
Modes und dessen Topic. <topic> ist optional.
 | 
			
		||||
Modes, Channel-Key, User-Limit und dessen Topic. <topic> ist optional.
 | 
			
		||||
 | 
			
		||||
Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits,
 | 
			
		||||
so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine
 | 
			
		||||
@@ -104,6 +104,12 @@ ignoriert.
 | 
			
		||||
Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben
 | 
			
		||||
erzeugt.
 | 
			
		||||
 | 
			
		||||
Hat ein Channel keinen Key (in <modes> ist der Mode "k" nicht vorhanden),
 | 
			
		||||
so muss der Parameter <key> ignoriert werden (da <key> vorhanden sein muss,
 | 
			
		||||
sollte in diesem Fall "*" uebergeben werden). Hat er kein User-Limit (kein
 | 
			
		||||
"l" in <modes>), so muss <limit> ignoriert werden (<limit> sollte hierbei
 | 
			
		||||
als "0" uebergeben werden).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- 
 | 
			
		||||
$Id: Protocol.txt,v 1.5 2002/09/04 00:06:19 alex Exp $
 | 
			
		||||
$Id: Protocol.txt,v 1.5.4.1 2003/01/08 20:36:57 alex Exp $
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
 | 
			
		||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
 | 
			
		||||
#
 | 
			
		||||
# $Id: Makefile.am,v 1.31 2002/12/12 12:36:41 alex Exp $
 | 
			
		||||
# $Id: Makefile.am,v 1.31.2.1 2003/01/04 10:58:15 alex Exp $
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
AUTOMAKE_OPTIONS = ../portab/ansi2knr
 | 
			
		||||
@@ -65,7 +65,8 @@ ngircd.c: cvs-date cvs-version.h
 | 
			
		||||
cvs-date:
 | 
			
		||||
	grep VERSION ../config.h | grep "CVS" \
 | 
			
		||||
	 && echo "#define CVSDATE \"$$( grep "\$$Id" $(srcdir)/*.c \
 | 
			
		||||
	    | awk "{ print \$$9 }" | sort | tail -n 1 )\"" > cvs-version.new \
 | 
			
		||||
	    | $(AWK) "{ print \$$9 }" | sort | tail -1 \
 | 
			
		||||
	    | sed -e "s/\//-/g" )\"" > cvs-version.new \
 | 
			
		||||
	 || echo "" > cvs-version.new
 | 
			
		||||
	diff cvs-version.h cvs-version.new || cp cvs-version.new cvs-version.h
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: client.c,v 1.65 2002/12/12 12:24:18 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: client.c,v 1.65.2.3 2003/01/08 23:13:45 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -57,6 +57,10 @@ LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type ));
 | 
			
		||||
 | 
			
		||||
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
 | 
			
		||||
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
 | 
			
		||||
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LONG Max_Users = 0, My_Max_Users = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLOBAL VOID
 | 
			
		||||
@@ -177,6 +181,9 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *
 | 
			
		||||
	client->next = (POINTER *)My_Clients;
 | 
			
		||||
	My_Clients = client;
 | 
			
		||||
 | 
			
		||||
	/* Adjust counters */
 | 
			
		||||
	Adjust_Counters( client );
 | 
			
		||||
 | 
			
		||||
	return client;
 | 
			
		||||
} /* Client_New */
 | 
			
		||||
 | 
			
		||||
@@ -387,24 +394,14 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd )
 | 
			
		||||
GLOBAL VOID
 | 
			
		||||
Client_SetAway( CLIENT *Client, CHAR *Txt )
 | 
			
		||||
{
 | 
			
		||||
	/* Von einem Client gelieferte AWAY-Nachricht */
 | 
			
		||||
 | 
			
		||||
	/* Set AWAY reason of client */
 | 
			
		||||
	
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
	assert( Txt != NULL );
 | 
			
		||||
 | 
			
		||||
	if( Txt )
 | 
			
		||||
	{
 | 
			
		||||
		/* Client AWAY setzen */
 | 
			
		||||
		strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
 | 
			
		||||
		Client->away[CLIENT_AWAY_LEN - 1] = '\0';
 | 
			
		||||
		Client_ModeAdd( Client, 'a' );
 | 
			
		||||
		Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		/* AWAY loeschen */
 | 
			
		||||
		Client_ModeDel( Client, 'a' );
 | 
			
		||||
		Log( LOG_DEBUG, "User \"%s\" is no longer away.", Client_Mask( Client ));
 | 
			
		||||
	}
 | 
			
		||||
	strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
 | 
			
		||||
	Client->away[CLIENT_AWAY_LEN - 1] = '\0';
 | 
			
		||||
	Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), Txt );
 | 
			
		||||
} /* Client_SetAway */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -414,6 +411,7 @@ Client_SetType( CLIENT *Client, INT Type )
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
	Client->type = Type;
 | 
			
		||||
	if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
 | 
			
		||||
	Adjust_Counters( Client );
 | 
			
		||||
} /* Client_SetType */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -919,6 +917,20 @@ Client_UnknownCount( VOID )
 | 
			
		||||
} /* Client_UnknownCount */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLOBAL LONG
 | 
			
		||||
Client_MaxUserCount( VOID )
 | 
			
		||||
{
 | 
			
		||||
	return Max_Users;
 | 
			
		||||
} /* Client_MaxUserCount */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLOBAL LONG
 | 
			
		||||
Client_MyMaxUserCount( VOID )
 | 
			
		||||
{
 | 
			
		||||
	return My_Max_Users;
 | 
			
		||||
} /* Client_MyMaxUserCount */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
GLOBAL BOOLEAN
 | 
			
		||||
Client_IsValidNick( CHAR *Nick )
 | 
			
		||||
{
 | 
			
		||||
@@ -1041,4 +1053,24 @@ Generate_MyToken( CLIENT *Client )
 | 
			
		||||
} /* Generate_MyToken */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
LOCAL VOID
 | 
			
		||||
Adjust_Counters( CLIENT *Client )
 | 
			
		||||
{
 | 
			
		||||
	LONG count;
 | 
			
		||||
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
 | 
			
		||||
	if( Client->type != CLIENT_USER ) return;
 | 
			
		||||
	
 | 
			
		||||
	if( Client->conn_id != NONE )
 | 
			
		||||
	{
 | 
			
		||||
		/* Local connection */
 | 
			
		||||
		count = Client_MyUserCount( );
 | 
			
		||||
		if( count > My_Max_Users ) My_Max_Users = count;
 | 
			
		||||
	}
 | 
			
		||||
	count = Client_UserCount( );
 | 
			
		||||
	if( count > Max_Users ) Max_Users = count;
 | 
			
		||||
} /* Adjust_Counters */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* -eof- */
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 * Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: client.h,v 1.32 2002/12/12 12:23:43 alex Exp $
 | 
			
		||||
 * $Id: client.h,v 1.32.2.1 2002/12/22 23:42:28 alex Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * Client management (header)
 | 
			
		||||
 */
 | 
			
		||||
@@ -130,6 +130,8 @@ GLOBAL LONG Client_UnknownCount PARAMS((VOID ));
 | 
			
		||||
GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
 | 
			
		||||
GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
 | 
			
		||||
GLOBAL LONG Client_MyServerCount PARAMS((VOID ));
 | 
			
		||||
GLOBAL LONG Client_MaxUserCount PARAMS(( VOID ));
 | 
			
		||||
GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID ));
 | 
			
		||||
 | 
			
		||||
GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: conn.c,v 1.106 2002/12/18 13:50:22 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: conn.c,v 1.106.2.1 2003/03/09 20:16:46 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -574,6 +574,18 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
 | 
			
		||||
	assert( Idx > NONE );
 | 
			
		||||
	assert( My_Connections[Idx].sock > NONE );
 | 
			
		||||
 | 
			
		||||
 	/* Is this link already shutting down? */
 | 
			
		||||
 	if( My_Connections[Idx].options & CONN_ISCLOSING )
 | 
			
		||||
 	{
 | 
			
		||||
 		/* Conn_Close() has been called recursively for this link;
 | 
			
		||||
 		 * probabe reason: Try_Write() failed  -- see below. */
 | 
			
		||||
 		return;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	/* Mark link as "closing" */
 | 
			
		||||
 	My_Connections[Idx].options |= CONN_ISCLOSING;
 | 
			
		||||
 
 | 
			
		||||
  	/* Search client, if any */
 | 
			
		||||
	c = Client_GetFromConn( Idx );
 | 
			
		||||
 | 
			
		||||
	if( InformClient )
 | 
			
		||||
@@ -592,9 +604,8 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )
 | 
			
		||||
		if( My_Connections[Idx].sock == NONE ) return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* zunaechst versuchen, noch im Schreibpuffer vorhandene
 | 
			
		||||
	 * Daten auf den Socket zu schreiben ... */
 | 
			
		||||
	Try_Write( Idx );
 | 
			
		||||
  	/* Try to write out the write buffer */
 | 
			
		||||
	(VOID)Try_Write( Idx );
 | 
			
		||||
 | 
			
		||||
	if( close( My_Connections[Idx].sock ) != 0 )
 | 
			
		||||
	{
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 * Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: conn.h,v 1.26 2002/12/18 13:50:22 alex Exp $
 | 
			
		||||
 * $Id: conn.h,v 1.26.2.1 2003/03/09 20:16:46 alex Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * Connection management (header)
 | 
			
		||||
 */
 | 
			
		||||
@@ -18,11 +18,13 @@
 | 
			
		||||
#define __conn_h__
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <time.h>			/* wg. time_t, s.u. */
 | 
			
		||||
#include <time.h>			/* fro time_t, see below */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define CONN_ISCLOSING 1		/* Conn_Close() already called */
 | 
			
		||||
 | 
			
		||||
#ifdef USE_ZLIB
 | 
			
		||||
#define CONN_ZIP 4			/* Kompression mit zlib */
 | 
			
		||||
#define CONN_ZIP 2			/* zlib compressed link */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-channel.c,v 1.21 2002/12/16 23:06:46 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -326,7 +326,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* an anderen Server forwarden */
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
@@ -365,18 +365,24 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	CLIENT *from;
 | 
			
		||||
	CHANNEL *chan;
 | 
			
		||||
	CHAR *ptr;
 | 
			
		||||
	INT arg_topic;
 | 
			
		||||
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
	assert( Req != NULL );
 | 
			
		||||
 | 
			
		||||
	/* Falsche Anzahl Parameter? */
 | 
			
		||||
	if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 | 
			
		||||
	/* Bad number of parameters? */
 | 
			
		||||
	if(( Req->argc < 2 ) || ( Req->argc == 4 ) || ( Req->argc > 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 | 
			
		||||
 | 
			
		||||
	/* From-Server suchen */
 | 
			
		||||
	/* Compatibility kludge */
 | 
			
		||||
	if( Req->argc == 5 ) arg_topic = 4;
 | 
			
		||||
	else if( Req->argc == 3 ) arg_topic = 2;
 | 
			
		||||
	else arg_topic = -1;
 | 
			
		||||
 | 
			
		||||
	/* Search origin */
 | 
			
		||||
	from = Client_Search( Req->prefix );
 | 
			
		||||
	if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
 | 
			
		||||
 | 
			
		||||
	/* Channel suchen bzw. erzeugen */
 | 
			
		||||
	/* Search or create channel */
 | 
			
		||||
	chan = Channel_Search( Req->argv[0] );
 | 
			
		||||
	if( ! chan ) chan = Channel_Create( Req->argv[0] );
 | 
			
		||||
	if( ! chan ) return CONNECTED;
 | 
			
		||||
@@ -386,27 +392,36 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
		ptr = Channel_Modes( chan );
 | 
			
		||||
		if( ! *ptr )
 | 
			
		||||
		{
 | 
			
		||||
			/* OK, es sind noch keine Modes gesetzt */
 | 
			
		||||
			/* OK, this channel doesn't have modes jet, set the received ones: */
 | 
			
		||||
			Channel_SetModes( chan, &Req->argv[1][1] );
 | 
			
		||||
			IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], &Req->argv[1][1] );
 | 
			
		||||
 | 
			
		||||
			/* Delete modes which we never want to inherit */
 | 
			
		||||
			Channel_ModeDel( chan, 'l' );
 | 
			
		||||
			Channel_ModeDel( chan, 'k' );
 | 
			
		||||
 | 
			
		||||
			/* Inform members of this channel */
 | 
			
		||||
			IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s", Req->argv[0], Channel_Modes( chan ));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" );
 | 
			
		||||
 | 
			
		||||
	if( Req->argc == 3 )
 | 
			
		||||
	if( arg_topic > 0 )
 | 
			
		||||
	{
 | 
			
		||||
		/* Es wurde auch ein Topic mit uebermittelt */
 | 
			
		||||
		/* We got a topic */
 | 
			
		||||
		ptr = Channel_Topic( chan );
 | 
			
		||||
		if( ! *ptr )
 | 
			
		||||
		if(( ! *ptr ) && ( Req->argv[arg_topic][0] ))
 | 
			
		||||
		{
 | 
			
		||||
			/* OK, es ist bisher kein Topic gesetzt */
 | 
			
		||||
			Channel_SetTopic( chan, Req->argv[2] );
 | 
			
		||||
			IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Req->argv[2] );
 | 
			
		||||
			/* OK, there is no topic jet */
 | 
			
		||||
			Channel_SetTopic( chan, Req->argv[arg_topic] );
 | 
			
		||||
			IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan ));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* an andere Server forwarden */
 | 
			
		||||
	IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
 | 
			
		||||
	/* Forward CHANINFO to other serevrs */
 | 
			
		||||
	if( Req->argc == 5 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2], Req->argv[3], Req->argv[4] );
 | 
			
		||||
	else if( Req->argc == 3 ) IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
 | 
			
		||||
	else IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s", Req->argv[0], Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
	return CONNECTED;
 | 
			
		||||
} /* IRC_CHANINFO */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.8 2002/12/18 13:55:41 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.8.2.2 2003/01/01 13:46:37 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -62,7 +62,7 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	/* An anderen Server weiterleiten? */
 | 
			
		||||
	if( target != Client_ThisServer( ))
 | 
			
		||||
	{
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
 | 
			
		||||
 | 
			
		||||
		/* forwarden */
 | 
			
		||||
		IRC_WriteStrClientPrefix( target, prefix, "ADMIN %s", Req->argv[0] );
 | 
			
		||||
@@ -141,7 +141,7 @@ IRC_LINKS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	if( Req->argc == 2 )
 | 
			
		||||
	{
 | 
			
		||||
		target = Client_Search( Req->argv[0] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
 | 
			
		||||
		else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -184,7 +184,7 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	if( Req->argc == 2 )
 | 
			
		||||
	{
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
		else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -219,7 +219,7 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* an anderen Server forwarden */
 | 
			
		||||
		target = Client_Search( Req->argv[0] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
 | 
			
		||||
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
@@ -254,7 +254,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* an anderen Server forwarden */
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
@@ -349,7 +349,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* an anderen Server forwarden */
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
@@ -426,7 +426,7 @@ IRC_TIME( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* an anderen Server forwarden */
 | 
			
		||||
		target = Client_Search( Req->argv[0] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
 | 
			
		||||
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
@@ -504,7 +504,7 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	/* An anderen Server weiterleiten? */
 | 
			
		||||
	if( target != Client_ThisServer( ))
 | 
			
		||||
	{
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( prefix, ERR_NOSUCHSERVER_MSG, Client_ID( prefix ), Req->argv[0] );
 | 
			
		||||
 | 
			
		||||
		/* forwarden */
 | 
			
		||||
		IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
 | 
			
		||||
@@ -596,40 +596,39 @@ GLOBAL BOOLEAN
 | 
			
		||||
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
{
 | 
			
		||||
	CLIENT *from, *target, *c;
 | 
			
		||||
	CHAR str[LINE_LEN + 1], *ptr = NULL;
 | 
			
		||||
	CHAR str[LINE_LEN + 1];
 | 
			
		||||
	CL2CHAN *cl2chan;
 | 
			
		||||
	CHANNEL *chan;
 | 
			
		||||
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
	assert( Req != NULL );
 | 
			
		||||
 | 
			
		||||
	/* Falsche Anzahl Parameter? */
 | 
			
		||||
	/* Bad number of parameters? */
 | 
			
		||||
	if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 | 
			
		||||
 | 
			
		||||
	/* Client suchen */
 | 
			
		||||
	/* Search client */
 | 
			
		||||
	c = Client_Search( Req->argv[Req->argc - 1] );
 | 
			
		||||
	if(( ! c ) || ( Client_Type( c ) != CLIENT_USER )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[Req->argc - 1] );
 | 
			
		||||
 | 
			
		||||
	/* Empfaenger des WHOIS suchen */
 | 
			
		||||
	/* Search sender of the WHOIS */
 | 
			
		||||
	if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
 | 
			
		||||
	else from = Client;
 | 
			
		||||
	if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
 | 
			
		||||
 | 
			
		||||
	/* Forwarden an anderen Server? */
 | 
			
		||||
	/* Forward to other server? */
 | 
			
		||||
	if( Req->argc > 1 )
 | 
			
		||||
	{
 | 
			
		||||
		/* angegebenen Ziel-Server suchen */
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[1] );
 | 
			
		||||
		ptr = Req->argv[1];
 | 
			
		||||
		/* Search target server (can be specified as nick of that server!) */
 | 
			
		||||
		target = Client_Search( Req->argv[0] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( from ), Req->argv[0] );
 | 
			
		||||
	}
 | 
			
		||||
	else target = Client_ThisServer( );
 | 
			
		||||
 | 
			
		||||
	assert( target != NULL );
 | 
			
		||||
 | 
			
		||||
	if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], ptr );
 | 
			
		||||
	if(( Client_NextHop( target ) != Client_ThisServer( )) && ( Client_Type( Client_NextHop( target )) == CLIENT_SERVER )) return IRC_WriteStrClientPrefix( target, from, "WHOIS %s :%s", Req->argv[0], Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
	/* Nick, User und Name */
 | 
			
		||||
	/* Nick, user and name */
 | 
			
		||||
	if( ! IRC_WriteStrClient( from, RPL_WHOISUSER_MSG, Client_ID( from ), Client_ID( c ), Client_User( c ), Client_Hostname( c ), Client_Info( c ))) return DISCONNECTED;
 | 
			
		||||
 | 
			
		||||
	/* Server */
 | 
			
		||||
@@ -643,7 +642,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
		chan = Channel_GetChannel( cl2chan );
 | 
			
		||||
		assert( chan != NULL );
 | 
			
		||||
 | 
			
		||||
		/* Channel-Name anhaengen */
 | 
			
		||||
		/* Concatenate channel names */
 | 
			
		||||
		if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
 | 
			
		||||
		if( strchr( Channel_UserModes( chan, c ), 'o' )) strcat( str, "@" );
 | 
			
		||||
		else if( strchr( Channel_UserModes( chan, c ), 'v' )) strcat( str, "+" );
 | 
			
		||||
@@ -651,17 +650,17 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
 | 
			
		||||
		if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
 | 
			
		||||
		{
 | 
			
		||||
			/* Zeile wird zu lang: senden! */
 | 
			
		||||
			/* Line becomes too long: send it! */
 | 
			
		||||
			if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
 | 
			
		||||
			sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* naechstes Mitglied suchen */
 | 
			
		||||
		/* next */
 | 
			
		||||
		cl2chan = Channel_NextChannelOf( c, cl2chan );
 | 
			
		||||
	}
 | 
			
		||||
	if( str[strlen( str ) - 1] != ':')
 | 
			
		||||
	{
 | 
			
		||||
		/* Es sind noch Daten da, die gesendet werden muessen */
 | 
			
		||||
		/* There is data left to send: */
 | 
			
		||||
		if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -671,7 +670,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
		if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Idle (nur lokale Clients) */
 | 
			
		||||
	/* Idle (only local clients) */
 | 
			
		||||
	if( Client_Conn( c ) > NONE )
 | 
			
		||||
	{
 | 
			
		||||
		if( ! IRC_WriteStrClient( from, RPL_WHOISIDLE_MSG, Client_ID( from ), Client_ID( c ), Conn_GetIdle( Client_Conn ( c )))) return DISCONNECTED;
 | 
			
		||||
@@ -710,29 +709,36 @@ IRC_Send_LUSERS( CLIENT *Client )
 | 
			
		||||
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
 | 
			
		||||
	/* Users, Services und Serevr im Netz */
 | 
			
		||||
	/* Users, services and serevers in the network */
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
 | 
			
		||||
 | 
			
		||||
	/* IRC-Operatoren im Netz */
 | 
			
		||||
	/* Number of IRC operators */
 | 
			
		||||
	cnt = Client_OperCount( );
 | 
			
		||||
	if( cnt > 0 )
 | 
			
		||||
	{
 | 
			
		||||
		if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Unbekannt Verbindungen */
 | 
			
		||||
	/* Unknown connections */
 | 
			
		||||
	cnt = Client_UnknownCount( );
 | 
			
		||||
	if( cnt > 0 )
 | 
			
		||||
	{
 | 
			
		||||
		if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Channels im Netz */
 | 
			
		||||
	/* Number of created channels */
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
 | 
			
		||||
 | 
			
		||||
	/* Channels im Netz */
 | 
			
		||||
	/* Number of local users, services and servers */
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
 | 
			
		||||
 | 
			
		||||
#ifndef STRICT_RFC
 | 
			
		||||
	/* Maximum number of local users */
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_LOCALUSERS_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyMaxUserCount( ))) return DISCONNECTED;
 | 
			
		||||
	/* Maximum number of users in the network */
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_NETUSERS_MSG, Client_ID( Client ), Client_UserCount( ), Client_MaxUserCount( ))) return DISCONNECTED;
 | 
			
		||||
#endif
 | 
			
		||||
	
 | 
			
		||||
	return CONNECTED;
 | 
			
		||||
} /* IRC_Send_LUSERS */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-login.c,v 1.27 2002/12/12 12:24:18 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.2 2003/01/01 13:46:37 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -371,7 +371,7 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* es wurde ein Ziel-Client angegeben */
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
			/* ok, forwarden */
 | 
			
		||||
@@ -403,7 +403,7 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	if( Req->argc == 2 )
 | 
			
		||||
	{
 | 
			
		||||
		target = Client_Search( Req->argv[1] );
 | 
			
		||||
		if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
		if( target != Client_ThisServer( ))
 | 
			
		||||
		{
 | 
			
		||||
			/* ok, forwarden */
 | 
			
		||||
@@ -448,6 +448,9 @@ Hello_User( CLIENT *Client )
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), VERSION, USERMODES, CHANMODES )) return FALSE;
 | 
			
		||||
 | 
			
		||||
	/* Features */
 | 
			
		||||
	if( ! IRC_WriteStrClient( Client, RPL_FEATURE_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
 | 
			
		||||
 | 
			
		||||
	Client_SetType( Client, CLIENT_USER );
 | 
			
		||||
 | 
			
		||||
	if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-mode.c,v 1.24 2002/12/18 14:16:21 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.5 2003/01/21 21:05:19 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -156,7 +156,11 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
 | 
			
		||||
		{
 | 
			
		||||
			case 'a':
 | 
			
		||||
				/* Away */
 | 
			
		||||
				if( Client_Type( Client ) == CLIENT_SERVER ) x[0] = 'a';
 | 
			
		||||
				if( Client_Type( Client ) == CLIENT_SERVER )
 | 
			
		||||
				{
 | 
			
		||||
					x[0] = 'a';
 | 
			
		||||
					Client_SetAway( Client, DEFAULT_AWAY_MSG );
 | 
			
		||||
				}
 | 
			
		||||
				else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
 | 
			
		||||
				break;
 | 
			
		||||
			case 'i':
 | 
			
		||||
@@ -242,11 +246,42 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
 | 
			
		||||
	LONG l;
 | 
			
		||||
 | 
			
		||||
	/* Mode request: let's answer it :-) */
 | 
			
		||||
	if( Req->argc == 1 ) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel ));
 | 
			
		||||
	if( Req->argc == 1 )
 | 
			
		||||
	{
 | 
			
		||||
		/* Member or not? -- That's the question! */
 | 
			
		||||
		if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), Channel_Modes( Channel ));
 | 
			
		||||
 | 
			
		||||
		/* The sender is a member: generate extended reply */
 | 
			
		||||
		strcpy( the_modes, Channel_Modes( Channel ));
 | 
			
		||||
		mode_ptr = the_modes;
 | 
			
		||||
		strcpy( the_args, "" );
 | 
			
		||||
		while( *mode_ptr )
 | 
			
		||||
		{
 | 
			
		||||
			switch( *mode_ptr )
 | 
			
		||||
			{
 | 
			
		||||
				case 'l':
 | 
			
		||||
					snprintf( argadd, sizeof( argadd ), " %ld", Channel_MaxUsers( Channel ));
 | 
			
		||||
					strcat( the_args, argadd );
 | 
			
		||||
					break;
 | 
			
		||||
				case 'k':
 | 
			
		||||
					strcat( the_args, " " );
 | 
			
		||||
					strcat( the_args, Channel_Key( Channel ));
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
			mode_ptr++;
 | 
			
		||||
		}
 | 
			
		||||
		if( the_args[0] ) strcat( the_modes, the_args );
 | 
			
		||||
 | 
			
		||||
		return IRC_WriteStrClient( Origin, RPL_CHANNELMODEIS_MSG, Client_ID( Origin ), Channel_Name( Channel ), the_modes );
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Is the user allowed to change modes? */
 | 
			
		||||
	if( Client_Type( Client ) == CLIENT_USER )
 | 
			
		||||
	{
 | 
			
		||||
		/* Is the originating user on that channel? */
 | 
			
		||||
		if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Channel_Name( Channel ));
 | 
			
		||||
 | 
			
		||||
		/* Is he channel operator? */
 | 
			
		||||
		if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE;
 | 
			
		||||
		else modeok = FALSE;
 | 
			
		||||
		if( Conf_OperCanMode )
 | 
			
		||||
@@ -472,6 +507,13 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
 | 
			
		||||
		/* Is there a valid mode change? */
 | 
			
		||||
		if( ! x[0] ) continue;
 | 
			
		||||
 | 
			
		||||
		/* Validate target client */
 | 
			
		||||
		if( client && ( ! Channel_IsMemberOf( Channel, client )))
 | 
			
		||||
		{
 | 
			
		||||
			if( ! IRC_WriteStrClient( Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID( Origin ), Client_ID( client ), Channel_Name( Channel ))) break;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if( set )
 | 
			
		||||
		{
 | 
			
		||||
			/* Set mode */
 | 
			
		||||
@@ -569,13 +611,14 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
	{
 | 
			
		||||
		/* AWAY setzen */
 | 
			
		||||
		Client_SetAway( Client, Req->argv[0] );
 | 
			
		||||
		Client_ModeAdd( Client, 'a' );
 | 
			
		||||
		IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
 | 
			
		||||
		return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		/* AWAY loeschen */
 | 
			
		||||
		Client_SetAway( Client, NULL );
 | 
			
		||||
		Client_ModeDel( Client, 'a' );
 | 
			
		||||
		IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
 | 
			
		||||
		return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: irc.c,v 1.107 2002/12/12 12:24:18 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: irc.c,v 1.107.2.3 2002/12/31 15:48:33 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -52,14 +52,15 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
{
 | 
			
		||||
	CLIENT *prefix, *c;
 | 
			
		||||
	CHAR reason[COMMAND_LEN];
 | 
			
		||||
	CONN_ID my_conn, conn;
 | 
			
		||||
 | 
			
		||||
	assert( Client != NULL );
 | 
			
		||||
	assert( Req != NULL );
 | 
			
		||||
 | 
			
		||||
	/* is the user an IRC operator? */
 | 
			
		||||
	/* Is the user an IRC operator? */
 | 
			
		||||
	if(( Client_Type( Client ) != CLIENT_SERVER ) && ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
 | 
			
		||||
 | 
			
		||||
	/* Falsche Anzahl Parameter? */
 | 
			
		||||
	/* Bad number of parameters? */
 | 
			
		||||
	if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
 | 
			
		||||
 | 
			
		||||
	if( Req->prefix ) prefix = Client_Search( Req->prefix );
 | 
			
		||||
@@ -72,24 +73,30 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
 | 
			
		||||
 | 
			
		||||
	Log( LOG_NOTICE|LOG_snotice, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
	/* build reason string */
 | 
			
		||||
	/* Build reason string */
 | 
			
		||||
	if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
 | 
			
		||||
	else strcpy( reason, Req->argv[1] );
 | 
			
		||||
 | 
			
		||||
	/* andere Server benachrichtigen */
 | 
			
		||||
	/* Inform other servers */
 | 
			
		||||
	IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
 | 
			
		||||
	
 | 
			
		||||
	/* Save ID of this connection */
 | 
			
		||||
	my_conn = Client_Conn( Client );
 | 
			
		||||
 | 
			
		||||
	/* haben wir selber einen solchen Client? */
 | 
			
		||||
	/* Do we host such a client? */
 | 
			
		||||
	c = Client_Search( Req->argv[0] );
 | 
			
		||||
	if( c )
 | 
			
		||||
	if( c && Client_Type( c ) == CLIENT_USER )
 | 
			
		||||
	{
 | 
			
		||||
		/* Ja, wir haben einen solchen Client */
 | 
			
		||||
		if( Client_Conn( c ) != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
 | 
			
		||||
		else Client_Destroy( c, NULL, reason, TRUE );
 | 
			
		||||
		/* Yes, I found it! */
 | 
			
		||||
		conn = Client_Conn( c );
 | 
			
		||||
		Client_Destroy( c, NULL, reason, FALSE );
 | 
			
		||||
		if( conn != NONE ) Conn_Close( Client_Conn( c ), NULL, reason, TRUE );
 | 
			
		||||
	}
 | 
			
		||||
	else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
 | 
			
		||||
 | 
			
		||||
	return CONNECTED;
 | 
			
		||||
	/* Are we still connected or were we killed, too? */
 | 
			
		||||
	if( Client_GetFromConn( my_conn )) return CONNECTED;
 | 
			
		||||
	else return DISCONNECTED;
 | 
			
		||||
} /* IRC_KILL */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 * Please read the file COPYING, README and AUTHORS for more information.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: messages.h,v 1.59 2002/12/18 14:03:14 alex Exp $
 | 
			
		||||
 * $Id: messages.h,v 1.59.2.1 2002/12/22 23:42:28 alex Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * IRC numerics (Header)
 | 
			
		||||
 */
 | 
			
		||||
@@ -22,6 +22,7 @@
 | 
			
		||||
#define RPL_YOURHOST_MSG		"002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
 | 
			
		||||
#define RPL_CREATED_MSG			"003 %s :This server has been started %s"
 | 
			
		||||
#define RPL_MYINFO_MSG			"004 %s %s ngircd-%s %s %s"
 | 
			
		||||
#define RPL_FEATURE_MSG			"005 %s NICKLEN=%d TOPICLEN=%d AWAYLEN=%d MAXCHANNELS=%d :are supported on this server"
 | 
			
		||||
#define RPL_STATSLINKINFO_MSG		"211 %s %s %d %ld %ld %ld %ld :%ld"
 | 
			
		||||
#define RPL_STATSCOMMANDS_MSG		"212 %s %s %ld %ld %ld"
 | 
			
		||||
#define RPL_ENDOFSTATS_MSG		"219 %s %c :End of STATS report"
 | 
			
		||||
@@ -35,6 +36,8 @@
 | 
			
		||||
#define RPL_ADMINLOC1_MSG		"257 %s :%s"
 | 
			
		||||
#define RPL_ADMINLOC2_MSG		"258 %s :%s"
 | 
			
		||||
#define RPL_ADMINEMAIL_MSG		"259 %s :%s"
 | 
			
		||||
#define RPL_LOCALUSERS_MSG		"265 %s :Current local users: %ld, Max: %ld"
 | 
			
		||||
#define RPL_NETUSERS_MSG		"266 %s :Current global users: %ld, Max: %ld"
 | 
			
		||||
 | 
			
		||||
#define RPL_AWAY_MSG			"301 %s %s :%s"
 | 
			
		||||
#define RPL_USERHOST_MSG		"302 %s :"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * ngIRCd -- The Next Generation IRC Daemon
 | 
			
		||||
 * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
 | 
			
		||||
 * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include "portab.h"
 | 
			
		||||
 | 
			
		||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.64 2002/12/12 11:31:21 alex Exp $";
 | 
			
		||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp $";
 | 
			
		||||
 | 
			
		||||
#include "imp.h"
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
@@ -506,7 +506,7 @@ LOCAL VOID
 | 
			
		||||
Show_Version( VOID )
 | 
			
		||||
{
 | 
			
		||||
	puts( NGIRCd_Version( ));
 | 
			
		||||
	puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
 | 
			
		||||
	puts( "Copyright (c)2001-2003 by Alexander Barton (<alex@barton.de>)." );
 | 
			
		||||
	puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
 | 
			
		||||
	puts( "This is free software; see the source for copying conditions. There is NO" );
 | 
			
		||||
	puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user