Commit Diff


commit - f3c0c7c0b3c12101675f09679785e6e603f555b0
commit + 05fc4a4cb7c2235565ee6d72aeb3961d1d2419f5
blob - ec0ed701b426118eba48eab04d0f4dd6dd9a20b3
blob + f8f29822ef22773b22e8e7efce6fb6dc71521752
--- src/ngircd/lists.c
+++ src/ngircd/lists.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: lists.c,v 1.7 2002/09/08 00:55:45 alex Exp $
+ * $Id: lists.c,v 1.8 2002/09/08 17:06:07 alex Exp $
  *
  * lists.c: Verwaltung der "IRC-Listen": Ban, Invite, ...
  */
@@ -54,6 +54,7 @@ LOCAL C2C *My_Invites, *My_Bans;
 LOCAL C2C *New_C2C PARAMS(( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ));
 
 LOCAL BOOLEAN Check_List PARAMS(( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan ));
+LOCAL BOOLEAN Already_Registered PARAMS(( C2C *Cl2Chan, CHAR *Mask, CHANNEL *Chan ));
 
 
 
@@ -101,13 +102,20 @@ Lists_CheckInvited( CLIENT *Client, CHANNEL *Chan )
 
 
 GLOBAL BOOLEAN
-Lists_AddInvited( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
+Lists_AddInvited( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
 {
 	C2C *c2c;
 
 	assert( Mask != NULL );
 	assert( Chan != NULL );
 
+	if( Already_Registered( My_Invites, Mask, Chan ))
+	{
+		/* Eintrag ist bereits vorhanden */
+		IRC_WriteStrClient( From, RPL_INVITELIST_MSG, Client_ID( From ), Channel_Name( Chan ), Mask );
+		return FALSE;
+	}
+	
 	c2c = New_C2C( Mask, Chan, OnlyOnce );
 	if( ! c2c )
 	{
@@ -181,12 +189,19 @@ Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan )
 
 
 GLOBAL BOOLEAN
-Lists_AddBanned( CHAR *Mask, CHANNEL *Chan )
+Lists_AddBanned( CLIENT *From, CHAR *Mask, CHANNEL *Chan )
 {
 	C2C *c2c;
 
 	assert( Mask != NULL );
 	assert( Chan != NULL );
+
+	if( Already_Registered( My_Bans, Mask, Chan ))
+	{
+		/* Eintrag ist bereits vorhanden */
+		IRC_WriteStrClient( From, RPL_BANLIST_MSG, Client_ID( From ), Channel_Name( Chan ), Mask );
+		return FALSE;
+	}
 
 	c2c = New_C2C( Mask, Chan, FALSE );
 	if( ! c2c )
@@ -415,4 +430,19 @@ Check_List( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Ch
 } /* Check_List */
 
 
+LOCAL BOOLEAN
+Already_Registered( C2C *List, CHAR *Mask, CHANNEL *Chan )
+{
+	C2C *c2c;
+
+	c2c = List;
+	while( c2c )
+	{
+		if(( c2c->channel == Chan ) && ( strcasecmp( c2c->mask, Mask ) == 0 )) return TRUE;
+		c2c = c2c->next;
+	}
+	return FALSE;
+} /* Already_Registered */
+
+
 /* -eof- */