1 |
/* |
2 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
* |
4 |
* Copyright (c) 2015-2016 plexus development team |
5 |
* Copyright (c) 2019-2020 ircd-hybrid development team |
6 |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
8 |
* it under the terms of the GNU General Public License as published by |
9 |
* the Free Software Foundation; either version 2 of the License, or |
10 |
* (at your option) any later version. |
11 |
* |
12 |
* This program is distributed in the hope that it will be useful, |
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
* GNU General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU General Public License |
18 |
* along with this program; if not, write to the Free Software |
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
20 |
* USA |
21 |
*/ |
22 |
|
23 |
/*! \file extban_mute.c |
24 |
* \brief Implements message muting extended channel bans. |
25 |
* \version $Id$ |
26 |
*/ |
27 |
|
28 |
#include "stdinc.h" |
29 |
#include "list.h" |
30 |
#include "channel.h" |
31 |
#include "channel_mode.h" |
32 |
#include "client.h" |
33 |
#include "extban.h" |
34 |
#include "numeric.h" |
35 |
|
36 |
|
37 |
int |
38 |
extban_mute_can_send(struct Channel *channel, struct Client *client, |
39 |
struct ChannelMember *member) |
40 |
{ |
41 |
if (!MyConnect(client)) |
42 |
return CAN_SEND_NONOP; |
43 |
|
44 |
if (member) |
45 |
{ |
46 |
if (member->flags & CHFL_BAN_SILENCED) |
47 |
return ERR_CANNOTSENDTOCHAN; |
48 |
|
49 |
if (member->flags & CHFL_MUTE_CHECKED) |
50 |
return CAN_SEND_NONOP; |
51 |
|
52 |
member->flags |= CHFL_MUTE_CHECKED; |
53 |
} |
54 |
|
55 |
/* Search for matching muteban */ |
56 |
if (find_bmask(client, channel, &channel->banlist, &extban_mute) == true) |
57 |
{ |
58 |
/* Clients who match +e m: override +b m: */ |
59 |
if (find_bmask(client, channel, &channel->exceptlist, &extban_mute) == false) |
60 |
{ |
61 |
if (member) |
62 |
member->flags |= CHFL_BAN_SILENCED; |
63 |
|
64 |
return ERR_CANNOTSENDTOCHAN; |
65 |
} |
66 |
} |
67 |
|
68 |
return CAN_SEND_NONOP; |
69 |
} |
70 |
|
71 |
struct Extban extban_mute = |
72 |
{ |
73 |
.character = 'm', |
74 |
.type = EXTBAN_ACTING, |
75 |
.types = CHFL_BAN | CHFL_EXCEPTION |
76 |
}; |