/[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.11 - (show annotations) (download) (as text)
Wed Dec 22 20:30:03 1999 UTC (19 years, 8 months ago) by guppy
Branch: MAIN
Changes since 1.10: +2 -1 lines
File MIME type: text/x-csrc
patches .. and more patches

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23