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

Annotation of /eggdrop1.8/src/chan.h

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


Revision 1.1.1.1 - (hide annotations) (download) (as text) (vendor branch)
Mon Jul 26 21:11:06 2010 UTC (8 years, 9 months ago) by simple
Branch: eggheads, MAIN
CVS Tags: v1, HEAD
Branch point for: gettext
Changes since 1.1: +0 -0 lines
File MIME type: text/x-csrc
Imported Eggdrop 1.6.20

1 simple 1.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.50 2010/01/03 13:27:31 pseudo Exp $
7     */
8     /*
9     * Copyright (C) 1997 Robey Pointer
10     * Copyright (C) 1999 - 2010 Eggheads Development Team
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     /* Valid channel prefixes. */
31     #define CHANMETA "#&!+"
32    
33     /* Modes the bot cannot set as halfop. You can add +b, +e, and +I to this to
34     * prevent them from being set as halfop. */
35     #define NOHALFOPS_MODES "ahoq"
36    
37     /* Only send modes as op (b, e, and I excluded)? */
38     #undef NO_HALFOP_CHANMODES
39    
40     /* Hard limit of modes per line. */
41     #define MODES_PER_LINE_MAX 6
42    
43     #define HALFOP_CANTDOMODE(_a) (!me_op(chan) && (!me_halfop(chan) || (strchr(NOHALFOPS_MODES, _a) != NULL)))
44     #define HALFOP_CANDOMODE(_a) (me_op(chan) || (me_halfop(chan) && (strchr(NOHALFOPS_MODES, _a) == NULL)))
45    
46     typedef struct memstruct {
47     char nick[NICKLEN];
48     char userhost[UHOSTLEN];
49     time_t joined;
50     unsigned long flags;
51     time_t split; /* in case they were just netsplit */
52     time_t last; /* for measuring idle time */
53     time_t delay; /* for delayed autoop */
54     struct userrec *user;
55     int tried_getuser;
56     struct memstruct *next;
57     } memberlist;
58    
59     #define CHANOP 0x00001 /* channel +o */
60     #define CHANVOICE 0x00002 /* channel +v */
61     #define FAKEOP 0x00004 /* op'd by server */
62     #define SENTOP 0x00008 /* a mode +o was already sent out for this user */
63     #define SENTDEOP 0x00010 /* a mode -o was already sent out for this user */
64     #define SENTKICK 0x00020 /* a kick was already sent out for this user */
65     #define SENTVOICE 0x00040 /* a mode +v was already sent out for this user */
66     #define SENTDEVOICE 0x00080 /* a mode -v was already sent out for this user */
67     #define WASOP 0x00100 /* was an op before a split */
68     #define STOPWHO 0x00200
69     #define FULL_DELAY 0x00400
70     #define STOPCHECK 0x00800
71     #define CHANHALFOP 0x01000 /* channel +h */
72     #define FAKEHALFOP 0x02000 /* halfop'd by server */
73     #define SENTHALFOP 0x04000 /* a mode +h was already sent out for this user */
74     #define SENTDEHALFOP 0x08000 /* a mode -h was already sent out for this user */
75     #define WASHALFOP 0x10000 /* was a halfop before a split */
76     #define WHO_SYNCED 0x20000 /* who reply received for this member */
77    
78     #define chan_hasvoice(x) (x->flags & CHANVOICE)
79     #define chan_hasop(x) (x->flags & CHANOP)
80     #define chan_hashalfop(x) (x->flags & CHANHALFOP)
81     #define chan_fakeop(x) (x->flags & FAKEOP)
82     #define chan_fakehalfop(x) (x->flags & FAKEHALFOP)
83     #define chan_sentop(x) (x->flags & SENTOP)
84     #define chan_sentdeop(x) (x->flags & SENTDEOP)
85     #define chan_senthalfop(x) (x->flags & SENTHALFOP)
86     #define chan_sentdehalfop(x) (x->flags & SENTDEHALFOP)
87     #define chan_sentkick(x) (x->flags & SENTKICK)
88     #define chan_sentvoice(x) (x->flags & SENTVOICE)
89     #define chan_sentdevoice(x) (x->flags & SENTDEVOICE)
90     #define chan_issplit(x) (x->split > 0)
91     #define chan_wasop(x) (x->flags & WASOP)
92     #define chan_washalfop(x) (x->flags & WASHALFOP)
93     #define chan_stopcheck(x) (x->flags & STOPCHECK)
94     #define chan_whosynced(x) (x->flags & WHO_SYNCED)
95    
96     /* Why duplicate this struct for exempts and invites only under another
97     * name? <cybah>
98     */
99     typedef struct maskstruct {
100     char *mask;
101     char *who;
102     time_t timer;
103     struct maskstruct *next;
104     } masklist;
105    
106     /* Used for temporary bans, exempts and invites */
107     typedef struct maskrec {
108     struct maskrec *next;
109     char *mask,
110     *desc,
111     *user;
112     time_t expire,
113     added,
114     lastactive;
115     int flags;
116     } maskrec;
117     extern maskrec *global_bans, *global_exempts, *global_invites;
118    
119     #define MASKREC_STICKY 1
120     #define MASKREC_PERM 2
121    
122     /* For every channel i join */
123     struct chan_t {
124     memberlist *member;
125     masklist *ban;
126     masklist *exempt;
127     masklist *invite;
128     char *topic;
129     char *key;
130     unsigned int mode;
131     int maxmembers;
132     int members;
133     };
134    
135     #define CHANINV 0x0001 /* i */
136     #define CHANPRIV 0x0002 /* p */
137     #define CHANSEC 0x0004 /* s */
138     #define CHANMODER 0x0008 /* m */
139     #define CHANTOPIC 0x0010 /* t */
140     #define CHANNOMSG 0x0020 /* n */
141     #define CHANLIMIT 0x0040 /* l */
142     #define CHANKEY 0x0080 /* k */
143     #define CHANANON 0x0100 /* a - ircd 2.9 */
144     #define CHANQUIET 0x0200 /* q - ircd 2.9 */
145     #define CHANNOCLR 0x0400 /* c - Bahamut */
146     #define CHANREGON 0x0800 /* R - Bahamut */
147     #define CHANMODREG 0x1000 /* M - Bahamut */
148     #define CHANNOCTCP 0x2000 /* C - QuakeNet's ircu 2.10 */
149     #define CHANLONLY 0x4000 /* r - ircu 2.10.11 */
150     #define CHANDELJN 0x8000 /* D - QuakeNet's asuka */
151     #define CHANSTRIP 0x10000 /* u - QuakeNet's asuka */
152     #define CHANNONOTC 0x20000 /* N - QuakeNet's asuka */
153     #define CHANINVIS 0x40000 /* d - QuakeNet's asuka */
154     #define CHANNOAMSG 0x80000 /* T - QuakeNet's snircd */
155    
156     struct chanset_t {
157     struct chanset_t *next;
158     struct chan_t channel;
159     char dname[81]; /* display name (!eggdev) - THIS IS ALWAYS SET*/
160     char name[81]; /* actual name (!ABCDEeggdev) - THIS IS SET WHEN THE BOT
161     * ACTUALLY JOINS THE CHANNEL */
162     char need_op[121];
163     char need_key[121];
164     char need_limit[121];
165     char need_unban[121];
166     char need_invite[121];
167     int flood_pub_thr;
168     int flood_pub_time;
169     int flood_join_thr;
170     int flood_join_time;
171     int flood_deop_thr;
172     int flood_deop_time;
173     int flood_kick_thr;
174     int flood_kick_time;
175     int flood_ctcp_thr;
176     int flood_ctcp_time;
177     int flood_nick_thr;
178     int flood_nick_time;
179     int aop_min;
180     int aop_max;
181     long status;
182     int ircnet_status;
183     int idle_kick;
184     int stopnethack_mode;
185     int revenge_mode;
186     int ban_type;
187     int ban_time;
188     int invite_time;
189     int exempt_time;
190     maskrec *bans, /* temporary channel bans */
191     *exempts, /* temporary channel exempts */
192     *invites; /* temporary channel invites */
193     int mode_pls_prot; /* modes to enforce */
194     int mode_mns_prot; /* modes to reject */
195     int limit_prot; /* desired limit */
196     char key_prot[121]; /* desired password */
197     char pls[21]; /* positive mode changes */
198     char mns[21]; /* negative mode changes */
199     char *key; /* new key to set */
200     char *rmkey; /* old key to remove */
201     int limit; /* new limit to set */
202     int bytes; /* total bytes so far */
203     int compat; /* prevents mixing of old/new modes */
204     struct {
205     char *op;
206     int type;
207     } cmode[MODES_PER_LINE_MAX];
208     char floodwho[FLOOD_CHAN_MAX][81];
209     time_t floodtime[FLOOD_CHAN_MAX];
210     int floodnum[FLOOD_CHAN_MAX];
211     char deopd[NICKLEN]; /* last user deopped */
212     };
213    
214     #define CHAN_ENFORCEBANS 0x0001 /* +enforcebans */
215     #define CHAN_DYNAMICBANS 0x0002 /* +dynamicbans */
216     #define CHAN_NOUSERBANS 0x0004 /* -userbans */
217     #define CHAN_OPONJOIN 0x0008 /* +autoop */
218     #define CHAN_BITCH 0x0010 /* +bitch */
219     #define CHAN_GREET 0x0020 /* +greet */
220     #define CHAN_PROTECTOPS 0x0040 /* +protectops */
221     #define CHAN_LOGSTATUS 0x0080 /* +statuslog */
222     #define CHAN_REVENGE 0x0100 /* +revenge */
223     #define CHAN_SECRET 0x0200 /* +secret */
224     #define CHAN_AUTOVOICE 0x0400 /* +autovoice */
225     #define CHAN_CYCLE 0x0800 /* +cycle */
226     #define CHAN_DONTKICKOPS 0x1000 /* +dontkickops */
227     #define CHAN_INACTIVE 0x2000 /* +inactive */
228     #define CHAN_PROTECTFRIENDS 0x4000 /* +protectfriends */
229     #define CHAN_SHARED 0x8000 /* +shared */
230     #define CHAN_SEEN 0x10000 /* +seen */
231     #define CHAN_REVENGEBOT 0x20000 /* +revengebot */
232     #define CHAN_NODESYNCH 0x40000 /* +nodesynch */
233     #define CHAN_AUTOHALFOP 0x80000 /* +autohalfop */
234     #define CHAN_PROTECTHALFOPS 0x100000 /* +protecthalfops */
235     #define CHAN_ACTIVE 0x200000 /* -inactive */
236    
237     #define CHAN_WHINED 0x1000000 /* whined about opless channel */
238     #define CHAN_PEND 0x2000000 /* waiting for end of WHO list */
239     #define CHAN_FLAGGED 0x4000000 /* flagged for delete during rehash */
240     #define CHAN_STATIC 0x8000000 /* non-dynamic channel */
241     #define CHAN_ASKEDBANS 0x10000000
242     #define CHAN_ASKEDMODES 0x20000000 /* find out key-info on IRCu */
243     #define CHAN_JUPED 0x40000000 /* channel is juped */
244     #define CHAN_STOP_CYCLE 0x80000000 /* NO_CHANOPS_WHEN_SPLIT servers */
245    
246     #define CHAN_ASKED_EXEMPTS 0x0001
247     #define CHAN_ASKED_INVITED 0x0002
248    
249     #define CHAN_DYNAMICEXEMPTS 0x0004
250     #define CHAN_NOUSEREXEMPTS 0x0008
251     #define CHAN_DYNAMICINVITES 0x0010
252     #define CHAN_NOUSERINVITES 0x0020
253    
254     /* prototypes */
255     memberlist *ismember(struct chanset_t *, char *);
256     struct chanset_t *findchan(const char *name);
257     struct chanset_t *findchan_by_dname(const char *name);
258    
259     #define channel_hidden(chan) (chan->channel.mode & (CHANPRIV | CHANSEC)) /* +s or +p ? */
260     #define channel_optopic(chan) (chan->channel.mode & CHANTOPIC) /* +t? */
261     #define channel_djoins(chan) (chan->status & (CHANDELJN | CHANINVIS)) /* +Dd? */
262    
263     #define channel_active(chan) (chan->status & CHAN_ACTIVE)
264     #define channel_pending(chan) (chan->status & CHAN_PEND)
265     #define channel_bitch(chan) (chan->status & CHAN_BITCH)
266     #define channel_nodesynch(chan) (chan->status & CHAN_NODESYNCH)
267     #define channel_autoop(chan) (chan->status & CHAN_OPONJOIN)
268     #define channel_autovoice(chan) (chan->status & CHAN_AUTOVOICE)
269     #define channel_autohalfop(chan) (chan->status & CHAN_AUTOHALFOP)
270     #define channel_greet(chan) (chan->status & CHAN_GREET)
271     #define channel_logstatus(chan) (chan->status & CHAN_LOGSTATUS)
272     #define channel_enforcebans(chan) (chan->status & CHAN_ENFORCEBANS)
273     #define channel_revenge(chan) (chan->status & CHAN_REVENGE)
274     #define channel_dynamicbans(chan) (chan->status & CHAN_DYNAMICBANS)
275     #define channel_nouserbans(chan) (chan->status & CHAN_NOUSERBANS)
276     #define channel_protectops(chan) (chan->status & CHAN_PROTECTOPS)
277     #define channel_protecthalfops(chan) (chan->status & CHAN_PROTECTHALFOPS)
278     #define channel_protectfriends(chan) (chan->status & CHAN_PROTECTFRIENDS)
279     #define channel_dontkickops(chan) (chan->status & CHAN_DONTKICKOPS)
280     #define channel_secret(chan) (chan->status & CHAN_SECRET)
281     #define channel_shared(chan) (chan->status & CHAN_SHARED)
282     #define channel_static(chan) (chan->status & CHAN_STATIC)
283     #define channel_cycle(chan) (chan->status & CHAN_CYCLE)
284     #define channel_seen(chan) (chan->status & CHAN_SEEN)
285     #define channel_inactive(chan) (chan->status & CHAN_INACTIVE)
286     #define channel_revengebot(chan) (chan->status & CHAN_REVENGEBOT)
287     #define channel_dynamicexempts(chan) (chan->ircnet_status & CHAN_DYNAMICEXEMPTS)
288     #define channel_nouserexempts(chan) (chan->ircnet_status & CHAN_NOUSEREXEMPTS)
289     #define channel_dynamicinvites(chan) (chan->ircnet_status & CHAN_DYNAMICINVITES)
290     #define channel_nouserinvites(chan) (chan->ircnet_status & CHAN_NOUSERINVITES)
291     #define channel_juped(chan) (chan->status & CHAN_JUPED)
292     #define channel_stop_cycle(chan) (chan->status & CHAN_STOP_CYCLE)
293     #define channel_whined(chan) (chan->status & CHAN_WHINED)
294    
295     struct msgq_head {
296     struct msgq *head;
297     struct msgq *last;
298     int tot;
299     int warned;
300     };
301    
302     /* Used to queue a lot of things */
303     struct msgq {
304     struct msgq *next;
305     int len;
306     char *msg;
307     };
308    
309     #endif /* _EGG_CHAN_H */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23