ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/extban_mute.c
Revision: 9234
Committed: Fri Jan 31 17:38:34 2020 UTC (5 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 2165 byte(s)
Log Message:
- Extbans have been implemented. Main implementation done by Adam for p4.
  Currently supported extbans:

  Matching:

   $a:<account>   Matches users logged into a matching account.
   $c:<channel>   Matches users that are on the given channel. An additional
                  prefix of either @, %, or + can be specified to test for
                  certain channel privileges.
   $o:<class>     Matches IRC operators that have joined a class
                  matching the mask.
   $r:<realname>  Matches users with a matching realname.
   $s:<server>    Matches users that are connected to a server matching the mask.
   $u:<modes>     Matches users having the specified user modes set or not set.
   $z:<certfp>    Matches users having the given TLS certificate fingerprint.

  Acting:

   $j:<banmask>   Prevents matching users from joining the channel.
   $m:<banmask>   Blocks messages from matching users. Users with voice
                  or above are not affected.

File Contents

# Content
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: extban_mute.c 9223 2020-01-26 11:35:22Z michael $
26 */
27
28 #include "stdinc.h"
29 #include "list.h"
30 #include "irc_string.h"
31 #include "channel.h"
32 #include "channel_mode.h"
33 #include "client.h"
34 #include "extban.h"
35 #include "numeric.h"
36
37
38 int
39 extban_mute_can_send(struct Channel *channel, struct Client *client_p,
40 struct ChannelMember *member)
41 {
42 if (!MyConnect(client_p))
43 return CAN_SEND_NONOP;
44
45 if (member)
46 {
47 if (member->flags & CHFL_BAN_SILENCED)
48 return ERR_CANNOTSENDTOCHAN;
49
50 if (member->flags & CHFL_MUTE_CHECKED)
51 return CAN_SEND_NONOP;
52
53 member->flags |= CHFL_MUTE_CHECKED;
54 }
55
56 /* Search for matching muteban */
57 if (find_bmask(client_p, channel, &channel->banlist, &extban_mute) == true)
58 {
59 /* Clients who match +e m: override +b m: */
60 if (find_bmask(client_p, channel, &channel->exceptlist, &extban_mute) == false)
61 {
62 if (member)
63 member->flags |= CHFL_BAN_SILENCED;
64
65 return ERR_CANNOTSENDTOCHAN;
66 }
67 }
68
69 return CAN_SEND_NONOP;
70 }
71
72 struct Extban extban_mute =
73 {
74 .character = 'm',
75 .type = EXTBAN_ACTING,
76 .types = CHFL_BAN | CHFL_EXCEPTION
77 };