Commit Diff


commit - 22e7c845b4d2f64222516c0eddeef290329fd98e
commit + e8543915e4db6bbc60f7db6926b23457a3a0b188
blob - 47f224b86b55ef2acdbe49c6a4804a026b599616
blob + dc3b7991833a8d5366aa3686fdd1b1e9daf5c9f0
--- src/ngircd/irc.c
+++ src/ngircd/irc.c
@@ -9,11 +9,14 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.c,v 1.4 2001/12/25 19:19:30 alex Exp $
+ * $Id: irc.c,v 1.5 2001/12/25 22:02:42 alex Exp $
  *
  * irc.c: IRC-Befehle
  *
  * $Log: irc.c,v $
+ * Revision 1.5  2001/12/25 22:02:42  alex
+ * - neuer IRC-Befehl "/QUIT". Verbessertes Logging & Debug-Ausgaben.
+ *
  * Revision 1.4  2001/12/25 19:19:30  alex
  * - bessere Fehler-Abfragen, diverse Bugfixes.
  * - Nicks werden nur einmal vergeben :-)
@@ -92,7 +95,7 @@ GLOBAL BOOLEAN IRC_WriteStr_Client( CLIENT *Client, CL
 	else
 	{
 		/* Remote-Client */
-		Log( LOG_DEBUG, "not implemented: IRC_WriteStr_Client()" );
+		Log( LOG_EMERG, "not implemented: IRC_WriteStr_Client()" );
 	}
 
 	va_end( ap );
@@ -105,7 +108,12 @@ GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req 
 	assert( Client != NULL );
 	assert( Req != NULL );
 
-	return IRC_WriteStr_Client( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Req->command );
+	if( Client->type == CLIENT_UNKNOWN )
+	{
+		Log( LOG_DEBUG, "Registration of connection %d: got PASS command ...", Client->conn_id );
+		return IRC_WriteStr_Client( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Req->command );
+	}
+	else return IRC_WriteStr_Client( Client, This_Server, ERR_ALREADYREGISTRED_MSG );
 } /* IRC_PASS */
 
 
@@ -142,6 +150,7 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req 
 		if( Client->type != CLIENT_USER )
 		{
 			/* Neuer Client */
+			Log( LOG_DEBUG, "Registration of connection %d: got NICK command ...", Client->conn_id );
 			if( Client->type == CLIENT_GOTUSER ) return Hello_User( Client );
 			else Client->type = CLIENT_GOTNICK;
 		}
@@ -166,6 +175,7 @@ GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req 
 		strncpy( Client->name, Req->argv[3], CLIENT_NAME_LEN );
 		Client->name[CLIENT_NAME_LEN] = '\0';
 		
+		Log( LOG_DEBUG, "Registration of connection %d: got USER command ...", Client->conn_id );
 		if( Client->type == CLIENT_GOTNICK ) return Hello_User( Client );
 		else Client->type = CLIENT_GOTUSER;
 		return CONNECTED;
@@ -178,6 +188,23 @@ GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req 
 } /* IRC_USER */
 
 
+GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req )
+{
+	assert( Client != NULL );
+	assert( Req != NULL );
+
+	if( Client->type != CLIENT_SERVER && Client->type != CLIENT_SERVICE )
+	{
+		/* Falsche Anzahl Parameter? */
+		if( Req->argc > 1 ) return IRC_WriteStr_Client( Client, This_Server, ERR_NEEDMOREPARAMS_MSG );
+
+		Conn_Close( Client->conn_id, "Client wants to quit." );
+		return DISCONNECTED;
+	}
+	else return IRC_WriteStr_Client( Client, This_Server, ERR_NOTREGISTERED_MSG );
+} /* IRC_QUIT */
+
+
 GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req )
 {
 	assert( Client != NULL );
blob - d0c18b8761d312859dd34a9d80c6c6fbf64adf26
blob + 8c9a3283416c4689b0b5cdcb71d475aa0c1dff7a
--- src/ngircd/irc.h
+++ src/ngircd/irc.h
@@ -9,11 +9,14 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc.h,v 1.3 2001/12/25 19:19:30 alex Exp $
+ * $Id: irc.h,v 1.4 2001/12/25 22:02:42 alex Exp $
  *
  * irc.h: IRC-Befehle (Header)
  *
  * $Log: irc.h,v $
+ * Revision 1.4  2001/12/25 22:02:42  alex
+ * - neuer IRC-Befehl "/QUIT". Verbessertes Logging & Debug-Ausgaben.
+ *
  * Revision 1.3  2001/12/25 19:19:30  alex
  * - bessere Fehler-Abfragen, diverse Bugfixes.
  * - Nicks werden nur einmal vergeben :-)
@@ -41,6 +44,7 @@ GLOBAL BOOLEAN IRC_WriteStr_Client( CLIENT *Client, CL
 GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req );
 GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req );
 GLOBAL BOOLEAN IRC_USER( CLIENT *Client, REQUEST *Req );
+GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req );
 
 GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req );