/[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.1 - (show annotations) (download) (as text)
Wed Jun 23 19:51:26 1999 UTC (20 years, 2 months ago) by segfault
Branch: MAIN
Branch point for: eggdev
File MIME type: text/x-csrc
Initial revision

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 voice has been sent since a deop */
35 #define SENTDEVOICE 0x0080 /* a devoice has been sent */
36 #define WASOP 0x0100 /* was an op before a split */
37
38 #define chan_hasvoice(x) (x->flags & CHANVOICE)
39 #define chan_hasop(x) (x->flags & CHANOP)
40 #define chan_fakeop(x) (x->flags & FAKEOP)
41 #define chan_sentop(x) (x->flags & SENTOP)
42 #define chan_sentdeop(x) (x->flags & SENTDEOP)
43 #define chan_sentkick(x) (x->flags & SENTKICK)
44 #define chan_sentvoice(x) (x->flags & SENTVOICE)
45 #define chan_issplit(x) (x->split > 0)
46 #define chan_wasop(x) (x->flags & WASOP)
47
48 typedef struct banstruct {
49 char *ban;
50 char *who;
51 time_t timer;
52 struct banstruct *next;
53 } banlist;
54
55 /* Next 2 structures created for IRCnet server module - Daemus - 2/1/1999 */
56 typedef struct exbanstruct {
57 char *exempt;
58 char *who;
59 time_t timer;
60 struct exbanstruct *next;
61 } exemptlist;
62
63 typedef struct exinvitestruct {
64 char *invite;
65 char *who;
66 time_t timer;
67 struct exinvitestruct *next;
68 } invitelist;
69
70 /* for every channel i join */
71 struct chan_t {
72 memberlist *member;
73 banlist *ban;
74 exemptlist *exempt;
75 invitelist *invite;
76 char *topic;
77 char *key;
78 unsigned short int mode;
79 int maxmembers;
80 int members;
81 };
82
83 #define CHANINV 0x0001 /* +i */
84 #define CHANPRIV 0x0002 /* +p */
85 #define CHANSEC 0x0004 /* +s */
86 #define CHANMODER 0x0008 /* +m */
87 #define CHANTOPIC 0x0010 /* +t */
88 #define CHANNOMSG 0x0020 /* +n */
89 #define CHANLIMIT 0x0040 /* -l -- used only for protecting modes */
90 #define CHANKEY 0x0080 /* -k -- used only for protecting modes */
91 #define CHANANON 0x0100 /* +a -- ircd 2.9 */
92 #define CHANQUIET 0x0200 /* +q -- ircd 2.9 */
93
94 /* for every channel i'm supposed to be active on */
95 struct chanset_t {
96 struct chanset_t *next;
97 struct chan_t channel; /* current information */
98 char name[81];
99 char need_op[121];
100 char need_key[121];
101 char need_limit[121];
102 char need_unban[121];
103 char need_invite[121];
104 int flood_pub_thr;
105 int flood_pub_time;
106 int flood_join_thr;
107 int flood_join_time;
108 int flood_deop_thr;
109 int flood_deop_time;
110 int flood_kick_thr;
111 int flood_kick_time;
112 int flood_ctcp_thr;
113 int flood_ctcp_time;
114 int status;
115 int ircnet_status;
116 int idle_kick;
117 struct banrec *bans; /* temporary channel bans */
118 /* desired channel modes: */
119 int mode_pls_prot; /* modes to enforce */
120 int mode_mns_prot; /* modes to reject */
121 int limit_prot; /* desired limit */
122 char key_prot[121]; /* desired password */
123 /* queued mode changes: */
124 char pls[21]; /* positive mode changes */
125 char mns[21]; /* negative mode changes */
126 char key[81]; /* new key to set */
127 char rmkey[81]; /* old key to remove */
128 int limit; /* new limit to set */
129 int bytes; /* total bytes so far */
130 struct {
131 char *op;
132 char type;
133 } cmode[6]; /* parameter-type mode changes - */
134 /* detect floods */
135 char floodwho[FLOOD_CHAN_MAX][81];
136 time_t floodtime[FLOOD_CHAN_MAX];
137 int floodnum[FLOOD_CHAN_MAX];
138 char deopd[NICKLEN]; /* last person deop'd (must change) */
139 };
140
141 /* behavior modes for the channel */
142 #define CHAN_CLEARBANS 0x0001 /* clear bans on join */
143 #define CHAN_ENFORCEBANS 0x0002 /* kick people who match channel bans */
144 #define CHAN_DYNAMICBANS 0x0004 /* only activate bans when needed */
145 #define CHAN_NOUSERBANS 0x0008 /* don't let non-bots place bans */
146 #define CHAN_OPONJOIN 0x0010 /* op +o people as soon as they join */
147 #define CHAN_BITCH 0x0020 /* be a tightwad with ops */
148 #define CHAN_GREET 0x0040 /* greet people with their info line */
149 #define CHAN_PROTECTOPS 0x0080 /* re-op any +o people who get deop'd */
150 #define CHAN_LOGSTATUS 0x0100 /* log channel status every 5 mins */
151 #define CHAN_STOPNETHACK 0x0200 /* deop netsplit hackers */
152 #define CHAN_REVENGE 0x0400 /* get revenge on bad people */
153 #define CHAN_SECRET 0x0800 /* don't advertise channel on botnet */
154 #define CHAN_AUTOVOICE 0x1000 /* dish out voice stuff automatically */
155 #define CHAN_CYCLE 0x2000 /* cycle the channel if possible */
156 #define CHAN_DONTKICKOPS 0x4000 /* never kick +o flag people - arthur2 */
157 #define CHAN_WASOPTEST 0x8000 /* wasop test for all +o user
158 * when +stopnethack */
159 #define CHAN_INACTIVE 0x10000 /* no irc support for this channel - drummer */
160 #define CHAN_ACTIVE 0x1000000 /* like i'm actually on the channel
161 * and stuff */
162 #define CHAN_PEND 0x2000000 /* just joined; waiting for end of
163 * WHO list */
164 #define CHAN_FLAGGED 0x4000000 /* flagged during rehash for delete */
165 #define CHAN_STATIC 0x8000000 /* channels that are NOT dynamic */
166 #define CHAN_SHARED 0x10000000 /* channel is being shared */
167 #define CHAN_ASKEDBANS 0x20000000
168 #define CHAN_SEEN 0x40000000
169
170 #define CHAN_ASKED_EXEMPTS 0x0001
171 #define CHAN_ASKED_INVITED 0x0002
172
173 /* prototypes */
174 memberlist *ismember(struct chanset_t *, char *);
175 struct chanset_t *findchan();
176
177 /* is this channel +s/+p? */
178 #define channel_hidden(chan) (chan->channel.mode & (CHANPRIV | CHANSEC))
179 /* is this channel +t? */
180 #define channel_optopic(chan) (chan->channel.mode & CHANTOPIC)
181 #define channel_active(chan) (chan->status & CHAN_ACTIVE)
182 #define channel_pending(chan) (chan->status & CHAN_PEND)
183 #define channel_bitch(chan) (chan->status & CHAN_BITCH)
184 #define channel_autoop(chan) (chan->status & CHAN_OPONJOIN)
185 #define channel_wasoptest(chan) (chan->status & CHAN_WASOPTEST)
186 #define channel_autovoice(chan) (chan->status & CHAN_AUTOVOICE)
187 #define channel_greet(chan) (chan->status & CHAN_GREET)
188 #define channel_logstatus(chan) (chan->status & CHAN_LOGSTATUS)
189 #define channel_clearbans(chan) (chan->status & CHAN_CLEARBANS)
190 #define channel_enforcebans(chan) (chan->status & CHAN_ENFORCEBANS)
191 #define channel_revenge(chan) (chan->status & CHAN_REVENGE)
192 #define channel_dynamicbans(chan) (chan->status & CHAN_DYNAMICBANS)
193 #define channel_nouserbans(chan) (chan->status & CHAN_NOUSERBANS)
194 #define channel_protectops(chan) (chan->status & CHAN_PROTECTOPS)
195 #define channel_dontkickops(chan) (chan->status & CHAN_DONTKICKOPS)
196 #define channel_stopnethack(chan) (chan->status & CHAN_STOPNETHACK)
197 #define channel_secret(chan) (chan->status & CHAN_SECRET)
198 #define channel_shared(chan) (chan->status & CHAN_SHARED)
199 #define channel_static(chan) (chan->status & CHAN_STATIC)
200 #define channel_cycle(chan) (chan->status & CHAN_CYCLE)
201 #define channel_seen(chan) (chan->status & CHAN_SEEN)
202 #define channel_inactive(chan) (chan->status & CHAN_INACTIVE)
203
204 struct server_list {
205 struct server_list *next;
206 char *name;
207 int port;
208 char *pass;
209 char *realname;
210 };
211
212 struct msgq_head {
213 struct msgq *head;
214 struct msgq *last;
215 int tot;
216 int warned;
217 };
218
219 /* used to queue a lot of things */
220 struct msgq {
221 struct msgq *next;
222 int len;
223 char *msg;
224 };
225
226 #endif

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23