ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/channel.h
Revision: 1365
Committed: Sun Apr 22 19:59:02 2012 UTC (11 years, 11 months ago) by michael
Content type: text/x-chdr
Original Path: ircd-hybrid-8/include/channel.h
File size: 4685 byte(s)
Log Message:
- change KEYLEN semantics. KEYLEN no longer includes space
  for the trailing \0

File Contents

# User Rev Content
1 adx 30 /*
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 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    
32     struct Client;
33    
34     /*! \brief Mode structure for channels */
35     struct Mode
36     {
37     unsigned int mode; /*!< simple modes */
38     unsigned int limit; /*!< +l userlimit */
39 michael 1365 char key[KEYLEN + 1]; /*!< +k key */
40 adx 30 };
41    
42     /*! \brief Channel structure */
43     struct Channel
44     {
45     dlink_node node;
46    
47     struct Channel *hnextch;
48 michael 1013 struct Mode mode;
49 adx 30
50 michael 1203 char topic[TOPICLEN + 1];
51     char topic_info[USERHOST_REPLYLEN];
52 michael 1013
53     time_t channelts;
54 adx 30 time_t topic_time;
55     time_t last_knock; /*!< don't allow knock to flood */
56 michael 1013 time_t last_join_time;
57     time_t first_received_message_time; /*!< channel flood control */
58     unsigned int flags;
59     int received_number_of_privmsgs;
60 adx 30
61     dlink_list members;
62     dlink_list invites;
63     dlink_list banlist;
64     dlink_list exceptlist;
65     dlink_list invexlist;
66    
67     float number_joined;
68    
69     char chname[CHANNELLEN + 1];
70     };
71    
72     /*! \brief Membership structure */
73     struct Membership
74     {
75     dlink_node channode; /*!< link to chptr->members */
76     dlink_node usernode; /*!< link to source_p->channel */
77     struct Channel *chptr; /*!< Channel pointer */
78     struct Client *client_p; /*!< Client pointer */
79     unsigned int flags; /*!< user/channel flags, e.g. CHFL_CHANOP */
80     };
81    
82     /*! \brief Ban structure. Used for b/e/I n!u\@h masks */
83     struct Ban
84     {
85     dlink_node node;
86     char *name;
87     char *username;
88     char *host;
89     char *who;
90 michael 1013 size_t len;
91 adx 30 time_t when;
92 michael 371 struct irc_ssaddr addr;
93     int bits;
94     char type;
95 adx 30 };
96    
97     extern dlink_list global_channel_list;
98    
99 michael 632 extern int check_channel_name(const char *, int);
100 michael 454 extern int can_send(struct Channel *, struct Client *, struct Membership *);
101 michael 1013 extern int is_banned(const struct Channel *, const struct Client *);
102 adx 30 extern int can_join(struct Client *, struct Channel *, const char *);
103     extern int has_member_flags(struct Membership *, unsigned int);
104    
105     extern void remove_ban(struct Ban *, dlink_list *);
106     extern void init_channels(void);
107     extern void add_user_to_channel(struct Channel *, struct Client *,
108     unsigned int, int);
109     extern void remove_user_from_channel(struct Membership *);
110     extern void channel_member_names(struct Client *, struct Channel *, int);
111     extern void add_invite(struct Channel *, struct Client *);
112     extern void del_invite(struct Channel *, struct Client *);
113     extern void send_channel_modes(struct Client *, struct Channel *);
114     extern void channel_modes(struct Channel *, struct Client *, char *, char *);
115     extern void check_spambot_warning(struct Client *, const char *);
116     extern void check_splitmode(void *);
117     extern void free_channel_list(dlink_list *);
118     extern void destroy_channel(struct Channel *);
119     extern void set_channel_topic(struct Channel *, const char *, const char *, time_t);
120    
121     extern const char *get_member_status(const struct Membership *, int);
122    
123 michael 632 extern struct Channel *make_channel(const char *);
124 adx 30 extern struct Membership *find_channel_link(struct Client *, struct Channel *);
125    
126     /* channel visible */
127     #define ShowChannel(v,c) (PubChannel(c) || IsMember((v),(c)))
128    
129     #define IsMember(who, chan) ((find_channel_link(who, chan)) ? 1 : 0)
130     #define AddMemberFlag(x, y) ((x)->flags |= (y))
131     #define DelMemberFlag(x, y) ((x)->flags &= ~(y))
132    
133     #define FLOOD_NOTICED 1
134     #define JOIN_FLOOD_NOTICED 2
135    
136     #define SetFloodNoticed(x) ((x)->flags |= FLOOD_NOTICED)
137     #define IsSetFloodNoticed(x) ((x)->flags & FLOOD_NOTICED)
138     #define ClearFloodNoticed(x) ((x)->flags &= ~FLOOD_NOTICED)
139    
140     #define SetJoinFloodNoticed(x) ((x)->flags |= JOIN_FLOOD_NOTICED)
141     #define IsSetJoinFloodNoticed(x) ((x)->flags & JOIN_FLOOD_NOTICED)
142     #define ClearJoinFloodNoticed(x) ((x)->flags &= ~JOIN_FLOOD_NOTICED)
143    
144     #endif /* INCLUDED_channel_h */

Properties

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