Commit Diff


commit - 118adda8d8b5ade51a495511a64998c9fc0d73f5
commit + 3cd8fc844663d737f9ce9fe2fa9d50d1a41209d0
blob - 2ede2e69d86726b2186eb4982c8bf2eb64e3992f
blob + e41ed5ce9ff998bd0374a980d949aff7b9e4df64
--- 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.10 2001/12/26 22:48:53 alex Exp $
+ * $Id: irc.c,v 1.11 2001/12/27 16:55:41 alex Exp $
  *
  * irc.c: IRC-Befehle
  *
  * $Log: irc.c,v $
+ * Revision 1.11  2001/12/27 16:55:41  alex
+ * - neu: IRC_WriteStrRelated(), Aenderungen auch in IRC_WriteStrClient().
+ *
  * Revision 1.10  2001/12/26 22:48:53  alex
  * - MOTD-Datei ist nun konfigurierbar und wird gelesen.
  *
@@ -96,31 +99,46 @@ GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CLI
 
 	CHAR buffer[1000];
 	BOOLEAN ok = CONNECTED;
+	CONN_ID send_to;
 	va_list ap;
 
 	assert( Client != NULL );
 	assert( Format != NULL );
 
 	va_start( ap, Format );
+	vsnprintf( buffer, 1000, Format, ap );
+	va_end( ap );
 
-	if( Client->conn_id != NONE )
-	{
-		/* Lokaler Client */
-		vsnprintf( buffer, 1000, Format, ap );
-		if( Prefix ) ok = Conn_WriteStr( Client->conn_id, ":%s %s", Prefix->host, buffer );
-		else ok = Conn_WriteStr( Client->conn_id, buffer );
-	}
-	else
-	{
-		/* Remote-Client */
-		Log( LOG_EMERG, "not implemented: IRC_WriteStrClient()" );
-	}
+	if( Client->conn_id != NONE ) send_to = Client->conn_id;
+	else send_to = Client->introducer->conn_id;
 
-	va_end( ap );
+	if( Prefix ) ok = Conn_WriteStr( Client->conn_id, ":%s %s", Client_GetID( Prefix ), buffer );
+	else ok = Conn_WriteStr( Client->conn_id, buffer );
+
 	return ok;
 } /* IRC_WriteStrClient */
+
+
+GLOBAL BOOLEAN IRC_WriteStrRelated( CLIENT *Client, CHAR *Format, ... )
+{
+	CHAR buffer[1000];
+	BOOLEAN ok = CONNECTED;
+	va_list ap;
 
+	assert( Client != NULL );
+	assert( Format != NULL );
 
+	va_start( ap, Format );
+	vsnprintf( buffer, 1000, Format, ap );
+	va_end( ap );
+
+	/* an den Client selber */
+	ok = IRC_WriteStrClient( Client, Client, buffer );
+
+	return ok;
+} /* IRC_WriteStrRelated */
+
+
 GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req )
 {
 	assert( Client != NULL );
@@ -148,6 +166,12 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req 
 		/* pruefen, ob Nick bereits vergeben */
 		if( ! Client_CheckNick( Client, Req->argv[0] )) return CONNECTED;
 
+		if( Client->type == CLIENT_USER )
+		{
+			/* Nick-Aenderung: allen mitteilen! */
+			IRC_WriteStrRelated( Client, "NICK :%s", Req->argv[0] );
+		}
+		
 		/* Client-Nick registrieren */
 		strcpy( Client->nick, Req->argv[0] );
 
@@ -271,7 +295,7 @@ LOCAL BOOLEAN Hello_User( CLIENT *Client )
 	
 	Log( LOG_NOTICE, "User \"%s!%s@%s\" (%s) registered.", Client->nick, Client->user, Client->host, Client->name );
 
-	IRC_WriteStrClient( Client, This_Server, RPL_WELCOME_MSG, Client->nick, Client->nick, Client->user, Client->host );
+	IRC_WriteStrClient( Client, This_Server, RPL_WELCOME_MSG, Client->nick, Client_GetID( Client ));
 	IRC_WriteStrClient( Client, This_Server, RPL_YOURHOST_MSG, Client->nick, This_Server->host );
 	IRC_WriteStrClient( Client, This_Server, RPL_CREATED_MSG, Client->nick );
 	IRC_WriteStrClient( Client, This_Server, RPL_MYINFO_MSG, Client->nick, This_Server->host );
blob - 858ce42c3229a3057d96ce19d4d358cd216499ae
blob + 4aa5670dbe12418b26ac82eeaa09bfe70fee5a9b
--- 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.6 2001/12/26 14:45:37 alex Exp $
+ * $Id: irc.h,v 1.7 2001/12/27 16:55:41 alex Exp $
  *
  * irc.h: IRC-Befehle (Header)
  *
  * $Log: irc.h,v $
+ * Revision 1.7  2001/12/27 16:55:41  alex
+ * - neu: IRC_WriteStrRelated(), Aenderungen auch in IRC_WriteStrClient().
+ *
  * Revision 1.6  2001/12/26 14:45:37  alex
  * - "Code Cleanups".
  *
@@ -47,6 +50,7 @@ GLOBAL VOID IRC_Init( VOID );
 GLOBAL VOID IRC_Exit( VOID );
 
 GLOBAL BOOLEAN IRC_WriteStrClient( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... );
+GLOBAL BOOLEAN IRC_WriteStrRelated( CLIENT *Client, CHAR *Format, ... );
 
 GLOBAL BOOLEAN IRC_PASS( CLIENT *Client, REQUEST *Req );
 GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req );