mirror of
https://github.com/osmarks/ngircd.git
synced 2025-06-27 15:42:54 +00:00
{Add|Del}_Ban_Invite > {Add_To|Del_From}_List(): more generic
This commit is contained in:
parent
a3a4b5f696
commit
33a165721b
@ -41,10 +41,10 @@ static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
|
|||||||
static bool Channel_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
|
static bool Channel_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
|
||||||
CHANNEL *Channel));
|
CHANNEL *Channel));
|
||||||
|
|
||||||
static bool Add_Ban_Invite PARAMS((char what, CLIENT *Prefix, CLIENT *Client,
|
static bool Add_To_List PARAMS((char what, CLIENT *Prefix, CLIENT *Client,
|
||||||
CHANNEL *Channel, const char *Pattern));
|
CHANNEL *Channel, const char *Pattern));
|
||||||
static bool Del_Ban_Invite PARAMS((char what, CLIENT *Prefix, CLIENT *Client,
|
static bool Del_From_List PARAMS((char what, CLIENT *Prefix, CLIENT *Client,
|
||||||
CHANNEL *Channel, const char *Pattern));
|
CHANNEL *Channel, const char *Pattern));
|
||||||
|
|
||||||
static bool Send_ListChange PARAMS((const bool IsAdd, const char ModeChar,
|
static bool Send_ListChange PARAMS((const bool IsAdd, const char ModeChar,
|
||||||
CLIENT *Prefix, CLIENT *Client,
|
CLIENT *Prefix, CLIENT *Client,
|
||||||
@ -668,10 +668,10 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
|
|||||||
/* modify list */
|
/* modify list */
|
||||||
if (modeok) {
|
if (modeok) {
|
||||||
connected = set
|
connected = set
|
||||||
? Add_Ban_Invite(*mode_ptr, Origin,
|
? Add_To_List(*mode_ptr, Origin,
|
||||||
Client, Channel,
|
Client, Channel,
|
||||||
Req->argv[arg_arg])
|
Req->argv[arg_arg])
|
||||||
: Del_Ban_Invite(*mode_ptr, Origin,
|
: Del_From_List(*mode_ptr, Origin,
|
||||||
Client, Channel,
|
Client, Channel,
|
||||||
Req->argv[arg_arg]);
|
Req->argv[arg_arg]);
|
||||||
} else {
|
} else {
|
||||||
@ -834,7 +834,7 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entries to channel ban and invite lists.
|
* Add entries to channel invite, ban and exception lists.
|
||||||
*
|
*
|
||||||
* @param what Can be 'I' for invite or 'b' for ban list.
|
* @param what Can be 'I' for invite or 'b' for ban list.
|
||||||
* @param Prefix The originator of the command.
|
* @param Prefix The originator of the command.
|
||||||
@ -844,8 +844,8 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
|
|||||||
* @return CONNECTED or DISCONNECTED.
|
* @return CONNECTED or DISCONNECTED.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
Add_Ban_Invite(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
||||||
const char *Pattern)
|
const char *Pattern)
|
||||||
{
|
{
|
||||||
const char *mask;
|
const char *mask;
|
||||||
struct list_head *list;
|
struct list_head *list;
|
||||||
@ -857,10 +857,14 @@ Add_Ban_Invite(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
|||||||
|
|
||||||
mask = Lists_MakeMask(Pattern);
|
mask = Lists_MakeMask(Pattern);
|
||||||
|
|
||||||
if (what == 'I')
|
switch(what) {
|
||||||
list = Channel_GetListInvites(Channel);
|
case 'I':
|
||||||
else
|
list = Channel_GetListInvites(Channel);
|
||||||
list = Channel_GetListBans(Channel);
|
break;
|
||||||
|
case 'b':
|
||||||
|
list = Channel_GetListBans(Channel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (Lists_CheckDupeMask(list, mask))
|
if (Lists_CheckDupeMask(list, mask))
|
||||||
return CONNECTED;
|
return CONNECTED;
|
||||||
@ -871,19 +875,22 @@ Add_Ban_Invite(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
|||||||
Channel_Name(Channel), mask,
|
Channel_Name(Channel), mask,
|
||||||
MAX_HNDL_CHANNEL_LISTS);
|
MAX_HNDL_CHANNEL_LISTS);
|
||||||
|
|
||||||
if (what == 'I') {
|
switch (what) {
|
||||||
if (!Channel_AddInvite(Channel, mask, false))
|
case 'I':
|
||||||
return CONNECTED;
|
if (!Channel_AddInvite(Channel, mask, false))
|
||||||
} else {
|
return CONNECTED;
|
||||||
if (!Channel_AddBan(Channel, mask))
|
break;
|
||||||
return CONNECTED;
|
case 'b':
|
||||||
|
if (!Channel_AddBan(Channel, mask))
|
||||||
|
return CONNECTED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Send_ListChange(true, what, Prefix, Client, Channel, mask);
|
return Send_ListChange(true, what, Prefix, Client, Channel, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete entries from channel ban and invite lists.
|
* Delete entries from channel invite, ban and exeption lists.
|
||||||
*
|
*
|
||||||
* @param what Can be 'I' for invite or 'b' for ban list.
|
* @param what Can be 'I' for invite or 'b' for ban list.
|
||||||
* @param Prefix The originator of the command.
|
* @param Prefix The originator of the command.
|
||||||
@ -893,8 +900,8 @@ Add_Ban_Invite(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
|||||||
* @return CONNECTED or DISCONNECTED.
|
* @return CONNECTED or DISCONNECTED.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
Del_Ban_Invite(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
Del_From_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
||||||
const char *Pattern)
|
const char *Pattern)
|
||||||
{
|
{
|
||||||
const char *mask;
|
const char *mask;
|
||||||
struct list_head *list;
|
struct list_head *list;
|
||||||
@ -906,10 +913,14 @@ Del_Ban_Invite(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
|
|||||||
|
|
||||||
mask = Lists_MakeMask(Pattern);
|
mask = Lists_MakeMask(Pattern);
|
||||||
|
|
||||||
if (what == 'I')
|
switch (what) {
|
||||||
list = Channel_GetListInvites(Channel);
|
case 'I':
|
||||||
else
|
list = Channel_GetListInvites(Channel);
|
||||||
list = Channel_GetListBans(Channel);
|
break;
|
||||||
|
case 'b':
|
||||||
|
list = Channel_GetListBans(Channel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Lists_CheckDupeMask(list, mask))
|
if (!Lists_CheckDupeMask(list, mask))
|
||||||
return CONNECTED;
|
return CONNECTED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user