mirror of
https://github.com/osmarks/ngircd.git
synced 2025-10-13 21:57:40 +00:00
Compare commits
59 Commits
branch-0-6
...
branch-0-5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b74699b074 | ||
![]() |
35054b1f64 | ||
![]() |
f68369d821 | ||
![]() |
d53d18833d | ||
![]() |
a02c7a5f47 | ||
![]() |
14216308a0 | ||
![]() |
7a449bad3c | ||
![]() |
e0941f1a17 | ||
![]() |
6cdc8f7802 | ||
![]() |
266b68b873 | ||
![]() |
34d7f4162d | ||
![]() |
6eab6d9514 | ||
![]() |
2230a6c96a | ||
![]() |
b4afaf9c52 | ||
![]() |
8e9a84a902 | ||
![]() |
0a90f59030 | ||
![]() |
ad252b5c4c | ||
![]() |
b0eb4b0019 | ||
![]() |
92a9e0d34f | ||
![]() |
ed4417c1a0 | ||
![]() |
1e66da4e50 | ||
![]() |
6e55ea7298 | ||
![]() |
bb180adb49 | ||
![]() |
e2c896cb7e | ||
![]() |
2c7b276cc5 | ||
![]() |
4decf352fa | ||
![]() |
19c2e79b72 | ||
![]() |
49d9585242 | ||
![]() |
9487976620 | ||
![]() |
35d1c2fc06 | ||
![]() |
c557a2920e | ||
![]() |
845b295e7d | ||
![]() |
59b5b0e025 | ||
![]() |
bdd23ece63 | ||
![]() |
a119700c62 | ||
![]() |
b0e7f564c7 | ||
![]() |
d69410f28d | ||
![]() |
d5fa1f76bb | ||
![]() |
3dec467ebc | ||
![]() |
a5fe6d6783 | ||
![]() |
37b579f3cd | ||
![]() |
268d02b90d | ||
![]() |
037418e8c0 | ||
![]() |
45c3886800 | ||
![]() |
38f387146f | ||
![]() |
fcbd44caa9 | ||
![]() |
f027308798 | ||
![]() |
462540e079 | ||
![]() |
7721c79747 | ||
![]() |
678a4dfba0 | ||
![]() |
8c956d25b7 | ||
![]() |
9f9f676716 | ||
![]() |
cf20b16d2a | ||
![]() |
97d4e580ae | ||
![]() |
b072b7712c | ||
![]() |
fd6a7f67ce | ||
![]() |
6c04ba84cd | ||
![]() |
ef6b7c7c63 | ||
![]() |
2592e73da0 |
86
ChangeLog
86
ChangeLog
@@ -1,96 +1,21 @@
|
|||||||
|
|
||||||
ngIRCd - Next Generation IRC Server
|
ngIRCd - Next Generation IRC Server
|
||||||
|
|
||||||
(c)2001-2003 by Alexander Barton,
|
(c)2001,2002 by Alexander Barton,
|
||||||
alex@barton.de, http://www.barton.de/
|
alex@barton.de, http://www.barton.de/
|
||||||
|
|
||||||
ngIRCd is free software and published under the
|
ngIRCd ist freie Software und steht unter
|
||||||
terms of the GNU General Public License.
|
der GNU General Public License.
|
||||||
|
|
||||||
-- ChangeLog / Aenderungen --
|
-- ChangeLog / Aenderungen --
|
||||||
|
|
||||||
|
|
||||||
ngIRCd 0.6.x
|
ngIRCd 0.5.x-CVS
|
||||||
|
|
||||||
- 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
|
|
||||||
Resolver (4 Sekunden), wenn das Ergebnis eintrifft setzt er aber den
|
|
||||||
Login sofort fort (bisher wurde immer mind. 1 Sekunde gewartet).
|
|
||||||
- Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
|
|
||||||
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
|
|
||||||
- Mit der neuen Konfigurationsvariable "MaxConnections" (Sektion "Global")
|
|
||||||
kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden.
|
|
||||||
Der Default ist -1, "unlimitiert".
|
|
||||||
- der Server erkennt nun, ob bereits eine eingehende Verbindung von einem
|
|
||||||
Peer-Server besteht und versucht dann nicht mehr, selber eine eigene
|
|
||||||
ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden
|
|
||||||
Servern in der Konfiguration ein Port fuer den Connect konfiguriert
|
|
||||||
werden (beide Server versuchen sich dann gegenseitig zu connectieren).
|
|
||||||
- Test-Suite und Dokumentation an A/UX angepasst.
|
|
||||||
- unter HP-UX definiert das configure-Script nun _XOPEN_SOURCE_EXTENDED.
|
|
||||||
- Server identifizieren sich nun mit asyncronen Passwoertern, d.h. das
|
|
||||||
Passwort, welches A an B schickt, kann ein anderes sein als das, welches
|
|
||||||
B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server",
|
|
||||||
wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt.
|
|
||||||
- Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies
|
|
||||||
macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird.
|
|
||||||
- Channel-Mode "P" ("persistent") kann nur noch von IRC-Operatoren gesetzt
|
|
||||||
werden. Grund: User koennen den Server sonst leicht "Channel-Flooden".
|
|
||||||
- MOTD kann nun an andere Server geforwarded werden.
|
|
||||||
- IRC-Befehl "TIME" implementiert.
|
|
||||||
- Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib
|
|
||||||
(www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung
|
|
||||||
nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist
|
|
||||||
kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen
|
|
||||||
miteinander ueber komprimiert Links kommunizieren.
|
|
||||||
- Handling der Schreibpuffer umgestellt: Server sollte schneller arbeiten.
|
|
||||||
- Prefix-Fehler werden besser protokolliert (mit verursachendem Befehl).
|
- Prefix-Fehler werden besser protokolliert (mit verursachendem Befehl).
|
||||||
- SQUIT wird nicht mehr doppelt an andere Server weitergeleitet.
|
- SQUIT wird nicht mehr doppelt an andere Server weitergeleitet.
|
||||||
- Der Server versucht nun vor dem Schliessen einer Verbindung Daten, die
|
- Der Server versucht nun vor dem Schliessen einer Verbindung Daten, die
|
||||||
noch im Schreibpuffer stehen, zu senden.
|
noch im Schreibpuffer stehen, zu senden.
|
||||||
- Source in weiteres Modul "irc-info" aufgespalten.
|
|
||||||
- Konfigurationsvariablen werden besser validiert: Laengen, Zahlen, ...
|
|
||||||
- neuen Befehl STATS begonnen: bisher unterstuetzt wird "l" und "m".
|
|
||||||
- bei ISON und USERHOST fehlte im Ergebnis-String der korrekte Absender.
|
|
||||||
- IRC Operatoren koennen nun mit KILL User toeten. Achtung: ein Grund muss
|
|
||||||
zwingend als zweiter Parameter angegeben werden!
|
|
||||||
- neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl
|
|
||||||
der Channels, in denen ein User Mitglied sein kann, begrent werden.
|
|
||||||
- neuer, deutlich flexiblerer Parser fuer den MODE Befehl.
|
|
||||||
- neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert.
|
|
||||||
|
|
||||||
ngIRCd 0.5.4, 24.11.2002
|
ngIRCd 0.5.4, 24.11.2002
|
||||||
|
|
||||||
@@ -348,6 +273,7 @@ ngIRCd 0.1.0, 29.01.2002
|
|||||||
- Clients werden nun korrekt sowohl nur ueber den Nickname als auch die
|
- Clients werden nun korrekt sowohl nur ueber den Nickname als auch die
|
||||||
komplette "Host Mask" erkannt.
|
komplette "Host Mask" erkannt.
|
||||||
|
|
||||||
|
|
||||||
ngIRCd 0.0.3, 16.01.2002
|
ngIRCd 0.0.3, 16.01.2002
|
||||||
|
|
||||||
- Server-Links vollstaendig implementiert: der ngIRCd kann nun auch
|
- Server-Links vollstaendig implementiert: der ngIRCd kann nun auch
|
||||||
@@ -394,4 +320,4 @@ ngIRCd 0.0.1, 31.12.2001
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: ChangeLog,v 1.147.2.14 2003/03/09 20:16:57 alex Exp $
|
$Id: ChangeLog,v 1.87.2.18 2002/11/29 11:42:24 alex Exp $
|
||||||
|
16
INSTALL
16
INSTALL
@@ -18,20 +18,6 @@
|
|||||||
+-----------------------------------------------------------------------+
|
+-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
0. Update von frueheren Versionen
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Unterschiede zu Version 0.5.x
|
|
||||||
|
|
||||||
- Ab Version 0.6.0 werden asyncrone Passwoerter zur Identifikation anderer
|
|
||||||
Server, die Variable "Password" in [Server]-Abschnitten wird nicht mehr
|
|
||||||
unterstuetzt. Passwoerter fuer Server-Server-Links werden nun mit den
|
|
||||||
Variablen "MyPassword" und "PeerPassword" angegeben.
|
|
||||||
|
|
||||||
- Neue Konfigurationsvariablen, Sektion [Global]: MaxConnections, MaxJoins
|
|
||||||
(vgl. auch Beispiel-Konfiguration "doc/sample-ngircd.conf"!)
|
|
||||||
|
|
||||||
|
|
||||||
I. Standard-Installation
|
I. Standard-Installation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -159,4 +145,4 @@ Server nach der Ausgabe wieder.
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: INSTALL,v 1.9 2002/12/18 12:19:07 alex Exp $
|
$Id: INSTALL,v 1.8 2002/09/16 11:03:05 alex Exp $
|
||||||
|
@@ -66,10 +66,9 @@
|
|||||||
08FB7794FE84155DC02AAC07 = {
|
08FB7794FE84155DC02AAC07 = {
|
||||||
children = (
|
children = (
|
||||||
1AB674ADFE9D54B511CA2CBB,
|
1AB674ADFE9D54B511CA2CBB,
|
||||||
F56D8B9E01E0BFA00155ADA7,
|
|
||||||
F5D3536103892A8A01A85B04,
|
|
||||||
F51F791401DFD0DE01D13771,
|
F51F791401DFD0DE01D13771,
|
||||||
F520AF150335F1B801A85B04,
|
F520AF150335F1B801A85B04,
|
||||||
|
F56D8B9E01E0BFA00155ADA7,
|
||||||
F52162B301C7B904012300F4,
|
F52162B301C7B904012300F4,
|
||||||
F52162C301C7B904012300F4,
|
F52162C301C7B904012300F4,
|
||||||
F52162C401C7B904012300F4,
|
F52162C401C7B904012300F4,
|
||||||
@@ -94,13 +93,11 @@
|
|||||||
);
|
);
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
INSTALL_PATH = "$(HOME)/bin";
|
INSTALL_PATH = "$(HOME)/bin";
|
||||||
LIBRARY_SEARCH_PATHS = "";
|
LIBRARY_SEARCH_PATHS = "";
|
||||||
OPTIMIZATION_CFLAGS = "-O2";
|
OTHER_CFLAGS = "-DLOCALSTATEDIR=\\\\\\\"/usr/local/var\\\\\\\" -DSYSCONFDIR=\\\\\\\"/usr/local/etc\\\\\\\"";
|
||||||
OTHER_CFLAGS = "-DSYSCONFDIR=\\\\\\\"/usr/local/etc\\\\\\\"";
|
OTHER_LDFLAGS = "";
|
||||||
OTHER_LDFLAGS = "-lz";
|
|
||||||
OTHER_REZFLAGS = "";
|
OTHER_REZFLAGS = "";
|
||||||
PRODUCT_NAME = ngircd;
|
PRODUCT_NAME = ngircd;
|
||||||
REZ_EXECUTABLE = YES;
|
REZ_EXECUTABLE = YES;
|
||||||
@@ -146,7 +143,6 @@
|
|||||||
F5BEF12E02A1169C01A85B03,
|
F5BEF12E02A1169C01A85B03,
|
||||||
F5BEF13302A12AFE01A85B03,
|
F5BEF13302A12AFE01A85B03,
|
||||||
F5E9448502C9F49D01A85B04,
|
F5E9448502C9F49D01A85B04,
|
||||||
F5D5CC9403990FED0155B873,
|
|
||||||
);
|
);
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -175,7 +171,6 @@
|
|||||||
F5BEF12F02A1169C01A85B03,
|
F5BEF12F02A1169C01A85B03,
|
||||||
F5BEF13502A24F1001A85B03,
|
F5BEF13502A24F1001A85B03,
|
||||||
F5E9448602C9F49D01A85B04,
|
F5E9448602C9F49D01A85B04,
|
||||||
F5D5CC9603990FFA0155B873,
|
|
||||||
);
|
);
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -584,8 +579,6 @@
|
|||||||
F51D180301C8FDD001E11C2E,
|
F51D180301C8FDD001E11C2E,
|
||||||
F57C888D02328D7201A85B04,
|
F57C888D02328D7201A85B04,
|
||||||
F57C888E02328D7201A85B04,
|
F57C888E02328D7201A85B04,
|
||||||
F5D5CC9503990FFA0155B873,
|
|
||||||
F5D5CC9303990FED0155B873,
|
|
||||||
F51DBB1B022D9D8F01A85B04,
|
F51DBB1B022D9D8F01A85B04,
|
||||||
F51DBB1C022D9D8F01A85B04,
|
F51DBB1C022D9D8F01A85B04,
|
||||||
F51DBB17022D995501A85B04,
|
F51DBB17022D995501A85B04,
|
||||||
@@ -827,8 +820,6 @@
|
|||||||
F5382426024F89BC01A85B04,
|
F5382426024F89BC01A85B04,
|
||||||
);
|
);
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
|
||||||
OPTIMIZATION_CFLAGS = "-O2";
|
|
||||||
OTHER_CFLAGS = "";
|
OTHER_CFLAGS = "";
|
||||||
OTHER_LDFLAGS = "";
|
OTHER_LDFLAGS = "";
|
||||||
OTHER_REZFLAGS = "";
|
OTHER_REZFLAGS = "";
|
||||||
@@ -1149,61 +1140,11 @@
|
|||||||
settings = {
|
settings = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
F5D3536103892A8A01A85B04 = {
|
|
||||||
children = (
|
|
||||||
F5D3536203892AD201A85B04,
|
|
||||||
F5D3536303892AD201A85B04,
|
|
||||||
);
|
|
||||||
isa = PBXGroup;
|
|
||||||
name = contrib;
|
|
||||||
refType = 4;
|
|
||||||
};
|
|
||||||
F5D3536203892AD201A85B04 = {
|
|
||||||
isa = PBXFileReference;
|
|
||||||
name = Makefile.am;
|
|
||||||
path = /Users/alex/Develop/ngircd/contrib/Makefile.am;
|
|
||||||
refType = 0;
|
|
||||||
};
|
|
||||||
F5D3536303892AD201A85B04 = {
|
|
||||||
isa = PBXFileReference;
|
|
||||||
name = ngircd.spec;
|
|
||||||
path = /Users/alex/Develop/ngircd/contrib/ngircd.spec;
|
|
||||||
refType = 0;
|
|
||||||
};
|
|
||||||
F5D3536403892AFE01A85B04 = {
|
|
||||||
isa = PBXFileReference;
|
|
||||||
name = "sample-ngircd.conf";
|
|
||||||
path = "en/sample-ngircd.conf";
|
|
||||||
refType = 4;
|
|
||||||
};
|
|
||||||
F5D5CC9303990FED0155B873 = {
|
|
||||||
isa = PBXFileReference;
|
|
||||||
path = "irc-info.h";
|
|
||||||
refType = 4;
|
|
||||||
};
|
|
||||||
F5D5CC9403990FED0155B873 = {
|
|
||||||
fileRef = F5D5CC9303990FED0155B873;
|
|
||||||
isa = PBXBuildFile;
|
|
||||||
settings = {
|
|
||||||
};
|
|
||||||
};
|
|
||||||
F5D5CC9503990FFA0155B873 = {
|
|
||||||
isa = PBXFileReference;
|
|
||||||
path = "irc-info.c";
|
|
||||||
refType = 4;
|
|
||||||
};
|
|
||||||
F5D5CC9603990FFA0155B873 = {
|
|
||||||
fileRef = F5D5CC9503990FFA0155B873;
|
|
||||||
isa = PBXBuildFile;
|
|
||||||
settings = {
|
|
||||||
};
|
|
||||||
};
|
|
||||||
F5E9447B02C9EE0E01A85B04 = {
|
F5E9447B02C9EE0E01A85B04 = {
|
||||||
children = (
|
children = (
|
||||||
F5E9448002C9EE4901A85B04,
|
F5E9448002C9EE4901A85B04,
|
||||||
F5E9448202C9EE4901A85B04,
|
F5E9448202C9EE4901A85B04,
|
||||||
F5E9448102C9EE4901A85B04,
|
F5E9448102C9EE4901A85B04,
|
||||||
F5D3536403892AFE01A85B04,
|
|
||||||
);
|
);
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
name = en;
|
name = en;
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
#
|
#
|
||||||
# $Id: Makefile.am,v 1.10 2002/10/01 09:57:08 alex Exp $
|
# $Id: Makefile.am,v 1.9.2.1 2002/10/03 16:13:38 alex Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = gnu
|
AUTOMAKE_OPTIONS = gnu
|
||||||
|
31
NEWS
31
NEWS
@@ -10,35 +10,6 @@
|
|||||||
-- NEWS / Neuigkeiten --
|
-- NEWS / Neuigkeiten --
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
- Connection-Strukturen werden nun "pool-weise" verwaltet; der Pool wird
|
|
||||||
bei Bedarf bis zu einem konfigurierten Limit vergroessert.
|
|
||||||
- Mit der neuen Konfigurationsvariable "MaxConnections" (Sekion "Global")
|
|
||||||
kann die maximale Anzahl gleichzeitiger Verbindungen begrenzt werden.
|
|
||||||
Der Default ist -1, "unlimitiert".
|
|
||||||
- der Server erkennt nun, ob bereits eine eingehende Verbindung von einem
|
|
||||||
Peer-Server besteht und versucht dann nicht mehr, selber eine eigene
|
|
||||||
ausgehende Verbindung zu diesem auufzubauen. Dadurch kann nun auf beiden
|
|
||||||
Servern in der Konfiguration ein Port fuer den Connect konfiguriert
|
|
||||||
werden (beide Server versuchen sich dann gegenseitig zu connectieren).
|
|
||||||
- Server identifizieren sich nun mit asyncronen Passwoertern, d.h. das
|
|
||||||
Passwort, welches A an B schickt, kann ein anderes sein als das, welches
|
|
||||||
B als Antwort an A sendet. In der Konfig.-Datei, Abschnitt "Server",
|
|
||||||
wurde "Password" dazu durch "MyPassword" und "PeerPassword" ersetzt.
|
|
||||||
- Der Server kann nun zur Laufzeit die Konfiguration neu einlesen: dies
|
|
||||||
macht er nach dem Befehl REHASH oder wenn ein HUP-Signal empfangen wird.
|
|
||||||
- Server-Server-Links koennen nun komprimiert werden, dazu wird die zlib
|
|
||||||
(www.zlib.org) benoetigt. Unterstuetzt die Gegenseite die Komprimierung
|
|
||||||
nicht, wird automatisch unkomprimiert kommuniziert. Das Verfahren ist
|
|
||||||
kompatibel mit dem Original-ircd 2.10.3, d.h. beide Server koennen
|
|
||||||
miteinander ueber komprimiert Links kommunizieren.
|
|
||||||
- neue Konfigurations-Variable "MaxJoins": Hiermit kann die maximale Zahl
|
|
||||||
der Channels, in denen ein User Mitglied sein kann, begrent werden.
|
|
||||||
- neue Channel-Modes l (User-Limit) und k (Channel-Key) implementiert.
|
|
||||||
|
|
||||||
ngIRCd 0.5.0, 20.09.2002
|
ngIRCd 0.5.0, 20.09.2002
|
||||||
|
|
||||||
- AIX (3.2.5), HP-UX (10.20), IRIX (6.5), NetBSD (1.5.3/m68k) und Solaris
|
- AIX (3.2.5), HP-UX (10.20), IRIX (6.5), NetBSD (1.5.3/m68k) und Solaris
|
||||||
@@ -139,4 +110,4 @@ ngIRCd 0.0.1, 31.12.2001
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: NEWS,v 1.45.2.2 2002/12/24 13:53:54 alex Exp $
|
$Id: NEWS,v 1.38.2.4 2002/10/03 16:09:50 alex Exp $
|
||||||
|
6
README
6
README
@@ -38,8 +38,8 @@ Bisher (mehr oder wenig vollstaendig) implementierte IRC-Befehle:
|
|||||||
|
|
||||||
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
|
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
|
||||||
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
|
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
|
||||||
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TIME, TOPIC,
|
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TOPIC, USERHOST,
|
||||||
USERHOST, USER, VERSION, WHO, WHOIS.
|
USER, VERSION, WHO, WHOIS.
|
||||||
|
|
||||||
|
|
||||||
III. Features (oder: warum gerade ngIRCd?)
|
III. Features (oder: warum gerade ngIRCd?)
|
||||||
@@ -102,4 +102,4 @@ schreiben.
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: README,v 1.14 2002/11/24 18:48:59 alex Exp $
|
$Id: README,v 1.13 2002/09/16 11:03:05 alex Exp $
|
||||||
|
64
configure.in
64
configure.in
@@ -1,14 +1,15 @@
|
|||||||
#
|
#
|
||||||
# ngIRCd -- The Next Generation IRC Daemon
|
# ngIRCd -- The Next Generation IRC Daemon
|
||||||
# Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
|
# Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
# it under the terms of the GNU General Public License as published by
|
# der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
# (at your option) any later version.
|
# der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
# Please read the file COPYING, README and AUTHORS for more information.
|
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
#
|
#
|
||||||
# $Id: configure.in,v 1.69.2.6 2003/03/09 22:33:19 alex Exp $
|
# $Id: configure.in,v 1.58.2.11 2002/11/29 10:53:44 alex Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
# -- Initialisierung --
|
# -- Initialisierung --
|
||||||
@@ -17,7 +18,7 @@ AC_INIT
|
|||||||
AC_PREREQ(2.50)
|
AC_PREREQ(2.50)
|
||||||
AC_CANONICAL_TARGET
|
AC_CANONICAL_TARGET
|
||||||
AC_CONFIG_SRCDIR(src/config.h.in)
|
AC_CONFIG_SRCDIR(src/config.h.in)
|
||||||
AM_INIT_AUTOMAKE(ngircd,0.6.x-CVS)
|
AM_INIT_AUTOMAKE(ngircd,0.5.x-CVS)
|
||||||
AM_CONFIG_HEADER(src/config.h)
|
AM_CONFIG_HEADER(src/config.h)
|
||||||
|
|
||||||
# -- Templates fuer config.h --
|
# -- Templates fuer config.h --
|
||||||
@@ -27,7 +28,6 @@ AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
|
|||||||
AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
|
AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
|
||||||
AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
|
AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
|
||||||
AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
|
AH_TEMPLATE([USE_SYSLOG], [Define if syslog should be used for logging])
|
||||||
AH_TEMPLATE([USE_ZLIB], [Define if zlib compression should be enabled])
|
|
||||||
AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
|
AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
|
||||||
|
|
||||||
AH_TEMPLATE([TARGET_OS], [Target operating system name])
|
AH_TEMPLATE([TARGET_OS], [Target operating system name])
|
||||||
@@ -53,20 +53,6 @@ AC_LANG_C
|
|||||||
AM_C_PROTOTYPES
|
AM_C_PROTOTYPES
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
|
||||||
# -- Defines --
|
|
||||||
|
|
||||||
if test `uname` = "A/UX"; then
|
|
||||||
# unter A/UX sollte _POSIX_SOURCE definiert sein.
|
|
||||||
AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
|
|
||||||
CFLAGS="$CFLAGS -D_POSIX_SOURCE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test `uname` = "HP-UX"; then
|
|
||||||
# unter HP-UX 11.11 muss _XOPEN_SOURCE_EXTENDED definiert sein.
|
|
||||||
AC_MSG_RESULT([detected HP-UX, defining _XOPEN_SOURCE_EXTENDED])
|
|
||||||
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# -- Header --
|
# -- Header --
|
||||||
|
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
@@ -80,7 +66,7 @@ AC_CHECK_HEADERS([ \
|
|||||||
strings.h sys/socket.h sys/time.h unistd.h \
|
strings.h sys/socket.h sys/time.h unistd.h \
|
||||||
],,AC_MSG_ERROR([required C header missing!]))
|
],,AC_MSG_ERROR([required C header missing!]))
|
||||||
|
|
||||||
AC_CHECK_HEADERS(arpa/inet.h ctype.h malloc.h stdint.h sys/select.h varargs.h)
|
AC_CHECK_HEADERS(arpa/inet.h malloc.h stdint.h sys/select.h varargs.h)
|
||||||
|
|
||||||
# -- Datentypen --
|
# -- Datentypen --
|
||||||
|
|
||||||
@@ -121,7 +107,7 @@ AC_CHECK_FUNCS([ \
|
|||||||
strstr waitpid \
|
strstr waitpid \
|
||||||
],,AC_MSG_ERROR([required function missing!]))
|
],,AC_MSG_ERROR([required function missing!]))
|
||||||
|
|
||||||
AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf)
|
AC_CHECK_FUNCS(inet_aton sigaction snprintf vsnprintf)
|
||||||
|
|
||||||
# -- Konfigurationsoptionen --
|
# -- Konfigurationsoptionen --
|
||||||
|
|
||||||
@@ -141,22 +127,6 @@ if test "$x_syslog_on" = "yes"; then
|
|||||||
AC_CHECK_LIB(be,syslog)
|
AC_CHECK_LIB(be,syslog)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_zlib_on=no
|
|
||||||
AC_ARG_ENABLE(zlib,
|
|
||||||
[ --disable-zlib disable zlib compression (autodetected by default)],
|
|
||||||
[ if test "$enableval" = "yes"; then
|
|
||||||
AC_CHECK_HEADER(zlib.h, x_zlib_on=yes,
|
|
||||||
AC_MSG_ERROR([Can't enable zlib: zlib.h not found!])
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[ AC_CHECK_HEADER(zlib.h, x_zlib_on=yes) ]
|
|
||||||
)
|
|
||||||
if test "$x_zlib_on" = "yes"; then
|
|
||||||
AC_DEFINE(USE_ZLIB, 1)
|
|
||||||
AC_CHECK_LIB(z,deflate)
|
|
||||||
fi
|
|
||||||
|
|
||||||
x_ircplus_on=yes
|
x_ircplus_on=yes
|
||||||
AC_ARG_ENABLE(ircplus,
|
AC_ARG_ENABLE(ircplus,
|
||||||
[ --disable-ircplus disable IRC+ protocol],
|
[ --disable-ircplus disable IRC+ protocol],
|
||||||
@@ -197,14 +167,18 @@ AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
|
|||||||
AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
|
AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
|
||||||
AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
|
AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
|
||||||
|
|
||||||
|
if test `uname` = "A/UX"; then
|
||||||
|
# unter A/UX sollte _POSIX_SOURCE definiert sein.
|
||||||
|
AC_MSG_RESULT([detected A/UX, defining _POSIX_SOURCE])
|
||||||
|
CFLAGS="$CFLAGS -D_POSIX_SOURCE"
|
||||||
|
fi
|
||||||
|
|
||||||
# -- Variablen --
|
# -- Variablen --
|
||||||
|
|
||||||
if test "$GCC" = "yes"; then
|
if test "$GCC" = "yes"; then
|
||||||
CFLAGS="-Wall $CFLAGS"
|
CFLAGS="-Wall $CFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
the_CFLAGS="$CFLAGS"
|
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
|
CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
|
||||||
|
|
||||||
# -- Ausgabe der Dateien --
|
# -- Ausgabe der Dateien --
|
||||||
@@ -235,11 +209,12 @@ M=`eval echo ${mandir}` ; M=`eval echo ${M}`
|
|||||||
|
|
||||||
echo " host: ${host}"
|
echo " host: ${host}"
|
||||||
echo " compiler: ${CC}"
|
echo " compiler: ${CC}"
|
||||||
echo " compiler flags: ${the_CFLAGS}"
|
echo " compiler flags: ${CFLAGS}"
|
||||||
echo " preprocessor flags: ${CPPFLAGS}"
|
echo " preprocessor flags: ${CPPFLAGS}"
|
||||||
echo " linker flags: ${LDFLAGS}"
|
echo " linker flags: ${LDFLAGS}"
|
||||||
echo " libraries: ${LIBS}"
|
echo " libraries: ${LIBS}"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo " 'ngircd' binary: $S"
|
echo " 'ngircd' binary: $S"
|
||||||
echo " configuration file: $C"
|
echo " configuration file: $C"
|
||||||
echo " manual pages: $M"
|
echo " manual pages: $M"
|
||||||
@@ -247,7 +222,6 @@ echo
|
|||||||
|
|
||||||
echo $ECHO_N " active options: $ECHO_C"
|
echo $ECHO_N " active options: $ECHO_C"
|
||||||
test "$x_syslog_on" = "yes" && echo $ECHO_N "Syslog $ECHO_C"
|
test "$x_syslog_on" = "yes" && echo $ECHO_N "Syslog $ECHO_C"
|
||||||
test "$x_zlib_on" = "yes" && echo $ECHO_N "zLib $ECHO_C"
|
|
||||||
test "$x_debug_on" = "yes" && echo $ECHO_N "Debug $ECHO_C"
|
test "$x_debug_on" = "yes" && echo $ECHO_N "Debug $ECHO_C"
|
||||||
test "$x_sniffer_on" = "yes" && echo $ECHO_N "Sniffer $ECHO_C"
|
test "$x_sniffer_on" = "yes" && echo $ECHO_N "Sniffer $ECHO_C"
|
||||||
test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C"
|
test "$x_strict_rfc_on" = "yes" && echo $ECHO_N "Strict-RFC $ECHO_C"
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
#
|
#
|
||||||
# $Id: Makefile.am,v 1.1 2002/10/01 09:57:08 alex Exp $
|
# $Id: Makefile.am,v 1.1.2.1 2002/10/03 16:13:38 alex Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
EXTRA_DIST = ngircd.spec
|
EXTRA_DIST = ngircd.spec
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
%define name ngircd
|
%define name ngircd
|
||||||
%define version 0.6.1
|
%define version 0.5.x-CVS
|
||||||
%define release 1
|
%define release 1
|
||||||
%define prefix %{_prefix}
|
%define prefix %{_prefix}
|
||||||
|
|
||||||
|
@@ -90,11 +90,11 @@ Folgende <serverflags> sind zur Zeit definiert:
|
|||||||
II.2 Channel-Modes, persistente Channel und Topic austauschen
|
II.2 Channel-Modes, persistente Channel und Topic austauschen
|
||||||
|
|
||||||
Befehl: CHANINFO
|
Befehl: CHANINFO
|
||||||
Parameter: <channel> +<modes> [[<key> <maxusers>] <topic>]
|
Parameter: <channel> +<mode> [<topic>]
|
||||||
Fuer: Server
|
Fuer: Server
|
||||||
|
|
||||||
Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen
|
Mit CHANINFO Informiert ein Server den anderen ueber einen Channel: dessen
|
||||||
Modes, Channel-Key, User-Limit und dessen Topic. <topic> ist optional.
|
Modes und dessen Topic. <topic> ist optional.
|
||||||
|
|
||||||
Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits,
|
Existiert auf dem Server, der das CHANINFO empfaengt, der Channel bereits,
|
||||||
so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine
|
so uebernimmt er die Werte jeweils nur dann, wenn er selber noch keine
|
||||||
@@ -104,12 +104,6 @@ ignoriert.
|
|||||||
Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben
|
Existiert der Channel noch nicht, so wird er mit den entsprechenden Angaben
|
||||||
erzeugt.
|
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.4.1 2003/01/08 20:36:57 alex Exp $
|
$Id: Protocol.txt,v 1.5 2002/09/04 00:06:19 alex Exp $
|
||||||
|
@@ -11,33 +11,37 @@
|
|||||||
|
|
||||||
|
|
||||||
Seit Version 0.2.2-pre gehoert Apple A/UX zu den offiziell unterstuetzten
|
Seit Version 0.2.2-pre gehoert Apple A/UX zu den offiziell unterstuetzten
|
||||||
Plattformen. Er ist im vollen Funktionsumfang nutzbar.
|
Platformen. Er ist im vollen Funktionsumfang nutzbar.
|
||||||
|
|
||||||
Ab Version 0.5.0 compiliert zudem der ngIRCd mit dem nativen A/UX-Compiler,
|
|
||||||
d.h. GNU C wird nicht mehr zwingend vorausgesetzt.
|
|
||||||
|
|
||||||
Folgende Software wird jedoch benoetigt:
|
Folgende Software wird jedoch benoetigt:
|
||||||
|
|
||||||
|
- GNU C Compiler (gcc)
|
||||||
|
Bezugsquellen:
|
||||||
|
http://www.rezepte-im-web.de/appleux/gcc281.tar.gz
|
||||||
|
ftp://arthur.ath.cx/pub/AUX/Software/Development/gcc-2.8.1-auxbin.tar.gz
|
||||||
|
|
||||||
|
- GNU make
|
||||||
|
Bezugsquellen:
|
||||||
|
http://www.rezepte-im-web.de/appleux/make-3.79.tar.gz
|
||||||
|
ftp://arthur.ath.cx/pub/AUX/Software/Development/make-3.79.tar.gz
|
||||||
|
|
||||||
- GNU sed
|
- GNU sed
|
||||||
Bezugsquellen:
|
Bezugsquellen:
|
||||||
http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz
|
http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz
|
||||||
ftp://arthur.ath.cx/pub/AUX/Software/Tools/sed-3.02.tar.gz
|
ftp://arthur.ath.cx/pub/AUX/Software/Tools/sed-3.02.tar.gz
|
||||||
|
|
||||||
A/UX beinhaltet ein /bin/sed, dieses unterstuetzt jedoch leider nicht
|
- install (z.B. aus den GNU fileutils)
|
||||||
alle Funktionen, die GNU automake/autoconf nutzen.
|
Ein install, welches entweder so "broken" ist, dass configure das eigene
|
||||||
Achtung: bitte bei der Installation von GNU sed sicherstellen, dass
|
Shell-Script waehlt, oder eines, das funktioniert. Leider ist mindestens
|
||||||
immer dieses und nie das von A/UX verwendet wird (also $PATH entsprechend
|
ein Binary im Umlauf, das Probleme macht.
|
||||||
anpassen bzw. die A/UX-Version komplett ersetzen)!
|
Bezugsquelle:
|
||||||
|
ftp://arthur.ath.cx/pub/UNIX/AUX/Software/Tools/fileutils-4.0.tar.gz
|
||||||
|
|
||||||
- libUTIL.a
|
- libUTIL.a
|
||||||
Bezugsquellen:
|
Bezugsquellen:
|
||||||
http://ftp.mayn.de/pub/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz
|
http://ftp.mayn.de/pub/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz
|
||||||
ftp://arthur.ath.cx/pub/AUX/Software/Libraries/libUTIL-2.1.tar.gz
|
ftp://arthur.ath.cx/pub/AUX/Software/Libraries/libUTIL-2.1.tar.gz
|
||||||
|
|
||||||
Diese Library beinhaltet Systemfunktionen, die auf UNIXoiden Systemen
|
|
||||||
gaengig, unter A/UX jedoch leider nicht verfuegbar sind. Dazu gehoert
|
|
||||||
u.a. memmove(), strerror() und strdup().
|
|
||||||
|
|
||||||
Nachdem diese Pakete entsprechend installiert sind, reicht ein ganz normales
|
Nachdem diese Pakete entsprechend installiert sind, reicht ein ganz normales
|
||||||
"./configure" und "make" aus, um den ngIRCd unter A/UX zu compilieren.
|
"./configure" und "make" aus, um den ngIRCd unter A/UX zu compilieren.
|
||||||
|
|
||||||
@@ -55,14 +59,13 @@ Noch ein paar Hinweise, wenn es doch (noch) nicht klappt:
|
|||||||
unbedingt ausserhalb von /bin (z.B. unter /usr/local/bin) installiert
|
unbedingt ausserhalb von /bin (z.B. unter /usr/local/bin) installiert
|
||||||
werden. Ansonsten waehlt es das configure-Script als Shell aus, leider
|
werden. Ansonsten waehlt es das configure-Script als Shell aus, leider
|
||||||
funktioniert das aber nicht.
|
funktioniert das aber nicht.
|
||||||
|
Das config.status-Script sollte mit der ksh als Interpreter erstellt
|
||||||
|
worden sein (siehe erste Zeile davon!).
|
||||||
|
|
||||||
- da die /bin/sh von A/UX recht limitiert ist, kann sie u.a. nicht zum
|
|
||||||
Erzeugen des "config.status"-Scripts verwendet werden.
|
Hier die Zeiten von Alex System (Macintosh SE/30, 32 MB, A/UX 3.0.1):
|
||||||
Abhilfe: /bin/sh umbenennen (z.B. in "/bin/sh.AUX") und durch einen (am
|
configure: 7:33, make: 12:02
|
||||||
besten symbolischen) Link auf /bin/ksh ersetzen.
|
|
||||||
Dieser Schritt sollte keine Probleme nach sich ziehen und ist daher immer,
|
|
||||||
auch unabhaengig vom ngIRCd, empfehlenswert.
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: README-AUX.txt,v 1.4 2002/11/11 00:59:11 alex Exp $
|
$Id: README-AUX.txt,v 1.3 2002/04/29 14:19:48 alex Exp $
|
||||||
|
@@ -11,19 +11,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
0. Upgrade Information
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Differences to version 0.5.x
|
|
||||||
|
|
||||||
- Starting with version 0.6.0, other servers are identified using asyncronous
|
|
||||||
passwords: therefore the variable "Password" in [Server]-sections has been
|
|
||||||
replaced by "MyPassword" and "PeerPassword".
|
|
||||||
|
|
||||||
- New configuration variables, section [Global]: MaxConnections, MaxJoins
|
|
||||||
(see example configuration file "doc/en/sample-ngircd.conf"!).
|
|
||||||
|
|
||||||
|
|
||||||
I. Standard-Installation
|
I. Standard-Installation
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -136,4 +123,4 @@ number. In both cases the server exits after the output.
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: INSTALL,v 1.3 2002/12/18 12:19:07 alex Exp $
|
$Id: INSTALL,v 1.2 2002/05/20 12:02:58 alex Exp $
|
||||||
|
@@ -9,10 +9,10 @@
|
|||||||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
#
|
#
|
||||||
# $Id: Makefile.am,v 1.2 2002/11/18 14:06:29 alex Exp $
|
# $Id: Makefile.am,v 1.1 2002/05/09 10:17:05 alex Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
EXTRA_DIST = INSTALL README sample-ngircd.conf
|
EXTRA_DIST = INSTALL README
|
||||||
|
|
||||||
maintainer-clean-local:
|
maintainer-clean-local:
|
||||||
rm -f Makefile Makefile.in
|
rm -f Makefile Makefile.in
|
||||||
|
@@ -32,8 +32,8 @@ Till today (more or less complete) implemented IRC-commands:
|
|||||||
|
|
||||||
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
|
ADMIN, AWAY, CHANINFO, CONNECT, DIE, ERROR, INVITE, ISON, JOIN, KICK, KILL,
|
||||||
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
|
LINKS, LIST, LUSERS, MODE, MOTD, NAMES, NICK, NJOIN, NOTICE, OPER, PART,
|
||||||
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TIME, TOPIC,
|
PASS, PING, PONG, PRIVMSG, QUIT, RESTART, SERVER, SQUIT, TOPIC, USERHOST,
|
||||||
USERHOST, USER, VERSION, WHO, WHOIS.
|
USER, VERSION, WHO, WHOIS.
|
||||||
|
|
||||||
|
|
||||||
III. Features (or: why use ngIRCd?)
|
III. Features (or: why use ngIRCd?)
|
||||||
@@ -98,4 +98,4 @@ to post a mail to: <alex@barton.de> or <alex@arthur.ath.cx>
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: README,v 1.7 2002/11/24 18:48:59 alex Exp $
|
$Id: README,v 1.6 2002/09/16 11:03:05 alex Exp $
|
||||||
|
@@ -1,138 +0,0 @@
|
|||||||
# $Id: sample-ngircd.conf,v 1.4 2002/12/18 12:19:07 alex Exp $
|
|
||||||
|
|
||||||
#
|
|
||||||
# This is a sample configuration for the ngIRCd, which must adept to the
|
|
||||||
# local preferences and needs.
|
|
||||||
#
|
|
||||||
# Comments are started with "#" or ";".
|
|
||||||
#
|
|
||||||
# Author: Alexander Barton, <alex@barton.de>
|
|
||||||
# Translation by Ilja Osthoff, <ilja@glide.ath.cx>
|
|
||||||
#
|
|
||||||
|
|
||||||
[Global]
|
|
||||||
|
|
||||||
# In the [global] section of this file, there is the place of the
|
|
||||||
# main server configuration. Needed is only the variable "Name",
|
|
||||||
# Info you can adjust, if you like to. For all the others variables,
|
|
||||||
# you can use the defaults, this means you can leave it by default.
|
|
||||||
|
|
||||||
# Server name in the IRC-network
|
|
||||||
Name = irc.the.net
|
|
||||||
|
|
||||||
# Info-text of the server. This will be shown i.e. by a WHOIS- or
|
|
||||||
# LINKS-request.
|
|
||||||
Info = Server Info Text
|
|
||||||
|
|
||||||
# Information about the server and administrator in the ADMIN-request
|
|
||||||
;AdminInfo1 = Description
|
|
||||||
;AdminInfo2 = Location
|
|
||||||
;AdminEMail = admin@irc.server
|
|
||||||
|
|
||||||
# Ports, on which the server will listen. There may be more than
|
|
||||||
# one port, separated with ";". (Default: 6667)
|
|
||||||
;Ports = 6667, 6668, 66694
|
|
||||||
|
|
||||||
# Textfile with the "message of the day" (MOTD). This will be shown
|
|
||||||
# on a user connection with the server.
|
|
||||||
;MotdFile = /usr/local/etc/ngircd.motd
|
|
||||||
|
|
||||||
# User-ID, under which the server is started (for that the server
|
|
||||||
# must be started with root-rights). You can use the name of the
|
|
||||||
# user or the numerical ID.
|
|
||||||
# ATTENTION: the configuration and the MOTD file must be readable
|
|
||||||
# by this user, otherwise RESTART won't work!
|
|
||||||
;ServerUID = 65534
|
|
||||||
|
|
||||||
# Group-ID, under which the server is running (for that the server
|
|
||||||
# must be started with root-rights). You can use the name of the
|
|
||||||
# group or the numerical ID.
|
|
||||||
;ServerGID = 65534
|
|
||||||
|
|
||||||
# After <PingTimeout> seconds, the server will send a ping after
|
|
||||||
# inactivity of this client.
|
|
||||||
;PingTimeout = 120
|
|
||||||
|
|
||||||
# If there is an answer of a client, to which the ping was sended,
|
|
||||||
# not after <PongTimeout> seconds, it will be disconnected.
|
|
||||||
;PongTimeout = 20
|
|
||||||
|
|
||||||
# The server tries every <ConnectRetry> seconds, not yet connected
|
|
||||||
# or not anymore connected servers to connect.
|
|
||||||
;ConnectRetry = 60
|
|
||||||
|
|
||||||
# Should IRC-operators be allowed to use the MODE command even if
|
|
||||||
# they are not(!) channel-operators?
|
|
||||||
;OperCanUseMode = no
|
|
||||||
|
|
||||||
# Maximum number of simultanous connection the server is allowed
|
|
||||||
# to accept (<=0: unlimited):
|
|
||||||
;MaxConnections = -1
|
|
||||||
|
|
||||||
# Maximum number of channels a user can be member of (<=0: no limit):
|
|
||||||
;MaxJoins = 10
|
|
||||||
|
|
||||||
[Operator]
|
|
||||||
# In this [operator]-section, there will be the configuration of
|
|
||||||
# the name and password of an IRC operator. There may be more than
|
|
||||||
# one operator-block (for each operator one).
|
|
||||||
|
|
||||||
# ID of the operator (may be different of the nick)
|
|
||||||
;Name = TheOper
|
|
||||||
|
|
||||||
# Password of the operator
|
|
||||||
;Password = ThePwd
|
|
||||||
|
|
||||||
[Server]
|
|
||||||
# In this [Server] section, there is the configuration of the
|
|
||||||
# servers, which are allowed to connect to your own server.
|
|
||||||
# There may be more than one server-block.
|
|
||||||
# If you configured a port for the connection, then the ngIRCd
|
|
||||||
# tries to connect to this port. If not, it waits for the other
|
|
||||||
# server.
|
|
||||||
#
|
|
||||||
# Server-groups:
|
|
||||||
# The ngIRCd allows "server-groups": that means, that you can assign
|
|
||||||
# server-groups for every server, to which you want the ngIRCd to
|
|
||||||
# connect to. If one server of a server-group won't answer, the
|
|
||||||
# ngIRCd tries the next one of this group.
|
|
||||||
# ATTENTION: Server-groups will only work if you defined a port!
|
|
||||||
|
|
||||||
# IRC-name of the server
|
|
||||||
;Name = irc2.the.net
|
|
||||||
|
|
||||||
# Hostname of the server
|
|
||||||
;Host = connect-to-host.the.net
|
|
||||||
|
|
||||||
# Port of the server, to which the ngIRCd should connect. If you
|
|
||||||
# assign no port, the ngIRCd waits for an answer of that server.
|
|
||||||
;Port = 6666
|
|
||||||
|
|
||||||
# Own password for the connection. This password has to be configured
|
|
||||||
# as "PeerPassword" on the other server.
|
|
||||||
;MyPassword = MySecret
|
|
||||||
|
|
||||||
# Foreign password for this connection. This password has to be
|
|
||||||
# configured as "MyPassword" on the other server.
|
|
||||||
;PeerPassword = PeerSecret
|
|
||||||
|
|
||||||
# Group of that server (optional)
|
|
||||||
;Group = 123
|
|
||||||
|
|
||||||
[Channel]
|
|
||||||
# In the [Channel] there can be defined "persistent channels". This
|
|
||||||
# means, that the server creates the channel and even if all users
|
|
||||||
# left this channel, it will persist. There may be more than one
|
|
||||||
# block. Signed with the mode "P", which can be set or unset, like
|
|
||||||
# normal modes.
|
|
||||||
|
|
||||||
# Name of the channel
|
|
||||||
;Name = #TheName
|
|
||||||
|
|
||||||
# Topic for the channel
|
|
||||||
;Topic = a great topic
|
|
||||||
|
|
||||||
# Channel-modes
|
|
||||||
;Modes = tn
|
|
||||||
|
|
||||||
# -eof-
|
|
@@ -1,4 +1,4 @@
|
|||||||
# $Id: sample-ngircd.conf,v 1.17 2002/12/18 12:19:07 alex Exp $
|
# $Id: sample-ngircd.conf,v 1.11 2002/09/16 10:33:09 alex Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# Das ist eine Beispiel-Konfiguration fuer den ngIRCd, die an die
|
# Das ist eine Beispiel-Konfiguration fuer den ngIRCd, die an die
|
||||||
@@ -6,11 +6,6 @@
|
|||||||
#
|
#
|
||||||
# Kommentare werden mit "#" oder ";" eingeleitet.
|
# Kommentare werden mit "#" oder ";" eingeleitet.
|
||||||
#
|
#
|
||||||
# +-----------------------------------------------------------------------+
|
|
||||||
# | Please note: English translations of some of the german documentation |
|
|
||||||
# | files can be found in the directory "doc/en" -- please have a look! |
|
|
||||||
# +-----------------------------------------------------------------------+
|
|
||||||
#
|
|
||||||
# Autor: Alexander Barton, <alex@barton.de>
|
# Autor: Alexander Barton, <alex@barton.de>
|
||||||
# Erweiterungen von Ilja Osthoff, <ilja@glide.ath.cx>
|
# Erweiterungen von Ilja Osthoff, <ilja@glide.ath.cx>
|
||||||
#
|
#
|
||||||
@@ -47,16 +42,14 @@
|
|||||||
;MotdFile = /usr/local/etc/ngircd.motd
|
;MotdFile = /usr/local/etc/ngircd.motd
|
||||||
|
|
||||||
# User-ID, unter der der Daemon laufen soll (dazu muss der Server
|
# User-ID, unter der der Daemon laufen soll (dazu muss der Server
|
||||||
# jedoch mit root-Rechten gestartet werden). Es kann der Name oder
|
# jedoch mit root-Rechten gestartet werden).
|
||||||
# die numerische ID angegeben werden.
|
|
||||||
# ACHTUNG: Die Konfigurations- und MOTD-Datei muessen fuer diesen
|
# ACHTUNG: Die Konfigurations- und MOTD-Datei muessen fuer diesen
|
||||||
# Benutzer lesbar sein, ansonsten schlaegt ein RESTART fehl!
|
# Benutzer lesbar sein, ansonsten schlaegt ein RESTART fehl!
|
||||||
;ServerUID = ircd
|
;ServerUID = 65534
|
||||||
|
|
||||||
# Group-ID, zu der der Daemon wechseln soll (hierzu muss der Server
|
# Group-ID, zu der der Daemon wechseln soll (hierzu muss der Server
|
||||||
# jedoch mit root-Rechten gestartet werden). Es kann der Name oder
|
# jedoch mit root-Rechten gestartet werden)
|
||||||
# die numerische ID angegeben werden.
|
;ServerGID = 65534
|
||||||
;ServerGID = daemon
|
|
||||||
|
|
||||||
# Nach <PingTimeout> Sekunden verschickt der Server bei Inaktivitaet
|
# Nach <PingTimeout> Sekunden verschickt der Server bei Inaktivitaet
|
||||||
# von einem Client diesem ein PING.
|
# von einem Client diesem ein PING.
|
||||||
@@ -74,14 +67,6 @@
|
|||||||
# koennen, auch wenn sie kein(!) Channel-Operator sind?
|
# koennen, auch wenn sie kein(!) Channel-Operator sind?
|
||||||
;OperCanUseMode = no
|
;OperCanUseMode = no
|
||||||
|
|
||||||
# Maximale Anzahl von gleichzeitigen Verbindungen, die dieser
|
|
||||||
# Server annehmen darf (<=0: unlimitiert).
|
|
||||||
;MaxConnections = -1
|
|
||||||
|
|
||||||
# Maximale Anzahl von Channels, in denen ein User zeitgleich
|
|
||||||
# Mitglied sein kann (<=0: unlimitiert).
|
|
||||||
;MaxJoins = 10
|
|
||||||
|
|
||||||
[Operator]
|
[Operator]
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -119,24 +104,19 @@
|
|||||||
# die Gegenseite angegeben hat!
|
# die Gegenseite angegeben hat!
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Hostname des Servers
|
||||||
|
;Host = connect-to-host.the.net
|
||||||
|
|
||||||
# IRC-Name des Servers
|
# IRC-Name des Servers
|
||||||
;Name = irc2.the.net
|
;Name = irc2.the.net
|
||||||
|
|
||||||
# DNS-Hostname des Servers
|
|
||||||
;Host = connect-to-host.the.net
|
|
||||||
|
|
||||||
# Port, zu dem dieser Server eine Verbindung herstellen soll. Wird
|
# Port, zu dem dieser Server eine Verbindung herstellen soll. Wird
|
||||||
# kein Port angegeben, so wird auf eine Verbindung der Gegenseite
|
# kein Port angegeben, so wird auf eine Verbindung der Gegenseite
|
||||||
# gewartet.
|
# gewartet.
|
||||||
;Port = 6666
|
;Port = 6666
|
||||||
|
|
||||||
# Eigenes Passwort fuer diese Verbindung. Dieses Passwort muss auf
|
# Passwort fuer diese Verbindung
|
||||||
# dem anderen Server als "PeerPassword" konfiguriert werden.
|
;Password = ThePwd1
|
||||||
;MyPassword = MySecret
|
|
||||||
|
|
||||||
# Passwort des Peer-Servers fuer diese Verbindung. Dieses Passwort
|
|
||||||
# muss auf dem anderen Server als "MyPassword" konfiguriert sein.
|
|
||||||
;PeerPassword = PeerSecret
|
|
||||||
|
|
||||||
# Gruppe, zu der dieser Server gehoert (optional).
|
# Gruppe, zu der dieser Server gehoert (optional).
|
||||||
;Group = 123
|
;Group = 123
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $Id: ngircd.8,v 1.5 2002/11/18 18:49:34 alex Exp $
|
.\" $Id: ngircd.8,v 1.4 2002/09/16 11:11:21 alex Exp $
|
||||||
.\"
|
.\"
|
||||||
.TH ngircd 8 "September 2002" ngircd "ngIRCd Manual"
|
.TH ngircd 8 "September 2002" ngircd "ngIRCd Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@@ -24,7 +24,7 @@ use
|
|||||||
.I file
|
.I file
|
||||||
as configuration file.
|
as configuration file.
|
||||||
.IP "-n, --nodaemon"
|
.IP "-n, --nodaemon"
|
||||||
don't fork and don't detach from controlling terminal.
|
don't fork and don't detatch from controlling terminal.
|
||||||
.IP "-p, --passive"
|
.IP "-p, --passive"
|
||||||
disable automatic connections to other servers.
|
disable automatic connections to other servers.
|
||||||
.IP --version
|
.IP --version
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
#
|
#
|
||||||
# $Id: Makefile.am,v 1.31.2.1 2003/01/04 10:58:15 alex Exp $
|
# $Id: Makefile.am,v 1.27 2002/09/07 18:06:29 alex Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
||||||
@@ -21,20 +21,20 @@ LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN
|
|||||||
sbin_PROGRAMS = ngircd
|
sbin_PROGRAMS = ngircd
|
||||||
|
|
||||||
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \
|
ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \
|
||||||
irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c irc-oper.c \
|
irc-channel.c irc-login.c irc-mode.c irc-op.c irc-oper.c irc-server.c \
|
||||||
irc-server.c irc-write.c lists.c log.c match.c parse.c resolve.c tool.c
|
irc-write.c lists.c log.c match.c parse.c resolve.c tool.c
|
||||||
|
|
||||||
ngircd_LDFLAGS = -L../portab
|
ngircd_LDFLAGS = -L../portab
|
||||||
|
|
||||||
ngircd_LDADD = -lngportab
|
ngircd_LDADD = -lngportab
|
||||||
|
|
||||||
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \
|
noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \
|
||||||
irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h irc-oper.h \
|
irc-channel.h irc-login.h irc-mode.h irc-op.h irc-oper.h irc-server.h \
|
||||||
irc-server.h irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \
|
irc-write.h lists.h log.h match.h parse.h resolve.h tool.h \
|
||||||
messages.h defines.h
|
messages.h defines.h
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f check-version check-help lint.out cvs-version.*
|
rm -f check-version check-help lint.out
|
||||||
|
|
||||||
maintainer-clean-local:
|
maintainer-clean-local:
|
||||||
rm -f Makefile Makefile.in
|
rm -f Makefile Makefile.in
|
||||||
@@ -60,16 +60,6 @@ lint:
|
|||||||
fi; \
|
fi; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
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 -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
|
|
||||||
|
|
||||||
TESTS = check-version check-help
|
TESTS = check-version check-help
|
||||||
|
|
||||||
# -eof-
|
# -eof-
|
||||||
|
@@ -2,13 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Channel management
|
* $Id: channel.c,v 1.32.2.1 2002/11/04 19:18:39 alex Exp $
|
||||||
|
*
|
||||||
|
* channel.c: Management der Channels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -17,8 +20,6 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: channel.c,v 1.38 2002/12/16 23:05:24 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -88,14 +89,6 @@ Channel_InitPredefined( VOID )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gibt es den Channel bereits? */
|
|
||||||
chan = Channel_Search( Conf_Channel[i].name );
|
|
||||||
if( chan )
|
|
||||||
{
|
|
||||||
Log( LOG_INFO, "Can't create pre-defined channel \"%s\": name already in use.", Conf_Channel[i].name );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Channel anlegen */
|
/* Channel anlegen */
|
||||||
chan = Channel_Create( Conf_Channel[i].name );
|
chan = Channel_Create( Conf_Channel[i].name );
|
||||||
if( chan )
|
if( chan )
|
||||||
@@ -292,48 +285,6 @@ Channel_MemberCount( CHANNEL *Chan )
|
|||||||
} /* Channel_MemberCount */
|
} /* Channel_MemberCount */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL INT
|
|
||||||
Channel_CountForUser( CLIENT *Client )
|
|
||||||
{
|
|
||||||
/* Count number of channels a user is member of. */
|
|
||||||
|
|
||||||
CL2CHAN *cl2chan;
|
|
||||||
INT count;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
cl2chan = My_Cl2Chan;
|
|
||||||
while( cl2chan )
|
|
||||||
{
|
|
||||||
if( cl2chan->client == Client ) count++;
|
|
||||||
cl2chan = cl2chan->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
} /* Channel_CountForUser */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL INT
|
|
||||||
Channel_PCount( VOID )
|
|
||||||
{
|
|
||||||
/* Count the number of persistent (mode 'P') channels */
|
|
||||||
|
|
||||||
CHANNEL *chan;
|
|
||||||
INT count;
|
|
||||||
|
|
||||||
count = 0;
|
|
||||||
chan = My_Channels;
|
|
||||||
while( chan )
|
|
||||||
{
|
|
||||||
if( strchr( chan->modes, 'P' )) count++;
|
|
||||||
chan = chan->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
} /* Channel_PCount */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL CHAR *
|
GLOBAL CHAR *
|
||||||
Channel_Name( CHANNEL *Chan )
|
Channel_Name( CHANNEL *Chan )
|
||||||
{
|
{
|
||||||
@@ -350,22 +301,6 @@ Channel_Modes( CHANNEL *Chan )
|
|||||||
} /* Channel_Modes */
|
} /* Channel_Modes */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL CHAR *
|
|
||||||
Channel_Key( CHANNEL *Chan )
|
|
||||||
{
|
|
||||||
assert( Chan != NULL );
|
|
||||||
return Chan->key;
|
|
||||||
} /* Channel_Key */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL LONG
|
|
||||||
Channel_MaxUsers( CHANNEL *Chan )
|
|
||||||
{
|
|
||||||
assert( Chan != NULL );
|
|
||||||
return Chan->maxusers;
|
|
||||||
} /* Channel_MaxUsers */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL CHANNEL *
|
GLOBAL CHANNEL *
|
||||||
Channel_First( VOID )
|
Channel_First( VOID )
|
||||||
{
|
{
|
||||||
@@ -645,27 +580,6 @@ Channel_SetModes( CHANNEL *Chan, CHAR *Modes )
|
|||||||
} /* Channel_SetModes */
|
} /* Channel_SetModes */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID
|
|
||||||
Channel_SetKey( CHANNEL *Chan, CHAR *Key )
|
|
||||||
{
|
|
||||||
assert( Chan != NULL );
|
|
||||||
assert( Key != NULL );
|
|
||||||
|
|
||||||
strncpy( Chan->key, Key, CLIENT_PASS_LEN - 1 );
|
|
||||||
Chan->key[CLIENT_PASS_LEN - 1] = '\0';
|
|
||||||
Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
|
|
||||||
} /* Channel_SetKey */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID
|
|
||||||
Channel_SetMaxUsers( CHANNEL *Chan, LONG Count )
|
|
||||||
{
|
|
||||||
assert( Chan != NULL );
|
|
||||||
|
|
||||||
Chan->maxusers = Count;
|
|
||||||
Log( LOG_DEBUG, "Channel %s: Member limit is now %ld.", Chan->name, Chan->maxusers );
|
|
||||||
} /* Channel_SetMaxUsers */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
|
Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
|
||||||
@@ -715,8 +629,6 @@ Channel_Create( CHAR *Name )
|
|||||||
strcpy( c->modes, "" );
|
strcpy( c->modes, "" );
|
||||||
strcpy( c->topic, "" );
|
strcpy( c->topic, "" );
|
||||||
c->hash = Hash( c->name );
|
c->hash = Hash( c->name );
|
||||||
strcpy( c->key, "" );
|
|
||||||
c->maxusers = 0;
|
|
||||||
|
|
||||||
/* Verketten */
|
/* Verketten */
|
||||||
c->next = My_Channels;
|
c->next = My_Channels;
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: channel.h,v 1.26 2002/12/16 23:05:24 alex Exp $
|
* $Id: channel.h,v 1.21.2.1 2002/11/04 19:18:39 alex Exp $
|
||||||
*
|
*
|
||||||
* Channel management (header)
|
* channel.h: Management der Channels (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -25,12 +26,10 @@
|
|||||||
typedef struct _CHANNEL
|
typedef struct _CHANNEL
|
||||||
{
|
{
|
||||||
struct _CHANNEL *next;
|
struct _CHANNEL *next;
|
||||||
CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */
|
CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */
|
||||||
UINT32 hash; /* Hash of the (lowecase!) name */
|
UINT32 hash; /* Hash ueber (kleingeschrieben) Namen */
|
||||||
CHAR modes[CHANNEL_MODE_LEN]; /* Channel modes */
|
CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */
|
||||||
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic of the channel */
|
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */
|
||||||
CHAR key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
|
|
||||||
LONG maxusers; /* Maximum number of members (mode "l") */
|
|
||||||
} CHANNEL;
|
} CHANNEL;
|
||||||
|
|
||||||
typedef struct _CLIENT2CHAN
|
typedef struct _CLIENT2CHAN
|
||||||
@@ -49,60 +48,54 @@ typedef POINTER CL2CHAN;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID Channel_Init PARAMS(( VOID ));
|
GLOBAL VOID Channel_Init PARAMS((VOID ));
|
||||||
GLOBAL VOID Channel_InitPredefined PARAMS(( VOID ));
|
GLOBAL VOID Channel_InitPredefined PARAMS(( VOID ));
|
||||||
GLOBAL VOID Channel_Exit PARAMS(( VOID ));
|
GLOBAL VOID Channel_Exit PARAMS((VOID ));
|
||||||
|
|
||||||
GLOBAL BOOLEAN Channel_Join PARAMS(( CLIENT *Client, CHAR *Name ));
|
GLOBAL BOOLEAN Channel_Join PARAMS((CLIENT *Client, CHAR *Name ));
|
||||||
GLOBAL BOOLEAN Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
|
GLOBAL BOOLEAN Channel_Part PARAMS((CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
|
||||||
|
|
||||||
GLOBAL VOID Channel_Quit PARAMS(( CLIENT *Client, CHAR *Reason ));
|
GLOBAL VOID Channel_Quit PARAMS((CLIENT *Client, CHAR *Reason ));
|
||||||
|
|
||||||
GLOBAL VOID Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
|
GLOBAL VOID Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ));
|
||||||
|
|
||||||
GLOBAL LONG Channel_Count PARAMS(( VOID ));
|
GLOBAL LONG Channel_Count PARAMS((VOID ));
|
||||||
GLOBAL LONG Channel_MemberCount PARAMS(( CHANNEL *Chan ));
|
GLOBAL LONG Channel_MemberCount PARAMS((CHANNEL *Chan ));
|
||||||
GLOBAL INT Channel_CountForUser PARAMS(( CLIENT *Client ));
|
|
||||||
GLOBAL INT Channel_PCount PARAMS(( VOID ));
|
|
||||||
|
|
||||||
GLOBAL CHAR *Channel_Name PARAMS(( CHANNEL *Chan ));
|
GLOBAL CHAR *Channel_Name PARAMS((CHANNEL *Chan ));
|
||||||
GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan ));
|
GLOBAL CHAR *Channel_Modes PARAMS((CHANNEL *Chan ));
|
||||||
GLOBAL CHAR *Channel_Topic PARAMS(( CHANNEL *Chan ));
|
GLOBAL CHAR *Channel_Topic PARAMS((CHANNEL *Chan ));
|
||||||
GLOBAL CHAR *Channel_Key PARAMS(( CHANNEL *Chan ));
|
|
||||||
GLOBAL LONG Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
|
|
||||||
|
|
||||||
GLOBAL VOID Channel_SetTopic PARAMS(( CHANNEL *Chan, CHAR *Topic ));
|
GLOBAL VOID Channel_SetTopic PARAMS((CHANNEL *Chan, CHAR *Topic ));
|
||||||
GLOBAL VOID Channel_SetModes PARAMS(( CHANNEL *Chan, CHAR *Modes ));
|
GLOBAL VOID Channel_SetModes PARAMS((CHANNEL *Chan, CHAR *Modes ));
|
||||||
GLOBAL VOID Channel_SetKey PARAMS(( CHANNEL *Chan, CHAR *Key ));
|
|
||||||
GLOBAL VOID Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, LONG Count ));
|
|
||||||
|
|
||||||
GLOBAL CHANNEL *Channel_Search PARAMS(( CHAR *Name ));
|
GLOBAL CHANNEL *Channel_Search PARAMS((CHAR *Name ));
|
||||||
|
|
||||||
GLOBAL CHANNEL *Channel_First PARAMS(( VOID ));
|
GLOBAL CHANNEL *Channel_First PARAMS((VOID ));
|
||||||
GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan ));
|
GLOBAL CHANNEL *Channel_Next PARAMS((CHANNEL *Chan ));
|
||||||
|
|
||||||
GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan ));
|
GLOBAL CL2CHAN *Channel_FirstMember PARAMS((CHANNEL *Chan ));
|
||||||
GLOBAL CL2CHAN *Channel_NextMember PARAMS(( CHANNEL *Chan, CL2CHAN *Cl2Chan ));
|
GLOBAL CL2CHAN *Channel_NextMember PARAMS((CHANNEL *Chan, CL2CHAN *Cl2Chan ));
|
||||||
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS(( CLIENT *Client ));
|
GLOBAL CL2CHAN *Channel_FirstChannelOf PARAMS((CLIENT *Client ));
|
||||||
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan ));
|
GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS((CLIENT *Client, CL2CHAN *Cl2Chan ));
|
||||||
|
|
||||||
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
|
GLOBAL CLIENT *Channel_GetClient PARAMS((CL2CHAN *Cl2Chan ));
|
||||||
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
|
GLOBAL CHANNEL *Channel_GetChannel PARAMS((CL2CHAN *Cl2Chan ));
|
||||||
|
|
||||||
GLOBAL BOOLEAN Channel_IsValidName PARAMS(( CHAR *Name ));
|
GLOBAL BOOLEAN Channel_IsValidName PARAMS((CHAR *Name ));
|
||||||
|
|
||||||
GLOBAL BOOLEAN Channel_ModeAdd PARAMS(( CHANNEL *Chan, CHAR Mode ));
|
GLOBAL BOOLEAN Channel_ModeAdd PARAMS((CHANNEL *Chan, CHAR Mode ));
|
||||||
GLOBAL BOOLEAN Channel_ModeDel PARAMS(( CHANNEL *Chan, CHAR Mode ));
|
GLOBAL BOOLEAN Channel_ModeDel PARAMS((CHANNEL *Chan, CHAR Mode ));
|
||||||
|
|
||||||
GLOBAL BOOLEAN Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
|
GLOBAL BOOLEAN Channel_UserModeAdd PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
|
||||||
GLOBAL BOOLEAN Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
|
GLOBAL BOOLEAN Channel_UserModeDel PARAMS((CHANNEL *Chan, CLIENT *Client, CHAR Mode ));
|
||||||
GLOBAL CHAR *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client ));
|
GLOBAL CHAR *Channel_UserModes PARAMS((CHANNEL *Chan, CLIENT *Client ));
|
||||||
|
|
||||||
GLOBAL BOOLEAN Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client ));
|
GLOBAL BOOLEAN Channel_IsMemberOf PARAMS((CHANNEL *Chan, CLIENT *Client ));
|
||||||
|
|
||||||
GLOBAL BOOLEAN Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ));
|
GLOBAL BOOLEAN Channel_Write PARAMS((CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ));
|
||||||
|
|
||||||
GLOBAL CHANNEL *Channel_Create PARAMS(( CHAR *Name ));
|
GLOBAL CHANNEL *Channel_Create PARAMS((CHAR *Name ));
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2,13 +2,23 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Client management.
|
* $Id: client.c,v 1.60.2.2 2002/11/04 19:18:39 alex Exp $
|
||||||
|
*
|
||||||
|
* client.c: Management aller Clients
|
||||||
|
*
|
||||||
|
* Der Begriff "Client" ist in diesem Fall evtl. etwas verwirrend: Clients sind
|
||||||
|
* alle Verbindungen, die im gesamten(!) IRC-Netzwerk bekannt sind. Das sind IRC-
|
||||||
|
* Clients (User), andere Server und IRC-Services.
|
||||||
|
* Ueber welchen IRC-Server die Verbindung nun tatsaechlich in das Netzwerk her-
|
||||||
|
* gestellt wurde, muss der jeweiligen Struktur entnommen werden. Ist es dieser
|
||||||
|
* Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -17,8 +27,6 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: client.c,v 1.65.2.3 2003/01/08 23:13:45 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -57,10 +65,6 @@ LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type ));
|
|||||||
|
|
||||||
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
|
LOCAL CLIENT *New_Client_Struct PARAMS(( VOID ));
|
||||||
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
|
LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client ));
|
||||||
LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client ));
|
|
||||||
|
|
||||||
|
|
||||||
LONG Max_Users = 0, My_Max_Users = 0;
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID
|
GLOBAL VOID
|
||||||
@@ -181,9 +185,6 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *
|
|||||||
client->next = (POINTER *)My_Clients;
|
client->next = (POINTER *)My_Clients;
|
||||||
My_Clients = client;
|
My_Clients = client;
|
||||||
|
|
||||||
/* Adjust counters */
|
|
||||||
Adjust_Counters( client );
|
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
} /* Client_New */
|
} /* Client_New */
|
||||||
|
|
||||||
@@ -374,7 +375,7 @@ Client_SetFlags( CLIENT *Client, CHAR *Flags )
|
|||||||
assert( Flags != NULL );
|
assert( Flags != NULL );
|
||||||
|
|
||||||
strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
|
strncpy( Client->flags, Flags, CLIENT_FLAGS_LEN - 1 );
|
||||||
Client->flags[CLIENT_FLAGS_LEN - 1] = '\0';
|
Client->modes[CLIENT_FLAGS_LEN - 1] = '\0';
|
||||||
} /* Client_SetFlags */
|
} /* Client_SetFlags */
|
||||||
|
|
||||||
|
|
||||||
@@ -394,14 +395,24 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd )
|
|||||||
GLOBAL VOID
|
GLOBAL VOID
|
||||||
Client_SetAway( CLIENT *Client, CHAR *Txt )
|
Client_SetAway( CLIENT *Client, CHAR *Txt )
|
||||||
{
|
{
|
||||||
/* Set AWAY reason of client */
|
/* Von einem Client gelieferte AWAY-Nachricht */
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Txt != NULL );
|
|
||||||
|
|
||||||
strncpy( Client->away, Txt, CLIENT_AWAY_LEN - 1 );
|
if( Txt )
|
||||||
Client->away[CLIENT_AWAY_LEN - 1] = '\0';
|
{
|
||||||
Log( LOG_DEBUG, "User \"%s\" is away: %s", Client_Mask( Client ), 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 ));
|
||||||
|
}
|
||||||
} /* Client_SetAway */
|
} /* Client_SetAway */
|
||||||
|
|
||||||
|
|
||||||
@@ -411,7 +422,6 @@ Client_SetType( CLIENT *Client, INT Type )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
Client->type = Type;
|
Client->type = Type;
|
||||||
if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
|
if( Type == CLIENT_SERVER ) Generate_MyToken( Client );
|
||||||
Adjust_Counters( Client );
|
|
||||||
} /* Client_SetType */
|
} /* Client_SetType */
|
||||||
|
|
||||||
|
|
||||||
@@ -798,9 +808,8 @@ Client_CheckID( CLIENT *Client, CHAR *ID )
|
|||||||
if( strcasecmp( c->id, ID ) == 0 )
|
if( strcasecmp( c->id, ID ) == 0 )
|
||||||
{
|
{
|
||||||
/* die Server-ID gibt es bereits */
|
/* die Server-ID gibt es bereits */
|
||||||
sprintf( str, "ID \"%s\" already registered", ID );
|
sprintf( str, "ID \"%s\" already registered!", ID );
|
||||||
if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id );
|
Log( LOG_ERR, "%s (on connection %d)", str, Client->conn_id );
|
||||||
else Log( LOG_ERR, "%s (via network)!", str );
|
|
||||||
Conn_Close( Client->conn_id, str, str, TRUE );
|
Conn_Close( Client->conn_id, str, str, TRUE );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -917,20 +926,6 @@ Client_UnknownCount( VOID )
|
|||||||
} /* Client_UnknownCount */
|
} /* 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
|
GLOBAL BOOLEAN
|
||||||
Client_IsValidNick( CHAR *Nick )
|
Client_IsValidNick( CHAR *Nick )
|
||||||
{
|
{
|
||||||
@@ -1053,24 +1048,4 @@ Generate_MyToken( CLIENT *Client )
|
|||||||
} /* Generate_MyToken */
|
} /* 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- */
|
/* -eof- */
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: client.h,v 1.32.2.1 2002/12/22 23:42:28 alex Exp $
|
* $Id: client.h,v 1.29.2.1 2002/11/04 19:18:39 alex Exp $
|
||||||
*
|
*
|
||||||
* Client management (header)
|
* client.h: Konfiguration des ngircd (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -18,17 +19,18 @@
|
|||||||
#define __client_h__
|
#define __client_h__
|
||||||
|
|
||||||
|
|
||||||
#define CLIENT_UNKNOWN 1 /* connection of unknown type */
|
typedef enum
|
||||||
#define CLIENT_GOTPASS 2 /* client did send PASS */
|
{
|
||||||
#define CLIENT_GOTNICK 4 /* client did send NICK */
|
CLIENT_UNKNOWN, /* Verbindung mit (noch) unbekanntem Typ */
|
||||||
#define CLIENT_GOTUSER 8 /* client did send USER */
|
CLIENT_GOTPASS, /* Client hat PASS gesendet */
|
||||||
#define CLIENT_USER 16 /* client is an IRC user */
|
CLIENT_GOTNICK, /* Client hat NICK gesendet */
|
||||||
#define CLIENT_UNKNOWNSERVER 32 /* unregistered server connection */
|
CLIENT_GOTUSER, /* Client hat USER gesendet */
|
||||||
#define CLIENT_GOTPASSSERVER 64 /* client did send PASS in "server style" */
|
CLIENT_USER, /* Client ist ein Benutzer (USER wurde gesendet) */
|
||||||
#define CLIENT_SERVER 128 /* client is a server */
|
CLIENT_UNKNOWNSERVER, /* unregistrierte Server-Verbindung */
|
||||||
#define CLIENT_SERVICE 256 /* client is a service */
|
CLIENT_GOTPASSSERVER, /* Client hat PASS nach "Server-Art" gesendet */
|
||||||
|
CLIENT_SERVER, /* Client ist ein Server */
|
||||||
#define CLIENT_TYPE INT
|
CLIENT_SERVICE /* Client ist ein Service */
|
||||||
|
} CLIENT_TYPE;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__client_c__) | defined(S_SPLINT_S)
|
#if defined(__client_c__) | defined(S_SPLINT_S)
|
||||||
@@ -37,22 +39,22 @@
|
|||||||
|
|
||||||
typedef struct _CLIENT
|
typedef struct _CLIENT
|
||||||
{
|
{
|
||||||
CHAR id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */
|
CHAR id[CLIENT_ID_LEN]; /* Nick (User) bzw. ID (Server) */
|
||||||
UINT32 hash; /* hash of lower-case ID */
|
UINT32 hash; /* Hash ueber die (kleingeschriebene) ID */
|
||||||
POINTER *next; /* pointer to next client structure */
|
POINTER *next; /* Zeiger auf naechste Client-Struktur */
|
||||||
CLIENT_TYPE type; /* type of client, see CLIENT_xxx */
|
CLIENT_TYPE type; /* Typ des Client, vgl. CLIENT_TYPE */
|
||||||
CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */
|
CONN_ID conn_id; /* ID der Connection (wenn lokal) bzw. NONE (remote) */
|
||||||
struct _CLIENT *introducer; /* ID of the servers which the client is connected to */
|
struct _CLIENT *introducer; /* ID des Servers, der die Verbindung hat */
|
||||||
struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */
|
struct _CLIENT *topserver; /* Toplevel-Servers (nur gueltig, wenn Client ein Server ist) */
|
||||||
CHAR pwd[CLIENT_PASS_LEN]; /* password received of the client */
|
CHAR pwd[CLIENT_PASS_LEN]; /* Passwort, welches der Client angegeben hat */
|
||||||
CHAR host[CLIENT_HOST_LEN]; /* hostname of the client */
|
CHAR host[CLIENT_HOST_LEN]; /* Hostname des Client */
|
||||||
CHAR user[CLIENT_USER_LEN]; /* user name ("login") */
|
CHAR user[CLIENT_USER_LEN]; /* Benutzername ("Login") */
|
||||||
CHAR info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
|
CHAR info[CLIENT_INFO_LEN]; /* Langer Benutzername (User) bzw. Infotext (Server) */
|
||||||
CHAR modes[CLIENT_MODE_LEN]; /* client modes */
|
CHAR modes[CLIENT_MODE_LEN]; /* Client Modes */
|
||||||
INT hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */
|
INT hops, token, mytoken; /* "Hops" und "Token" (-> SERVER-Befehl) */
|
||||||
BOOLEAN oper_by_me; /* client is local IRC operator on this server? */
|
BOOLEAN oper_by_me; /* IRC-Operator-Status durch diesen Server? */
|
||||||
CHAR away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */
|
CHAR away[CLIENT_AWAY_LEN]; /* AWAY-Text, wenn Mode 'a' gesetzt */
|
||||||
CHAR flags[CLIENT_FLAGS_LEN]; /* flags of the client */
|
CHAR flags[CLIENT_FLAGS_LEN]; /* Flags des Client (aktuell nur bei Servern) */
|
||||||
} CLIENT;
|
} CLIENT;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -130,8 +132,6 @@ GLOBAL LONG Client_UnknownCount PARAMS((VOID ));
|
|||||||
GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
|
GLOBAL LONG Client_MyUserCount PARAMS((VOID ));
|
||||||
GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
|
GLOBAL LONG Client_MyServiceCount PARAMS((VOID ));
|
||||||
GLOBAL LONG Client_MyServerCount 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 ));
|
GLOBAL BOOLEAN Client_IsValidNick PARAMS((CHAR *Nick ));
|
||||||
|
|
||||||
|
@@ -1,21 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Configuration management (reading, parsing & validation)
|
* $Id: conf.c,v 1.29.2.5 2002/11/24 15:25:25 alex Exp $
|
||||||
|
*
|
||||||
|
* conf.h: Konfiguration des ngircd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: conf.c,v 1.47 2002/12/18 02:53:36 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -27,11 +28,6 @@ static char UNUSED id[] = "$Id: conf.c,v 1.47 2002/12/18 02:53:36 alex Exp $";
|
|||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_CTYPE_H
|
|
||||||
# include <ctype.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ngircd.h"
|
#include "ngircd.h"
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
@@ -50,7 +46,7 @@ LOCAL BOOLEAN Use_Log = TRUE;
|
|||||||
|
|
||||||
LOCAL VOID Set_Defaults PARAMS(( VOID ));
|
LOCAL VOID Set_Defaults PARAMS(( VOID ));
|
||||||
LOCAL VOID Read_Config PARAMS(( VOID ));
|
LOCAL VOID Read_Config PARAMS(( VOID ));
|
||||||
LOCAL VOID Validate_Config PARAMS(( BOOLEAN TestOnly ));
|
LOCAL VOID Validate_Config PARAMS(( VOID ));
|
||||||
|
|
||||||
LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
|
LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
|
||||||
LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
|
LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
|
||||||
@@ -65,14 +61,14 @@ Conf_Init( VOID )
|
|||||||
{
|
{
|
||||||
Set_Defaults( );
|
Set_Defaults( );
|
||||||
Read_Config( );
|
Read_Config( );
|
||||||
Validate_Config( FALSE );
|
Validate_Config( );
|
||||||
} /* Config_Init */
|
} /* Config_Init */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL INT
|
GLOBAL INT
|
||||||
Conf_Test( VOID )
|
Conf_Test( VOID )
|
||||||
{
|
{
|
||||||
/* Read configuration, validate and output it. */
|
/* Konfiguration einlesen, ueberpruefen und ausgeben. */
|
||||||
|
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
@@ -81,10 +77,10 @@ Conf_Test( VOID )
|
|||||||
Use_Log = FALSE;
|
Use_Log = FALSE;
|
||||||
Set_Defaults( );
|
Set_Defaults( );
|
||||||
|
|
||||||
|
printf( "Using \"%s\" as configuration file ...\n", NGIRCd_ConfFile );
|
||||||
Read_Config( );
|
Read_Config( );
|
||||||
Validate_Config( TRUE );
|
|
||||||
|
|
||||||
/* If stdin is a valid tty wait for a key: */
|
/* Wenn stdin ein ein TTY ist: auf Taste warten */
|
||||||
if( isatty( fileno( stdout )))
|
if( isatty( fileno( stdout )))
|
||||||
{
|
{
|
||||||
puts( "OK, press enter to see a dump of your service configuration ..." );
|
puts( "OK, press enter to see a dump of your service configuration ..." );
|
||||||
@@ -117,17 +113,13 @@ Conf_Test( VOID )
|
|||||||
printf( " PongTimeout = %d\n", Conf_PongTimeout );
|
printf( " PongTimeout = %d\n", Conf_PongTimeout );
|
||||||
printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
|
printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
|
||||||
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
|
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
|
||||||
if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
|
|
||||||
else printf( " MaxConnections = -1\n" );
|
|
||||||
if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins );
|
|
||||||
else printf( " MaxJoins = -1\n" );
|
|
||||||
puts( "" );
|
puts( "" );
|
||||||
|
|
||||||
for( i = 0; i < Conf_Oper_Count; i++ )
|
for( i = 0; i < Conf_Oper_Count; i++ )
|
||||||
{
|
{
|
||||||
if( ! Conf_Oper[i].name[0] ) continue;
|
if( ! Conf_Oper[i].name[0] ) continue;
|
||||||
|
|
||||||
/* Valid "Operator" section */
|
/* gueltiger Operator-Block: ausgeben */
|
||||||
puts( "[OPERATOR]" );
|
puts( "[OPERATOR]" );
|
||||||
printf( " Name = %s\n", Conf_Oper[i].name );
|
printf( " Name = %s\n", Conf_Oper[i].name );
|
||||||
printf( " Password = %s\n", Conf_Oper[i].pwd );
|
printf( " Password = %s\n", Conf_Oper[i].pwd );
|
||||||
@@ -137,14 +129,14 @@ Conf_Test( VOID )
|
|||||||
for( i = 0; i < Conf_Server_Count; i++ )
|
for( i = 0; i < Conf_Server_Count; i++ )
|
||||||
{
|
{
|
||||||
if( ! Conf_Server[i].name[0] ) continue;
|
if( ! Conf_Server[i].name[0] ) continue;
|
||||||
|
if( ! Conf_Server[i].host[0] ) continue;
|
||||||
|
|
||||||
/* Valid "Server" section */
|
/* gueltiger Server-Block: ausgeben */
|
||||||
puts( "[SERVER]" );
|
puts( "[SERVER]" );
|
||||||
printf( " Name = %s\n", Conf_Server[i].name );
|
printf( " Name = %s\n", Conf_Server[i].name );
|
||||||
printf( " Host = %s\n", Conf_Server[i].host );
|
printf( " Host = %s\n", Conf_Server[i].host );
|
||||||
printf( " Port = %d\n", Conf_Server[i].port );
|
printf( " Port = %d\n", Conf_Server[i].port );
|
||||||
printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
|
printf( " Password = %s\n", Conf_Server[i].pwd );
|
||||||
printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
|
|
||||||
printf( " Group = %d\n", Conf_Server[i].group );
|
printf( " Group = %d\n", Conf_Server[i].group );
|
||||||
puts( "" );
|
puts( "" );
|
||||||
}
|
}
|
||||||
@@ -153,7 +145,7 @@ Conf_Test( VOID )
|
|||||||
{
|
{
|
||||||
if( ! Conf_Channel[i].name[0] ) continue;
|
if( ! Conf_Channel[i].name[0] ) continue;
|
||||||
|
|
||||||
/* Valid "Channel" section */
|
/* gueltiger Channel-Block: ausgeben */
|
||||||
puts( "[CHANNEL]" );
|
puts( "[CHANNEL]" );
|
||||||
printf( " Name = %s\n", Conf_Channel[i].name );
|
printf( " Name = %s\n", Conf_Channel[i].name );
|
||||||
printf( " Modes = %s\n", Conf_Channel[i].modes );
|
printf( " Modes = %s\n", Conf_Channel[i].modes );
|
||||||
@@ -168,7 +160,7 @@ Conf_Test( VOID )
|
|||||||
LOCAL VOID
|
LOCAL VOID
|
||||||
Set_Defaults( VOID )
|
Set_Defaults( VOID )
|
||||||
{
|
{
|
||||||
/* Initialize configuration variables with default values. */
|
/* Konfigurationsvariablen initialisieren, d.h. auf Default-Werte setzen. */
|
||||||
|
|
||||||
strcpy( Conf_ServerName, "" );
|
strcpy( Conf_ServerName, "" );
|
||||||
sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
|
sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
|
||||||
@@ -194,16 +186,13 @@ Set_Defaults( VOID )
|
|||||||
Conf_Channel_Count = 0;
|
Conf_Channel_Count = 0;
|
||||||
|
|
||||||
Conf_OperCanMode = FALSE;
|
Conf_OperCanMode = FALSE;
|
||||||
|
|
||||||
Conf_MaxConnections = -1;
|
|
||||||
Conf_MaxJoins = 10;
|
|
||||||
} /* Set_Defaults */
|
} /* Set_Defaults */
|
||||||
|
|
||||||
|
|
||||||
LOCAL VOID
|
LOCAL VOID
|
||||||
Read_Config( VOID )
|
Read_Config( VOID )
|
||||||
{
|
{
|
||||||
/* Read configuration file. */
|
/* Konfigurationsdatei einlesen. */
|
||||||
|
|
||||||
CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
|
CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
|
||||||
INT line;
|
INT line;
|
||||||
@@ -212,14 +201,12 @@ Read_Config( VOID )
|
|||||||
fd = fopen( NGIRCd_ConfFile, "r" );
|
fd = fopen( NGIRCd_ConfFile, "r" );
|
||||||
if( ! fd )
|
if( ! fd )
|
||||||
{
|
{
|
||||||
/* No configuration file found! */
|
/* Keine Konfigurationsdatei gefunden */
|
||||||
Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
|
Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
|
||||||
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
|
|
||||||
|
|
||||||
line = 0;
|
line = 0;
|
||||||
strcpy( section, "" );
|
strcpy( section, "" );
|
||||||
while( TRUE )
|
while( TRUE )
|
||||||
@@ -228,10 +215,10 @@ Read_Config( VOID )
|
|||||||
ngt_TrimStr( str );
|
ngt_TrimStr( str );
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
/* Skip comments and empty lines */
|
/* Kommentarzeilen und leere Zeilen ueberspringen */
|
||||||
if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
|
if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
|
||||||
|
|
||||||
/* Is this the beginning of a new section? */
|
/* Anfang eines Abschnittes? */
|
||||||
if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
|
if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
|
||||||
{
|
{
|
||||||
strcpy( section, str );
|
strcpy( section, str );
|
||||||
@@ -241,7 +228,7 @@ Read_Config( VOID )
|
|||||||
if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
|
if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Initialize new operator structure */
|
/* neuen Operator initialisieren */
|
||||||
strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
|
strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
|
||||||
strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
|
strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
|
||||||
Conf_Oper_Count++;
|
Conf_Oper_Count++;
|
||||||
@@ -253,12 +240,11 @@ Read_Config( VOID )
|
|||||||
if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
|
if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Initialize new server structure */
|
/* neuen Server ("Peer") initialisieren */
|
||||||
strcpy( Conf_Server[Conf_Server_Count].host, "" );
|
strcpy( Conf_Server[Conf_Server_Count].host, "" );
|
||||||
strcpy( Conf_Server[Conf_Server_Count].ip, "" );
|
strcpy( Conf_Server[Conf_Server_Count].ip, "" );
|
||||||
strcpy( Conf_Server[Conf_Server_Count].name, "" );
|
strcpy( Conf_Server[Conf_Server_Count].name, "" );
|
||||||
strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
|
strcpy( Conf_Server[Conf_Server_Count].pwd, "" );
|
||||||
strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
|
|
||||||
Conf_Server[Conf_Server_Count].port = 0;
|
Conf_Server[Conf_Server_Count].port = 0;
|
||||||
Conf_Server[Conf_Server_Count].group = -1;
|
Conf_Server[Conf_Server_Count].group = -1;
|
||||||
Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
|
Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
|
||||||
@@ -272,7 +258,7 @@ Read_Config( VOID )
|
|||||||
if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
|
if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Initialize new channel structure */
|
/* neuen vordefinierten Channel initialisieren */
|
||||||
strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
|
strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
|
||||||
strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
|
strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
|
||||||
strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
|
strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
|
||||||
@@ -285,7 +271,7 @@ Read_Config( VOID )
|
|||||||
}
|
}
|
||||||
if( section[0] == 0x1 ) continue;
|
if( section[0] == 0x1 ) continue;
|
||||||
|
|
||||||
/* Split line into variable name and parameters */
|
/* In Variable und Argument zerlegen */
|
||||||
ptr = strchr( str, '=' );
|
ptr = strchr( str, '=' );
|
||||||
if( ! ptr )
|
if( ! ptr )
|
||||||
{
|
{
|
||||||
@@ -305,7 +291,7 @@ Read_Config( VOID )
|
|||||||
|
|
||||||
fclose( fd );
|
fclose( fd );
|
||||||
|
|
||||||
/* If there are no ports configured use the default: 6667 */
|
/* Wenn kein Port definiert wurde, Port 6667 als Default benutzen */
|
||||||
if( Conf_ListenPorts_Count < 1 )
|
if( Conf_ListenPorts_Count < 1 )
|
||||||
{
|
{
|
||||||
Conf_ListenPorts_Count = 1;
|
Conf_ListenPorts_Count = 1;
|
||||||
@@ -328,56 +314,50 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
|
|
||||||
if( strcasecmp( Var, "Name" ) == 0 )
|
if( strcasecmp( Var, "Name" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Server name */
|
/* Der Server-Name */
|
||||||
strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
|
strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
|
||||||
Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
|
Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Info" ) == 0 )
|
if( strcasecmp( Var, "Info" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Info text of server */
|
/* Server-Info-Text */
|
||||||
strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
|
strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
|
||||||
Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
|
Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Password" ) == 0 )
|
if( strcasecmp( Var, "Password" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Global server password */
|
/* Server-Passwort */
|
||||||
strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
|
strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
|
||||||
Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
|
Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "AdminInfo1" ) == 0 )
|
if( strcasecmp( Var, "AdminInfo1" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Administrative info #1 */
|
/* Server-Info-Text */
|
||||||
strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
|
strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
|
||||||
Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
|
Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "AdminInfo2" ) == 0 )
|
if( strcasecmp( Var, "AdminInfo2" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Administrative info #2 */
|
/* Server-Info-Text */
|
||||||
strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
|
strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
|
||||||
Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
|
Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "AdminEMail" ) == 0 )
|
if( strcasecmp( Var, "AdminEMail" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Administrative email contact */
|
/* Server-Info-Text */
|
||||||
strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
|
strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
|
||||||
Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
|
Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Ports" ) == 0 )
|
if( strcasecmp( Var, "Ports" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Ports on that the server should listen. More port numbers
|
/* Ports, durch "," getrennt, auf denen der Server
|
||||||
* must be separated by "," */
|
* Verbindungen annehmen soll */
|
||||||
ptr = strtok( Arg, "," );
|
ptr = strtok( Arg, "," );
|
||||||
while( ptr )
|
while( ptr )
|
||||||
{
|
{
|
||||||
@@ -395,104 +375,57 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MotdFile" ) == 0 )
|
if( strcasecmp( Var, "MotdFile" ) == 0 )
|
||||||
{
|
{
|
||||||
/* "Message of the day" (MOTD) file */
|
/* Datei mit der "message of the day" (MOTD) */
|
||||||
strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
|
strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
|
||||||
Conf_MotdFile[FNAME_LEN - 1] = '\0';
|
Conf_MotdFile[FNAME_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > FNAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "ServerUID" ) == 0 )
|
if( strcasecmp( Var, "ServerUID" ) == 0 )
|
||||||
{
|
{
|
||||||
/* UID the daemon should switch to */
|
/* UID, mit der der Daemon laufen soll */
|
||||||
pwd = getpwnam( Arg );
|
pwd = getpwnam( Arg );
|
||||||
if( pwd ) Conf_UID = pwd->pw_uid;
|
if( pwd ) Conf_UID = pwd->pw_uid;
|
||||||
else
|
else Conf_UID = (UINT)atoi( Arg );
|
||||||
{
|
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Conf_UID = (UINT)atoi( Arg );
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "ServerGID" ) == 0 )
|
if( strcasecmp( Var, "ServerGID" ) == 0 )
|
||||||
{
|
{
|
||||||
/* GID the daemon should use */
|
/* GID, mit der der Daemon laufen soll */
|
||||||
grp = getgrnam( Arg );
|
grp = getgrnam( Arg );
|
||||||
if( grp ) Conf_GID = grp->gr_gid;
|
if( grp ) Conf_GID = grp->gr_gid;
|
||||||
else
|
else Conf_GID = (UINT)atoi( Arg );
|
||||||
{
|
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Conf_GID = (UINT)atoi( Arg );
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "PingTimeout" ) == 0 )
|
if( strcasecmp( Var, "PingTimeout" ) == 0 )
|
||||||
{
|
{
|
||||||
/* PING timeout */
|
/* PING-Timeout */
|
||||||
Conf_PingTimeout = atoi( Arg );
|
Conf_PingTimeout = atoi( Arg );
|
||||||
if( Conf_PingTimeout < 5 )
|
if(( Conf_PingTimeout ) < 5 ) Conf_PingTimeout = 5;
|
||||||
{
|
|
||||||
Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", NGIRCd_ConfFile, Line );
|
|
||||||
Conf_PingTimeout = 5;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "PongTimeout" ) == 0 )
|
if( strcasecmp( Var, "PongTimeout" ) == 0 )
|
||||||
{
|
{
|
||||||
/* PONG timeout */
|
/* PONG-Timeout */
|
||||||
Conf_PongTimeout = atoi( Arg );
|
Conf_PongTimeout = atoi( Arg );
|
||||||
if( Conf_PongTimeout < 5 )
|
if(( Conf_PongTimeout ) < 5 ) Conf_PongTimeout = 5;
|
||||||
{
|
|
||||||
Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", NGIRCd_ConfFile, Line );
|
|
||||||
Conf_PongTimeout = 5;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "ConnectRetry" ) == 0 )
|
if( strcasecmp( Var, "ConnectRetry" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Seconds between connection attempts to other servers */
|
/* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
|
||||||
Conf_ConnectRetry = atoi( Arg );
|
Conf_ConnectRetry = atoi( Arg );
|
||||||
if( Conf_ConnectRetry < 5 )
|
if(( Conf_ConnectRetry ) < 5 ) Conf_ConnectRetry = 5;
|
||||||
{
|
|
||||||
Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", NGIRCd_ConfFile, Line );
|
|
||||||
Conf_ConnectRetry = 5;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
|
if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Are IRC operators allowed to use MODE in channels they aren't Op in? */
|
/* Koennen IRC-Operatoren immer MODE benutzen? */
|
||||||
if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
|
if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
|
||||||
else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
|
else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
|
||||||
else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
|
else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
|
||||||
else Conf_OperCanMode = FALSE;
|
else Conf_OperCanMode = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MaxConnections" ) == 0 )
|
|
||||||
{
|
|
||||||
/* Maximum number of connections. Values <= 0 are equal to "no limit". */
|
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Conf_MaxConnections = atol( Arg );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( strcasecmp( Var, "MaxJoins" ) == 0 )
|
|
||||||
{
|
|
||||||
/* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */
|
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Conf_MaxJoins = atoi( Arg );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
|
Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
|
||||||
} /* Handle_GLOBAL */
|
} /* Handle_GLOBAL */
|
||||||
@@ -508,18 +441,16 @@ Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
|
|
||||||
if( strcasecmp( Var, "Name" ) == 0 )
|
if( strcasecmp( Var, "Name" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Name of IRC operator */
|
/* Name des IRC Operator */
|
||||||
strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
|
strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
|
||||||
Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
|
Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Password" ) == 0 )
|
if( strcasecmp( Var, "Password" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Password of IRC operator */
|
/* Passwort des IRC Operator */
|
||||||
strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
|
strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
|
||||||
Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
|
Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,39 +469,28 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
|
|
||||||
if( strcasecmp( Var, "Host" ) == 0 )
|
if( strcasecmp( Var, "Host" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Hostname of the server */
|
/* Hostname des Servers */
|
||||||
strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
|
strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
|
||||||
Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
|
Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > HOST_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Name" ) == 0 )
|
if( strcasecmp( Var, "Name" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Name of the server ("Nick"/"ID") */
|
/* Name des Servers ("Nick") */
|
||||||
strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
|
strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
|
||||||
Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
|
Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "MyPassword" ) == 0 )
|
if( strcasecmp( Var, "Password" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Password of this server which is sent to the peer */
|
/* Passwort des Servers */
|
||||||
strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
|
strncpy( Conf_Server[Conf_Server_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
|
||||||
Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
|
Conf_Server[Conf_Server_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( strcasecmp( Var, "PeerPassword" ) == 0 )
|
|
||||||
{
|
|
||||||
/* Passwort of the peer which must be received */
|
|
||||||
strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
|
|
||||||
Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
|
|
||||||
if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Port" ) == 0 )
|
if( strcasecmp( Var, "Port" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Port to which this server should connect */
|
/* Port, zu dem Verbunden werden soll */
|
||||||
port = atol( Arg );
|
port = atol( Arg );
|
||||||
if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
|
if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
|
||||||
else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
|
else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
|
||||||
@@ -578,11 +498,7 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Group" ) == 0 )
|
if( strcasecmp( Var, "Group" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Server group */
|
/* Server-Gruppe */
|
||||||
#ifdef HAVE_ISDIGIT
|
|
||||||
if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
|
Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -600,26 +516,23 @@ Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
|
|
||||||
if( strcasecmp( Var, "Name" ) == 0 )
|
if( strcasecmp( Var, "Name" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Name of the channel */
|
/* Hostname des Servers */
|
||||||
strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
|
strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
|
||||||
Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
|
Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CHANNEL_NAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Modes" ) == 0 )
|
if( strcasecmp( Var, "Modes" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Initial modes */
|
/* Name des Servers ("Nick") */
|
||||||
strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
|
strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
|
||||||
Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
|
Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CHANNEL_MODE_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( strcasecmp( Var, "Topic" ) == 0 )
|
if( strcasecmp( Var, "Topic" ) == 0 )
|
||||||
{
|
{
|
||||||
/* Initial topic */
|
/* Passwort des Servers */
|
||||||
strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
|
strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
|
||||||
Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
|
Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
|
||||||
if( strlen( Arg ) > CHANNEL_TOPIC_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,48 +541,33 @@ Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
|
|||||||
|
|
||||||
|
|
||||||
LOCAL VOID
|
LOCAL VOID
|
||||||
Validate_Config( BOOLEAN Configtest )
|
Validate_Config( VOID )
|
||||||
{
|
{
|
||||||
/* Validate configuration settings. */
|
/* Konfiguration ueberpruefen */
|
||||||
|
|
||||||
if( ! Conf_ServerName[0] )
|
if( ! Conf_ServerName[0] )
|
||||||
{
|
{
|
||||||
/* No server name configured! */
|
/* Kein Servername konfiguriert */
|
||||||
Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
|
Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
|
||||||
if( ! Configtest )
|
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
||||||
{
|
exit( 1 );
|
||||||
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
|
||||||
exit( 1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STRICT_RFC
|
#ifdef STRICT_RFC
|
||||||
if( ! Conf_ServerAdminMail[0] )
|
if( ! Conf_ServerAdminMail[0] )
|
||||||
{
|
{
|
||||||
/* No administrative contact configured! */
|
/* Keine Server-Information konfiguriert */
|
||||||
Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
|
Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
|
||||||
if( ! Configtest )
|
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
||||||
{
|
exit( 1 );
|
||||||
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
|
||||||
exit( 1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
|
if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
|
||||||
{
|
{
|
||||||
/* No administrative information configured! */
|
/* Keine Server-Information konfiguriert */
|
||||||
Config_Error( LOG_WARNING, "No administrative information configured but required by RFC!" );
|
Log( LOG_WARNING, "No server information configured but required by RFC!" );
|
||||||
}
|
}
|
||||||
#ifdef FD_SETSIZE
|
|
||||||
if(( Conf_MaxConnections > (LONG)FD_SETSIZE ) || ( Conf_MaxConnections < 1 ))
|
|
||||||
{
|
|
||||||
Conf_MaxConnections = (LONG)FD_SETSIZE;
|
|
||||||
Config_Error( LOG_ERR, "Setting MaxConnections to %ld, select() can't handle more file descriptors!", Conf_MaxConnections );
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" );
|
|
||||||
#endif
|
|
||||||
} /* Validate_Config */
|
} /* Validate_Config */
|
||||||
|
|
||||||
|
|
||||||
@@ -682,13 +580,14 @@ CONST CHAR *Format;
|
|||||||
va_dcl
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Error! Write to console and/or logfile. */
|
/* Fehler! Auf Console und/oder ins Log schreiben */
|
||||||
|
|
||||||
CHAR msg[MAX_LOG_MSG_LEN];
|
CHAR msg[MAX_LOG_MSG_LEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
assert( Format != NULL );
|
assert( Format != NULL );
|
||||||
|
|
||||||
|
/* String mit variablen Argumenten zusammenbauen ... */
|
||||||
#ifdef PROTOTYPES
|
#ifdef PROTOTYPES
|
||||||
va_start( ap, Format );
|
va_start( ap, Format );
|
||||||
#else
|
#else
|
||||||
@@ -697,9 +596,9 @@ va_dcl
|
|||||||
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
/* During "normal operations" the log functions of the daemon should
|
/* Im "normalen Betrieb" soll der Log-Mechanismus des ngIRCd verwendet
|
||||||
* be used, but during testing of the configuration file, all messages
|
* werden, beim Testen der Konfiguration jedoch nicht, hier sollen alle
|
||||||
* should go directly to the console: */
|
* Meldungen direkt auf die Konsole ausgegeben werden: */
|
||||||
if( Use_Log ) Log( Level, "%s", msg );
|
if( Use_Log ) Log( Level, "%s", msg );
|
||||||
else puts( msg );
|
else puts( msg );
|
||||||
} /* Config_Error */
|
} /* Config_Error */
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: conf.h,v 1.24 2002/12/14 13:36:19 alex Exp $
|
* $Id: conf.h,v 1.19 2002/09/16 09:13:40 alex Exp $
|
||||||
*
|
*
|
||||||
* Configuration management (header)
|
* conf.h: Konfiguration des ngircd (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -24,85 +25,77 @@
|
|||||||
|
|
||||||
typedef struct _Conf_Oper
|
typedef struct _Conf_Oper
|
||||||
{
|
{
|
||||||
CHAR name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
|
CHAR name[CLIENT_PASS_LEN]; /* Name (ID) des IRC-OPs */
|
||||||
CHAR pwd[CLIENT_PASS_LEN]; /* Password */
|
CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
|
||||||
} CONF_OPER;
|
} CONF_OPER;
|
||||||
|
|
||||||
typedef struct _Conf_Server
|
typedef struct _Conf_Server
|
||||||
{
|
{
|
||||||
CHAR host[HOST_LEN]; /* Hostname */
|
CHAR host[HOST_LEN]; /* Hostname */
|
||||||
CHAR ip[16]; /* IP address (Resolver) */
|
CHAR ip[16]; /* IP-Adresse (von Resolver) */
|
||||||
CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */
|
CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */
|
||||||
CHAR pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */
|
CHAR pwd[CLIENT_PASS_LEN]; /* Passwort */
|
||||||
CHAR pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */
|
INT port; /* Server-Port */
|
||||||
INT port; /* Server port */
|
INT group; /* Gruppe des Servers */
|
||||||
INT group; /* Group of server */
|
time_t lasttry; /* Letzter Connect-Versuch */
|
||||||
time_t lasttry; /* Last connect attempt */
|
RES_STAT *res_stat; /* Status des Resolver */
|
||||||
RES_STAT *res_stat; /* Status of the resolver */
|
|
||||||
} CONF_SERVER;
|
} CONF_SERVER;
|
||||||
|
|
||||||
typedef struct _Conf_Channel
|
typedef struct _Conf_Channel
|
||||||
{
|
{
|
||||||
CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */
|
CHAR name[CHANNEL_NAME_LEN]; /* Name des Channel */
|
||||||
CHAR modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
|
CHAR modes[CHANNEL_MODE_LEN]; /* Channel-Modes */
|
||||||
CHAR topic[CHANNEL_TOPIC_LEN]; /* Initial topic */
|
CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic des Channels */
|
||||||
} CONF_CHANNEL;
|
} CONF_CHANNEL;
|
||||||
|
|
||||||
|
|
||||||
/* Name ("Nick") of the servers */
|
/* Name ("Nick") des Servers */
|
||||||
GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN];
|
GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN];
|
||||||
|
|
||||||
/* Server info text */
|
/* Server-Info-Text */
|
||||||
GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN];
|
GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN];
|
||||||
|
|
||||||
/* Global server passwort */
|
/* Server-Passwort */
|
||||||
GLOBAL CHAR Conf_ServerPwd[CLIENT_PASS_LEN];
|
GLOBAL CHAR Conf_ServerPwd[CLIENT_PASS_LEN];
|
||||||
|
|
||||||
/* Administrative information */
|
/* Admin-Info-Texte */
|
||||||
GLOBAL CHAR Conf_ServerAdmin1[CLIENT_INFO_LEN];
|
GLOBAL CHAR Conf_ServerAdmin1[CLIENT_INFO_LEN];
|
||||||
GLOBAL CHAR Conf_ServerAdmin2[CLIENT_INFO_LEN];
|
GLOBAL CHAR Conf_ServerAdmin2[CLIENT_INFO_LEN];
|
||||||
GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN];
|
GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN];
|
||||||
|
|
||||||
/* File with MOTD text */
|
/* Datei mit MOTD-Text */
|
||||||
GLOBAL CHAR Conf_MotdFile[FNAME_LEN];
|
GLOBAL CHAR Conf_MotdFile[FNAME_LEN];
|
||||||
|
|
||||||
/* Ports the server should listen on */
|
/* Ports, auf denen der Server Verbindungen entgegen nimmt */
|
||||||
GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS];
|
GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS];
|
||||||
GLOBAL INT Conf_ListenPorts_Count;
|
GLOBAL INT Conf_ListenPorts_Count;
|
||||||
|
|
||||||
/* User and group ID the server should run with */
|
/* User- und Group-ID, zu denen der Daemon wechseln soll */
|
||||||
GLOBAL UINT Conf_UID;
|
GLOBAL UINT Conf_UID;
|
||||||
GLOBAL UINT Conf_GID;
|
GLOBAL UINT Conf_GID;
|
||||||
|
|
||||||
/* Timeouts for PING and PONG */
|
/* Timeouts fuer PING und PONG */
|
||||||
GLOBAL INT Conf_PingTimeout;
|
GLOBAL INT Conf_PingTimeout;
|
||||||
GLOBAL INT Conf_PongTimeout;
|
GLOBAL INT Conf_PongTimeout;
|
||||||
|
|
||||||
/* Seconds between connect attempts to other servers */
|
/* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
|
||||||
GLOBAL INT Conf_ConnectRetry;
|
GLOBAL INT Conf_ConnectRetry;
|
||||||
|
|
||||||
/* Operators */
|
/* Operatoren */
|
||||||
GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
|
GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
|
||||||
GLOBAL INT Conf_Oper_Count;
|
GLOBAL INT Conf_Oper_Count;
|
||||||
|
|
||||||
/* Servers */
|
/* Server */
|
||||||
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
|
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
|
||||||
GLOBAL INT Conf_Server_Count;
|
GLOBAL INT Conf_Server_Count;
|
||||||
|
|
||||||
/* Pre-defined channels */
|
/* Vorkonfigurierte Channels */
|
||||||
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
|
GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
|
||||||
GLOBAL INT Conf_Channel_Count;
|
GLOBAL INT Conf_Channel_Count;
|
||||||
|
|
||||||
/* Are IRC operators allowed to always use MODE? */
|
/* Koennen IRC OPs immer Modes setzen? */
|
||||||
GLOBAL BOOLEAN Conf_OperCanMode;
|
GLOBAL BOOLEAN Conf_OperCanMode;
|
||||||
|
|
||||||
/* Maximum number of connections to this server */
|
|
||||||
GLOBAL LONG Conf_MaxConnections;
|
|
||||||
|
|
||||||
/* Maximum number of channels a user can join */
|
|
||||||
GLOBAL INT Conf_MaxJoins;
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID Conf_Init PARAMS((VOID ));
|
GLOBAL VOID Conf_Init PARAMS((VOID ));
|
||||||
GLOBAL INT Conf_Test PARAMS((VOID ));
|
GLOBAL INT Conf_Test PARAMS((VOID ));
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: conn.h,v 1.26.2.1 2003/03/09 20:16:46 alex Exp $
|
* $Id: conn.h,v 1.17 2002/08/26 00:03:15 alex Exp $
|
||||||
*
|
*
|
||||||
* Connection management (header)
|
* conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -18,14 +19,7 @@
|
|||||||
#define __conn_h__
|
#define __conn_h__
|
||||||
|
|
||||||
|
|
||||||
#include <time.h> /* fro time_t, see below */
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
#define CONN_ISCLOSING 1 /* Conn_Close() already called */
|
|
||||||
|
|
||||||
#ifdef USE_ZLIB
|
|
||||||
#define CONN_ZIP 2 /* zlib compressed link */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef INT CONN_ID;
|
typedef INT CONN_ID;
|
||||||
@@ -34,9 +28,6 @@ typedef INT CONN_ID;
|
|||||||
GLOBAL VOID Conn_Init PARAMS((VOID ));
|
GLOBAL VOID Conn_Init PARAMS((VOID ));
|
||||||
GLOBAL VOID Conn_Exit PARAMS(( VOID ));
|
GLOBAL VOID Conn_Exit PARAMS(( VOID ));
|
||||||
|
|
||||||
GLOBAL INT Conn_InitListeners PARAMS(( VOID ));
|
|
||||||
GLOBAL VOID Conn_ExitListeners PARAMS(( VOID ));
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
|
GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
|
||||||
|
|
||||||
GLOBAL VOID Conn_Handler PARAMS(( VOID ));
|
GLOBAL VOID Conn_Handler PARAMS(( VOID ));
|
||||||
@@ -49,38 +40,8 @@ GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN
|
|||||||
GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
|
GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
|
||||||
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
|
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
|
||||||
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
|
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
|
||||||
GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL INT Conn_SendQ PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL INT Conn_RecvQ PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL LONG Conn_SendMsg PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL LONG Conn_RecvMsg PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL LONG Conn_SendBytes PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL LONG Conn_RecvBytes PARAMS(( CONN_ID Idx ));
|
|
||||||
|
|
||||||
GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
|
GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds ));
|
||||||
GLOBAL VOID Conn_ResetPenalty PARAMS(( CONN_ID Idx ));
|
|
||||||
|
|
||||||
GLOBAL VOID Conn_ClearFlags PARAMS(( VOID ));
|
|
||||||
GLOBAL INT Conn_Flag PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL VOID Conn_SetFlag PARAMS(( CONN_ID Idx, INT Flag ));
|
|
||||||
|
|
||||||
GLOBAL VOID Conn_SetServer PARAMS(( CONN_ID Idx, INT ConfServer ));
|
|
||||||
|
|
||||||
GLOBAL CONN_ID Conn_First PARAMS(( VOID ));
|
|
||||||
GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
|
|
||||||
|
|
||||||
GLOBAL VOID Conn_SetOption PARAMS(( CONN_ID Idx, INT Option ));
|
|
||||||
GLOBAL VOID Conn_UnsetOption PARAMS(( CONN_ID Idx, INT Option ));
|
|
||||||
GLOBAL INT Conn_Options PARAMS(( CONN_ID Idx ));
|
|
||||||
|
|
||||||
#ifdef USE_ZLIB
|
|
||||||
GLOBAL BOOLEAN Conn_InitZip PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL LONG Conn_SendBytesZip PARAMS(( CONN_ID Idx ));
|
|
||||||
GLOBAL LONG Conn_RecvBytesZip PARAMS(( CONN_ID Idx ));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GLOBAL VOID Conn_ResetWCounter PARAMS(( VOID ));
|
|
||||||
GLOBAL LONG Conn_WCounter PARAMS(( VOID ));
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL INT Conn_MaxFD;
|
GLOBAL INT Conn_MaxFD;
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* 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.40 2002/12/16 23:10:56 alex Exp $
|
* $Id: defines.h,v 1.33.2.1 2002/11/23 16:20:25 alex Exp $
|
||||||
*
|
*
|
||||||
* Global defines of ngIRCd.
|
* defines.h: (globale) Konstanten
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __defines_h__
|
#ifndef __defines_h__
|
||||||
@@ -35,9 +36,7 @@
|
|||||||
|
|
||||||
#define MAX_DEFCHANNELS 16 /* max. Anzahl vorkonfigurierbarerr Channels */
|
#define MAX_DEFCHANNELS 16 /* max. Anzahl vorkonfigurierbarerr Channels */
|
||||||
|
|
||||||
#define MAX_SERVICES 8 /* maximum number of configurable services */
|
#define MAX_CONNECTIONS 100 /* max. Anzahl von Verbindungen an diesem Server */
|
||||||
|
|
||||||
#define CONNECTION_POOL 100 /* Anzahl Verbindungs-Strukturen, die blockweise alloziert werden */
|
|
||||||
|
|
||||||
#define CLIENT_ID_LEN 64 /* max. ID-Laenge; vgl. RFC 2812, 1.1 und 1.2.1 */
|
#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_NICK_LEN 10 /* max. Nick-Laenge; vgl. RFC 2812, 1.2.1 */
|
||||||
@@ -56,14 +55,9 @@
|
|||||||
|
|
||||||
#define COMMAND_LEN 513 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */
|
#define COMMAND_LEN 513 /* max. Laenge eines Befehls, vgl. RFC 2812, 3.2 */
|
||||||
|
|
||||||
#define READBUFFER_LEN 2048 /* Laenge des Lesepuffers je Verbindung (Bytes) */
|
#define READBUFFER_LEN 2 * COMMAND_LEN /* Laenge des Lesepuffers je Verbindung (Bytes) */
|
||||||
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
|
#define WRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers je Verbindung (Bytes) */
|
||||||
|
|
||||||
#ifdef USE_ZLIB
|
|
||||||
#define ZREADBUFFER_LEN 1024 /* Laenge des Lesepuffers je Verbindung (Bytes) */
|
|
||||||
#define ZWRITEBUFFER_LEN 4096 /* Laenge des Schreibpuffers fuer Kompression (Bytes) */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PROTOVER "0210" /* implementierte Protokoll-Version (RFC 2813, 4.1.1) */
|
#define PROTOVER "0210" /* implementierte Protokoll-Version (RFC 2813, 4.1.1) */
|
||||||
#define PROTOIRC "-IRC" /* Protokoll-Suffix (RFC 2813, 4.1.1) */
|
#define PROTOIRC "-IRC" /* Protokoll-Suffix (RFC 2813, 4.1.1) */
|
||||||
#define PROTOIRCPLUS "-IRC+" /* Protokoll-Suffix f<>r IRC+-Protokoll */
|
#define PROTOIRCPLUS "-IRC+" /* Protokoll-Suffix f<>r IRC+-Protokoll */
|
||||||
@@ -76,7 +70,7 @@
|
|||||||
#define RECONNECT_DELAY 3 /* Server-Links erst nach 3 Sekunden versuchen, wieder aufzubauen */
|
#define RECONNECT_DELAY 3 /* Server-Links erst nach 3 Sekunden versuchen, wieder aufzubauen */
|
||||||
|
|
||||||
#define USERMODES "aios" /* unterstuetzte User-Modes */
|
#define USERMODES "aios" /* unterstuetzte User-Modes */
|
||||||
#define CHANMODES "biklImnoPtv" /* unterstuetzte Channel-Modes */
|
#define CHANMODES "biImnoPtv" /* unterstuetzte Channel-Modes */
|
||||||
|
|
||||||
#define CONNECTED TRUE /* fuer die irc-xxx-Module */
|
#define CONNECTED TRUE /* fuer die irc-xxx-Module */
|
||||||
#define DISCONNECTED FALSE
|
#define DISCONNECTED FALSE
|
||||||
@@ -96,8 +90,6 @@
|
|||||||
|
|
||||||
#define TOKEN_OUTBOUND -2 /* Kennzeichnung fuer ausgehende Server-Links im Aufbau */
|
#define TOKEN_OUTBOUND -2 /* Kennzeichnung fuer ausgehende Server-Links im Aufbau */
|
||||||
|
|
||||||
#define NOTICE_TXTPREFIX "" /* Kennzeichnung fuer Server-NOTICEs an User */
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Hash calculation
|
* $Id: hash.c,v 1.5 2002/05/27 12:54:07 alex Exp $
|
||||||
|
*
|
||||||
|
* hash.c: Hash-Werte berechnen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: hash.c,v 1.6 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: hash.h,v 1.4 2002/12/12 12:23:43 alex Exp $
|
* $Id: hash.h,v 1.3 2002/05/27 12:54:07 alex Exp $
|
||||||
*
|
*
|
||||||
* Hash calculation (header)
|
* hash.h: Hash-Werte berechnen (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* IRC channel commands
|
* $Id: irc-channel.c,v 1.15 2002/09/16 09:16:17 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-channel.c: IRC-Channel-Befehle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
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 "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -29,10 +30,8 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 ale
|
|||||||
#include "match.h"
|
#include "match.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "irc-info.h"
|
#include "irc.h"
|
||||||
#include "irc-write.h"
|
#include "irc-write.h"
|
||||||
#include "resolve.h"
|
|
||||||
#include "conf.h"
|
|
||||||
|
|
||||||
#include "exp.h"
|
#include "exp.h"
|
||||||
#include "irc-channel.h"
|
#include "irc-channel.h"
|
||||||
@@ -41,7 +40,7 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.21.2.5 2003/01/08 23:09:34 ale
|
|||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
CHAR *channame, *key, *flags, *topic, modes[8];
|
CHAR *channame, *flags, *topic, modes[8];
|
||||||
BOOLEAN is_new_chan, is_invited, is_banned;
|
BOOLEAN is_new_chan, is_invited, is_banned;
|
||||||
CLIENT *target;
|
CLIENT *target;
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
@@ -49,18 +48,16 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
/* Bad number of arguments? */
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* Who is the sender? */
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* Wer ist der Absender? */
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
||||||
else target = Client;
|
else target = Client;
|
||||||
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
/* Are channel keys given? */
|
|
||||||
if( Req->argc > 1 ) key = Req->argv[1];
|
|
||||||
else key = NULL;
|
|
||||||
|
|
||||||
/* Channel-Namen durchgehen */
|
/* Channel-Namen durchgehen */
|
||||||
chan = NULL;
|
chan = NULL;
|
||||||
channame = strtok( Req->argv[0], "," );
|
channame = strtok( Req->argv[0], "," );
|
||||||
@@ -87,16 +84,6 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
|||||||
/* Lokaler Client? */
|
/* Lokaler Client? */
|
||||||
if( Client_Type( Client ) == CLIENT_USER )
|
if( Client_Type( Client ) == CLIENT_USER )
|
||||||
{
|
{
|
||||||
/* Test if the user has reached his maximum channel count */
|
|
||||||
if( Client_Type( Client ) == CLIENT_USER )
|
|
||||||
{
|
|
||||||
if(( Conf_MaxJoins > 0 ) && ( Channel_CountForUser( Client ) >= Conf_MaxJoins ))
|
|
||||||
{
|
|
||||||
IRC_WriteStrClient( Client, ERR_TOOMANYCHANNELS_MSG, Client_ID( Client ), channame );
|
|
||||||
return CONNECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */
|
/* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */
|
||||||
if( is_new_chan )
|
if( is_new_chan )
|
||||||
{
|
{
|
||||||
@@ -118,40 +105,18 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
|||||||
/* Client ist gebanned (und nicht invited): */
|
/* Client ist gebanned (und nicht invited): */
|
||||||
IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
|
IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
|
||||||
|
|
||||||
/* Try next name, if any */
|
/* naechsten Namen ermitteln */
|
||||||
channame = strtok( NULL, "," );
|
channame = strtok( NULL, "," );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ist der Channel "invite-only"? */
|
/* Ist der Channel "invite-only"? */
|
||||||
if(( strchr( Channel_Modes( chan ), 'i' )) && ( is_invited == FALSE ))
|
if(( strchr( Channel_Modes( chan ), 'i' ) != NULL ) && ( is_invited == FALSE ))
|
||||||
{
|
{
|
||||||
/* Channel ist "invite-only" und Client wurde nicht invited: */
|
/* Channel ist "invite-only" und Client wurde nicht invited: */
|
||||||
IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame );
|
IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame );
|
||||||
|
|
||||||
/* Try next name, if any */
|
/* naechsten Namen ermitteln */
|
||||||
channame = strtok( NULL, "," );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Is the channel protected by a key? */
|
|
||||||
if(( strchr( Channel_Modes( chan ), 'k' )) && ( strcmp( Channel_Key( chan ), key ? key : "" ) != 0 ))
|
|
||||||
{
|
|
||||||
/* Bad channel key! */
|
|
||||||
IRC_WriteStrClient( Client, ERR_BADCHANNELKEY_MSG, Client_ID( Client ), channame );
|
|
||||||
|
|
||||||
/* Try next name, if any */
|
|
||||||
channame = strtok( NULL, "," );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Are there already too many members? */
|
|
||||||
if(( strchr( Channel_Modes( chan ), 'l' )) && ( Channel_MaxUsers( chan ) <= Channel_MemberCount( chan )))
|
|
||||||
{
|
|
||||||
/* Bad channel key! */
|
|
||||||
IRC_WriteStrClient( Client, ERR_CHANNELISFULL_MSG, Client_ID( Client ), channame );
|
|
||||||
|
|
||||||
/* Try next name, if any */
|
|
||||||
channame = strtok( NULL, "," );
|
channame = strtok( NULL, "," );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -224,6 +189,8 @@ IRC_PART( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -260,6 +227,8 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -311,6 +280,8 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -326,7 +297,7 @@ IRC_LIST( CLIENT *Client, REQUEST *Req )
|
|||||||
{
|
{
|
||||||
/* an anderen Server forwarden */
|
/* an anderen Server forwarden */
|
||||||
target = Client_Search( Req->argv[1] );
|
target = Client_Search( 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 ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
|
||||||
|
|
||||||
if( target != Client_ThisServer( ))
|
if( target != Client_ThisServer( ))
|
||||||
{
|
{
|
||||||
@@ -365,24 +336,20 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
|||||||
CLIENT *from;
|
CLIENT *from;
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
CHAR *ptr;
|
CHAR *ptr;
|
||||||
INT arg_topic;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
/* Bad number of parameters? */
|
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
if(( Req->argc < 2 ) || ( Req->argc == 4 ) || ( Req->argc > 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* Compatibility kludge */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc == 5 ) arg_topic = 4;
|
if(( Req->argc < 1 ) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
else if( Req->argc == 3 ) arg_topic = 2;
|
|
||||||
else arg_topic = -1;
|
|
||||||
|
|
||||||
/* Search origin */
|
/* From-Server suchen */
|
||||||
from = Client_Search( Req->prefix );
|
from = Client_Search( Req->prefix );
|
||||||
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
/* Search or create channel */
|
/* Channel suchen bzw. erzeugen */
|
||||||
chan = Channel_Search( Req->argv[0] );
|
chan = Channel_Search( Req->argv[0] );
|
||||||
if( ! chan ) chan = Channel_Create( Req->argv[0] );
|
if( ! chan ) chan = Channel_Create( Req->argv[0] );
|
||||||
if( ! chan ) return CONNECTED;
|
if( ! chan ) return CONNECTED;
|
||||||
@@ -392,36 +359,27 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
|
|||||||
ptr = Channel_Modes( chan );
|
ptr = Channel_Modes( chan );
|
||||||
if( ! *ptr )
|
if( ! *ptr )
|
||||||
{
|
{
|
||||||
/* OK, this channel doesn't have modes jet, set the received ones: */
|
/* OK, es sind noch keine Modes gesetzt */
|
||||||
Channel_SetModes( chan, &Req->argv[1][1] );
|
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!" );
|
else Log( LOG_WARNING, "CHANNELINFO: invalid MODE format ignored!" );
|
||||||
|
|
||||||
if( arg_topic > 0 )
|
if( Req->argc == 3 )
|
||||||
{
|
{
|
||||||
/* We got a topic */
|
/* Es wurde auch ein Topic mit uebermittelt */
|
||||||
ptr = Channel_Topic( chan );
|
ptr = Channel_Topic( chan );
|
||||||
if(( ! *ptr ) && ( Req->argv[arg_topic][0] ))
|
if( ! *ptr )
|
||||||
{
|
{
|
||||||
/* OK, there is no topic jet */
|
/* OK, es ist bisher kein Topic gesetzt */
|
||||||
Channel_SetTopic( chan, Req->argv[arg_topic] );
|
Channel_SetTopic( chan, Req->argv[2] );
|
||||||
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan ));
|
IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Req->argv[2] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Forward CHANINFO to other serevrs */
|
/* an andere Server forwarden */
|
||||||
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] );
|
IRC_WriteStrServersPrefixFlag( Client, from, 'C', "CHANINFO %s %s :%s", Req->argv[0], Req->argv[1], Req->argv[2] );
|
||||||
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;
|
return CONNECTED;
|
||||||
} /* IRC_CHANINFO */
|
} /* IRC_CHANINFO */
|
||||||
|
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-channel.h,v 1.6 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-channel.h,v 1.5 2002/09/03 23:56:55 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC channel commands (header)
|
* irc-channel.h: IRC-Channel-Befehle (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,879 +0,0 @@
|
|||||||
/*
|
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
|
||||||
* Copyright (c)2001,2002 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* IRC info commands
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
|
||||||
|
|
||||||
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>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "ngircd.h"
|
|
||||||
#include "conn.h"
|
|
||||||
#include "client.h"
|
|
||||||
#include "channel.h"
|
|
||||||
#include "resolve.h"
|
|
||||||
#include "conf.h"
|
|
||||||
#include "defines.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "messages.h"
|
|
||||||
#include "tool.h"
|
|
||||||
#include "parse.h"
|
|
||||||
#include "irc-write.h"
|
|
||||||
|
|
||||||
#include "exp.h"
|
|
||||||
#include "irc-info.h"
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_ADMIN(CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *target, *prefix;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* Ziel suchen */
|
|
||||||
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
|
|
||||||
else target = Client_ThisServer( );
|
|
||||||
|
|
||||||
/* Prefix ermitteln */
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
|
|
||||||
else prefix = Client;
|
|
||||||
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
|
||||||
|
|
||||||
/* An anderen Server weiterleiten? */
|
|
||||||
if( target != Client_ThisServer( ))
|
|
||||||
{
|
|
||||||
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] );
|
|
||||||
return CONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* mit Versionsinfo antworten */
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_ADMINME_MSG, Client_ID( prefix ), Conf_ServerName )) return DISCONNECTED;
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC1_MSG, Client_ID( prefix ), Conf_ServerAdmin1 )) return DISCONNECTED;
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED;
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED;
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_ADMIN */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_ISON( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CHAR rpl[COMMAND_LEN];
|
|
||||||
CLIENT *c;
|
|
||||||
CHAR *ptr;
|
|
||||||
INT i;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( 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_Search( ptr );
|
|
||||||
if( c && ( Client_Type( c ) == 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, rpl, Client_ID( Client ) );
|
|
||||||
} /* IRC_ISON */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_LINKS( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *target, *from, *c;
|
|
||||||
CHAR *mask;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* Server-Mask ermitteln */
|
|
||||||
if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
|
|
||||||
else mask = "*";
|
|
||||||
|
|
||||||
/* Absender ermitteln */
|
|
||||||
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 );
|
|
||||||
|
|
||||||
/* An anderen Server forwarden? */
|
|
||||||
if( Req->argc == 2 )
|
|
||||||
{
|
|
||||||
target = Client_Search( 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] );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wer ist der Absender? */
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
|
||||||
else target = Client;
|
|
||||||
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
|
||||||
|
|
||||||
c = Client_First( );
|
|
||||||
while( c )
|
|
||||||
{
|
|
||||||
if( Client_Type( c ) == CLIENT_SERVER )
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( target, RPL_LINKS_MSG, Client_ID( target ), Client_ID( c ), Client_ID( Client_TopServer( c ) ? Client_TopServer( c ) : Client_ThisServer( )), Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
c = Client_Next( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
|
|
||||||
} /* IRC_LINKS */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_LUSERS( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *target, *from;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* Absender ermitteln */
|
|
||||||
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 );
|
|
||||||
|
|
||||||
/* An anderen Server forwarden? */
|
|
||||||
if( Req->argc == 2 )
|
|
||||||
{
|
|
||||||
target = Client_Search( 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] );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wer ist der Absender? */
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
|
||||||
else target = Client;
|
|
||||||
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
|
||||||
|
|
||||||
IRC_Send_LUSERS( target );
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_LUSERS */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_MOTD( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *from, *target;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* From aus Prefix ermitteln */
|
|
||||||
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 );
|
|
||||||
|
|
||||||
if( Req->argc == 1 )
|
|
||||||
{
|
|
||||||
/* an anderen Server forwarden */
|
|
||||||
target = Client_Search( 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( ))
|
|
||||||
{
|
|
||||||
/* Ok, anderer Server ist das Ziel: forwarden */
|
|
||||||
return IRC_WriteStrClientPrefix( target, from, "MOTD %s", Req->argv[0] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return IRC_Show_MOTD( from );
|
|
||||||
} /* IRC_MOTD */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_NAMES( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CHAR rpl[COMMAND_LEN], *ptr;
|
|
||||||
CLIENT *target, *from, *c;
|
|
||||||
CHANNEL *chan;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* From aus Prefix ermitteln */
|
|
||||||
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 );
|
|
||||||
|
|
||||||
if( Req->argc == 2 )
|
|
||||||
{
|
|
||||||
/* an anderen Server forwarden */
|
|
||||||
target = Client_Search( 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( ))
|
|
||||||
{
|
|
||||||
/* Ok, anderer Server ist das Ziel: forwarden */
|
|
||||||
return IRC_WriteStrClientPrefix( target, from, "NAMES %s :%s", Req->argv[0], Req->argv[1] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Req->argc > 0 )
|
|
||||||
{
|
|
||||||
/* bestimmte Channels durchgehen */
|
|
||||||
ptr = strtok( Req->argv[0], "," );
|
|
||||||
while( ptr )
|
|
||||||
{
|
|
||||||
chan = Channel_Search( ptr );
|
|
||||||
if( chan )
|
|
||||||
{
|
|
||||||
/* Namen ausgeben */
|
|
||||||
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), ptr )) return DISCONNECTED;
|
|
||||||
|
|
||||||
/* naechsten Namen ermitteln */
|
|
||||||
ptr = strtok( NULL, "," );
|
|
||||||
}
|
|
||||||
return CONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* alle Channels durchgehen */
|
|
||||||
chan = Channel_First( );
|
|
||||||
while( chan )
|
|
||||||
{
|
|
||||||
/* Namen ausgeben */
|
|
||||||
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
|
|
||||||
|
|
||||||
/* naechster Channel */
|
|
||||||
chan = Channel_Next( chan );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nun noch alle Clients ausgeben, die in keinem Channel sind */
|
|
||||||
c = Client_First( );
|
|
||||||
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
|
|
||||||
while( c )
|
|
||||||
{
|
|
||||||
if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' )))
|
|
||||||
{
|
|
||||||
/* Okay, das ist ein User: anhaengen */
|
|
||||||
if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " );
|
|
||||||
strcat( rpl, Client_ID( c ));
|
|
||||||
|
|
||||||
if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
|
|
||||||
{
|
|
||||||
/* Zeile wird zu lang: senden! */
|
|
||||||
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
|
|
||||||
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* naechster Client */
|
|
||||||
c = Client_Next( c );
|
|
||||||
}
|
|
||||||
if( rpl[strlen( rpl ) - 1] != ':')
|
|
||||||
{
|
|
||||||
/* es wurden User gefunden */
|
|
||||||
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
|
|
||||||
} /* IRC_NAMES */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_STATS( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *from, *target, *cl;
|
|
||||||
CONN_ID con;
|
|
||||||
CHAR query;
|
|
||||||
COMMAND *cmd;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* From aus Prefix ermitteln */
|
|
||||||
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 );
|
|
||||||
|
|
||||||
if( Req->argc == 2 )
|
|
||||||
{
|
|
||||||
/* an anderen Server forwarden */
|
|
||||||
target = Client_Search( 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( ))
|
|
||||||
{
|
|
||||||
/* Ok, anderer Server ist das Ziel: forwarden */
|
|
||||||
return IRC_WriteStrClientPrefix( target, from, "STATS %s %s", Req->argv[0], Req->argv[1] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Req->argc > 0 ) query = Req->argv[0][0] ? Req->argv[0][0] : '*';
|
|
||||||
else query = '*';
|
|
||||||
|
|
||||||
switch ( query )
|
|
||||||
{
|
|
||||||
case 'l': /* Links */
|
|
||||||
case 'L':
|
|
||||||
con = Conn_First( );
|
|
||||||
while( con != NONE )
|
|
||||||
{
|
|
||||||
cl = Client_GetFromConn( con );
|
|
||||||
if( cl && (( Client_Type( cl ) == CLIENT_SERVER ) || ( cl == Client )))
|
|
||||||
{
|
|
||||||
/* Server link or our own connection */
|
|
||||||
#ifdef USE_ZLIB
|
|
||||||
if( Conn_Options( con ) & CONN_ZIP )
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytesZip( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytesZip( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFO_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
con = Conn_Next( con );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'm': /* IRC-Befehle */
|
|
||||||
case 'M':
|
|
||||||
cmd = Parse_GetCommandStruct( );
|
|
||||||
while( cmd->name )
|
|
||||||
{
|
|
||||||
if( cmd->lcount > 0 || cmd->rcount > 0 )
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_STATSCOMMANDS_MSG, Client_ID( from ), cmd->name, cmd->lcount, cmd->bytes, cmd->rcount )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
cmd++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IRC_WriteStrClient( from, RPL_ENDOFSTATS_MSG, Client_ID( from ), query );
|
|
||||||
} /* IRC_STATS */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_TIME( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *from, *target;
|
|
||||||
CHAR t_str[64];
|
|
||||||
time_t t;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* From aus Prefix ermitteln */
|
|
||||||
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 );
|
|
||||||
|
|
||||||
if( Req->argc == 1 )
|
|
||||||
{
|
|
||||||
/* an anderen Server forwarden */
|
|
||||||
target = Client_Search( 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( ))
|
|
||||||
{
|
|
||||||
/* Ok, anderer Server ist das Ziel: forwarden */
|
|
||||||
return IRC_WriteStrClientPrefix( target, from, "TIME %s", Req->argv[0] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t = time( NULL );
|
|
||||||
(VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %z", localtime( &t ));
|
|
||||||
return IRC_WriteStrClient( from, RPL_TIME_MSG, Client_ID( from ), Client_ID( Client_ThisServer( )), t_str );
|
|
||||||
} /* IRC_TIME */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_USERHOST( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CHAR rpl[COMMAND_LEN];
|
|
||||||
CLIENT *c;
|
|
||||||
INT max, i;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( 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_Search( Req->argv[i] );
|
|
||||||
if( c && ( Client_Type( c ) == CLIENT_USER ))
|
|
||||||
{
|
|
||||||
/* Dieser Nick ist "online" */
|
|
||||||
strcat( rpl, Client_ID( c ));
|
|
||||||
if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
|
|
||||||
strcat( rpl, "=" );
|
|
||||||
if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
|
|
||||||
else strcat( rpl, "+" );
|
|
||||||
strcat( rpl, Client_User( c ));
|
|
||||||
strcat( rpl, "@" );
|
|
||||||
strcat( rpl, Client_Hostname( c ));
|
|
||||||
strcat( rpl, " " );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
|
|
||||||
|
|
||||||
return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
|
|
||||||
} /* IRC_USERHOST */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_VERSION( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *target, *prefix;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* Ziel suchen */
|
|
||||||
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
|
|
||||||
else target = Client_ThisServer( );
|
|
||||||
|
|
||||||
/* Prefix ermitteln */
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
|
|
||||||
else prefix = Client;
|
|
||||||
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
|
||||||
|
|
||||||
/* An anderen Server weiterleiten? */
|
|
||||||
if( target != Client_ThisServer( ))
|
|
||||||
{
|
|
||||||
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] );
|
|
||||||
return CONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* mit Versionsinfo antworten */
|
|
||||||
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
|
|
||||||
} /* IRC_VERSION */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_WHO( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
BOOLEAN ok, only_ops;
|
|
||||||
CHAR flags[8], *ptr;
|
|
||||||
CL2CHAN *cl2chan;
|
|
||||||
CHANNEL *chan;
|
|
||||||
CLIENT *c;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
only_ops = FALSE;
|
|
||||||
chan = NULL;
|
|
||||||
|
|
||||||
if( Req->argc == 2 )
|
|
||||||
{
|
|
||||||
/* Nur OPs anzeigen? */
|
|
||||||
if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE;
|
|
||||||
#ifdef STRICT_RFC
|
|
||||||
else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Req->argc >= 1 )
|
|
||||||
{
|
|
||||||
/* wurde ein Channel oder Nick-Mask angegeben? */
|
|
||||||
chan = Channel_Search( Req->argv[0] );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( chan )
|
|
||||||
{
|
|
||||||
/* User eines Channels ausgeben */
|
|
||||||
if( ! IRC_Send_WHO( Client, chan, only_ops )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
c = Client_First( );
|
|
||||||
while( c )
|
|
||||||
{
|
|
||||||
if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' )))
|
|
||||||
{
|
|
||||||
ok = FALSE;
|
|
||||||
if( Req->argc == 0 ) ok = TRUE;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE;
|
|
||||||
else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
|
|
||||||
{
|
|
||||||
/* Flags zusammenbasteln */
|
|
||||||
strcpy( flags, "H" );
|
|
||||||
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
|
|
||||||
|
|
||||||
/* ausgeben */
|
|
||||||
cl2chan = Channel_FirstChannelOf( c );
|
|
||||||
if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
|
|
||||||
else ptr = "*";
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* naechster Client */
|
|
||||||
c = Client_Next( c );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
|
|
||||||
else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
|
|
||||||
else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
|
|
||||||
} /* IRC_WHO */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *from, *target, *c;
|
|
||||||
CHAR str[LINE_LEN + 1];
|
|
||||||
CL2CHAN *cl2chan;
|
|
||||||
CHANNEL *chan;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Bad number of parameters? */
|
|
||||||
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
/* 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] );
|
|
||||||
|
|
||||||
/* 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 );
|
|
||||||
|
|
||||||
/* Forward to other server? */
|
|
||||||
if( Req->argc > 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], Req->argv[1] );
|
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED;
|
|
||||||
|
|
||||||
/* Channels */
|
|
||||||
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
|
|
||||||
cl2chan = Channel_FirstChannelOf( c );
|
|
||||||
while( cl2chan )
|
|
||||||
{
|
|
||||||
chan = Channel_GetChannel( cl2chan );
|
|
||||||
assert( chan != NULL );
|
|
||||||
|
|
||||||
/* 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, "+" );
|
|
||||||
strcat( str, Channel_Name( chan ));
|
|
||||||
|
|
||||||
if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
|
|
||||||
{
|
|
||||||
/* 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 ));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* next */
|
|
||||||
cl2chan = Channel_NextChannelOf( c, cl2chan );
|
|
||||||
}
|
|
||||||
if( str[strlen( str ) - 1] != ':')
|
|
||||||
{
|
|
||||||
/* There is data left to send: */
|
|
||||||
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IRC-Operator? */
|
|
||||||
if( Client_HasMode( c, 'o' ))
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Away? */
|
|
||||||
if( Client_HasMode( c, 'a' ))
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End of Whois */
|
|
||||||
return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
|
|
||||||
} /* IRC_WHOIS */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
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 );
|
|
||||||
|
|
||||||
/* ... */
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_WHOWAS */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_Send_LUSERS( CLIENT *Client )
|
|
||||||
{
|
|
||||||
LONG cnt;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
/* Number of IRC operators */
|
|
||||||
cnt = Client_OperCount( );
|
|
||||||
if( cnt > 0 )
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unknown connections */
|
|
||||||
cnt = Client_UnknownCount( );
|
|
||||||
if( cnt > 0 )
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Number of created channels */
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
|
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_Show_MOTD( CLIENT *Client )
|
|
||||||
{
|
|
||||||
BOOLEAN ok;
|
|
||||||
CHAR line[127];
|
|
||||||
FILE *fd;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
|
|
||||||
fd = fopen( Conf_MotdFile, "r" );
|
|
||||||
if( ! fd )
|
|
||||||
{
|
|
||||||
Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
|
|
||||||
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )));
|
|
||||||
while( TRUE )
|
|
||||||
{
|
|
||||||
if( ! fgets( line, 126, fd )) break;
|
|
||||||
if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
|
|
||||||
{
|
|
||||||
fclose( fd );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
|
|
||||||
|
|
||||||
fclose( fd );
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
} /* IRC_Show_MOTD */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
|
|
||||||
{
|
|
||||||
BOOLEAN is_visible, is_member;
|
|
||||||
CHAR str[LINE_LEN + 1];
|
|
||||||
CL2CHAN *cl2chan;
|
|
||||||
CLIENT *cl;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Chan != NULL );
|
|
||||||
|
|
||||||
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
|
|
||||||
else is_member = FALSE;
|
|
||||||
|
|
||||||
/* Alle Mitglieder suchen */
|
|
||||||
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
|
|
||||||
cl2chan = Channel_FirstMember( Chan );
|
|
||||||
while( cl2chan )
|
|
||||||
{
|
|
||||||
cl = Channel_GetClient( cl2chan );
|
|
||||||
|
|
||||||
if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE;
|
|
||||||
else is_visible = TRUE;
|
|
||||||
|
|
||||||
if( is_member || is_visible )
|
|
||||||
{
|
|
||||||
/* Nick anhaengen */
|
|
||||||
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
|
|
||||||
if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" );
|
|
||||||
else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" );
|
|
||||||
strcat( str, Client_ID( cl ));
|
|
||||||
|
|
||||||
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
|
|
||||||
{
|
|
||||||
/* Zeile wird zu lang: senden! */
|
|
||||||
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
|
||||||
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* naechstes Mitglied suchen */
|
|
||||||
cl2chan = Channel_NextMember( Chan, cl2chan );
|
|
||||||
}
|
|
||||||
if( str[strlen( str ) - 1] != ':')
|
|
||||||
{
|
|
||||||
/* Es sind noch Daten da, die gesendet werden muessen */
|
|
||||||
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_Send_NAMES */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
|
|
||||||
{
|
|
||||||
BOOLEAN is_visible, is_member;
|
|
||||||
CL2CHAN *cl2chan;
|
|
||||||
CHAR flags[8];
|
|
||||||
CLIENT *c;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Chan != NULL );
|
|
||||||
|
|
||||||
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
|
|
||||||
else is_member = FALSE;
|
|
||||||
|
|
||||||
/* Alle Mitglieder suchen */
|
|
||||||
cl2chan = Channel_FirstMember( Chan );
|
|
||||||
while( cl2chan )
|
|
||||||
{
|
|
||||||
c = Channel_GetClient( cl2chan );
|
|
||||||
|
|
||||||
if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE;
|
|
||||||
else is_visible = TRUE;
|
|
||||||
|
|
||||||
if( is_member || is_visible )
|
|
||||||
{
|
|
||||||
/* Flags zusammenbasteln */
|
|
||||||
strcpy( flags, "H" );
|
|
||||||
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
|
|
||||||
if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" );
|
|
||||||
else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" );
|
|
||||||
|
|
||||||
/* ausgeben */
|
|
||||||
if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' )))
|
|
||||||
{
|
|
||||||
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), Channel_Name( Chan ), Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* naechstes Mitglied suchen */
|
|
||||||
cl2chan = Channel_NextMember( Chan, cl2chan );
|
|
||||||
}
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_Send_WHO */
|
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
|
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
|
||||||
* Copyright (c)2001,2002 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
|
|
||||||
* 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: irc-info.h,v 1.2 2002/12/12 12:23:43 alex Exp $
|
|
||||||
*
|
|
||||||
* IRC info commands (header)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __irc_info_h__
|
|
||||||
#define __irc_info_h__
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_WHOWAS PARAMS(( CLIENT *Client, REQUEST *Req ));
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS(( CLIENT *Client ));
|
|
||||||
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS(( CLIENT *Client, CHANNEL *Chan ));
|
|
||||||
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS(( CLIENT *Client ));
|
|
||||||
GLOBAL BOOLEAN IRC_Send_WHO PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Login and logout
|
* $Id: irc-login.c,v 1.21.2.1 2002/09/22 21:37:06 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-login.c: Anmeldung und Abmeldung im IRC
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
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 "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -31,7 +32,7 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.27.2.2 2003/01/01 13:46:37 alex
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "irc-info.h"
|
#include "irc.h"
|
||||||
#include "irc-write.h"
|
#include "irc-write.h"
|
||||||
|
|
||||||
#include "exp.h"
|
#include "exp.h"
|
||||||
@@ -64,7 +65,7 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
|
|||||||
}
|
}
|
||||||
else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
|
else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 )))
|
||||||
{
|
{
|
||||||
CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags;
|
CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr;
|
||||||
INT protohigh, protolow;
|
INT protohigh, protolow;
|
||||||
|
|
||||||
/* noch nicht registrierte Server-Verbindung */
|
/* noch nicht registrierte Server-Verbindung */
|
||||||
@@ -93,10 +94,6 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
|
|||||||
if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4];
|
if( strlen( Req->argv[1] ) > 4 ) type = &Req->argv[1][4];
|
||||||
else type = NULL;
|
else type = NULL;
|
||||||
|
|
||||||
/* IRC-Flags (nach RFC 2813) */
|
|
||||||
if( Req->argc >= 4 ) ircflags = Req->argv[3];
|
|
||||||
else ircflags = "";
|
|
||||||
|
|
||||||
/* Implementation, Version und ngIRCd-Flags */
|
/* Implementation, Version und ngIRCd-Flags */
|
||||||
impl = Req->argv[2];
|
impl = Req->argv[2];
|
||||||
ptr = strchr( impl, '|' );
|
ptr = strchr( impl, '|' );
|
||||||
@@ -114,16 +111,12 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
|
|||||||
flags++;
|
flags++;
|
||||||
}
|
}
|
||||||
else flags = "";
|
else flags = "";
|
||||||
Log( LOG_INFO, "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags );
|
Log( LOG_INFO, "Connection %d: Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", Client_Conn( Client ), impl, serverver, protohigh, protolow, flags );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* auf der anderen Seite laeuft ein Server, der
|
serverver = flags = "";
|
||||||
* nur das Originalprotokoll unterstuetzt */
|
Log( LOG_INFO, "Connection %d: Peer announces itself as \"%s\" using protocol %d.%d.", Client_Conn( Client ), impl, protohigh, protolow );
|
||||||
serverver = "";
|
|
||||||
if( strchr( ircflags, 'Z' )) flags = "Z";
|
|
||||||
else flags = "";
|
|
||||||
Log( LOG_INFO, "Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Client_SetType( Client, CLIENT_GOTPASSSERVER );
|
Client_SetType( Client, CLIENT_GOTPASSSERVER );
|
||||||
@@ -361,6 +354,8 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
|
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
|
||||||
#ifdef STRICT_RFC
|
#ifdef STRICT_RFC
|
||||||
@@ -371,7 +366,7 @@ IRC_PING( CLIENT *Client, REQUEST *Req )
|
|||||||
{
|
{
|
||||||
/* es wurde ein Ziel-Client angegeben */
|
/* es wurde ein Ziel-Client angegeben */
|
||||||
target = Client_Search( Req->argv[1] );
|
target = Client_Search( 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 ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
|
||||||
if( target != Client_ThisServer( ))
|
if( target != Client_ThisServer( ))
|
||||||
{
|
{
|
||||||
/* ok, forwarden */
|
/* ok, forwarden */
|
||||||
@@ -395,6 +390,8 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
|
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
|
||||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
@@ -403,7 +400,7 @@ IRC_PONG( CLIENT *Client, REQUEST *Req )
|
|||||||
if( Req->argc == 2 )
|
if( Req->argc == 2 )
|
||||||
{
|
{
|
||||||
target = Client_Search( Req->argv[1] );
|
target = Client_Search( 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 ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
|
||||||
if( target != Client_ThisServer( ))
|
if( target != Client_ThisServer( ))
|
||||||
{
|
{
|
||||||
/* ok, forwarden */
|
/* ok, forwarden */
|
||||||
@@ -448,9 +445,6 @@ Hello_User( CLIENT *Client )
|
|||||||
if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE;
|
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;
|
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 );
|
Client_SetType( Client, CLIENT_USER );
|
||||||
|
|
||||||
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
|
if( ! IRC_Send_LUSERS( Client )) return DISCONNECTED;
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-login.h,v 1.5 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-login.h,v 1.4 2002/05/27 13:09:27 alex Exp $
|
||||||
*
|
*
|
||||||
* Login and logout (header)
|
* irc-login.h: Anmeldung und Abmeldung im IRC (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,24 +2,23 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* IRC commands for mode changes (MODE, AWAY, ...)
|
* $Id: irc-mode.c,v 1.14 2002/09/08 17:07:14 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-mode.c: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
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 "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
@@ -38,9 +37,6 @@ static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.5 2003/01/21 21:05:19 alex E
|
|||||||
#include "irc-mode.h"
|
#include "irc-mode.h"
|
||||||
|
|
||||||
|
|
||||||
LOCAL BOOLEAN Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
|
|
||||||
LOCAL BOOLEAN Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
|
|
||||||
|
|
||||||
LOCAL BOOLEAN Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ));
|
LOCAL BOOLEAN Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ));
|
||||||
LOCAL BOOLEAN Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ));
|
LOCAL BOOLEAN Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ));
|
||||||
|
|
||||||
@@ -53,549 +49,383 @@ LOCAL BOOLEAN Send_ListChange PARAMS(( CHAR *Mode, CLIENT *Prefix, CLIENT *Clien
|
|||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
IRC_MODE( CLIENT *Client, REQUEST *Req )
|
IRC_MODE( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
CLIENT *cl, *origin;
|
CHAR *mode_ptr, the_modes[CLIENT_MODE_LEN], x[2];
|
||||||
|
CLIENT *cl, *chan_cl, *prefix;
|
||||||
|
BOOLEAN set, ok, modeok;
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
/* No parameters? */
|
cl = chan_cl = prefix = NULL;
|
||||||
|
chan = NULL;
|
||||||
|
|
||||||
|
/* Valider Client? */
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Keine Parameter? */
|
||||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
/* Origin for answers */
|
/* Ziel suchen: Client bzw. Channel */
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER )
|
|
||||||
{
|
|
||||||
origin = Client_Search( Req->prefix );
|
|
||||||
if( ! origin ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
|
||||||
}
|
|
||||||
else origin = Client;
|
|
||||||
|
|
||||||
/* Channel or user mode? */
|
|
||||||
cl = chan = NULL;
|
|
||||||
if( Client_IsValidNick( Req->argv[0] )) cl = Client_Search( Req->argv[0] );
|
if( Client_IsValidNick( Req->argv[0] )) cl = Client_Search( Req->argv[0] );
|
||||||
if( Channel_IsValidName( Req->argv[0] )) chan = Channel_Search( Req->argv[0] );
|
if( Channel_IsValidName( Req->argv[0] )) chan = Channel_Search( Req->argv[0] );
|
||||||
|
|
||||||
if( cl ) return Client_Mode( Client, Req, origin, cl );
|
/* Kein Ziel gefunden? */
|
||||||
if( chan ) return Channel_Mode( Client, Req, origin, chan );
|
if(( ! cl ) && ( ! chan )) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
|
||||||
|
|
||||||
/* No target found! */
|
assert(( cl && chan ) != TRUE );
|
||||||
return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
|
|
||||||
} /* IRC_MODE */
|
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( cl ) && ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
if(( chan ) && ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
LOCAL BOOLEAN
|
/* Prefix fuer Antworten etc. ermitteln */
|
||||||
Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
|
if( Client_Type( Client ) == CLIENT_SERVER )
|
||||||
{
|
|
||||||
/* Handle client mode requests */
|
|
||||||
|
|
||||||
CHAR the_modes[COMMAND_LEN], x[2], *mode_ptr;
|
|
||||||
BOOLEAN ok, set;
|
|
||||||
INT mode_arg;
|
|
||||||
|
|
||||||
/* Is the client allowed to request or change the modes? */
|
|
||||||
if( Client_Type( Client ) == CLIENT_USER )
|
|
||||||
{
|
{
|
||||||
/* Users are only allowed to manipulate their own modes! */
|
prefix = Client_Search( Req->prefix );
|
||||||
if( Target != Client ) return IRC_WriteStrClient( Client, ERR_USERSDONTMATCH_MSG, Client_ID( Client ));
|
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
}
|
||||||
|
else prefix = Client;
|
||||||
|
|
||||||
|
if(( chan ) && (( Req->argc == 2 ) || ( Req->argc == 3 )))
|
||||||
|
{
|
||||||
|
/* pruefen, ob "Listen-Operation": Invite, Ban */
|
||||||
|
if(( Req->argv[1][0] == '-' ) || ( Req->argv[1][0] == '+' )) mode_ptr = &Req->argv[1][1];
|
||||||
|
else mode_ptr = &Req->argv[1][0];
|
||||||
|
|
||||||
|
if( Req->argc == 2 )
|
||||||
|
{
|
||||||
|
/* Liste anzeigen */
|
||||||
|
if( *mode_ptr == 'I' ) return Lists_ShowInvites( prefix, chan );
|
||||||
|
if( *mode_ptr == 'b' ) return Lists_ShowBans( prefix, chan );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Listen veraendern */
|
||||||
|
|
||||||
|
if( Client_Type( Client ) == CLIENT_USER )
|
||||||
|
{
|
||||||
|
/* Ist der User Channel-Operator? */
|
||||||
|
modeok = FALSE;
|
||||||
|
if( strchr( Channel_UserModes( chan, Client ), 'o' )) modeok = TRUE;
|
||||||
|
if( Conf_OperCanMode )
|
||||||
|
{
|
||||||
|
/* auch IRC-Operatoren duerfen MODE verwenden */
|
||||||
|
if( Client_OperByMe( Client )) modeok = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! modeok )
|
||||||
|
{
|
||||||
|
Log( LOG_DEBUG, "Can't change modes: \"%s\" is not operator on %s!", Client_ID( Client ), Channel_Name( chan ));
|
||||||
|
return IRC_WriteStrClient( Client, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Client ), Channel_Name( chan ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Req->argv[1][0] == '+' )
|
||||||
|
{
|
||||||
|
/* Listen-Eintrag hinzufuegen */
|
||||||
|
if( *mode_ptr == 'I' ) return Add_Invite( prefix, Client, chan, Req->argv[2] );
|
||||||
|
if( *mode_ptr == 'b' ) return Add_Ban( prefix, Client, chan, Req->argv[2] );
|
||||||
|
}
|
||||||
|
else if( Req->argv[1][0] == '-' )
|
||||||
|
{
|
||||||
|
/* Listen-Eintrag loeschen */
|
||||||
|
if( *mode_ptr == 'I' ) return Del_Invite( prefix, Client, chan, Req->argv[2] );
|
||||||
|
if( *mode_ptr == 'b' ) return Del_Ban( prefix, Client, chan, Req->argv[2] );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mode request: let's answer it :-) */
|
/* Client ermitteln, wenn bei Channel-Modes mit 3 Parametern */
|
||||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Origin, RPL_UMODEIS_MSG, Client_ID( Origin ), Client_Modes( Target ));
|
if(( chan ) && (Req->argc == 3 ))
|
||||||
|
{
|
||||||
|
chan_cl = Client_Search( Req->argv[2] );
|
||||||
|
if( ! chan_cl ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
|
||||||
|
}
|
||||||
|
|
||||||
mode_arg = 1;
|
/* Wenn Anfragender ein User ist: Zugriff erlaubt? */
|
||||||
mode_ptr = Req->argv[mode_arg];
|
if( Client_Type( Client ) == CLIENT_USER )
|
||||||
|
{
|
||||||
|
if( cl )
|
||||||
|
{
|
||||||
|
/* MODE ist nur fuer sich selber zulaessig! */
|
||||||
|
if( cl != Client ) return IRC_WriteStrClient( Client, ERR_USERSDONTMATCH_MSG, Client_ID( Client ));
|
||||||
|
}
|
||||||
|
if( chan )
|
||||||
|
{
|
||||||
|
/* Darf der User die Channel-Modes ermitteln? */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Initial state: set or unset modes? */
|
/* Werden die Modes "nur" erfragt? */
|
||||||
if( *mode_ptr == '+' ) set = TRUE;
|
if(( cl ) && ( Req->argc == 1 )) return IRC_WriteStrClient( Client, RPL_UMODEIS_MSG, Client_ID( Client ), Client_Modes( cl ));
|
||||||
else if( *mode_ptr == '-' ) set = FALSE;
|
if(( chan ) && ( Req->argc == 1 )) return IRC_WriteStrClient( Client, RPL_CHANNELMODEIS_MSG, Client_ID( Client ), Channel_Name( chan ), Channel_Modes( chan ));
|
||||||
else return IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Origin ));
|
|
||||||
|
|
||||||
/* Prepare reply string */
|
mode_ptr = Req->argv[1];
|
||||||
|
|
||||||
|
/* Sollen Modes gesetzt oder geloescht werden? */
|
||||||
|
if( cl )
|
||||||
|
{
|
||||||
|
if( *mode_ptr == '+' ) set = TRUE;
|
||||||
|
else if( *mode_ptr == '-' ) set = FALSE;
|
||||||
|
else return IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Client ));
|
||||||
|
mode_ptr++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( *mode_ptr == '-' ) set = FALSE;
|
||||||
|
else set = TRUE;
|
||||||
|
if(( *mode_ptr == '-' ) || ( *mode_ptr == '+' )) mode_ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reply-String mit Aenderungen vorbereiten */
|
||||||
if( set ) strcpy( the_modes, "+" );
|
if( set ) strcpy( the_modes, "+" );
|
||||||
else strcpy( the_modes, "-" );
|
else strcpy( the_modes, "-" );
|
||||||
|
|
||||||
|
ok = TRUE;
|
||||||
x[1] = '\0';
|
x[1] = '\0';
|
||||||
ok = CONNECTED;
|
while( *mode_ptr )
|
||||||
while( mode_ptr )
|
|
||||||
{
|
{
|
||||||
mode_ptr++;
|
|
||||||
if( ! *mode_ptr )
|
|
||||||
{
|
|
||||||
/* Try next argument if there's any */
|
|
||||||
mode_arg++;
|
|
||||||
if( mode_arg < Req->argc ) mode_ptr = Req->argv[mode_arg];
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( *mode_ptr )
|
|
||||||
{
|
|
||||||
case '+':
|
|
||||||
case '-':
|
|
||||||
if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
|
|
||||||
{
|
|
||||||
/* Action modifier ("+"/"-") must be changed ... */
|
|
||||||
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' ))
|
|
||||||
{
|
|
||||||
/* Adjust last action modifier in result */
|
|
||||||
the_modes[strlen( the_modes ) - 1] = *mode_ptr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Append modifier character to result string */
|
|
||||||
x[0] = *mode_ptr; strcat( the_modes, x );
|
|
||||||
}
|
|
||||||
if( *mode_ptr == '+' ) set = TRUE;
|
|
||||||
else set = FALSE;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Validate modes */
|
|
||||||
x[0] = '\0';
|
x[0] = '\0';
|
||||||
switch( *mode_ptr )
|
if( Client_Type( Client ) == CLIENT_SERVER )
|
||||||
{
|
{
|
||||||
case 'a':
|
/* Befehl kommt von einem Server, daher
|
||||||
/* Away */
|
* trauen wir ihm "unbesehen" ... */
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER )
|
x[0] = *mode_ptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Modes validieren */
|
||||||
|
if( cl )
|
||||||
|
{
|
||||||
|
/* User-Modes */
|
||||||
|
switch( *mode_ptr )
|
||||||
{
|
{
|
||||||
x[0] = 'a';
|
case 'i':
|
||||||
Client_SetAway( Client, DEFAULT_AWAY_MSG );
|
/* invisible */
|
||||||
|
x[0] = 'i';
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
/* operator (kann nur geloescht werden) */
|
||||||
|
if( ! set )
|
||||||
|
{
|
||||||
|
Client_SetOperByMe( Client, FALSE );
|
||||||
|
x[0] = 'o';
|
||||||
|
}
|
||||||
|
else ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Client ));
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
/* restricted (kann nur gesetzt werden) */
|
||||||
|
if( set ) x[0] = 'r';
|
||||||
|
else ok = IRC_WriteStrClient( Client, ERR_RESTRICTED_MSG, Client_ID( Client ));
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
/* server messages */
|
||||||
|
x[0] = 's';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID( Client ));
|
||||||
|
ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Client ), set ? '+' : '-', *mode_ptr );
|
||||||
|
x[0] = '\0';
|
||||||
}
|
}
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
|
}
|
||||||
break;
|
if( chan )
|
||||||
case 'i':
|
{
|
||||||
/* Invisible */
|
/* Ist der User ein Channel Operator? */
|
||||||
x[0] = 'i';
|
modeok = FALSE;
|
||||||
break;
|
if( strchr( Channel_UserModes( chan, Client ), 'o' )) modeok = TRUE;
|
||||||
case 'o':
|
if( Conf_OperCanMode )
|
||||||
/* IRC operator (only unsetable!) */
|
|
||||||
if(( ! set ) || ( Client_Type( Client ) == CLIENT_SERVER ))
|
|
||||||
{
|
{
|
||||||
Client_SetOperByMe( Target, FALSE );
|
/* auch IRC-Operatoren duerfen MODE verwenden */
|
||||||
x[0] = 'o';
|
if( Client_OperByMe( Client )) modeok = TRUE;
|
||||||
}
|
}
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
|
|
||||||
break;
|
if( ! modeok )
|
||||||
case 'r':
|
{
|
||||||
/* Restricted (only setable) */
|
Log( LOG_DEBUG, "Can't change modes: \"%s\" is not operator on %s!", Client_ID( Client ), Channel_Name( chan ));
|
||||||
if(( set ) || ( Client_Type( Client ) == CLIENT_SERVER )) x[0] = 'r';
|
ok = IRC_WriteStrClient( Client, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Client ), Channel_Name( chan ));
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_RESTRICTED_MSG, Client_ID( Origin ));
|
break;
|
||||||
break;
|
}
|
||||||
case 's':
|
|
||||||
/* Server messages */
|
/* Channel-Modes oder Channel-User-Modes */
|
||||||
x[0] = 's';
|
if( chan_cl )
|
||||||
break;
|
{
|
||||||
default:
|
/* Channel-User-Modes */
|
||||||
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID( Origin ));
|
switch( *mode_ptr )
|
||||||
if( Client_Type( Client ) != CLIENT_SERVER ) ok = IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Origin ), set ? '+' : '-', *mode_ptr );
|
{
|
||||||
x[0] = '\0';
|
case 'o':
|
||||||
goto client_exit;
|
/* Channel Operator */
|
||||||
|
x[0] = 'o';
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
/* Voice */
|
||||||
|
x[0] = 'v';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log( LOG_DEBUG, "Unknown channel-user-mode \"%c%c\" from \"%s\" on \"%s\" at %s!?", set ? '+' : '-', *mode_ptr, Client_ID( Client ), Client_ID( chan_cl ), Channel_Name( chan ));
|
||||||
|
ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Client ), set ? '+' : '-', *mode_ptr );
|
||||||
|
x[0] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Channel-Modes */
|
||||||
|
switch( *mode_ptr )
|
||||||
|
{
|
||||||
|
case 'i':
|
||||||
|
/* Invite-Only */
|
||||||
|
x[0] = 'i';
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
/* Moderated */
|
||||||
|
x[0] = 'm';
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
/* kein Schreiben in den Channel von aussen */
|
||||||
|
x[0] = 'n';
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
/* Topic Lock */
|
||||||
|
x[0] = 't';
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
/* Persistent */
|
||||||
|
x[0] = 'P';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log( LOG_DEBUG, "Unknown channel-mode \"%c%c\" from \"%s\" at %s!?", set ? '+' : '-', *mode_ptr, Client_ID( Client ), Channel_Name( chan ));
|
||||||
|
ok = IRC_WriteStrClient( Client, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Client ), set ? '+' : '-', *mode_ptr );
|
||||||
|
x[0] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( ! ok ) break;
|
if( ! ok ) break;
|
||||||
|
|
||||||
/* Is there a valid mode change? */
|
mode_ptr++;
|
||||||
if( ! x[0] ) continue;
|
if( ! x[0] ) continue;
|
||||||
|
|
||||||
if( set )
|
/* Okay, gueltigen Mode gefunden */
|
||||||
|
if( cl )
|
||||||
{
|
{
|
||||||
/* Set mode */
|
/* Es geht um User-Modes */
|
||||||
if( Client_ModeAdd( Target, x[0] )) strcat( the_modes, x );
|
if( set )
|
||||||
|
{
|
||||||
|
/* Mode setzen. Wenn der Client ihn noch nicht hatte: merken */
|
||||||
|
if( Client_ModeAdd( cl, x[0] )) strcat( the_modes, x );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Modes geloescht. Wenn der Client ihn hatte: merken */
|
||||||
|
if( Client_ModeDel( cl, x[0] )) strcat( the_modes, x );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "nachbearbeiten" */
|
||||||
|
if( x[0] == 'a' )
|
||||||
|
{
|
||||||
|
/* away */
|
||||||
|
if( set ) Client_SetAway( cl, DEFAULT_AWAY_MSG );
|
||||||
|
else Client_SetAway( cl, NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
if( chan )
|
||||||
{
|
{
|
||||||
/* Unset mode */
|
/* Es geht um Channel-Modes oder Channel-User-Modes */
|
||||||
if( Client_ModeDel( Target, x[0] )) strcat( the_modes, x );
|
if( chan_cl )
|
||||||
|
{
|
||||||
|
/* Channel-User-Modes */
|
||||||
|
if( set )
|
||||||
|
{
|
||||||
|
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
|
||||||
|
if( Channel_UserModeAdd( chan, chan_cl, x[0] )) strcat( the_modes, x );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
|
||||||
|
if( Channel_UserModeDel( chan, chan_cl, x[0] )) strcat( the_modes, x );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Channel-Mode */
|
||||||
|
if( set )
|
||||||
|
{
|
||||||
|
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
|
||||||
|
if( Channel_ModeAdd( chan, x[0] )) strcat( the_modes, x );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Mode setzen. Wenn der Channel ihn noch nicht hatte: merken */
|
||||||
|
if( Channel_ModeDel( chan, x[0] )) strcat( the_modes, x );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client_exit:
|
|
||||||
|
|
||||||
/* Are there changed modes? */
|
/* Wurden Modes geaendert? */
|
||||||
if( the_modes[1] )
|
if( the_modes[1] )
|
||||||
{
|
{
|
||||||
/* Remoce needless action modifier characters */
|
if( cl )
|
||||||
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' )) the_modes[strlen( the_modes ) - 1] = '\0';
|
|
||||||
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER )
|
|
||||||
{
|
{
|
||||||
/* Forward modes to other servers */
|
/* Client-Mode */
|
||||||
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s :%s", Client_ID( Target ), the_modes );
|
if( Client_Type( Client ) == CLIENT_SERVER )
|
||||||
|
{
|
||||||
|
/* Modes an andere Server forwarden */
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Client_ID( cl ), the_modes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Bestaetigung an Client schicken & andere Server informieren */
|
||||||
|
ok = IRC_WriteStrClientPrefix( Client, prefix, "MODE %s %s", Client_ID( cl ), the_modes );
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Client_ID( cl ), the_modes );
|
||||||
|
}
|
||||||
|
Log( LOG_DEBUG, "User \"%s\": Mode change, now \"%s\".", Client_Mask( cl ), Client_Modes( cl ));
|
||||||
}
|
}
|
||||||
else
|
if( chan )
|
||||||
{
|
{
|
||||||
/* Send reply to client and inform other servers */
|
/* Channel-Modes oder Channel-User-Mode */
|
||||||
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s", Client_ID( Target ), the_modes );
|
if( chan_cl )
|
||||||
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s :%s", Client_ID( Target ), the_modes );
|
{
|
||||||
|
/* Channel-User-Mode */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER )
|
||||||
|
{
|
||||||
|
/* Modes an andere Server und Channel-User forwarden */
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s %s :%s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
|
||||||
|
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s %s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */
|
||||||
|
ok = IRC_WriteStrClientPrefix( Client, prefix, "MODE %s %s %s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s %s :%s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
|
||||||
|
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s %s", Channel_Name( chan ), the_modes, Client_ID( chan_cl));
|
||||||
|
}
|
||||||
|
Log( LOG_DEBUG, "User \"%s\" on %s: Mode change, now \"%s\".", Client_Mask( chan_cl), Channel_Name( chan ), Channel_UserModes( chan, chan_cl ));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Channel-Mode */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER )
|
||||||
|
{
|
||||||
|
/* Modes an andere Server und Channel-User forwarden */
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Channel_Name( chan ), the_modes );
|
||||||
|
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s", Channel_Name( chan ), the_modes );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */
|
||||||
|
ok = IRC_WriteStrClientPrefix( Client, prefix, "MODE %s %s", Channel_Name( chan ), the_modes );
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "MODE %s :%s", Channel_Name( chan ), the_modes );
|
||||||
|
IRC_WriteStrChannelPrefix( Client, chan, prefix, FALSE, "MODE %s %s", Channel_Name( chan ), the_modes );
|
||||||
|
}
|
||||||
|
Log( LOG_DEBUG, "Channel \"%s\": Mode change, now \"%s\".", Channel_Name( chan ), Channel_Modes( chan ));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Log( LOG_DEBUG, "User \"%s\": Mode change, now \"%s\".", Client_Mask( Target ), Client_Modes( Target ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
} /* Client_Mode */
|
} /* IRC_MODE */
|
||||||
|
|
||||||
|
|
||||||
LOCAL BOOLEAN
|
|
||||||
Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
|
|
||||||
{
|
|
||||||
/* Handle channel and channel-user modes */
|
|
||||||
|
|
||||||
CHAR the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr;
|
|
||||||
BOOLEAN ok, set, modeok, skiponce;
|
|
||||||
INT mode_arg, arg_arg;
|
|
||||||
CLIENT *client;
|
|
||||||
LONG l;
|
|
||||||
|
|
||||||
/* Mode request: let's answer it :-) */
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
/* auch IRC-Operatoren duerfen MODE verwenden */
|
|
||||||
if( Client_OperByMe( Origin )) modeok = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else modeok = TRUE;
|
|
||||||
|
|
||||||
mode_arg = 1;
|
|
||||||
mode_ptr = Req->argv[mode_arg];
|
|
||||||
if( Req->argc > mode_arg + 1 ) arg_arg = mode_arg + 1;
|
|
||||||
else arg_arg = -1;
|
|
||||||
|
|
||||||
/* Initial state: set or unset modes? */
|
|
||||||
skiponce = FALSE;
|
|
||||||
if( *mode_ptr == '-' ) set = FALSE;
|
|
||||||
else if( *mode_ptr == '+' ) set = TRUE;
|
|
||||||
else set = skiponce = TRUE;
|
|
||||||
|
|
||||||
/* Prepare reply string */
|
|
||||||
if( set ) strcpy( the_modes, "+" );
|
|
||||||
else strcpy( the_modes, "-" );
|
|
||||||
strcpy( the_args, " " );
|
|
||||||
|
|
||||||
x[1] = '\0';
|
|
||||||
ok = CONNECTED;
|
|
||||||
while( mode_ptr )
|
|
||||||
{
|
|
||||||
if( ! skiponce ) mode_ptr++;
|
|
||||||
if( ! *mode_ptr )
|
|
||||||
{
|
|
||||||
/* Try next argument if there's any */
|
|
||||||
if( arg_arg > mode_arg ) mode_arg = arg_arg;
|
|
||||||
else mode_arg++;
|
|
||||||
if( mode_arg < Req->argc ) mode_ptr = Req->argv[mode_arg];
|
|
||||||
else break;
|
|
||||||
if( Req->argc > mode_arg + 1 ) arg_arg = mode_arg + 1;
|
|
||||||
else arg_arg = -1;
|
|
||||||
}
|
|
||||||
skiponce = FALSE;
|
|
||||||
|
|
||||||
switch( *mode_ptr )
|
|
||||||
{
|
|
||||||
case '+':
|
|
||||||
case '-':
|
|
||||||
if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
|
|
||||||
{
|
|
||||||
/* Action modifier ("+"/"-") must be changed ... */
|
|
||||||
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' ))
|
|
||||||
{
|
|
||||||
/* Adjust last action modifier in result */
|
|
||||||
the_modes[strlen( the_modes ) - 1] = *mode_ptr;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Append modifier character to result string */
|
|
||||||
x[0] = *mode_ptr; strcat( the_modes, x );
|
|
||||||
}
|
|
||||||
if( *mode_ptr == '+' ) set = TRUE;
|
|
||||||
else set = FALSE;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Are there arguments left? */
|
|
||||||
if( arg_arg >= Req->argc ) arg_arg = -1;
|
|
||||||
|
|
||||||
/* Validate modes */
|
|
||||||
x[0] = '\0';
|
|
||||||
argadd[0] = '\0';
|
|
||||||
client = NULL;
|
|
||||||
switch( *mode_ptr )
|
|
||||||
{
|
|
||||||
/* Channel modes */
|
|
||||||
case 'i':
|
|
||||||
/* Invite-Only */
|
|
||||||
if( modeok ) x[0] = 'i';
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
case 'm':
|
|
||||||
/* Moderated */
|
|
||||||
if( modeok ) x[0] = 'm';
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
case 'n':
|
|
||||||
/* kein Schreiben in den Channel von aussen */
|
|
||||||
if( modeok ) x[0] = 'n';
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
/* Topic Lock */
|
|
||||||
if( modeok ) x[0] = 't';
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
/* Persistent channel */
|
|
||||||
if( modeok )
|
|
||||||
{
|
|
||||||
if( set && ( ! Client_OperByMe( Client )))
|
|
||||||
{
|
|
||||||
/* Only IRC operators are allowed to set P mode */
|
|
||||||
ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin ));
|
|
||||||
}
|
|
||||||
else x[0] = 'P';
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Channel user modes */
|
|
||||||
case 'o':
|
|
||||||
/* Channel operator */
|
|
||||||
case 'v':
|
|
||||||
/* Voice */
|
|
||||||
if( arg_arg > mode_arg )
|
|
||||||
{
|
|
||||||
if( modeok )
|
|
||||||
{
|
|
||||||
client = Client_Search( Req->argv[arg_arg] );
|
|
||||||
if( client ) x[0] = *mode_ptr;
|
|
||||||
else ok = IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[arg_arg] );
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
Req->argv[arg_arg][0] = '\0';
|
|
||||||
arg_arg++;
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID( Origin ), Req->command );
|
|
||||||
break;
|
|
||||||
case 'k':
|
|
||||||
/* Channel key */
|
|
||||||
if( ! set )
|
|
||||||
{
|
|
||||||
if( modeok ) x[0] = *mode_ptr;
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( arg_arg > mode_arg )
|
|
||||||
{
|
|
||||||
if( modeok )
|
|
||||||
{
|
|
||||||
Channel_ModeDel( Channel, 'k' );
|
|
||||||
Channel_SetKey( Channel, Req->argv[arg_arg] );
|
|
||||||
strcpy( argadd, Channel_Key( Channel ));
|
|
||||||
x[0] = *mode_ptr;
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
Req->argv[arg_arg][0] = '\0';
|
|
||||||
arg_arg++;
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID( Origin ), Req->command );
|
|
||||||
break;
|
|
||||||
case 'l':
|
|
||||||
/* Member limit */
|
|
||||||
if( ! set )
|
|
||||||
{
|
|
||||||
if( modeok ) x[0] = *mode_ptr;
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( arg_arg > mode_arg )
|
|
||||||
{
|
|
||||||
if( modeok )
|
|
||||||
{
|
|
||||||
l = atol( Req->argv[arg_arg] );
|
|
||||||
if( l > 0 && l < 0xFFFF )
|
|
||||||
{
|
|
||||||
Channel_ModeDel( Channel, 'l' );
|
|
||||||
Channel_SetMaxUsers( Channel, l );
|
|
||||||
sprintf( argadd, "%ld", l );
|
|
||||||
x[0] = *mode_ptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
Req->argv[arg_arg][0] = '\0';
|
|
||||||
arg_arg++;
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_NEEDMOREPARAMS_MSG, Client_ID( Origin ), Req->command );
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Channel lists */
|
|
||||||
case 'I':
|
|
||||||
/* Invite lists */
|
|
||||||
if( arg_arg > mode_arg )
|
|
||||||
{
|
|
||||||
/* modify list */
|
|
||||||
if( modeok )
|
|
||||||
{
|
|
||||||
if( set ) Add_Invite( Origin, Client, Channel, Req->argv[arg_arg] );
|
|
||||||
else Del_Invite( Origin, Client, Channel, Req->argv[arg_arg] );
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
Req->argv[arg_arg][0] = '\0';
|
|
||||||
arg_arg++;
|
|
||||||
}
|
|
||||||
else Lists_ShowInvites( Origin, Channel );
|
|
||||||
break;
|
|
||||||
case 'b':
|
|
||||||
/* Ban lists */
|
|
||||||
if( arg_arg > mode_arg )
|
|
||||||
{
|
|
||||||
/* modify list */
|
|
||||||
if( modeok )
|
|
||||||
{
|
|
||||||
if( set ) Add_Ban( Origin, Client, Channel, Req->argv[arg_arg] );
|
|
||||||
else Del_Ban( Origin, Client, Channel, Req->argv[arg_arg] );
|
|
||||||
}
|
|
||||||
else ok = IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
Req->argv[arg_arg][0] = '\0';
|
|
||||||
arg_arg++;
|
|
||||||
}
|
|
||||||
else Lists_ShowBans( Origin, Channel );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\" on %s!?", set ? '+' : '-', *mode_ptr, Client_ID( Origin ), Channel_Name( Channel ));
|
|
||||||
if( Client_Type( Client ) != CLIENT_SERVER ) ok = IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Origin ), set ? '+' : '-', *mode_ptr );
|
|
||||||
x[0] = '\0';
|
|
||||||
goto chan_exit;
|
|
||||||
}
|
|
||||||
if( ! ok ) break;
|
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
if( client )
|
|
||||||
{
|
|
||||||
/* Channel-User-Mode */
|
|
||||||
if( Channel_UserModeAdd( Channel, client, x[0] ))
|
|
||||||
{
|
|
||||||
strcat( the_args, Client_ID( client ));
|
|
||||||
strcat( the_args, " " ); strcat( the_modes, x );
|
|
||||||
Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Channel-Mode */
|
|
||||||
if( Channel_ModeAdd( Channel, x[0] ))
|
|
||||||
{
|
|
||||||
strcat( the_modes, x );
|
|
||||||
Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Unset mode */
|
|
||||||
if( client )
|
|
||||||
{
|
|
||||||
/* Channel-User-Mode */
|
|
||||||
if( Channel_UserModeDel( Channel, client, x[0] ))
|
|
||||||
{
|
|
||||||
strcat( the_args, Client_ID( client ));
|
|
||||||
strcat( the_args, " " ); strcat( the_modes, x );
|
|
||||||
Log( LOG_DEBUG, "User \"%s\": Mode change on %s, now \"%s\"", Client_Mask( client ), Channel_Name( Channel ), Channel_UserModes( Channel, client ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Channel-Mode */
|
|
||||||
if( Channel_ModeDel( Channel, x[0] ))
|
|
||||||
{
|
|
||||||
strcat( the_modes, x );
|
|
||||||
Log( LOG_DEBUG, "Channel %s: Mode change, now \"%s\".", Channel_Name( Channel ), Channel_Modes( Channel ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Are there additional arguments to add? */
|
|
||||||
if( argadd[0] )
|
|
||||||
{
|
|
||||||
if( the_args[strlen( the_args ) - 1] != ' ' ) strcat( the_args, " " );
|
|
||||||
strcat( the_args, argadd );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chan_exit:
|
|
||||||
|
|
||||||
/* Are there changed modes? */
|
|
||||||
if( the_modes[1] )
|
|
||||||
{
|
|
||||||
/* Clean up mode string */
|
|
||||||
if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' )) the_modes[strlen( the_modes ) - 1] = '\0';
|
|
||||||
|
|
||||||
/* Clean up argument string if there are none */
|
|
||||||
if( ! the_args[1] ) the_args[0] = '\0';
|
|
||||||
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER )
|
|
||||||
{
|
|
||||||
/* Forward mode changes to channel users and other servers */
|
|
||||||
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
|
|
||||||
IRC_WriteStrChannelPrefix( Client, Channel, Origin, FALSE, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Send reply to client and inform other servers and channel users */
|
|
||||||
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
|
|
||||||
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
|
|
||||||
IRC_WriteStrChannelPrefix( Client, Channel, Origin, FALSE, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* Channel_Mode */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
@@ -604,6 +434,8 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -611,14 +443,13 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
|
|||||||
{
|
{
|
||||||
/* AWAY setzen */
|
/* AWAY setzen */
|
||||||
Client_SetAway( Client, Req->argv[0] );
|
Client_SetAway( Client, Req->argv[0] );
|
||||||
Client_ModeAdd( Client, 'a' );
|
|
||||||
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
|
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
|
||||||
return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
|
return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* AWAY loeschen */
|
/* AWAY loeschen */
|
||||||
Client_ModeDel( Client, 'a' );
|
Client_SetAway( Client, NULL );
|
||||||
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
|
IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
|
||||||
return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
|
return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
|
||||||
}
|
}
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-mode.h,v 1.5 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-mode.h,v 1.4 2002/05/27 13:09:27 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC commands for mode changes (header)
|
* irc-mode.h: IRC-Befehle zur Mode-Aenderung (MODE, AWAY, ...) (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Channel operator commands
|
* $Id: irc-op.c,v 1.9 2002/09/08 17:06:54 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-op.c: Befehle zur Channel-Verwaltung
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-op.c,v 1.11 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -43,6 +44,9 @@ IRC_KICK( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
/* Valider Client? */
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if(( Req->argc < 2) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if(( Req->argc < 2) || ( Req->argc > 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -69,6 +73,9 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
/* Valider Client? */
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-op.h,v 1.3 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-op.h,v 1.2 2002/09/08 00:52:55 alex Exp $
|
||||||
*
|
*
|
||||||
* Channel operator commands (header)
|
* irc-op.h: Befehle zur Channel-Verwaltung (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* IRC operator commands
|
* $Id: irc-oper.c,v 1.8 2002/09/03 23:54:59 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-oper.c: IRC-Operator-Befehle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-oper.c,v 1.13 2002/12/12 12:33:14 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -43,6 +44,8 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -85,6 +88,8 @@ IRC_DIE( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -96,30 +101,14 @@ IRC_DIE( CLIENT *Client, REQUEST *Req )
|
|||||||
} /* IRC_DIE */
|
} /* IRC_DIE */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_REHASH( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
|
||||||
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
|
||||||
|
|
||||||
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
|
|
||||||
|
|
||||||
Log( LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\", re-reading configuration ...", Client_Mask( Client ));
|
|
||||||
NGIRCd_Rehash( );
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_REHASH */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
IRC_RESTART( CLIENT *Client, REQUEST *Req )
|
IRC_RESTART( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -140,6 +129,8 @@ IRC_CONNECT(CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
|
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-oper.h,v 1.9 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-oper.h,v 1.6 2002/09/03 23:54:59 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC operator commands (header)
|
* irc-oper.h: IRC-Operator-Befehle (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +21,6 @@
|
|||||||
|
|
||||||
GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL BOOLEAN IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req ));
|
|
||||||
GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* IRC commands for server links
|
* $Id: irc-server.c,v 1.17.2.3 2002/11/29 10:58:49 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-server.c: IRC-Befehle fuer Server-Links
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-server.c,v 1.24 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -46,7 +47,6 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
|
|||||||
INT max_hops, i;
|
INT max_hops, i;
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
BOOLEAN ok;
|
BOOLEAN ok;
|
||||||
CONN_ID con;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
@@ -71,10 +71,10 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
|
|||||||
Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE );
|
Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE );
|
||||||
return DISCONNECTED;
|
return DISCONNECTED;
|
||||||
}
|
}
|
||||||
if( strcmp( Client_Password( Client ), Conf_Server[i].pwd_in ) != 0 )
|
if( strcmp( Client_Password( Client ), Conf_Server[i].pwd ) != 0 )
|
||||||
{
|
{
|
||||||
/* Falsches Passwort */
|
/* Falsches Passwort */
|
||||||
Log( LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
|
Log( LOG_ERR, "Connection %d: Bad password for server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
|
||||||
Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
|
Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
|
||||||
return DISCONNECTED;
|
return DISCONNECTED;
|
||||||
}
|
}
|
||||||
@@ -89,16 +89,15 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
|
|||||||
|
|
||||||
/* Meldet sich der Server bei uns an (d.h., bauen nicht wir
|
/* Meldet sich der Server bei uns an (d.h., bauen nicht wir
|
||||||
* selber die Verbindung zu einem anderen Server auf)? */
|
* selber die Verbindung zu einem anderen Server auf)? */
|
||||||
con = Client_Conn( Client );
|
|
||||||
if( Client_Token( Client ) != TOKEN_OUTBOUND )
|
if( Client_Token( Client ) != TOKEN_OUTBOUND )
|
||||||
{
|
{
|
||||||
/* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */
|
/* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID )) ok = FALSE;
|
if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd, NGIRCd_ProtoID )) ok = FALSE;
|
||||||
else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo );
|
else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo );
|
||||||
if( ! ok )
|
if( ! ok )
|
||||||
{
|
{
|
||||||
Conn_Close( con, "Unexpected server behavior!", NULL, FALSE );
|
Conn_Close( Client_Conn( Client ), "Unexpected server behavior!", NULL, FALSE );
|
||||||
return DISCONNECTED;
|
return DISCONNECTED;
|
||||||
}
|
}
|
||||||
Client_SetIntroducer( Client, Client );
|
Client_SetIntroducer( Client, Client );
|
||||||
@@ -111,23 +110,9 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
|
|||||||
Client_SetToken( Client, atoi( Req->argv[1] ));
|
Client_SetToken( Client, atoi( Req->argv[1] ));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), con );
|
Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" registered (connection %d, 1 hop - direct link).", Client_ID( Client ), Client_Conn( Client ));
|
||||||
|
|
||||||
Client_SetType( Client, CLIENT_SERVER );
|
Client_SetType( Client, CLIENT_SERVER );
|
||||||
Conn_SetServer( con, i );
|
|
||||||
|
|
||||||
#ifdef USE_ZLIB
|
|
||||||
/* Kompression initialisieren, wenn erforderlich */
|
|
||||||
if( strchr( Client_Flags( Client ), 'Z' ))
|
|
||||||
{
|
|
||||||
if( ! Conn_InitZip( con ))
|
|
||||||
{
|
|
||||||
/* Fehler! */
|
|
||||||
Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE );
|
|
||||||
return DISCONNECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* maximalen Hop Count ermitteln */
|
/* maximalen Hop Count ermitteln */
|
||||||
max_hops = 0;
|
max_hops = 0;
|
||||||
@@ -281,6 +266,8 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTEREDSERVER_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
@@ -344,6 +331,9 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
/* SQUIT ist nur fuer Server erlaubt */
|
||||||
|
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-server.h,v 1.4 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-server.h,v 1.3 2002/05/27 13:09:27 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC commands for server links (header)
|
* irc-server.h: IRC-Befehle fuer Server-Links (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Sending IRC commands over the network
|
* $Id: irc-write.c,v 1.7.2.3 2002/10/04 13:12:46 alex Exp $
|
||||||
|
*
|
||||||
|
* irc-write.c: IRC-Texte und Befehle ueber Netzwerk versenden
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc-write.c,v 1.13 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -31,10 +32,6 @@ static char UNUSED id[] = "$Id: irc-write.c,v 1.13 2002/12/12 12:24:18 alex Exp
|
|||||||
#include "irc-write.h"
|
#include "irc-write.h"
|
||||||
|
|
||||||
|
|
||||||
#define SEND_TO_USER 1
|
|
||||||
#define SEND_TO_SERVER 2
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
|
LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
|
||||||
|
|
||||||
|
|
||||||
@@ -149,11 +146,11 @@ CHAR *Format;
|
|||||||
va_dcl
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
BOOLEAN ok = CONNECTED;
|
BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
|
||||||
CHAR buffer[1000];
|
CHAR buffer[1000];
|
||||||
CL2CHAN *cl2chan;
|
CL2CHAN *cl2chan;
|
||||||
CONN_ID conn;
|
|
||||||
CLIENT *c;
|
CLIENT *c;
|
||||||
|
INT s, i;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
@@ -169,7 +166,7 @@ va_dcl
|
|||||||
vsnprintf( buffer, 1000, Format, ap );
|
vsnprintf( buffer, 1000, Format, ap );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
Conn_ClearFlags( );
|
for( i = 0; i < MAX_CONNECTIONS; i++ ) sock[i] = FALSE;
|
||||||
|
|
||||||
/* An alle Clients, die in den selben Channels sind.
|
/* An alle Clients, die in den selben Channels sind.
|
||||||
* Dabei aber nur einmal je Remote-Server */
|
* Dabei aber nur einmal je Remote-Server */
|
||||||
@@ -187,26 +184,26 @@ va_dcl
|
|||||||
if( c && ( c != Client ))
|
if( c && ( c != Client ))
|
||||||
{
|
{
|
||||||
/* Ok, anderer Client */
|
/* Ok, anderer Client */
|
||||||
conn = Client_Conn( c );
|
s = Client_Conn( c );
|
||||||
if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER );
|
assert( s >= 0 );
|
||||||
else Conn_SetFlag( conn, SEND_TO_USER );
|
assert( s < MAX_CONNECTIONS );
|
||||||
|
sock[s] = TRUE;
|
||||||
|
if( Client_Type( c ) == CLIENT_SERVER ) is_server[s] = TRUE;
|
||||||
|
else is_server[s] = FALSE;
|
||||||
}
|
}
|
||||||
cl2chan = Channel_NextMember( Chan, cl2chan );
|
cl2chan = Channel_NextMember( Chan, cl2chan );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Senden: alle Verbindungen durchgehen ... */
|
/* Senden ... */
|
||||||
conn = Conn_First( );
|
for( i = 0; i < MAX_CONNECTIONS; i++ )
|
||||||
while( conn != NONE )
|
|
||||||
{
|
{
|
||||||
/* muessen Daten ueber diese Verbindung verschickt werden? */
|
if( sock[i] )
|
||||||
if( Conn_Flag( conn ) == SEND_TO_SERVER) ok = Conn_WriteStr( conn, ":%s %s", Client_ID( Prefix ), buffer );
|
{
|
||||||
else if( Conn_Flag( conn ) == SEND_TO_USER ) ok = Conn_WriteStr( conn, ":%s %s", Client_Mask( Prefix ), buffer );
|
if( is_server[i] ) ok = Conn_WriteStr( i, ":%s %s", Client_ID( Prefix ), buffer );
|
||||||
if( ! ok ) break;
|
else ok = Conn_WriteStr( i, ":%s %s", Client_Mask( Prefix ), buffer );
|
||||||
|
if( ! ok ) break;
|
||||||
/* naechste Verbindung testen */
|
}
|
||||||
conn = Conn_Next( conn );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
} /* IRC_WriteStrChannelPrefix */
|
} /* IRC_WriteStrChannelPrefix */
|
||||||
|
|
||||||
@@ -324,13 +321,13 @@ CHAR *Format;
|
|||||||
va_dcl
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
BOOLEAN ok = CONNECTED;
|
BOOLEAN sock[MAX_CONNECTIONS], is_server[MAX_CONNECTIONS], ok = CONNECTED;
|
||||||
CL2CHAN *chan_cl2chan, *cl2chan;
|
CL2CHAN *chan_cl2chan, *cl2chan;
|
||||||
CHAR buffer[1000];
|
CHAR buffer[1000];
|
||||||
CHANNEL *chan;
|
CHANNEL *chan;
|
||||||
CONN_ID conn;
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
CLIENT *c;
|
CLIENT *c;
|
||||||
|
INT i, s;
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Prefix != NULL );
|
assert( Prefix != NULL );
|
||||||
@@ -345,7 +342,7 @@ va_dcl
|
|||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
/* initialisieren */
|
/* initialisieren */
|
||||||
Conn_ClearFlags( );
|
for( i = 0; i < MAX_CONNECTIONS; i++ ) sock[i] = FALSE;
|
||||||
|
|
||||||
/* An alle Clients, die in einem Channel mit dem "Ausloeser" sind,
|
/* An alle Clients, die in einem Channel mit dem "Ausloeser" sind,
|
||||||
* den Text schicken. An Remote-Server aber jeweils nur einmal. */
|
* den Text schicken. An Remote-Server aber jeweils nur einmal. */
|
||||||
@@ -368,9 +365,12 @@ va_dcl
|
|||||||
if( c && ( c != Client ))
|
if( c && ( c != Client ))
|
||||||
{
|
{
|
||||||
/* Ok, anderer Client */
|
/* Ok, anderer Client */
|
||||||
conn = Client_Conn( c );
|
s = Client_Conn( c );
|
||||||
if( Client_Type( c ) == CLIENT_SERVER ) Conn_SetFlag( conn, SEND_TO_SERVER );
|
assert( s >= 0 );
|
||||||
else Conn_SetFlag( conn, SEND_TO_USER );
|
assert( s < MAX_CONNECTIONS );
|
||||||
|
sock[s] = TRUE;
|
||||||
|
if( Client_Type( c ) == CLIENT_SERVER ) is_server[s] = TRUE;
|
||||||
|
else is_server[s] = FALSE;
|
||||||
}
|
}
|
||||||
cl2chan = Channel_NextMember( chan, cl2chan );
|
cl2chan = Channel_NextMember( chan, cl2chan );
|
||||||
}
|
}
|
||||||
@@ -379,17 +379,15 @@ va_dcl
|
|||||||
chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan );
|
chan_cl2chan = Channel_NextChannelOf( Client, chan_cl2chan );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Senden: alle Verbindungen durchgehen ... */
|
/* Senden ... */
|
||||||
conn = Conn_First( );
|
for( i = 0; i < MAX_CONNECTIONS; i++ )
|
||||||
while( conn != NONE )
|
|
||||||
{
|
{
|
||||||
/* muessen ueber diese Verbindung Daten gesendet werden? */
|
if( sock[i] )
|
||||||
if( Conn_Flag( conn ) == SEND_TO_SERVER ) ok = Conn_WriteStr( conn, ":%s %s", Client_ID( Prefix ), buffer );
|
{
|
||||||
else if( Conn_Flag( conn ) == SEND_TO_USER ) ok = Conn_WriteStr( conn, ":%s %s", Client_Mask( Prefix ), buffer );
|
if( is_server[i] ) ok = Conn_WriteStr( i, ":%s %s", Client_ID( Prefix ), buffer );
|
||||||
if( ! ok ) break;
|
else ok = Conn_WriteStr( i, ":%s %s", Client_Mask( Prefix ), buffer );
|
||||||
|
if( ! ok ) break;
|
||||||
/* naechste Verbindung testen */
|
}
|
||||||
conn = Conn_Next( conn );
|
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
} /* IRC_WriteStrRelatedPrefix */
|
} /* IRC_WriteStrRelatedPrefix */
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc-write.h,v 1.5 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc-write.h,v 1.4 2002/09/03 23:56:06 alex Exp $
|
||||||
*
|
*
|
||||||
* Sending IRC commands over the network (header)
|
* irc-write.h: IRC-Texte und Befehle ueber Netzwerk versenden (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
879
src/ngircd/irc.c
879
src/ngircd/irc.c
@@ -2,129 +2,58 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* IRC commands
|
* $Id: irc.c,v 1.95.2.3 2002/11/04 19:18:39 alex Exp $
|
||||||
|
*
|
||||||
|
* irc.c: IRC-Befehle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: irc.c,v 1.107.2.3 2002/12/31 15:48:33 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "ngircd.h"
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "defines.h"
|
#include "resolve.h"
|
||||||
|
#include "conf.h"
|
||||||
|
#include "conn.h"
|
||||||
#include "irc-write.h"
|
#include "irc-write.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
#include "tool.h"
|
||||||
|
|
||||||
#include "exp.h"
|
#include "exp.h"
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
IRC_ERROR( CLIENT *Client, REQUEST *Req )
|
IRC_MOTD( CLIENT *Client, REQUEST *Req )
|
||||||
{
|
{
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
if( Req->argc < 1 ) Log( LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask( Client ));
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
else Log( LOG_NOTICE, "Got ERROR from \"%s\": %s!", Client_Mask( Client ), Req->argv[0] );
|
|
||||||
|
|
||||||
return CONNECTED;
|
|
||||||
} /* IRC_ERROR */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
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? */
|
|
||||||
if(( Client_Type( Client ) != CLIENT_SERVER ) && ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
|
|
||||||
|
|
||||||
/* 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 );
|
|
||||||
else prefix = Client;
|
|
||||||
if( ! prefix )
|
|
||||||
{
|
|
||||||
Log( LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix );
|
|
||||||
prefix = Client_ThisServer( );
|
|
||||||
}
|
|
||||||
|
|
||||||
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 */
|
|
||||||
if( Client_Type( Client ) == CLIENT_USER ) sprintf( reason, "KILLed by %s: %s", Client_ID( Client ), Req->argv[1] );
|
|
||||||
else strcpy( reason, Req->argv[1] );
|
|
||||||
|
|
||||||
/* Inform other servers */
|
|
||||||
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], reason );
|
|
||||||
|
|
||||||
/* Save ID of this connection */
|
|
||||||
my_conn = Client_Conn( Client );
|
|
||||||
|
|
||||||
/* Do we host such a client? */
|
|
||||||
c = Client_Search( Req->argv[0] );
|
|
||||||
if( c && Client_Type( c ) == CLIENT_USER )
|
|
||||||
{
|
|
||||||
/* 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] );
|
|
||||||
|
|
||||||
/* Are we still connected or were we killed, too? */
|
|
||||||
if( Client_GetFromConn( my_conn )) return CONNECTED;
|
|
||||||
else return DISCONNECTED;
|
|
||||||
} /* IRC_KILL */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
|
||||||
IRC_NOTICE( CLIENT *Client, REQUEST *Req )
|
|
||||||
{
|
|
||||||
CLIENT *to, *from;
|
|
||||||
|
|
||||||
assert( Client != NULL );
|
|
||||||
assert( Req != NULL );
|
|
||||||
|
|
||||||
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return CONNECTED;
|
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc != 2 ) return CONNECTED;
|
if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
|
return IRC_Show_MOTD( Client );
|
||||||
else from = Client;
|
} /* IRC_MOTD */
|
||||||
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
|
||||||
|
|
||||||
to = Client_Search( Req->argv[0] );
|
|
||||||
if(( to ) && ( Client_Type( to ) == CLIENT_USER ))
|
|
||||||
{
|
|
||||||
/* Okay, Ziel ist ein User */
|
|
||||||
return IRC_WriteStrClientPrefix( to, from, "NOTICE %s :%s", Client_ID( to ), Req->argv[1] );
|
|
||||||
}
|
|
||||||
else return CONNECTED;
|
|
||||||
} /* IRC_NOTICE */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
@@ -136,6 +65,8 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
|
|||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
assert( Req != NULL );
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
/* Falsche Anzahl Parameter? */
|
/* Falsche Anzahl Parameter? */
|
||||||
if( Req->argc == 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
|
if( Req->argc == 0 ) return IRC_WriteStrClient( Client, ERR_NORECIPIENT_MSG, Client_ID( Client ), Req->command );
|
||||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, ERR_NOTEXTTOSEND_MSG, Client_ID( Client ));
|
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, ERR_NOTEXTTOSEND_MSG, Client_ID( Client ));
|
||||||
@@ -170,4 +101,768 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
|
|||||||
} /* IRC_PRIVMSG */
|
} /* IRC_PRIVMSG */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_NOTICE( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *to, *from;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return CONNECTED;
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if( Req->argc != 2 ) return CONNECTED;
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
to = Client_Search( Req->argv[0] );
|
||||||
|
if(( to ) && ( Client_Type( to ) == CLIENT_USER ))
|
||||||
|
{
|
||||||
|
/* Okay, Ziel ist ein User */
|
||||||
|
return IRC_WriteStrClientPrefix( to, from, "NOTICE %s :%s", Client_ID( to ), Req->argv[1] );
|
||||||
|
}
|
||||||
|
else return CONNECTED;
|
||||||
|
} /* IRC_NOTICE */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_NAMES( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CHAR rpl[COMMAND_LEN], *ptr;
|
||||||
|
CLIENT *target, *from, *c;
|
||||||
|
CHANNEL *chan;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* From aus Prefix ermitteln */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
|
||||||
|
else from = Client;
|
||||||
|
if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
|
if( Req->argc == 2 )
|
||||||
|
{
|
||||||
|
/* an anderen Server forwarden */
|
||||||
|
target = Client_Search( Req->argv[1] );
|
||||||
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
|
||||||
|
|
||||||
|
if( target != Client_ThisServer( ))
|
||||||
|
{
|
||||||
|
/* Ok, anderer Server ist das Ziel: forwarden */
|
||||||
|
return IRC_WriteStrClientPrefix( target, from, "NAMES %s :%s", Req->argv[0], Req->argv[1] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Req->argc > 0 )
|
||||||
|
{
|
||||||
|
/* bestimmte Channels durchgehen */
|
||||||
|
ptr = strtok( Req->argv[0], "," );
|
||||||
|
while( ptr )
|
||||||
|
{
|
||||||
|
chan = Channel_Search( ptr );
|
||||||
|
if( chan )
|
||||||
|
{
|
||||||
|
/* Namen ausgeben */
|
||||||
|
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
if( ! IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), ptr )) return DISCONNECTED;
|
||||||
|
|
||||||
|
/* naechsten Namen ermitteln */
|
||||||
|
ptr = strtok( NULL, "," );
|
||||||
|
}
|
||||||
|
return CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* alle Channels durchgehen */
|
||||||
|
chan = Channel_First( );
|
||||||
|
while( chan )
|
||||||
|
{
|
||||||
|
/* Namen ausgeben */
|
||||||
|
if( ! IRC_Send_NAMES( from, chan )) return DISCONNECTED;
|
||||||
|
|
||||||
|
/* naechster Channel */
|
||||||
|
chan = Channel_Next( chan );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nun noch alle Clients ausgeben, die in keinem Channel sind */
|
||||||
|
c = Client_First( );
|
||||||
|
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
|
||||||
|
while( c )
|
||||||
|
{
|
||||||
|
if(( Client_Type( c ) == CLIENT_USER ) && ( Channel_FirstChannelOf( c ) == NULL ) && ( ! strchr( Client_Modes( c ), 'i' )))
|
||||||
|
{
|
||||||
|
/* Okay, das ist ein User: anhaengen */
|
||||||
|
if( rpl[strlen( rpl ) - 1] != ':' ) strcat( rpl, " " );
|
||||||
|
strcat( rpl, Client_ID( c ));
|
||||||
|
|
||||||
|
if( strlen( rpl ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
|
||||||
|
{
|
||||||
|
/* Zeile wird zu lang: senden! */
|
||||||
|
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
|
||||||
|
sprintf( rpl, RPL_NAMREPLY_MSG, Client_ID( from ), "*", "*" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* naechster Client */
|
||||||
|
c = Client_Next( c );
|
||||||
|
}
|
||||||
|
if( rpl[strlen( rpl ) - 1] != ':')
|
||||||
|
{
|
||||||
|
/* es wurden User gefunden */
|
||||||
|
if( ! IRC_WriteStrClient( from, "%s", rpl )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IRC_WriteStrClient( from, RPL_ENDOFNAMES_MSG, Client_ID( from ), "*" );
|
||||||
|
} /* IRC_NAMES */
|
||||||
|
|
||||||
|
|
||||||
|
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( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( 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_Search( ptr );
|
||||||
|
if( c && ( Client_Type( c ) == 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, "%s", rpl, Client_ID( Client ) );
|
||||||
|
} /* IRC_ISON */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_WHOIS( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *from, *target, *c;
|
||||||
|
CHAR str[LINE_LEN + 1], *ptr = NULL;
|
||||||
|
CL2CHAN *cl2chan;
|
||||||
|
CHANNEL *chan;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc < 1 ) || ( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* Client suchen */
|
||||||
|
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 */
|
||||||
|
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? */
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
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 );
|
||||||
|
|
||||||
|
/* Nick, User und 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 */
|
||||||
|
if( ! IRC_WriteStrClient( from, RPL_WHOISSERVER_MSG, Client_ID( from ), Client_ID( c ), Client_ID( Client_Introducer( c )), Client_Info( Client_Introducer( c )))) return DISCONNECTED;
|
||||||
|
|
||||||
|
/* Channels */
|
||||||
|
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
|
||||||
|
cl2chan = Channel_FirstChannelOf( c );
|
||||||
|
while( cl2chan )
|
||||||
|
{
|
||||||
|
chan = Channel_GetChannel( cl2chan );
|
||||||
|
assert( chan != NULL );
|
||||||
|
|
||||||
|
/* Channel-Name anhaengen */
|
||||||
|
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, "+" );
|
||||||
|
strcat( str, Channel_Name( chan ));
|
||||||
|
|
||||||
|
if( strlen( str ) > ( LINE_LEN - CHANNEL_NAME_LEN - 4 ))
|
||||||
|
{
|
||||||
|
/* Zeile wird zu lang: senden! */
|
||||||
|
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
||||||
|
sprintf( str, RPL_WHOISCHANNELS_MSG, Client_ID( from ), Client_ID( c ));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* naechstes Mitglied suchen */
|
||||||
|
cl2chan = Channel_NextChannelOf( c, cl2chan );
|
||||||
|
}
|
||||||
|
if( str[strlen( str ) - 1] != ':')
|
||||||
|
{
|
||||||
|
/* Es sind noch Daten da, die gesendet werden muessen */
|
||||||
|
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IRC-Operator? */
|
||||||
|
if( Client_HasMode( c, 'o' ))
|
||||||
|
{
|
||||||
|
if( ! IRC_WriteStrClient( from, RPL_WHOISOPERATOR_MSG, Client_ID( from ), Client_ID( c ))) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Idle (nur lokale 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Away? */
|
||||||
|
if( Client_HasMode( c, 'a' ))
|
||||||
|
{
|
||||||
|
if( ! IRC_WriteStrClient( from, RPL_AWAY_MSG, Client_ID( from ), Client_ID( c ), Client_Away( c ))) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of Whois */
|
||||||
|
return IRC_WriteStrClient( from, RPL_ENDOFWHOIS_MSG, Client_ID( from ), Client_ID( c ));
|
||||||
|
} /* IRC_WHOIS */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_WHO( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
BOOLEAN ok, only_ops;
|
||||||
|
CHAR flags[8], *ptr;
|
||||||
|
CL2CHAN *cl2chan;
|
||||||
|
CHANNEL *chan;
|
||||||
|
CLIENT *c;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
only_ops = FALSE;
|
||||||
|
chan = NULL;
|
||||||
|
|
||||||
|
if( Req->argc == 2 )
|
||||||
|
{
|
||||||
|
/* Nur OPs anzeigen? */
|
||||||
|
if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE;
|
||||||
|
#ifdef STRICT_RFC
|
||||||
|
else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Req->argc >= 1 )
|
||||||
|
{
|
||||||
|
/* wurde ein Channel oder Nick-Mask angegeben? */
|
||||||
|
chan = Channel_Search( Req->argv[0] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( chan )
|
||||||
|
{
|
||||||
|
/* User eines Channels ausgeben */
|
||||||
|
if( ! IRC_Send_WHO( Client, chan, only_ops )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
c = Client_First( );
|
||||||
|
while( c )
|
||||||
|
{
|
||||||
|
if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' )))
|
||||||
|
{
|
||||||
|
ok = FALSE;
|
||||||
|
if( Req->argc == 0 ) ok = TRUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE;
|
||||||
|
else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' ))))
|
||||||
|
{
|
||||||
|
/* Flags zusammenbasteln */
|
||||||
|
strcpy( flags, "H" );
|
||||||
|
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
|
||||||
|
|
||||||
|
/* ausgeben */
|
||||||
|
cl2chan = Channel_FirstChannelOf( c );
|
||||||
|
if( cl2chan ) ptr = Channel_Name( Channel_GetChannel( cl2chan ));
|
||||||
|
else ptr = "*";
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), ptr, Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* naechster Client */
|
||||||
|
c = Client_Next( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( chan ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Channel_Name( chan ));
|
||||||
|
else if( Req->argc == 0 ) return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), "*" );
|
||||||
|
else return IRC_WriteStrClient( Client, RPL_ENDOFWHO_MSG, Client_ID( Client ), Req->argv[0] );
|
||||||
|
} /* IRC_WHO */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_USERHOST( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CHAR rpl[COMMAND_LEN];
|
||||||
|
CLIENT *c;
|
||||||
|
INT max, i;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc < 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( 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_Search( Req->argv[i] );
|
||||||
|
if( c && ( Client_Type( c ) == CLIENT_USER ))
|
||||||
|
{
|
||||||
|
/* Dieser Nick ist "online" */
|
||||||
|
strcat( rpl, Client_ID( c ));
|
||||||
|
if( Client_HasMode( c, 'o' )) strcat( rpl, "*" );
|
||||||
|
strcat( rpl, "=" );
|
||||||
|
if( Client_HasMode( c, 'a' )) strcat( rpl, "-" );
|
||||||
|
else strcat( rpl, "+" );
|
||||||
|
strcat( rpl, Client_User( c ));
|
||||||
|
strcat( rpl, "@" );
|
||||||
|
strcat( rpl, Client_Hostname( c ));
|
||||||
|
strcat( rpl, " " );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
|
||||||
|
|
||||||
|
return IRC_WriteStrClient( Client, "%s", rpl, Client_ID( Client ) );
|
||||||
|
} /* IRC_USERHOST */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_ERROR( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Req->argc < 1 ) Log( LOG_NOTICE, "Got ERROR from \"%s\"!", Client_Mask( Client ));
|
||||||
|
else Log( LOG_NOTICE, "Got ERROR from \"%s\": %s!", Client_Mask( Client ), Req->argv[0] );
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_ERROR */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_LUSERS( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *target, *from;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* Absender ermitteln */
|
||||||
|
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 );
|
||||||
|
|
||||||
|
/* An anderen Server forwarden? */
|
||||||
|
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] );
|
||||||
|
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LUSERS %s %s", Req->argv[0], Req->argv[1] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wer ist der Absender? */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
||||||
|
else target = Client;
|
||||||
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
|
IRC_Send_LUSERS( target );
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_LUSERS */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_LINKS( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *target, *from, *c;
|
||||||
|
CHAR *mask;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* Server-Mask ermitteln */
|
||||||
|
if( Req->argc > 0 ) mask = Req->argv[Req->argc - 1];
|
||||||
|
else mask = "*";
|
||||||
|
|
||||||
|
/* Absender ermitteln */
|
||||||
|
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 );
|
||||||
|
|
||||||
|
/* An anderen Server forwarden? */
|
||||||
|
if( Req->argc == 2 )
|
||||||
|
{
|
||||||
|
target = Client_Search( Req->argv[0] );
|
||||||
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
|
||||||
|
else if( target != Client_ThisServer( )) return IRC_WriteStrClientPrefix( target, from, "LINKS %s %s", Req->argv[0], Req->argv[1] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wer ist der Absender? */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
||||||
|
else target = Client;
|
||||||
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
|
c = Client_First( );
|
||||||
|
while( c )
|
||||||
|
{
|
||||||
|
if( Client_Type( c ) == CLIENT_SERVER )
|
||||||
|
{
|
||||||
|
if( ! IRC_WriteStrClient( target, RPL_LINKS_MSG, Client_ID( target ), Client_ID( c ), Client_ID( Client_TopServer( c ) ? Client_TopServer( c ) : Client_ThisServer( )), Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
c = Client_Next( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
return IRC_WriteStrClient( target, RPL_ENDOFLINKS_MSG, Client_ID( target ), mask );
|
||||||
|
} /* IRC_LINKS */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_VERSION( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *target, *prefix;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* Ziel suchen */
|
||||||
|
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
|
||||||
|
else target = Client_ThisServer( );
|
||||||
|
|
||||||
|
/* Prefix ermitteln */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
|
||||||
|
else prefix = Client;
|
||||||
|
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
|
/* An anderen Server weiterleiten? */
|
||||||
|
if( target != Client_ThisServer( ))
|
||||||
|
{
|
||||||
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
|
||||||
|
|
||||||
|
/* forwarden */
|
||||||
|
IRC_WriteStrClientPrefix( target, prefix, "VERSION %s", Req->argv[0] );
|
||||||
|
return CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mit Versionsinfo antworten */
|
||||||
|
return IRC_WriteStrClient( Client, RPL_VERSION_MSG, Client_ID( prefix ), PACKAGE, VERSION, NGIRCd_DebugLevel, Conf_ServerName, NGIRCd_VersionAddition( ));
|
||||||
|
} /* IRC_VERSION */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_KILL( CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *prefix, *c;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if( Client_Type( Client ) != CLIENT_SERVER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc != 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
prefix = Client_Search( Req->prefix );
|
||||||
|
if( ! prefix )
|
||||||
|
{
|
||||||
|
Log( LOG_WARNING, "Got KILL with invalid prefix: \"%s\"!", Req->prefix );
|
||||||
|
prefix = Client_ThisServer( );
|
||||||
|
}
|
||||||
|
|
||||||
|
Log( LOG_NOTICE, "Got KILL command from \"%s\" for \"%s\": %s", Client_Mask( prefix ), Req->argv[0], Req->argv[1] );
|
||||||
|
|
||||||
|
/* andere Server benachrichtigen */
|
||||||
|
IRC_WriteStrServersPrefix( Client, prefix, "KILL %s :%s", Req->argv[0], Req->argv[1] );
|
||||||
|
|
||||||
|
/* haben wir selber einen solchen Client? */
|
||||||
|
c = Client_Search( Req->argv[0] );
|
||||||
|
if( c )
|
||||||
|
{
|
||||||
|
/* Ja, wir haben einen solchen Client */
|
||||||
|
if( Client_Conn( c ) != NONE ) Conn_Close( Client_Conn( c ), NULL, Req->argv[1], TRUE );
|
||||||
|
else Client_Destroy( c, NULL, Req->argv[1], TRUE );
|
||||||
|
}
|
||||||
|
else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_KILL */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_ADMIN(CLIENT *Client, REQUEST *Req )
|
||||||
|
{
|
||||||
|
CLIENT *target, *prefix;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Req != NULL );
|
||||||
|
|
||||||
|
if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
|
||||||
|
|
||||||
|
/* Falsche Anzahl Parameter? */
|
||||||
|
if(( Req->argc > 1 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||||
|
|
||||||
|
/* Ziel suchen */
|
||||||
|
if( Req->argc == 1 ) target = Client_Search( Req->argv[0] );
|
||||||
|
else target = Client_ThisServer( );
|
||||||
|
|
||||||
|
/* Prefix ermitteln */
|
||||||
|
if( Client_Type( Client ) == CLIENT_SERVER ) prefix = Client_Search( Req->prefix );
|
||||||
|
else prefix = Client;
|
||||||
|
if( ! prefix ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
|
||||||
|
|
||||||
|
/* An anderen Server weiterleiten? */
|
||||||
|
if( target != Client_ThisServer( ))
|
||||||
|
{
|
||||||
|
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
|
||||||
|
|
||||||
|
/* forwarden */
|
||||||
|
IRC_WriteStrClientPrefix( target, prefix, "ADMIN %s", Req->argv[0] );
|
||||||
|
return CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mit Versionsinfo antworten */
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_ADMINME_MSG, Client_ID( prefix ), Conf_ServerName )) return DISCONNECTED;
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC1_MSG, Client_ID( prefix ), Conf_ServerAdmin1 )) return DISCONNECTED;
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_ADMINLOC2_MSG, Client_ID( prefix ), Conf_ServerAdmin2 )) return DISCONNECTED;
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_ADMINEMAIL_MSG, Client_ID( prefix ), Conf_ServerAdminMail )) return DISCONNECTED;
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_ADMIN */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_Show_MOTD( CLIENT *Client )
|
||||||
|
{
|
||||||
|
BOOLEAN ok;
|
||||||
|
CHAR line[127];
|
||||||
|
FILE *fd;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
|
||||||
|
fd = fopen( Conf_MotdFile, "r" );
|
||||||
|
if( ! fd )
|
||||||
|
{
|
||||||
|
Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
|
||||||
|
return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )));
|
||||||
|
while( TRUE )
|
||||||
|
{
|
||||||
|
if( ! fgets( line, 126, fd )) break;
|
||||||
|
if( line[strlen( line ) - 1] == '\n' ) line[strlen( line ) - 1] = '\0';
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
|
||||||
|
{
|
||||||
|
fclose( fd );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
|
||||||
|
|
||||||
|
fclose( fd );
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
} /* IRC_Show_MOTD */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan )
|
||||||
|
{
|
||||||
|
BOOLEAN is_visible, is_member;
|
||||||
|
CHAR str[LINE_LEN + 1];
|
||||||
|
CL2CHAN *cl2chan;
|
||||||
|
CLIENT *cl;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Chan != NULL );
|
||||||
|
|
||||||
|
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
|
||||||
|
else is_member = FALSE;
|
||||||
|
|
||||||
|
/* Alle Mitglieder suchen */
|
||||||
|
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
|
||||||
|
cl2chan = Channel_FirstMember( Chan );
|
||||||
|
while( cl2chan )
|
||||||
|
{
|
||||||
|
cl = Channel_GetClient( cl2chan );
|
||||||
|
|
||||||
|
if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE;
|
||||||
|
else is_visible = TRUE;
|
||||||
|
|
||||||
|
if( is_member || is_visible )
|
||||||
|
{
|
||||||
|
/* Nick anhaengen */
|
||||||
|
if( str[strlen( str ) - 1] != ':' ) strcat( str, " " );
|
||||||
|
if( strchr( Channel_UserModes( Chan, cl ), 'o' )) strcat( str, "@" );
|
||||||
|
else if( strchr( Channel_UserModes( Chan, cl ), 'v' )) strcat( str, "+" );
|
||||||
|
strcat( str, Client_ID( cl ));
|
||||||
|
|
||||||
|
if( strlen( str ) > ( LINE_LEN - CLIENT_NICK_LEN - 4 ))
|
||||||
|
{
|
||||||
|
/* Zeile wird zu lang: senden! */
|
||||||
|
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
||||||
|
sprintf( str, RPL_NAMREPLY_MSG, Client_ID( Client ), "=", Channel_Name( Chan ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* naechstes Mitglied suchen */
|
||||||
|
cl2chan = Channel_NextMember( Chan, cl2chan );
|
||||||
|
}
|
||||||
|
if( str[strlen( str ) - 1] != ':')
|
||||||
|
{
|
||||||
|
/* Es sind noch Daten da, die gesendet werden muessen */
|
||||||
|
if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_Send_NAMES */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )
|
||||||
|
{
|
||||||
|
BOOLEAN is_visible, is_member;
|
||||||
|
CL2CHAN *cl2chan;
|
||||||
|
CHAR flags[8];
|
||||||
|
CLIENT *c;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
assert( Chan != NULL );
|
||||||
|
|
||||||
|
if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE;
|
||||||
|
else is_member = FALSE;
|
||||||
|
|
||||||
|
/* Alle Mitglieder suchen */
|
||||||
|
cl2chan = Channel_FirstMember( Chan );
|
||||||
|
while( cl2chan )
|
||||||
|
{
|
||||||
|
c = Channel_GetClient( cl2chan );
|
||||||
|
|
||||||
|
if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE;
|
||||||
|
else is_visible = TRUE;
|
||||||
|
|
||||||
|
if( is_member || is_visible )
|
||||||
|
{
|
||||||
|
/* Flags zusammenbasteln */
|
||||||
|
strcpy( flags, "H" );
|
||||||
|
if( strchr( Client_Modes( c ), 'o' )) strcat( flags, "*" );
|
||||||
|
if( strchr( Channel_UserModes( Chan, c ), 'o' )) strcat( flags, "@" );
|
||||||
|
else if( strchr( Channel_UserModes( Chan, c ), 'v' )) strcat( flags, "+" );
|
||||||
|
|
||||||
|
/* ausgeben */
|
||||||
|
if(( ! OnlyOps ) || ( strchr( Client_Modes( c ), 'o' )))
|
||||||
|
{
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_WHOREPLY_MSG, Client_ID( Client ), Channel_Name( Chan ), Client_User( c ), Client_Hostname( c ), Client_ID( Client_Introducer( c )), Client_ID( c ), flags, Client_Hops( c ), Client_Info( c ))) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* naechstes Mitglied suchen */
|
||||||
|
cl2chan = Channel_NextMember( Chan, cl2chan );
|
||||||
|
}
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_Send_WHO */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN
|
||||||
|
IRC_Send_LUSERS( CLIENT *Client )
|
||||||
|
{
|
||||||
|
LONG cnt;
|
||||||
|
|
||||||
|
assert( Client != NULL );
|
||||||
|
|
||||||
|
/* Users, Services und Serevr im Netz */
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_LUSERCLIENT_MSG, Client_ID( Client ), Client_UserCount( ), Client_ServiceCount( ), Client_ServerCount( ))) return DISCONNECTED;
|
||||||
|
|
||||||
|
/* IRC-Operatoren im Netz */
|
||||||
|
cnt = Client_OperCount( );
|
||||||
|
if( cnt > 0 )
|
||||||
|
{
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_LUSEROP_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unbekannt Verbindungen */
|
||||||
|
cnt = Client_UnknownCount( );
|
||||||
|
if( cnt > 0 )
|
||||||
|
{
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_LUSERUNKNOWN_MSG, Client_ID( Client ), cnt )) return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Channels im Netz */
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_LUSERCHANNELS_MSG, Client_ID( Client ), Channel_Count( ))) return DISCONNECTED;
|
||||||
|
|
||||||
|
/* Channels im Netz */
|
||||||
|
if( ! IRC_WriteStrClient( Client, RPL_LUSERME_MSG, Client_ID( Client ), Client_MyUserCount( ), Client_MyServiceCount( ), Client_MyServerCount( ))) return DISCONNECTED;
|
||||||
|
|
||||||
|
return CONNECTED;
|
||||||
|
} /* IRC_Send_LUSERS */
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: irc.h,v 1.36 2002/12/12 12:23:43 alex Exp $
|
* $Id: irc.h,v 1.32 2002/09/16 09:14:45 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC commands (header)
|
* irc.h: IRC-Befehle (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -18,10 +19,28 @@
|
|||||||
#define __irc_h__
|
#define __irc_h__
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN IRC_ERROR PARAMS(( CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_MOTD PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL BOOLEAN IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_LUSERS PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL BOOLEAN IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_LINKS PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req ));
|
GLOBAL BOOLEAN IRC_VERSION PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_ADMIN PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN IRC_PRIVMSG PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_NOTICE PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN IRC_NAMES PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_ISON PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_WHOIS PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_USERHOST PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_WHO PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN IRC_ERROR PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
GLOBAL BOOLEAN IRC_KILL PARAMS((CLIENT *Client, REQUEST *Req ));
|
||||||
|
|
||||||
|
GLOBAL BOOLEAN IRC_Send_NAMES PARAMS((CLIENT *Client, CHANNEL *Chan ));
|
||||||
|
GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS((CLIENT *Client ));
|
||||||
|
GLOBAL BOOLEAN IRC_Show_MOTD PARAMS((CLIENT *Client ));
|
||||||
|
GLOBAL BOOLEAN IRC_Send_WHO PARAMS((CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ));
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Management of IRC lists: ban, invite, ...
|
* $Id: lists.c,v 1.8.2.2 2002/10/04 13:12:46 alex Exp $
|
||||||
|
*
|
||||||
|
* lists.c: Verwaltung der "IRC-Listen": Ban, Invite, ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: lists.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: lists.h,v 1.9 2002/12/12 12:23:43 alex Exp $
|
* $Id: lists.h,v 1.8 2002/09/08 17:05:25 alex Exp $
|
||||||
*
|
*
|
||||||
* Management of IRC lists: ban, invite, ... (header)
|
* lists.h: Verwaltung der "IRC-Listen": Ban, Invite, ... (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Logging functions
|
* $Id: log.c,v 1.37.2.3 2002/11/04 19:18:39 alex Exp $
|
||||||
|
*
|
||||||
|
* log.c: Logging-Funktionen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: log.c,v 1.41 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -279,7 +280,7 @@ Wall_ServerNotice( CHAR *Msg )
|
|||||||
c = Client_First( );
|
c = Client_First( );
|
||||||
while( c )
|
while( c )
|
||||||
{
|
{
|
||||||
if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s%s", Client_ThisServer( ), NOTICE_TXTPREFIX, Msg );
|
if(( Client_Conn( c ) > NONE ) && ( Client_HasMode( c, 's' ))) IRC_WriteStrClient( c, "NOTICE %s :%s", Client_ThisServer( ), Msg );
|
||||||
c = Client_Next( c );
|
c = Client_Next( c );
|
||||||
}
|
}
|
||||||
} /* Wall_ServerNotice */
|
} /* Wall_ServerNotice */
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: log.h,v 1.13 2002/12/12 12:23:43 alex Exp $
|
* $Id: log.h,v 1.12 2002/05/27 13:09:27 alex Exp $
|
||||||
*
|
*
|
||||||
* Logging functions (header)
|
* log.h: Logging-Funktionen (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Wildcard pattern matching
|
* $Id: match.c,v 1.1 2002/06/26 15:42:58 alex Exp $
|
||||||
|
*
|
||||||
|
* match.c: Wildcard Pattern Matching
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: match.c,v 1.2 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: match.h,v 1.2 2002/12/12 12:23:43 alex Exp $
|
* $Id: match.h,v 1.1 2002/06/26 15:42:58 alex Exp $
|
||||||
*
|
*
|
||||||
* Wildcard pattern matching (header)
|
* match.h: Wildcard Pattern Matching (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: messages.h,v 1.59.2.1 2002/12/22 23:42:28 alex Exp $
|
* $Id: messages.h,v 1.46.2.4 2002/11/22 22:55:05 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC numerics (Header)
|
* irc.h: IRC-Befehle (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -22,10 +23,6 @@
|
|||||||
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
|
#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_CREATED_MSG "003 %s :This server has been started %s"
|
||||||
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %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"
|
|
||||||
#define RPL_UMODEIS_MSG "221 %s +%s"
|
#define RPL_UMODEIS_MSG "221 %s +%s"
|
||||||
#define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers"
|
#define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers"
|
||||||
#define RPL_LUSEROP_MSG "252 %s %ld :operator(s) online"
|
#define RPL_LUSEROP_MSG "252 %s %ld :operator(s) online"
|
||||||
@@ -36,8 +33,6 @@
|
|||||||
#define RPL_ADMINLOC1_MSG "257 %s :%s"
|
#define RPL_ADMINLOC1_MSG "257 %s :%s"
|
||||||
#define RPL_ADMINLOC2_MSG "258 %s :%s"
|
#define RPL_ADMINLOC2_MSG "258 %s :%s"
|
||||||
#define RPL_ADMINEMAIL_MSG "259 %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_AWAY_MSG "301 %s %s :%s"
|
||||||
#define RPL_USERHOST_MSG "302 %s :"
|
#define RPL_USERHOST_MSG "302 %s :"
|
||||||
@@ -47,7 +42,6 @@
|
|||||||
#define RPL_WHOISUSER_MSG "311 %s %s %s %s * :%s"
|
#define RPL_WHOISUSER_MSG "311 %s %s %s %s * :%s"
|
||||||
#define RPL_WHOISSERVER_MSG "312 %s %s %s :%s"
|
#define RPL_WHOISSERVER_MSG "312 %s %s %s :%s"
|
||||||
#define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator"
|
#define RPL_WHOISOPERATOR_MSG "313 %s %s :is an IRC operator"
|
||||||
#define RPL_WHOWASUSER_MSG "314 %s %s %s %s * :%s"
|
|
||||||
#define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list"
|
#define RPL_ENDOFWHO_MSG "315 %s %s :End of WHO list"
|
||||||
#define RPL_WHOISIDLE_MSG "317 %s %s %ld :seconds idle"
|
#define RPL_WHOISIDLE_MSG "317 %s %s %ld :seconds idle"
|
||||||
#define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list"
|
#define RPL_ENDOFWHOIS_MSG "318 %s %s :End of WHOIS list"
|
||||||
@@ -68,20 +62,15 @@
|
|||||||
#define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list"
|
#define RPL_ENDOFNAMES_MSG "366 %s %s :End of NAMES list"
|
||||||
#define RPL_BANLIST_MSG "367 %s %s %s"
|
#define RPL_BANLIST_MSG "367 %s %s %s"
|
||||||
#define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list"
|
#define RPL_ENDOFBANLIST_MSG "368 %s %s :End of channel ban list"
|
||||||
#define RPL_ENDOFWHOWAS_MSG "369 %s %s :End of WHOWAS list"
|
|
||||||
#define RPL_MOTD_MSG "372 %s :- %s"
|
#define RPL_MOTD_MSG "372 %s :- %s"
|
||||||
#define RPL_MOTDSTART_MSG "375 %s :- %s message of the day"
|
#define RPL_MOTDSTART_MSG "375 %s :- %s message of the day"
|
||||||
#define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command"
|
#define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command"
|
||||||
#define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator"
|
#define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator"
|
||||||
#define RPL_YOURESERVICE_MSG "383 %s :You are service %s"
|
|
||||||
#define RPL_TIME_MSG "391 %s %s :%s"
|
|
||||||
|
|
||||||
#define ERR_NOSUCHNICK_MSG "401 %s %s :No such nick or channel name"
|
#define ERR_NOSUCHNICK_MSG "401 %s %s :No such nick or channel name"
|
||||||
#define ERR_NOSUCHSERVER_MSG "402 %s %s :No such server"
|
#define ERR_NOSUCHSERVER_MSG "402 %s %s :No such server"
|
||||||
#define ERR_NOSUCHCHANNEL_MSG "403 %s %s :No such channel"
|
#define ERR_NOSUCHCHANNEL_MSG "403 %s %s :No such channel"
|
||||||
#define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel"
|
#define ERR_CANNOTSENDTOCHAN_MSG "404 %s %s :Cannot send to channel"
|
||||||
#define ERR_TOOMANYCHANNELS_MSG "405 %s %s :You have joined too many channels"
|
|
||||||
#define ERR_WASNOSUCHNICK_MSG "406 %s %s :There was no such nickname"
|
|
||||||
#define ERR_NOORIGIN_MSG "409 %s :No origin specified"
|
#define ERR_NOORIGIN_MSG "409 %s :No origin specified"
|
||||||
#define ERR_NORECIPIENT_MSG "411 %s :No receipient given (%s)"
|
#define ERR_NORECIPIENT_MSG "411 %s :No receipient given (%s)"
|
||||||
#define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send"
|
#define ERR_NOTEXTTOSEND_MSG "412 %s :No text to send"
|
||||||
@@ -96,12 +85,10 @@
|
|||||||
#define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link"
|
#define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link"
|
||||||
#define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error"
|
#define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error"
|
||||||
#define ERR_ALREADYREGISTRED_MSG "462 %s :Connection already registered"
|
#define ERR_ALREADYREGISTRED_MSG "462 %s :Connection already registered"
|
||||||
#define ERR_PASSWDMISMATCH_MSG "464 %s :Invalid password"
|
#define ERR_PASSWDMISMATCH_MSG "464 %s: Invalid password"
|
||||||
#define ERR_CHANNELISFULL_MSG "471 %s %s :Cannot join channel (+l)"
|
|
||||||
#define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s"
|
#define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s"
|
||||||
#define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)"
|
#define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)"
|
||||||
#define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)"
|
#define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)"
|
||||||
#define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k)"
|
|
||||||
#define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied"
|
#define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied"
|
||||||
#define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator"
|
#define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator"
|
||||||
#define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted"
|
#define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted"
|
||||||
@@ -111,10 +98,6 @@
|
|||||||
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
|
#define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\""
|
||||||
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
|
#define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users"
|
||||||
|
|
||||||
#ifdef USE_ZLIB
|
|
||||||
#define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,21 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Main program -- main()
|
* $Id: ngircd.c,v 1.54.2.4 2002/11/24 15:25:25 alex Exp $
|
||||||
|
*
|
||||||
|
* ngircd.c: Hier beginnt alles ;-)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -36,7 +37,6 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp
|
|||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "channel.h"
|
#include "channel.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "cvs-version.h"
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "lists.h"
|
#include "lists.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -50,6 +50,8 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.64.2.1 2003/01/01 13:47:42 alex Exp
|
|||||||
LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID ));
|
LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID ));
|
||||||
LOCAL VOID Signal_Handler PARAMS(( INT Signal ));
|
LOCAL VOID Signal_Handler PARAMS(( INT Signal ));
|
||||||
|
|
||||||
|
LOCAL VOID Initialize_Listen_Ports PARAMS(( VOID ));
|
||||||
|
|
||||||
LOCAL VOID Show_Version PARAMS(( VOID ));
|
LOCAL VOID Show_Version PARAMS(( VOID ));
|
||||||
LOCAL VOID Show_Help PARAMS(( VOID ));
|
LOCAL VOID Show_Help PARAMS(( VOID ));
|
||||||
|
|
||||||
@@ -293,29 +295,18 @@ main( int argc, const char *argv[] )
|
|||||||
* sind in doc/Protocol.txt beschrieben. */
|
* sind in doc/Protocol.txt beschrieben. */
|
||||||
#ifdef IRCPLUS
|
#ifdef IRCPLUS
|
||||||
sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS );
|
sprintf( NGIRCd_ProtoID, "%s%s %s|%s:%s", PROTOVER, PROTOIRCPLUS, PACKAGE, VERSION, IRCPLUSFLAGS );
|
||||||
#ifdef USE_ZLIB
|
|
||||||
strcat( NGIRCd_ProtoID, "Z" );
|
|
||||||
#endif
|
|
||||||
if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
|
if( Conf_OperCanMode ) strcat( NGIRCd_ProtoID, "o" );
|
||||||
#else
|
#else
|
||||||
sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION );
|
sprintf( NGIRCd_ProtoID, "%s%s %s|%s", PROTOVER, PROTOIRC, PACKAGE, VERSION );
|
||||||
#endif
|
#endif
|
||||||
strcat( NGIRCd_ProtoID, " P" );
|
strcat( NGIRCd_ProtoID, " P" );
|
||||||
#ifdef USE_ZLIB
|
|
||||||
strcat( NGIRCd_ProtoID, "Z" );
|
|
||||||
#endif
|
|
||||||
Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
|
Log( LOG_DEBUG, "Protocol and server ID is \"%s\".", NGIRCd_ProtoID );
|
||||||
|
|
||||||
/* Vordefinierte Channels anlegen */
|
/* Vordefinierte Channels anlegen */
|
||||||
Channel_InitPredefined( );
|
Channel_InitPredefined( );
|
||||||
|
|
||||||
/* Listen-Ports initialisieren */
|
/* Listen-Ports initialisieren */
|
||||||
if( Conn_InitListeners( ) < 1 )
|
Initialize_Listen_Ports( );
|
||||||
{
|
|
||||||
Log( LOG_ALERT, "Server isn't listening on a single port!" );
|
|
||||||
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
|
||||||
exit( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hauptschleife */
|
/* Hauptschleife */
|
||||||
Conn_Handler( );
|
Conn_Handler( );
|
||||||
@@ -337,11 +328,7 @@ NGIRCd_Version( VOID )
|
|||||||
{
|
{
|
||||||
STATIC CHAR version[126];
|
STATIC CHAR version[126];
|
||||||
|
|
||||||
#ifdef CVSDATE
|
|
||||||
sprintf( version, "%s %s(%s)-%s", PACKAGE, VERSION, CVSDATE, NGIRCd_VersionAddition( ));
|
|
||||||
#else
|
|
||||||
sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( ));
|
sprintf( version, "%s %s-%s", PACKAGE, VERSION, NGIRCd_VersionAddition( ));
|
||||||
#endif
|
|
||||||
return version;
|
return version;
|
||||||
} /* NGIRCd_Version */
|
} /* NGIRCd_Version */
|
||||||
|
|
||||||
@@ -357,10 +344,6 @@ NGIRCd_VersionAddition( VOID )
|
|||||||
if( txt[0] ) strcat( txt, "+" );
|
if( txt[0] ) strcat( txt, "+" );
|
||||||
strcat( txt, "SYSLOG" );
|
strcat( txt, "SYSLOG" );
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_ZLIB
|
|
||||||
if( txt[0] ) strcat( txt, "+" );
|
|
||||||
strcat( txt, "ZLIB" );
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if( txt[0] ) strcat( txt, "+" );
|
if( txt[0] ) strcat( txt, "+" );
|
||||||
strcat( txt, "DEBUG" );
|
strcat( txt, "DEBUG" );
|
||||||
@@ -389,38 +372,6 @@ NGIRCd_VersionAddition( VOID )
|
|||||||
} /* NGIRCd_VersionAddition */
|
} /* NGIRCd_VersionAddition */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL VOID
|
|
||||||
NGIRCd_Rehash( VOID )
|
|
||||||
{
|
|
||||||
CHAR old_name[CLIENT_ID_LEN];
|
|
||||||
|
|
||||||
/* Alle Listen-Sockets schliessen */
|
|
||||||
Conn_ExitListeners( );
|
|
||||||
|
|
||||||
/* Alten Server-Namen merken */
|
|
||||||
strcpy( old_name, Conf_ServerName );
|
|
||||||
|
|
||||||
/* Konfiguration neu lesen ... */
|
|
||||||
Conf_Init( );
|
|
||||||
|
|
||||||
/* Alten Server-Namen wiederherstellen: dieser
|
|
||||||
* kann nicht zur Laufzeit geaendert werden ... */
|
|
||||||
if( strcmp( old_name, Conf_ServerName ) != 0 )
|
|
||||||
{
|
|
||||||
strcpy( Conf_ServerName, old_name );
|
|
||||||
Log( LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name." );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* neue pre-defined Channel anlegen: */
|
|
||||||
Channel_InitPredefined( );
|
|
||||||
|
|
||||||
/* Listen-Sockets neu anlegen: */
|
|
||||||
Conn_InitListeners( );
|
|
||||||
|
|
||||||
Log( LOG_INFO, "Re-reading of configuration done." );
|
|
||||||
} /* NGIRCd_Rehash */
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL VOID
|
LOCAL VOID
|
||||||
Initialize_Signal_Handler( VOID )
|
Initialize_Signal_Handler( VOID )
|
||||||
{
|
{
|
||||||
@@ -481,15 +432,15 @@ Signal_Handler( INT Signal )
|
|||||||
case SIGINT:
|
case SIGINT:
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
/* wir soll(t)en uns wohl beenden ... */
|
/* wir soll(t)en uns wohl beenden ... */
|
||||||
if( Signal == SIGTERM ) Log( LOG_WARNING|LOG_snotice, "Got TERM signal, terminating now ..." );
|
if( Signal == SIGTERM ) Log( LOG_WARNING, "Got TERM signal, terminating now ..." );
|
||||||
else if( Signal == SIGINT ) Log( LOG_WARNING|LOG_snotice, "Got INT signal, terminating now ..." );
|
else if( Signal == SIGINT ) Log( LOG_WARNING, "Got INT signal, terminating now ..." );
|
||||||
else if( Signal == SIGQUIT ) Log( LOG_WARNING|LOG_snotice, "Got QUIT signal, terminating now ..." );
|
else if( Signal == SIGQUIT ) Log( LOG_WARNING, "Got QUIT signal, terminating now ..." );
|
||||||
NGIRCd_Quit = TRUE;
|
NGIRCd_Quit = TRUE;
|
||||||
break;
|
break;
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
/* Konfiguration neu einlesen: */
|
/* neu starten */
|
||||||
Log( LOG_WARNING|LOG_snotice, "Got HUP signal, re-reading configuration ..." );
|
Log( LOG_WARNING, "Got HUP signal, restarting now ..." );
|
||||||
NGIRCd_Rehash( );
|
NGIRCd_Restart = TRUE;
|
||||||
break;
|
break;
|
||||||
case SIGCHLD:
|
case SIGCHLD:
|
||||||
/* Child-Prozess wurde beendet. Zombies vermeiden: */
|
/* Child-Prozess wurde beendet. Zombies vermeiden: */
|
||||||
@@ -502,11 +453,35 @@ Signal_Handler( INT Signal )
|
|||||||
} /* Signal_Handler */
|
} /* Signal_Handler */
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL VOID
|
||||||
|
Initialize_Listen_Ports( VOID )
|
||||||
|
{
|
||||||
|
/* Ports, auf denen der Server Verbindungen entgegennehmen
|
||||||
|
* soll, initialisieren */
|
||||||
|
|
||||||
|
INT created, i;
|
||||||
|
|
||||||
|
created = 0;
|
||||||
|
for( i = 0; i < Conf_ListenPorts_Count; i++ )
|
||||||
|
{
|
||||||
|
if( Conn_NewListener( Conf_ListenPorts[i] )) created++;
|
||||||
|
else Log( LOG_ERR, "Can't listen on port %u!", Conf_ListenPorts[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( created < 1 )
|
||||||
|
{
|
||||||
|
Log( LOG_ALERT, "Server isn't listening on a single port!" );
|
||||||
|
Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
|
||||||
|
exit( 1 );
|
||||||
|
}
|
||||||
|
} /* Initialize_Listen_Ports */
|
||||||
|
|
||||||
|
|
||||||
LOCAL VOID
|
LOCAL VOID
|
||||||
Show_Version( VOID )
|
Show_Version( VOID )
|
||||||
{
|
{
|
||||||
puts( NGIRCd_Version( ));
|
puts( NGIRCd_Version( ));
|
||||||
puts( "Copyright (c)2001-2003 by Alexander Barton (<alex@barton.de>)." );
|
puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
|
||||||
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
|
puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
|
||||||
puts( "This is free software; see the source for copying conditions. There is NO" );
|
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." );
|
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
|
||||||
@@ -520,7 +495,7 @@ Show_Help( VOID )
|
|||||||
puts( " -d, --debug log extra debug messages" );
|
puts( " -d, --debug log extra debug messages" );
|
||||||
#endif
|
#endif
|
||||||
puts( " -f, --config <f> use file <f> as configuration file" );
|
puts( " -f, --config <f> use file <f> as configuration file" );
|
||||||
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
|
puts( " -n, --nodaemon don't fork and don't detatch from controlling terminal" );
|
||||||
puts( " -p, --passive disable automatic connections to other servers" );
|
puts( " -p, --passive disable automatic connections to other servers" );
|
||||||
#ifdef SNIFFER
|
#ifdef SNIFFER
|
||||||
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
|
puts( " -s, --sniffer enable network sniffer and display all IRC traffic" );
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: ngircd.h,v 1.17 2002/12/12 11:30:23 alex Exp $
|
* $Id: ngircd.h,v 1.14 2002/09/02 19:01:11 alex Exp $
|
||||||
*
|
*
|
||||||
* Prototypes of the "main module".
|
* ngircd.h: Prototypen aus dem "Haupt-Modul"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,12 +47,9 @@ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */
|
|||||||
|
|
||||||
GLOBAL CHAR NGIRCd_ProtoID[1024]; /* Protokoll- und Server-Identifikation */
|
GLOBAL CHAR NGIRCd_ProtoID[1024]; /* Protokoll- und Server-Identifikation */
|
||||||
|
|
||||||
|
|
||||||
GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));
|
GLOBAL CHAR *NGIRCd_Version PARAMS((VOID ));
|
||||||
GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID ));
|
GLOBAL CHAR *NGIRCd_VersionAddition PARAMS((VOID ));
|
||||||
|
|
||||||
GLOBAL VOID NGIRCd_Rehash PARAMS(( VOID ));
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* IRC command parser and validator
|
* $Id: parse.c,v 1.41.2.4 2002/11/29 10:59:51 alex Exp $
|
||||||
|
*
|
||||||
|
* parse.c: Parsen der Client-Anfragen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -37,7 +38,6 @@ static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $";
|
|||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include "irc.h"
|
#include "irc.h"
|
||||||
#include "irc-channel.h"
|
#include "irc-channel.h"
|
||||||
#include "irc-info.h"
|
|
||||||
#include "irc-login.h"
|
#include "irc-login.h"
|
||||||
#include "irc-mode.h"
|
#include "irc-mode.h"
|
||||||
#include "irc-op.h"
|
#include "irc-op.h"
|
||||||
@@ -48,54 +48,6 @@ static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $";
|
|||||||
#include "exp.h"
|
#include "exp.h"
|
||||||
|
|
||||||
|
|
||||||
COMMAND My_Commands[] =
|
|
||||||
{
|
|
||||||
{ "ADMIN", IRC_ADMIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "CONNECT", IRC_CONNECT, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "KICK", IRC_KICK, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "KILL", IRC_KILL, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "LINKS", IRC_LINKS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "LIST", IRC_LIST, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "LUSERS", IRC_LUSERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "MODE", IRC_MODE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "MOTD", IRC_MOTD, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "NAMES", IRC_NAMES, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "NICK", IRC_NICK, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "NJOIN", IRC_NJOIN, CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "NOTICE", IRC_NOTICE, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "OPER", IRC_OPER, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "PASS", IRC_PASS, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "PONG", IRC_PONG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "QUIT", IRC_QUIT, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "RESTART", IRC_RESTART, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "SERVER", IRC_SERVER, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "SQUIT", IRC_SQUIT, CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "USER", IRC_USER, 0xFFFF, 0, 0, 0 },
|
|
||||||
{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
|
|
||||||
{ "WHOIS", IRC_WHOIS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
{ "WHOWAS", IRC_WHOWAS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
#ifdef IRCPLUS
|
|
||||||
{ "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, 0, 0 },
|
|
||||||
#endif
|
|
||||||
{ NULL, NULL, 0x0, 0, 0, 0 } /* Ende-Marke */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL VOID Init_Request PARAMS(( REQUEST *Req ));
|
LOCAL VOID Init_Request PARAMS(( REQUEST *Req ));
|
||||||
|
|
||||||
LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ));
|
LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ));
|
||||||
@@ -105,13 +57,6 @@ LOCAL BOOLEAN Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed
|
|||||||
LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
|
LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
|
||||||
|
|
||||||
|
|
||||||
GLOBAL COMMAND *
|
|
||||||
Parse_GetCommandStruct( VOID )
|
|
||||||
{
|
|
||||||
return My_Commands;
|
|
||||||
} /* Parse_GetCommandStruct */
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN
|
GLOBAL BOOLEAN
|
||||||
Parse_Request( CONN_ID Idx, CHAR *Request )
|
Parse_Request( CONN_ID Idx, CHAR *Request )
|
||||||
{
|
{
|
||||||
@@ -315,8 +260,6 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
|
|||||||
|
|
||||||
CLIENT *client, *target, *prefix;
|
CLIENT *client, *target, *prefix;
|
||||||
CHAR str[LINE_LEN];
|
CHAR str[LINE_LEN];
|
||||||
BOOLEAN result;
|
|
||||||
COMMAND *cmd;
|
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
assert( Idx >= 0 );
|
assert( Idx >= 0 );
|
||||||
@@ -370,39 +313,50 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
|
|||||||
return IRC_WriteStrClientPrefix( target, prefix, "%s", str );
|
return IRC_WriteStrClientPrefix( target, prefix, "%s", str );
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = My_Commands;
|
if( strcasecmp( Req->command, "PASS" ) == 0 ) return IRC_PASS( client, Req );
|
||||||
while( cmd->name )
|
else if( strcasecmp( Req->command, "NICK" ) == 0 ) return IRC_NICK( client, Req );
|
||||||
{
|
else if( strcasecmp( Req->command, "USER" ) == 0 ) return IRC_USER( client, Req );
|
||||||
/* Befehl suchen */
|
else if( strcasecmp( Req->command, "SERVER" ) == 0 ) return IRC_SERVER( client, Req );
|
||||||
if( strcasecmp( Req->command, cmd->name ) != 0 )
|
else if( strcasecmp( Req->command, "NJOIN" ) == 0 ) return IRC_NJOIN( client, Req );
|
||||||
{
|
else if( strcasecmp( Req->command, "QUIT" ) == 0 ) return IRC_QUIT( client, Req );
|
||||||
cmd++; continue;
|
else if( strcasecmp( Req->command, "SQUIT" ) == 0 ) return IRC_SQUIT( client, Req );
|
||||||
}
|
else if( strcasecmp( Req->command, "PING" ) == 0 ) return IRC_PING( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "PONG" ) == 0 ) return IRC_PONG( client, Req );
|
||||||
if( Client_Type( client ) & cmd->type )
|
else if( strcasecmp( Req->command, "MOTD" ) == 0 ) return IRC_MOTD( client, Req );
|
||||||
{
|
else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
|
||||||
/* Command is allowed for this client: call it and count produced bytes */
|
else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
|
||||||
Conn_ResetWCounter( );
|
else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
|
||||||
result = (cmd->function)( client, Req );
|
else if( strcasecmp( Req->command, "NAMES" ) == 0 ) return IRC_NAMES( client, Req );
|
||||||
cmd->bytes += Conn_WCounter( );
|
else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req );
|
||||||
/* Adjust counters */
|
else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req );
|
||||||
if( Client_Type( client ) != CLIENT_SERVER ) cmd->lcount++;
|
else if( strcasecmp( Req->command, "OPER" ) == 0 ) return IRC_OPER( client, Req );
|
||||||
else cmd->rcount++;
|
else if( strcasecmp( Req->command, "DIE" ) == 0 ) return IRC_DIE( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "RESTART" ) == 0 ) return IRC_RESTART( client, Req );
|
||||||
return result;
|
else if( strcasecmp( Req->command, "ERROR" ) == 0 ) return IRC_ERROR( client, Req );
|
||||||
}
|
else if( strcasecmp( Req->command, "LUSERS" ) == 0 ) return IRC_LUSERS( client, Req );
|
||||||
else
|
else if( strcasecmp( Req->command, "LINKS" ) == 0 ) return IRC_LINKS( client, Req );
|
||||||
{
|
else if( strcasecmp( Req->command, "JOIN" ) == 0 ) return IRC_JOIN( client, Req );
|
||||||
/* Befehl ist fuer diesen Client-Typ nicht erlaubt! */
|
else if( strcasecmp( Req->command, "PART" ) == 0 ) return IRC_PART( client, Req );
|
||||||
return IRC_WriteStrClient( client, ERR_NOTREGISTERED_MSG, Client_ID( client ));
|
else if( strcasecmp( Req->command, "VERSION" ) == 0 ) return IRC_VERSION( client, Req );
|
||||||
}
|
else if( strcasecmp( Req->command, "KILL" ) == 0 ) return IRC_KILL( client, Req );
|
||||||
}
|
else if( strcasecmp( Req->command, "AWAY" ) == 0 ) return IRC_AWAY( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "TOPIC" ) == 0 ) return IRC_TOPIC( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "WHO" ) == 0 ) return IRC_WHO( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "LIST" ) == 0 ) return IRC_LIST( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "INVITE" ) == 0 ) return IRC_INVITE( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "KICK" ) == 0 ) return IRC_KICK( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "CONNECT" ) == 0 ) return IRC_CONNECT( client, Req );
|
||||||
|
else if( strcasecmp( Req->command, "ADMIN" ) == 0 ) return IRC_ADMIN( client, Req );
|
||||||
|
#ifdef IRCPLUS
|
||||||
|
else if( strcasecmp( Req->command, "CHANINFO" ) == 0 ) return IRC_CHANINFO( client, Req );
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Unbekannter Befehl */
|
/* Unbekannter Befehl */
|
||||||
|
if( Client_Type( client ) != CLIENT_SERVER ) IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
|
||||||
Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
|
Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" );
|
||||||
if( Client_Type( client ) != CLIENT_SERVER ) return IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command );
|
|
||||||
else return TRUE;
|
return TRUE;
|
||||||
} /* Handle_Request */
|
} /* Handle_Request */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: parse.h,v 1.9 2002/12/18 13:53:20 alex Exp $
|
* $Id: parse.h,v 1.7 2002/05/27 13:09:27 alex Exp $
|
||||||
*
|
*
|
||||||
* IRC command parser and validator (header)
|
* parse.h: Parsen der Client-Anfragen (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -27,20 +28,8 @@ typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */
|
|||||||
} REQUEST;
|
} REQUEST;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _COMMAND
|
|
||||||
{
|
|
||||||
CHAR *name; /* command name */
|
|
||||||
BOOLEAN (*function)( CLIENT *Client, REQUEST *Request );
|
|
||||||
CLIENT_TYPE type; /* valid client types (bit mask) */
|
|
||||||
LONG lcount, rcount; /* number of local and remote calls */
|
|
||||||
LONG bytes; /* number of bytes created */
|
|
||||||
} COMMAND;
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request ));
|
GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request ));
|
||||||
|
|
||||||
GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( VOID ));
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Asynchronous resolver
|
* $Id: resolve.c,v 1.3 2002/06/09 13:19:08 alex Exp $
|
||||||
|
*
|
||||||
|
* resolve.c: asyncroner Resolver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: resolve.c,v 1.4 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: resolve.h,v 1.3 2002/12/12 12:23:43 alex Exp $
|
* $Id: resolve.h,v 1.2 2002/09/16 09:22:41 alex Exp $
|
||||||
*
|
*
|
||||||
* Asynchronous resolver (header)
|
* resolve.h: asyncroner Resolver (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* Tool functions
|
* $Id: tool.c,v 1.9 2002/05/27 13:09:27 alex Exp $
|
||||||
|
*
|
||||||
|
* tool.c: Hilfsfunktionen, ggf. Platformabhaengig
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: tool.c,v 1.10 2002/12/12 12:24:18 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@@ -2,15 +2,16 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: tool.h,v 1.9 2002/12/12 12:23:43 alex Exp $
|
* $Id: tool.h,v 1.8 2002/05/27 13:09:27 alex Exp $
|
||||||
*
|
*
|
||||||
* Tool functions (Header)
|
* log.h: Hilfsfunktionen (Header)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: portab.h,v 1.9 2002/12/12 11:26:08 alex Exp $
|
* $Id: portab.h,v 1.7.2.1 2002/11/04 19:18:39 alex Exp $
|
||||||
*
|
*
|
||||||
* portab.h: "Portabilitaets-Definitionen"
|
* portab.h: "Portabilitaets-Definitionen"
|
||||||
*/
|
*/
|
||||||
@@ -24,13 +24,6 @@
|
|||||||
|
|
||||||
/* Compiler Features */
|
/* Compiler Features */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
# define PUNUSED(x) __attribute__ ((unused)) x
|
|
||||||
# define UNUSED __attribute__ ((unused))
|
|
||||||
#else
|
|
||||||
# define PUNUSED(x) x
|
|
||||||
# define UNUSED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PARAMS
|
#ifndef PARAMS
|
||||||
# if PROTOTYPES
|
# if PROTOTYPES
|
||||||
|
@@ -2,20 +2,21 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* test program for portab.h and friends ;-)
|
* $Id: portabtest.c,v 1.8 2002/09/09 10:05:10 alex Exp $
|
||||||
|
*
|
||||||
|
* portabtest.c: Testprogramm fuer portab.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: portabtest.c,v 1.9 2002/12/12 11:38:46 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@@ -2,20 +2,20 @@
|
|||||||
* ngIRCd -- The Next Generation IRC Daemon
|
* ngIRCd -- The Next Generation IRC Daemon
|
||||||
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
* Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
|
||||||
* it under the terms of the GNU General Public License as published by
|
* der GNU General Public License (GPL), wie von der Free Software Foundation
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
|
||||||
* (at your option) any later version.
|
* der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* snprintf() and vsnprintf() replacement functions
|
* $Id: vsnprintf.c,v 1.3 2002/05/27 13:01:04 alex Exp $
|
||||||
|
*
|
||||||
|
* vsnprintf.c: u.a. Ersatz fuer vsnprintf()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: vsnprintf.c,v 1.4 2002/12/12 11:37:11 alex Exp $";
|
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
|
|
||||||
#include "exp.h"
|
#include "exp.h"
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
# Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
# der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
#
|
#
|
||||||
# $Id: Makefile.am,v 1.9 2002/11/10 14:28:06 alex Exp $
|
# $Id: Makefile.am,v 1.3.2.2 2002/09/20 15:39:55 alex Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
AUTOMAKE_OPTIONS = ../portab/ansi2knr
|
||||||
@@ -25,7 +25,7 @@ EXTRA_DIST = \
|
|||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd \
|
rm -rf logs tests *-test ngircd-test.log ngircd-test.motd \
|
||||||
T-ngircd procs.tmp
|
ngircd-TEST* procs.tmp
|
||||||
|
|
||||||
maintainer-clean-local:
|
maintainer-clean-local:
|
||||||
rm -f Makefile Makefile.in
|
rm -f Makefile Makefile.in
|
||||||
@@ -33,7 +33,7 @@ maintainer-clean-local:
|
|||||||
check_SCRIPTS = ngircd-TEST-Binary tests.sh
|
check_SCRIPTS = ngircd-TEST-Binary tests.sh
|
||||||
|
|
||||||
ngircd-TEST-Binary:
|
ngircd-TEST-Binary:
|
||||||
cp ../ngircd/ngircd T-ngircd
|
cp ../ngircd/ngircd ngircd-TEST
|
||||||
[ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh .
|
[ -f getpid.sh ] || ln -s $(srcdir)/getpid.sh .
|
||||||
|
|
||||||
connect-test: tests.sh
|
connect-test: tests.sh
|
||||||
|
@@ -1,24 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ngIRCd Test Suite
|
# ngIRCd Test Suite
|
||||||
# $Id: getpid.sh,v 1.2 2002/11/10 14:28:06 alex Exp $
|
# $Id: getpid.sh,v 1.1.2.1 2002/09/20 15:19:55 alex Exp $
|
||||||
|
|
||||||
# wurde ein Name uebergeben?
|
# wurde ein Name uebergeben?
|
||||||
[ $# -ne 1 ] && exit 1
|
[ $# -ne 1 ] && exit 1
|
||||||
|
|
||||||
# Flags fuer "ps" ermitteln
|
# Flags fuer "ps" ermitteln
|
||||||
if [ `uname` = "FreeBSD" ]; then
|
if [ `uname` = "FreeBSD" ]; then
|
||||||
PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1"
|
PS_FLAGS=-a; PS_PIDCOL=1
|
||||||
elif [ `uname` = "A/UX" ]; then
|
|
||||||
PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1"
|
|
||||||
else
|
else
|
||||||
PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1"
|
PS_FLAGS=-f; PS_PIDCOL=2
|
||||||
ps $PS_FLAGS > /dev/null 2>&1
|
ps $PS_FLAGS > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then PS_FLAGS="a"; PS_PIDCOL="1"; fi
|
if [ $? -ne 0 ]; then PS_FLAGS=a; PS_PIDCOL=1; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# PID ermitteln
|
# PID ermitteln
|
||||||
ps $PS_FLAGS > procs.tmp
|
ps $PS_FLAGS > procs.tmp
|
||||||
pid=$( cat procs.tmp | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n | head $HEAD_FLAGS )
|
pid=`cat procs.tmp | grep "$1" | awk "{ print \\\$$PS_PIDCOL }" | sort -n | head -n 1`
|
||||||
|
|
||||||
# ermittelte PID validieren
|
# ermittelte PID validieren
|
||||||
[ "$pid" -gt 1 ] > /dev/null 2>&1
|
[ "$pid" -gt 1 ] > /dev/null 2>&1
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# $Id: mode-test.e,v 1.4 2002/12/15 15:52:34 alex Exp $
|
# $Id: mode-test.e,v 1.2.2.1 2002/11/22 23:46:09 alex Exp $
|
||||||
|
|
||||||
spawn telnet localhost 6789
|
spawn telnet localhost 6789
|
||||||
expect {
|
expect {
|
||||||
@@ -93,10 +93,10 @@ expect {
|
|||||||
":nick!~user@* MODE #channel +I nick3!user@*"
|
":nick!~user@* MODE #channel +I nick3!user@*"
|
||||||
}
|
}
|
||||||
|
|
||||||
send "mode #channel -vo nick nick\r"
|
send "mode #channel -vo nick\r"
|
||||||
expect {
|
expect {
|
||||||
timeout { exit 1 }
|
timeout { exit 1 }
|
||||||
":nick!~user@* MODE #channel -vo nick nick"
|
":nick!~user@* MODE #channel -vo nick"
|
||||||
}
|
}
|
||||||
|
|
||||||
send "quit\r"
|
send "quit\r"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# $Id: ngircd-test.conf,v 1.3 2002/10/21 13:45:23 alex Exp $
|
# $Id: ngircd-test.conf,v 1.2.2.1 2002/11/04 19:18:39 alex Exp $
|
||||||
|
|
||||||
[Global]
|
[Global]
|
||||||
Name = ngircd.test.server
|
Name = ngircd.test.server
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ngIRCd Test Suite
|
# ngIRCd Test Suite
|
||||||
# $Id: start-server.sh,v 1.10 2002/11/10 14:28:06 alex Exp $
|
# $Id: start-server.sh,v 1.5.2.4 2002/10/03 16:13:38 alex Exp $
|
||||||
|
|
||||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ rm -rf logs *.log
|
|||||||
# pruefen, ob getpid.sh gueltige PID's liefert. Wenn dem nicht so ist,
|
# pruefen, ob getpid.sh gueltige PID's liefert. Wenn dem nicht so ist,
|
||||||
# wird kein ngIRCd gestartet, da dieser ansonsten nicht mehr am Ende
|
# wird kein ngIRCd gestartet, da dieser ansonsten nicht mehr am Ende
|
||||||
# des Testlaufs beendet werden koennte!
|
# des Testlaufs beendet werden koennte!
|
||||||
./getpid.sh sh > /dev/null 2>&1
|
./getpid.sh make > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo " error: getpid.sh FAILED!"
|
echo " error: getpid.sh FAILED!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -22,11 +22,11 @@ fi
|
|||||||
echo "This is an ngIRCd Test Server" > ngircd-test.motd
|
echo "This is an ngIRCd Test Server" > ngircd-test.motd
|
||||||
|
|
||||||
# Test-Server starten ...
|
# Test-Server starten ...
|
||||||
./T-ngircd -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
|
./ngircd-TEST -np -f ${srcdir}/ngircd-test.conf > ngircd-test.log 2>&1 &
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# validieren, dass Server laeuft
|
# validieren, dass Server laeuft
|
||||||
pid=`./getpid.sh T-ngircd`
|
pid=`./getpid.sh ngircd-TEST`
|
||||||
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
|
[ -n "$pid" ] && kill -0 $pid > /dev/null 2>&1 || exit 1
|
||||||
|
|
||||||
# -eof-
|
# -eof-
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ngIRCd Test Suite
|
# ngIRCd Test Suite
|
||||||
# $Id: stop-server.sh,v 1.9 2002/11/10 14:28:06 alex Exp $
|
# $Id: stop-server.sh,v 1.4.2.4 2002/10/03 16:13:38 alex Exp $
|
||||||
|
|
||||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||||
|
|
||||||
echo " stopping server ..."
|
echo " stopping server ..."
|
||||||
|
|
||||||
# Test-Server stoppen ...
|
# Test-Server stoppen ...
|
||||||
pid=`./getpid.sh T-ngircd`
|
pid=`./getpid.sh ngircd-TEST`
|
||||||
[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1
|
[ -n "$pid" ] && kill $pid > /dev/null 2>&1 || exit 1
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# ngIRCd Test Suite
|
# ngIRCd Test Suite
|
||||||
# $Id: stress-server.sh,v 1.6 2002/09/23 22:07:43 alex Exp $
|
# $Id: stress-server.sh,v 1.4.2.2 2002/10/03 16:13:38 alex Exp $
|
||||||
|
|
||||||
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
[ -z "$srcdir" ] && srcdir=`dirname $0`
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user