about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2002-09-16 09:14:45 +0000
committerAlexander Barton <alex@barton.de>2002-09-16 09:14:45 +0000
commit3a3d6d7b9a4b5e23f187a3722cb10ca9a916169f (patch)
treeb3f4d88c69880f268d7b1bca66dcb82bbe2e8b50
parent4ded22b00b44551ecf3b8d325144c2463ec4fe50 (diff)
downloadngircd-3a3d6d7b9a4b5e23f187a3722cb10ca9a916169f.tar.gz
ngircd-3a3d6d7b9a4b5e23f187a3722cb10ca9a916169f.zip
- neuer Befehl IRC_ADMIN().
-rw-r--r--src/ngircd/irc.c45
-rw-r--r--src/ngircd/irc.h3
2 files changed, 46 insertions, 2 deletions
diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index 4ec0427f..402cfead 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.c,v 1.94 2002/07/25 11:37:01 alex Exp $
+ * $Id: irc.c,v 1.95 2002/09/16 09:14:45 alex Exp $
  *
  * irc.c: IRC-Befehle
  */
@@ -656,6 +656,49 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
 
 
 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;
diff --git a/src/ngircd/irc.h b/src/ngircd/irc.h
index f65148e9..0864f266 100644
--- a/src/ngircd/irc.h
+++ b/src/ngircd/irc.h
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.h,v 1.31 2002/05/27 13:09:27 alex Exp $
+ * $Id: irc.h,v 1.32 2002/09/16 09:14:45 alex Exp $
  *
  * irc.h: IRC-Befehle (Header)
  */
@@ -23,6 +23,7 @@ GLOBAL BOOLEAN IRC_MOTD PARAMS((CLIENT *Client, REQUEST *Req ));
 GLOBAL BOOLEAN IRC_LUSERS PARAMS((CLIENT *Client, REQUEST *Req ));
 GLOBAL BOOLEAN IRC_LINKS 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 ));