ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/channel.h
Revision: 1937
Committed: Sat May 4 20:54:13 2013 UTC (12 years, 3 months ago) by michael
Content type: text/x-chdr
File size: 4733 byte(s)
Log Message:
-  Implemented channel mode +c. Known from other ircds, this mode basically
   prevents users from sending messages including control codes to a channel
   that has this mode set

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 *
4 * Copyright (C) 2002 by the past and present ircd coders, and others.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22 /*! \file channel.h
23 * \brief Responsible for managing channels, members, bans and topics
24 * \version $Id$
25 */
26
27 #ifndef INCLUDED_channel_h
28 #define INCLUDED_channel_h
29
30 #include "ircd_defs.h" /* KEYLEN, CHANNELLEN */
31
32 /* channel visible */
33 #define ShowChannel(v,c) (PubChannel(c) || IsMember((v),(c)))
34
35 #define IsMember(who, chan) ((find_channel_link(who, chan)) ? 1 : 0)
36 #define AddMemberFlag(x, y) ((x)->flags |= (y))
37 #define DelMemberFlag(x, y) ((x)->flags &= ~(y))
38
39 #define FLOOD_NOTICED 1
40 #define JOIN_FLOOD_NOTICED 2
41
42 #define SetFloodNoticed(x) ((x)->flags |= FLOOD_NOTICED)
43 #define IsSetFloodNoticed(x) ((x)->flags & FLOOD_NOTICED)
44 #define ClearFloodNoticed(x) ((x)->flags &= ~FLOOD_NOTICED)
45
46 #define SetJoinFloodNoticed(x) ((x)->flags |= JOIN_FLOOD_NOTICED)
47 #define IsSetJoinFloodNoticed(x) ((x)->flags & JOIN_FLOOD_NOTICED)
48 #define ClearJoinFloodNoticed(x) ((x)->flags &= ~JOIN_FLOOD_NOTICED)
49
50 struct Client;
51
52 /*! \brief Mode structure for channels */
53 struct Mode
54 {
55 unsigned int mode; /*!< simple modes */
56 unsigned int limit; /*!< +l userlimit */
57 char key[KEYLEN + 1]; /*!< +k key */
58 };
59
60 /*! \brief Channel structure */
61 struct Channel
62 {
63 dlink_node node;
64
65 struct Channel *hnextch;
66 struct Mode mode;
67
68 char topic[TOPICLEN + 1];
69 char topic_info[USERHOST_REPLYLEN];
70
71 time_t channelts;
72 time_t topic_time;
73 time_t last_knock; /*!< don't allow knock to flood */
74 time_t last_join_time;
75 time_t first_received_message_time; /*!< channel flood control */
76 unsigned int flags;
77 int received_number_of_privmsgs;
78
79 dlink_list members;
80 dlink_list invites;
81 dlink_list banlist;
82 dlink_list exceptlist;
83 dlink_list invexlist;
84
85 float number_joined;
86
87 char chname[CHANNELLEN + 1];
88 };
89
90 /*! \brief Membership structure */
91 struct Membership
92 {
93 dlink_node channode; /*!< link to chptr->members */
94 dlink_node usernode; /*!< link to source_p->channel */
95 struct Channel *chptr; /*!< Channel pointer */
96 struct Client *client_p; /*!< Client pointer */
97 unsigned int flags; /*!< user/channel flags, e.g. CHFL_CHANOP */
98 };
99
100 /*! \brief Ban structure. Used for b/e/I n!u\@h masks */
101 struct Ban
102 {
103 dlink_node node;
104 char *name;
105 char *username;
106 char *host;
107 char *who;
108 size_t len;
109 time_t when;
110 struct irc_ssaddr addr;
111 int bits;
112 int type;
113 };
114
115 extern dlink_list global_channel_list;
116
117 extern int check_channel_name(const char *, const int);
118 extern int can_send(struct Channel *, struct Client *, struct Membership *, const char *);
119 extern int is_banned(const struct Channel *, const struct Client *);
120 extern int can_join(struct Client *, struct Channel *, const char *);
121 extern int has_member_flags(const struct Membership *, const unsigned int);
122
123 extern void remove_ban(struct Ban *, dlink_list *);
124 extern void channel_init(void);
125 extern void add_user_to_channel(struct Channel *, struct Client *,
126 unsigned int, int);
127 extern void remove_user_from_channel(struct Membership *);
128 extern void channel_member_names(struct Client *, struct Channel *, int);
129 extern void add_invite(struct Channel *, struct Client *);
130 extern void del_invite(struct Channel *, struct Client *);
131 extern void send_channel_modes(struct Client *, struct Channel *);
132 extern void channel_modes(struct Channel *, struct Client *, char *, char *);
133 extern void check_spambot_warning(struct Client *, const char *);
134 extern void check_splitmode(void *);
135 extern void free_channel_list(dlink_list *);
136 extern void destroy_channel(struct Channel *);
137 extern void set_channel_topic(struct Channel *, const char *, const char *, time_t, int);
138
139 extern const char *get_member_status(const struct Membership *, int);
140
141 extern struct Channel *make_channel(const char *);
142 extern struct Membership *find_channel_link(struct Client *, struct Channel *);
143 #endif /* INCLUDED_channel_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision