/[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.8 - (show annotations) (download) (as text)
Sun Sep 26 18:46:18 1999 UTC (19 years, 11 months ago) by guppy
Branch: MAIN
Changes since 1.7: +9 -7 lines
File MIME type: text/x-csrc
Lots of patches were added

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23