1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-13 02:10:27 +00:00

Fixed handling of already existent entries in invite and ban lists:

the attempt to add an already existent entry is no error, it must
be propagated across servers (but not added to the list!).
This commit is contained in:
Alexander Barton 2004-04-09 21:41:52 +00:00
parent cc25c52048
commit 64d330b726
4 changed files with 15 additions and 23 deletions

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.33 2004/02/29 16:28:44 alex Exp $";
static char UNUSED id[] = "$Id: irc-mode.c,v 1.34 2004/04/09 21:41:52 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -642,7 +642,8 @@ Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )
mask = Lists_MakeMask( Pattern );
if( ! Lists_AddInvited( Prefix, mask, Channel, FALSE )) return CONNECTED;
if( ! Lists_AddInvited( mask, Channel, FALSE )) return CONNECTED;
return Send_ListChange( "+I", Prefix, Client, Channel, mask );
} /* Add_Invite */
@ -658,7 +659,8 @@ Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )
mask = Lists_MakeMask( Pattern );
if( ! Lists_AddBanned( Prefix, mask, Channel )) return CONNECTED;
if( ! Lists_AddBanned( mask, Channel )) return CONNECTED;
return Send_ListChange( "+b", Prefix, Client, Channel, mask );
} /* Add_Ban */

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-op.c,v 1.12 2003/12/05 11:57:28 alex Exp $";
static char UNUSED id[] = "$Id: irc-op.c,v 1.13 2004/04/09 21:41:52 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -104,7 +104,7 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req )
if( remember )
{
/* We must memember this invite */
if( ! Lists_AddInvited( from, Client_Mask( target ), chan, TRUE )) return CONNECTED;
if( ! Lists_AddInvited( Client_Mask( target ), chan, TRUE )) return CONNECTED;
}
}

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: lists.c,v 1.13 2004/03/11 22:16:31 alex Exp $";
static char UNUSED id[] = "$Id: lists.c,v 1.14 2004/04/09 21:41:52 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -102,19 +102,14 @@ Lists_CheckInvited( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN
Lists_AddInvited( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )
Lists_AddInvited( 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;
}
if( Already_Registered( My_Invites, Mask, Chan )) return TRUE;
c2c = New_C2C( Mask, Chan, OnlyOnce );
if( ! c2c )
@ -189,19 +184,14 @@ Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan )
GLOBAL BOOLEAN
Lists_AddBanned( CLIENT *From, CHAR *Mask, CHANNEL *Chan )
Lists_AddBanned( 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;
}
if( Already_Registered( My_Bans, Mask, Chan )) return TRUE;
c2c = New_C2C( Mask, Chan, FALSE );
if( ! c2c )

View File

@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: lists.h,v 1.9 2002/12/12 12:23:43 alex Exp $
* $Id: lists.h,v 1.10 2004/04/09 21:41:52 alex Exp $
*
* Management of IRC lists: ban, invite, ... (header)
*/
@ -22,12 +22,12 @@ GLOBAL VOID Lists_Init PARAMS(( VOID ));
GLOBAL VOID Lists_Exit PARAMS(( VOID ));
GLOBAL BOOLEAN Lists_CheckInvited PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CLIENT *From, CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ));
GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ));
GLOBAL VOID Lists_DelInvited PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_ShowInvites PARAMS(( CLIENT *Client, CHANNEL *Channel ));
GLOBAL BOOLEAN Lists_CheckBanned PARAMS(( CLIENT *Client, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddBanned PARAMS(( CLIENT *From, CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_AddBanned PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL VOID Lists_DelBanned PARAMS(( CHAR *Mask, CHANNEL *Chan ));
GLOBAL BOOLEAN Lists_ShowBans PARAMS(( CLIENT *Client, CHANNEL *Channel ));