ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/channel.h
Revision: 8917
Committed: Sun Apr 21 22:50:42 2019 UTC (4 years, 11 months ago) by michael
Content type: text/x-chdr
File size: 5615 byte(s)
Log Message:
- Update documentation in some files

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2019 ircd-hybrid development team
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
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 enum
40 {
41 CAN_SEND_NO = 0,
42 CAN_SEND_NONOP = -1,
43 CAN_SEND_OPV = -2
44 };
45
46 enum
47 {
48 MSG_FLOOD_NOTICED = 1 << 0,
49 JOIN_FLOOD_NOTICED = 1 << 1
50 };
51
52 #define SetFloodNoticed(x) ((x)->flags |= MSG_FLOOD_NOTICED)
53 #define IsSetFloodNoticed(x) ((x)->flags & MSG_FLOOD_NOTICED)
54 #define ClearFloodNoticed(x) ((x)->flags &= ~MSG_FLOOD_NOTICED)
55
56 #define SetJoinFloodNoticed(x) ((x)->flags |= JOIN_FLOOD_NOTICED)
57 #define IsSetJoinFloodNoticed(x) ((x)->flags & JOIN_FLOOD_NOTICED)
58 #define ClearJoinFloodNoticed(x) ((x)->flags &= ~JOIN_FLOOD_NOTICED)
59
60 struct Client;
61
62 /*! \brief Mode structure for channels */
63 struct Mode
64 {
65 unsigned int mode; /**< simple modes */
66 unsigned int limit; /**< +l userlimit */
67 char key[KEYLEN + 1]; /**< +k key */
68 };
69
70 /*! \brief Channel structure */
71 struct Channel
72 {
73 dlink_node node;
74
75 struct Channel *hnextch;
76 struct Mode mode;
77
78 char topic[TOPICLEN + 1];
79 char topic_info[NICKLEN + USERLEN + HOSTLEN + 3];
80
81 uintmax_t creationtime; /**< Real time */
82 uintmax_t topic_time; /**< Real time */
83 uintmax_t last_knock; /**< Don't allow knock to flood; monotonic time */
84 uintmax_t last_invite; /**< Monotonic time */
85 uintmax_t last_join_time; /**< Monotonic time */
86 uintmax_t first_received_message_time; /*!< Channel flood control; monotonic time */
87 unsigned int flags;
88 unsigned int received_number_of_privmsgs;
89
90 dlink_list members_local; /*!< local members are here too */
91 dlink_list members;
92 dlink_list invites;
93 dlink_list banlist;
94 dlink_list exceptlist;
95 dlink_list invexlist;
96
97 float number_joined;
98
99 char name[CHANNELLEN + 1];
100 size_t name_len;
101 };
102
103 /*! \brief Membership structure */
104 struct Membership
105 {
106 dlink_node locchannode; /**< link to chptr->members_local */
107 dlink_node channode; /**< link to chptr->members */
108 dlink_node usernode; /**< link to source_p->channel */
109 struct Channel *chptr; /**< Channel pointer */
110 struct Client *client_p; /**< Client pointer */
111 unsigned int flags; /**< user/channel flags, e.g. CHFL_CHANOP */
112 };
113
114 /*! \brief Ban structure. Used for b/e/I n!u\@h masks */
115 struct Ban
116 {
117 dlink_node node;
118 char name[NICKLEN + 1];
119 char user[USERLEN + 1];
120 char host[HOSTLEN + 1];
121 char who[NICKLEN + USERLEN + HOSTLEN + 3];
122 size_t len;
123 uintmax_t when; /**< Time this ban has been set; real time */
124 struct irc_ssaddr addr;
125 int bits;
126 int type;
127 };
128
129 /*! \brief Invite structure */
130 struct Invite
131 {
132 dlink_node user_node; /**< link to client_p->connection->invited */
133 dlink_node chan_node; /**< link to chptr->invites */
134 struct Channel *chptr; /**< Channel pointer */
135 struct Client *client_p; /**< Client pointer */
136 uintmax_t when; /**< Time the invite has been created; monotonic time */
137 };
138
139
140 extern const dlink_list *channel_get_list(void);
141 extern bool channel_check_name(const char *, bool);
142 extern int can_send(struct Channel *, struct Client *, struct Membership *, const char *, bool);
143 extern bool is_banned(const struct Channel *, const struct Client *);
144 extern int has_member_flags(const struct Membership *, const unsigned int);
145
146 extern void channel_do_join(struct Client *, char *, char *);
147 extern void channel_do_part(struct Client *, char *, const char *);
148 extern void remove_ban(struct Ban *, dlink_list *);
149 extern void add_user_to_channel(struct Channel *, struct Client *, unsigned int, bool);
150 extern void remove_user_from_channel(struct Membership *);
151 extern void channel_member_names(struct Client *, struct Channel *, bool);
152 extern void add_invite(struct Channel *, struct Client *);
153 extern void del_invite(struct Invite *);
154 extern void clear_invite_list(dlink_list *);
155 extern void channel_send_modes(struct Client *, const struct Channel *);
156 extern void channel_modes(const struct Channel *, const struct Client *, char *, char *);
157 extern void check_spambot_warning(struct Client *, const char *);
158 extern void channel_free(struct Channel *);
159 extern void channel_set_topic(struct Channel *, const char *, const char *, uintmax_t, bool);
160
161 extern const char *get_member_status(const struct Membership *, bool);
162
163 extern struct Channel *channel_make(const char *);
164 extern struct Membership *find_channel_link(const struct Client *, const struct Channel *);
165 #endif /* INCLUDED_channel_h */

Properties

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