ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/include/channel.h
Revision: 9453
Committed: Tue Jun 30 16:55:38 2020 UTC (3 years, 9 months ago) by michael
Content type: text/x-chdr
File size: 5392 byte(s)
Log Message:
- Add member_get_prefix_len() and make use of it in some places;  rename get_member_status() to member_get_prefix()

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2865 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 9102 * Copyright (c) 1997-2020 ircd-hybrid development team
5 adx 30 *
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 michael 4564 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22     /*! \file channel.h
23     * \brief Responsible for managing channels, members, bans and topics
24 knight 31 * \version $Id$
25 adx 30 */
26    
27     #ifndef INCLUDED_channel_h
28     #define INCLUDED_channel_h
29    
30     #include "ircd_defs.h" /* KEYLEN, CHANNELLEN */
31 michael 9233 #include "extban.h"
32 adx 30
33 michael 1798 #define AddMemberFlag(x, y) ((x)->flags |= (y))
34     #define DelMemberFlag(x, y) ((x)->flags &= ~(y))
35    
36 michael 6324 enum
37     {
38 michael 8807 CAN_SEND_NO = 0,
39     CAN_SEND_NONOP = -1,
40     CAN_SEND_OPV = -2
41     };
42    
43     enum
44     {
45 michael 8430 MSG_FLOOD_NOTICED = 1 << 0,
46     JOIN_FLOOD_NOTICED = 1 << 1
47 michael 6324 };
48 michael 1798
49 michael 6327 #define SetFloodNoticed(x) ((x)->flags |= MSG_FLOOD_NOTICED)
50     #define IsSetFloodNoticed(x) ((x)->flags & MSG_FLOOD_NOTICED)
51     #define ClearFloodNoticed(x) ((x)->flags &= ~MSG_FLOOD_NOTICED)
52 michael 1798
53     #define SetJoinFloodNoticed(x) ((x)->flags |= JOIN_FLOOD_NOTICED)
54     #define IsSetJoinFloodNoticed(x) ((x)->flags & JOIN_FLOOD_NOTICED)
55     #define ClearJoinFloodNoticed(x) ((x)->flags &= ~JOIN_FLOOD_NOTICED)
56    
57 adx 30 struct Client;
58    
59     /*! \brief Mode structure for channels */
60     struct Mode
61     {
62 michael 4405 unsigned int mode; /**< simple modes */
63     unsigned int limit; /**< +l userlimit */
64     char key[KEYLEN + 1]; /**< +k key */
65 adx 30 };
66    
67     /*! \brief Channel structure */
68     struct Channel
69     {
70     dlink_node node;
71    
72     struct Channel *hnextch;
73 michael 1013 struct Mode mode;
74 adx 30
75 michael 1203 char topic[TOPICLEN + 1];
76 michael 6931 char topic_info[NICKLEN + USERLEN + HOSTLEN + 3];
77 michael 1013
78 michael 9074 uintmax_t creation_time; /**< Real time */
79 michael 8916 uintmax_t topic_time; /**< Real time */
80 michael 9082 uintmax_t last_knock_time; /**< Don't allow knock to flood; monotonic time */
81     uintmax_t last_invite_time; /**< Monotonic time */
82 michael 8916 uintmax_t last_join_time; /**< Monotonic time */
83 michael 9082 uintmax_t first_received_message_time; /*!< Channel flood control; monotonic time */
84 michael 1013 unsigned int flags;
85 michael 7863 unsigned int received_number_of_privmsgs;
86 adx 30
87 michael 8600 dlink_list members_local; /*!< local members are here too */
88 adx 30 dlink_list members;
89     dlink_list invites;
90     dlink_list banlist;
91     dlink_list exceptlist;
92     dlink_list invexlist;
93    
94     float number_joined;
95    
96 michael 4617 char name[CHANNELLEN + 1];
97 michael 6981 size_t name_len;
98 adx 30 };
99    
100 michael 9082 /*! \brief ChannelMember structure */
101     struct ChannelMember
102 adx 30 {
103 michael 9082 dlink_node locchannode; /**< link to channel->members_local */
104     dlink_node channode; /**< link to channel->members */
105 michael 9249 dlink_node usernode; /**< link to client->channel */
106 michael 9082 struct Channel *channel; /**< Channel pointer */
107     struct Client *client; /**< Client pointer */
108     unsigned int flags; /**< user/channel flags, e.g. CHFL_CHANOP */
109 adx 30 };
110    
111 michael 9233 enum { BANSTRLEN = 200 }; /* XXX */
112    
113 michael 4405 /*! \brief Ban structure. Used for b/e/I n!u\@h masks */
114 adx 30 struct Ban
115     {
116     dlink_node node;
117 michael 9233 unsigned int extban;
118     char banstr[BANSTRLEN];
119 michael 5758 char name[NICKLEN + 1];
120     char user[USERLEN + 1];
121     char host[HOSTLEN + 1];
122     char who[NICKLEN + USERLEN + HOSTLEN + 3];
123 michael 9233 size_t banstr_len; /**< Cached string length of Ban::banstr */
124 michael 8916 uintmax_t when; /**< Time this ban has been set; real time */
125 michael 371 struct irc_ssaddr addr;
126     int bits;
127 michael 1644 int type;
128 adx 30 };
129    
130 michael 8438 extern const dlink_list *channel_get_list(void);
131 michael 8659 extern bool channel_check_name(const char *, bool);
132 michael 9082 extern int can_send(struct Channel *, struct Client *, struct ChannelMember *, const char *, bool);
133 michael 9233 extern bool is_banned(struct Channel *, struct Client *);
134     extern bool find_bmask(struct Client *, struct Channel*, const dlink_list *, struct Extban *);
135 michael 9082 extern int has_member_flags(const struct ChannelMember *, const unsigned int);
136 adx 30
137 michael 3936 extern void channel_do_join(struct Client *, char *, char *);
138 michael 4784 extern void channel_do_part(struct Client *, char *, const char *);
139 adx 30 extern void remove_ban(struct Ban *, dlink_list *);
140 michael 8663 extern void add_user_to_channel(struct Channel *, struct Client *, unsigned int, bool);
141 michael 9082 extern void remove_user_from_channel(struct ChannelMember *);
142 michael 9449 extern void channel_demote_members(struct Channel *, const struct Client *, unsigned int, const char);
143 michael 8655 extern void channel_member_names(struct Client *, struct Channel *, bool);
144 michael 8438 extern void channel_send_modes(struct Client *, const struct Channel *);
145     extern void channel_modes(const struct Channel *, const struct Client *, char *, char *);
146 adx 30 extern void check_spambot_warning(struct Client *, const char *);
147 michael 6374 extern void channel_free(struct Channel *);
148 michael 8659 extern void channel_set_topic(struct Channel *, const char *, const char *, uintmax_t, bool);
149 adx 30
150 michael 9453 extern const char *member_get_prefix(const struct ChannelMember *, bool);
151     extern size_t member_get_prefix_len(const struct ChannelMember *, bool);
152 adx 30
153 michael 6374 extern struct Channel *channel_make(const char *);
154 michael 9082 extern struct ChannelMember *find_channel_link(const struct Client *, const struct Channel *);
155 michael 8438 #endif /* INCLUDED_channel_h */

Properties

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