/[cvs]/eggdrop1.4/src/chan.h
ViewVC logotype

Contents of /eggdrop1.4/src/chan.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.10 - (show annotations) (download) (as text)
Wed Dec 15 02:32:58 1999 UTC (19 years, 8 months ago) by guppy
Branch: MAIN
Changes since 1.9: +27 -11 lines
File MIME type: text/x-csrc
id-header patch, finally, we have id tags for each file

1 /*
2 * chan.h
3 * stuff common to chan.c and mode.c
4 * users.h needs to be loaded too
5 *
6 * $Id$
7 */
8 /*
9 * Copyright (C) 1997 Robey Pointer
10 * Copyright (C) 1999 Eggheads
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 */
26 #ifndef _EGG_CHAN_H
27 #define _EGG_CHAN_H
28
29 typedef struct memstruct {
30 char nick[NICKLEN]; /* "dalnet" allows 30 */
31 char userhost[UHOSTLEN];
32 time_t joined;
33 unsigned short flags;
34 time_t split; /* in case they were just netsplit */
35 time_t last; /* for measuring idle time */
36 time_t delay; /* for delayed autoop */
37 struct userrec *user;
38 struct memstruct *next;
39 } memberlist;
40
41 #define CHANMETA "#&!+"
42
43 #define CHANOP 0x0001 /* channel +o */
44 #define CHANVOICE 0x0002 /* channel +v */
45 #define FAKEOP 0x0004 /* op'd by server */
46 #define SENTOP 0x0008 /* a mode +o was already sent out for
47 * this user */
48 #define SENTDEOP 0x0010 /* a mode -o was already sent out for
49 * this user */
50 #define SENTKICK 0x0020 /* a kick was already sent out for this user */
51 #define SENTVOICE 0x0040 /* a mode +v was already sent out for
52 * this user */
53 #define SENTDEVOICE 0x0080 /* a devoice has been sent */
54 #define WASOP 0x0100 /* was an op before a split */
55 #define STOPWHO 0x0200
56
57 #define chan_hasvoice(x) (x->flags & CHANVOICE)
58 #define chan_hasop(x) (x->flags & CHANOP)
59 #define chan_fakeop(x) (x->flags & FAKEOP)
60 #define chan_sentop(x) (x->flags & SENTOP)
61 #define chan_sentdeop(x) (x->flags & SENTDEOP)
62 #define chan_sentkick(x) (x->flags & SENTKICK)
63 #define chan_sentvoice(x) (x->flags & SENTVOICE)
64 #define chan_sentdevoice(x) (x->flags & SENTDEVOICE)
65 #define chan_issplit(x) (x->split > 0)
66 #define chan_wasop(x) (x->flags & WASOP)
67
68 /* Why duplicate this struct for exempts and invites only under another
69 * name? <cybah>
70 */
71 typedef struct maskstruct {
72 char *mask;
73 char *who;
74 time_t timer;
75 struct maskstruct *next;
76 } masklist;
77
78 /* used for temporary bans, exempts and invites */
79 typedef struct maskrec {
80 struct maskrec *next;
81 char *mask,
82 *desc,
83 *user;
84 time_t expire,
85 added,
86 lastactive;
87 int flags;
88 } maskrec;
89 extern maskrec *global_bans, *global_exempts, *global_invites;
90
91 #define MASKREC_STICKY 1
92 #define MASKREC_PERM 2
93
94 /* for every channel i join */
95 struct chan_t {
96 memberlist *member;
97 masklist *ban;
98 masklist *exempt;
99 masklist *invite;
100 char *topic;
101 char *key;
102 unsigned short int mode;
103 int maxmembers;
104 int members;
105 };
106
107 #define CHANINV 0x0001 /* +i */
108 #define CHANPRIV 0x0002 /* +p */
109 #define CHANSEC 0x0004 /* +s */
110 #define CHANMODER 0x0008 /* +m */
111 #define CHANTOPIC 0x0010 /* +t */
112 #define CHANNOMSG 0x0020 /* +n */
113 #define CHANLIMIT 0x0040 /* -l -- used only for protecting modes */
114 #define CHANKEY 0x0080 /* +k */
115 #define CHANANON 0x0100 /* +a -- ircd 2.9 */
116 #define CHANQUIET 0x0200 /* +q -- ircd 2.9 */
117
118 /* for every channel i'm supposed to be active on */
119 struct chanset_t {
120 struct chanset_t *next;
121 struct chan_t channel; /* current information */
122 char name[81];
123 char need_op[121];
124 char need_key[121];
125 char need_limit[121];
126 char need_unban[121];
127 char need_invite[121];
128 int flood_pub_thr;
129 int flood_pub_time;
130 int flood_join_thr;
131 int flood_join_time;
132 int flood_deop_thr;
133 int flood_deop_time;
134 int flood_kick_thr;
135 int flood_kick_time;
136 int flood_ctcp_thr;
137 int flood_ctcp_time;
138 int status;
139 int ircnet_status;
140 int idle_kick;
141 /* temporary channel bans, exempts and invites */
142 maskrec *bans,
143 *exempts,
144 *invites;
145 /* desired channel modes: */
146 int mode_pls_prot; /* modes to enforce */
147 int mode_mns_prot; /* modes to reject */
148 int limit_prot; /* desired limit */
149 char key_prot[121]; /* desired password */
150 /* queued mode changes: */
151 char pls[21]; /* positive mode changes */
152 char mns[21]; /* negative mode changes */
153 char key[81]; /* new key to set */
154 char rmkey[81]; /* old key to remove */
155 int limit; /* new limit to set */
156 int bytes; /* total bytes so far */
157 int compat; /* to prevent mixing old/new modes */
158 struct {
159 char *op;
160 char type;
161 } cmode[6]; /* parameter-type mode changes - */
162 /* detect floods */
163 char floodwho[FLOOD_CHAN_MAX][81];
164 time_t floodtime[FLOOD_CHAN_MAX];
165 int floodnum[FLOOD_CHAN_MAX];
166 char deopd[NICKLEN]; /* last person deop'd (must change) */
167 };
168
169 /* behavior modes for the channel */
170 #define CHAN_CLEARBANS 0x0001 /* clear bans on join */
171 #define CHAN_ENFORCEBANS 0x0002 /* kick people who match channel bans */
172 #define CHAN_DYNAMICBANS 0x0004 /* only activate bans when needed */
173 #define CHAN_NOUSERBANS 0x0008 /* don't let non-bots place bans */
174 #define CHAN_OPONJOIN 0x0010 /* op +o people as soon as they join */
175 #define CHAN_BITCH 0x0020 /* be a tightwad with ops */
176 #define CHAN_GREET 0x0040 /* greet people with their info line */
177 #define CHAN_PROTECTOPS 0x0080 /* re-op any +o people who get deop'd */
178 #define CHAN_LOGSTATUS 0x0100 /* log channel status every 5 mins */
179 #define CHAN_STOPNETHACK 0x0200 /* deop netsplit hackers */
180 #define CHAN_REVENGE 0x0400 /* get revenge on bad people */
181 #define CHAN_SECRET 0x0800 /* don't advertise channel on botnet */
182 #define CHAN_AUTOVOICE 0x1000 /* dish out voice stuff automatically */
183 #define CHAN_CYCLE 0x2000 /* cycle the channel if possible */
184 #define CHAN_DONTKICKOPS 0x4000 /* never kick +o flag people - arthur2 */
185 #define CHAN_WASOPTEST 0x8000 /* wasop test for all +o user
186 * when +stopnethack */
187 #define CHAN_INACTIVE 0x10000 /* no irc support for this channel - drummer */
188 #define CHAN_PROTECTFRIENDS 0x20000 /* re-op any +f people who get deop'd */
189 #define CHAN_SHARED 0x40000 /* channel is being shared */
190 #define CHAN_SEEN 0x80000
191 #define CHAN_REVENGEBOT 0x100000 /* revenge on actions against the bot */
192 /* 0x200000 */
193 /* 0x400000 */
194 /* 0x800000 */
195 #define CHAN_ACTIVE 0x1000000 /* like i'm actually on the channel
196 * and stuff */
197 #define CHAN_PEND 0x2000000 /* just joined; waiting for end of
198 * WHO list */
199 #define CHAN_FLAGGED 0x4000000 /* flagged during rehash for delete */
200 #define CHAN_STATIC 0x8000000 /* channels that are NOT dynamic */
201 #define CHAN_ASKEDBANS 0x10000000
202 #define CHAN_ASKEDMODES 0x20000000 /* find out key-info on IRCu */
203
204 #define CHAN_ASKED_EXEMPTS 0x0001
205 #define CHAN_ASKED_INVITED 0x0002
206
207 #define CHAN_DYNAMICEXEMPTS 0x0004
208 #define CHAN_NOUSEREXEMPTS 0x0008
209 #define CHAN_DYNAMICINVITES 0x0010
210 #define CHAN_NOUSERINVITES 0x0020
211
212 /* prototypes */
213 memberlist *ismember(struct chanset_t *, char *);
214 struct chanset_t *findchan();
215
216 /* is this channel +s/+p? */
217 #define channel_hidden(chan) (chan->channel.mode & (CHANPRIV | CHANSEC))
218 /* is this channel +t? */
219 #define channel_optopic(chan) (chan->channel.mode & CHANTOPIC)
220 #define channel_active(chan) (chan->status & CHAN_ACTIVE)
221 #define channel_pending(chan) (chan->status & CHAN_PEND)
222 #define channel_bitch(chan) (chan->status & CHAN_BITCH)
223 #define channel_autoop(chan) (chan->status & CHAN_OPONJOIN)
224 #define channel_wasoptest(chan) (chan->status & CHAN_WASOPTEST)
225 #define channel_autovoice(chan) (chan->status & CHAN_AUTOVOICE)
226 #define channel_greet(chan) (chan->status & CHAN_GREET)
227 #define channel_logstatus(chan) (chan->status & CHAN_LOGSTATUS)
228 #define channel_clearbans(chan) (chan->status & CHAN_CLEARBANS)
229 #define channel_enforcebans(chan) (chan->status & CHAN_ENFORCEBANS)
230 #define channel_revenge(chan) (chan->status & CHAN_REVENGE)
231 #define channel_dynamicbans(chan) (chan->status & CHAN_DYNAMICBANS)
232 #define channel_nouserbans(chan) (chan->status & CHAN_NOUSERBANS)
233 #define channel_protectops(chan) (chan->status & CHAN_PROTECTOPS)
234 #define channel_protectfriends(chan) (chan->status & CHAN_PROTECTFRIENDS)
235 #define channel_dontkickops(chan) (chan->status & CHAN_DONTKICKOPS)
236 #define channel_stopnethack(chan) (chan->status & CHAN_STOPNETHACK)
237 #define channel_secret(chan) (chan->status & CHAN_SECRET)
238 #define channel_shared(chan) (chan->status & CHAN_SHARED)
239 #define channel_static(chan) (chan->status & CHAN_STATIC)
240 #define channel_cycle(chan) (chan->status & CHAN_CYCLE)
241 #define channel_seen(chan) (chan->status & CHAN_SEEN)
242 #define channel_inactive(chan) (chan->status & CHAN_INACTIVE)
243 #define channel_revengebot(chan) (chan->status & CHAN_REVENGEBOT)
244 #define channel_dynamicexempts(chan) (chan->ircnet_status & CHAN_DYNAMICEXEMPTS)
245 #define channel_nouserexempts(chan) (chan->ircnet_status & CHAN_NOUSEREXEMPTS)
246 #define channel_dynamicinvites(chan) (chan->ircnet_status & CHAN_DYNAMICINVITES)
247 #define channel_nouserinvites(chan) (chan->ircnet_status & CHAN_NOUSERINVITES)
248
249 struct server_list {
250 struct server_list *next;
251 char *name;
252 int port;
253 char *pass;
254 char *realname;
255 };
256
257 struct msgq_head {
258 struct msgq *head;
259 struct msgq *last;
260 int tot;
261 int warned;
262 };
263
264 /* used to queue a lot of things */
265 struct msgq {
266 struct msgq *next;
267 int len;
268 char *msg;
269 };
270
271 #endif /* _EGG_CHAN_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23