00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _EGG_CHAN_H
00028 #define _EGG_CHAN_H
00029
00030
00031 #define CHANMETA "#&!+"
00032
00033
00034
00035 #define NOHALFOPS_MODES "ahoq"
00036
00037
00038 #undef NO_HALFOP_CHANMODES
00039
00040
00041 #define MODES_PER_LINE_MAX 6
00042
00043 #define HALFOP_CANTDOMODE(_a) (!me_op(chan) && (!me_halfop(chan) || (strchr(NOHALFOPS_MODES, _a) != NULL)))
00044 #define HALFOP_CANDOMODE(_a) (me_op(chan) || (me_halfop(chan) && (strchr(NOHALFOPS_MODES, _a) == NULL)))
00045
00046 typedef struct memstruct {
00047 char nick[NICKLEN];
00048 char userhost[UHOSTLEN];
00049 time_t joined;
00050 unsigned long flags;
00051 time_t split;
00052 time_t last;
00053 time_t delay;
00054 struct userrec *user;
00055 int tried_getuser;
00056 struct memstruct *next;
00057 } memberlist;
00058
00059 #define CHANOP 0x00001
00060 #define CHANVOICE 0x00002
00061 #define FAKEOP 0x00004
00062 #define SENTOP 0x00008
00063 #define SENTDEOP 0x00010
00064 #define SENTKICK 0x00020
00065 #define SENTVOICE 0x00040
00066 #define SENTDEVOICE 0x00080
00067 #define WASOP 0x00100
00068 #define STOPWHO 0x00200
00069 #define FULL_DELAY 0x00400
00070 #define STOPCHECK 0x00800
00071 #define CHANHALFOP 0x01000
00072 #define FAKEHALFOP 0x02000
00073 #define SENTHALFOP 0x04000
00074 #define SENTDEHALFOP 0x08000
00075 #define WASHALFOP 0x10000
00076 #define WHO_SYNCED 0x20000
00077
00078 #define chan_hasvoice(x) (x->flags & CHANVOICE)
00079 #define chan_hasop(x) (x->flags & CHANOP)
00080 #define chan_hashalfop(x) (x->flags & CHANHALFOP)
00081 #define chan_fakeop(x) (x->flags & FAKEOP)
00082 #define chan_fakehalfop(x) (x->flags & FAKEHALFOP)
00083 #define chan_sentop(x) (x->flags & SENTOP)
00084 #define chan_sentdeop(x) (x->flags & SENTDEOP)
00085 #define chan_senthalfop(x) (x->flags & SENTHALFOP)
00086 #define chan_sentdehalfop(x) (x->flags & SENTDEHALFOP)
00087 #define chan_sentkick(x) (x->flags & SENTKICK)
00088 #define chan_sentvoice(x) (x->flags & SENTVOICE)
00089 #define chan_sentdevoice(x) (x->flags & SENTDEVOICE)
00090 #define chan_issplit(x) (x->split > 0)
00091 #define chan_wasop(x) (x->flags & WASOP)
00092 #define chan_washalfop(x) (x->flags & WASHALFOP)
00093 #define chan_stopcheck(x) (x->flags & STOPCHECK)
00094 #define chan_whosynced(x) (x->flags & WHO_SYNCED)
00095
00096
00097
00098
00099 typedef struct maskstruct {
00100 char *mask;
00101 char *who;
00102 time_t timer;
00103 struct maskstruct *next;
00104 } masklist;
00105
00106
00107 typedef struct maskrec {
00108 struct maskrec *next;
00109 char *mask,
00110 *desc,
00111 *user;
00112 time_t expire,
00113 added,
00114 lastactive;
00115 int flags;
00116 } maskrec;
00117 extern maskrec *global_bans, *global_exempts, *global_invites;
00118
00119 #define MASKREC_STICKY 1
00120 #define MASKREC_PERM 2
00121
00122
00123 struct chan_t {
00124 memberlist *member;
00125 masklist *ban;
00126 masklist *exempt;
00127 masklist *invite;
00128 char *topic;
00129 char *key;
00130 unsigned int mode;
00131 int maxmembers;
00132 int members;
00133 };
00134
00135 #define CHANINV 0x0001
00136 #define CHANPRIV 0x0002
00137 #define CHANSEC 0x0004
00138 #define CHANMODER 0x0008
00139 #define CHANTOPIC 0x0010
00140 #define CHANNOMSG 0x0020
00141 #define CHANLIMIT 0x0040
00142 #define CHANKEY 0x0080
00143 #define CHANANON 0x0100
00144 #define CHANQUIET 0x0200
00145 #define CHANNOCLR 0x0400
00146 #define CHANREGON 0x0800
00147 #define CHANMODREG 0x1000
00148 #define CHANNOCTCP 0x2000
00149 #define CHANLONLY 0x4000
00150 #define CHANDELJN 0x8000
00151 #define CHANSTRIP 0x10000
00152 #define CHANNONOTC 0x20000
00153 #define CHANINVIS 0x40000
00154 #define CHANNOAMSG 0x80000
00155
00156 struct chanset_t {
00157 struct chanset_t *next;
00158 struct chan_t channel;
00159 char dname[81];
00160 char name[81];
00161
00162 char need_op[121];
00163 char need_key[121];
00164 char need_limit[121];
00165 char need_unban[121];
00166 char need_invite[121];
00167 int flood_pub_thr;
00168 int flood_pub_time;
00169 int flood_join_thr;
00170 int flood_join_time;
00171 int flood_deop_thr;
00172 int flood_deop_time;
00173 int flood_kick_thr;
00174 int flood_kick_time;
00175 int flood_ctcp_thr;
00176 int flood_ctcp_time;
00177 int flood_nick_thr;
00178 int flood_nick_time;
00179 int aop_min;
00180 int aop_max;
00181 long status;
00182 int ircnet_status;
00183 int idle_kick;
00184 int stopnethack_mode;
00185 int revenge_mode;
00186 int ban_type;
00187 int ban_time;
00188 int invite_time;
00189 int exempt_time;
00190 maskrec *bans,
00191 *exempts,
00192 *invites;
00193 int mode_pls_prot;
00194 int mode_mns_prot;
00195 int limit_prot;
00196 char key_prot[121];
00197 char pls[21];
00198 char mns[21];
00199 char *key;
00200 char *rmkey;
00201 int limit;
00202 int bytes;
00203 int compat;
00204 struct {
00205 char *op;
00206 int type;
00207 } cmode[MODES_PER_LINE_MAX];
00208 char floodwho[FLOOD_CHAN_MAX][81];
00209 time_t floodtime[FLOOD_CHAN_MAX];
00210 int floodnum[FLOOD_CHAN_MAX];
00211 char deopd[NICKLEN];
00212 };
00213
00214 #define CHAN_ENFORCEBANS 0x0001
00215 #define CHAN_DYNAMICBANS 0x0002
00216 #define CHAN_NOUSERBANS 0x0004
00217 #define CHAN_OPONJOIN 0x0008
00218 #define CHAN_BITCH 0x0010
00219 #define CHAN_GREET 0x0020
00220 #define CHAN_PROTECTOPS 0x0040
00221 #define CHAN_LOGSTATUS 0x0080
00222 #define CHAN_REVENGE 0x0100
00223 #define CHAN_SECRET 0x0200
00224 #define CHAN_AUTOVOICE 0x0400
00225 #define CHAN_CYCLE 0x0800
00226 #define CHAN_DONTKICKOPS 0x1000
00227 #define CHAN_INACTIVE 0x2000
00228 #define CHAN_PROTECTFRIENDS 0x4000
00229 #define CHAN_SHARED 0x8000
00230 #define CHAN_SEEN 0x10000
00231 #define CHAN_REVENGEBOT 0x20000
00232 #define CHAN_NODESYNCH 0x40000
00233 #define CHAN_AUTOHALFOP 0x80000
00234 #define CHAN_PROTECTHALFOPS 0x100000
00235 #define CHAN_ACTIVE 0x200000
00236
00237 #define CHAN_WHINED 0x1000000
00238 #define CHAN_PEND 0x2000000
00239 #define CHAN_FLAGGED 0x4000000
00240 #define CHAN_STATIC 0x8000000
00241 #define CHAN_ASKEDBANS 0x10000000
00242 #define CHAN_ASKEDMODES 0x20000000
00243 #define CHAN_JUPED 0x40000000
00244 #define CHAN_STOP_CYCLE 0x80000000
00245
00246 #define CHAN_ASKED_EXEMPTS 0x0001
00247 #define CHAN_ASKED_INVITED 0x0002
00248
00249 #define CHAN_DYNAMICEXEMPTS 0x0004
00250 #define CHAN_NOUSEREXEMPTS 0x0008
00251 #define CHAN_DYNAMICINVITES 0x0010
00252 #define CHAN_NOUSERINVITES 0x0020
00253
00254
00255 memberlist *ismember(struct chanset_t *, char *);
00256 struct chanset_t *findchan(const char *name);
00257 struct chanset_t *findchan_by_dname(const char *name);
00258
00259 #define channel_hidden(chan) (chan->channel.mode & (CHANPRIV | CHANSEC))
00260 #define channel_optopic(chan) (chan->channel.mode & CHANTOPIC)
00261 #define channel_djoins(chan) (chan->status & (CHANDELJN | CHANINVIS))
00262
00263 #define channel_active(chan) (chan->status & CHAN_ACTIVE)
00264 #define channel_pending(chan) (chan->status & CHAN_PEND)
00265 #define channel_bitch(chan) (chan->status & CHAN_BITCH)
00266 #define channel_nodesynch(chan) (chan->status & CHAN_NODESYNCH)
00267 #define channel_autoop(chan) (chan->status & CHAN_OPONJOIN)
00268 #define channel_autovoice(chan) (chan->status & CHAN_AUTOVOICE)
00269 #define channel_autohalfop(chan) (chan->status & CHAN_AUTOHALFOP)
00270 #define channel_greet(chan) (chan->status & CHAN_GREET)
00271 #define channel_logstatus(chan) (chan->status & CHAN_LOGSTATUS)
00272 #define channel_enforcebans(chan) (chan->status & CHAN_ENFORCEBANS)
00273 #define channel_revenge(chan) (chan->status & CHAN_REVENGE)
00274 #define channel_dynamicbans(chan) (chan->status & CHAN_DYNAMICBANS)
00275 #define channel_nouserbans(chan) (chan->status & CHAN_NOUSERBANS)
00276 #define channel_protectops(chan) (chan->status & CHAN_PROTECTOPS)
00277 #define channel_protecthalfops(chan) (chan->status & CHAN_PROTECTHALFOPS)
00278 #define channel_protectfriends(chan) (chan->status & CHAN_PROTECTFRIENDS)
00279 #define channel_dontkickops(chan) (chan->status & CHAN_DONTKICKOPS)
00280 #define channel_secret(chan) (chan->status & CHAN_SECRET)
00281 #define channel_shared(chan) (chan->status & CHAN_SHARED)
00282 #define channel_static(chan) (chan->status & CHAN_STATIC)
00283 #define channel_cycle(chan) (chan->status & CHAN_CYCLE)
00284 #define channel_seen(chan) (chan->status & CHAN_SEEN)
00285 #define channel_inactive(chan) (chan->status & CHAN_INACTIVE)
00286 #define channel_revengebot(chan) (chan->status & CHAN_REVENGEBOT)
00287 #define channel_dynamicexempts(chan) (chan->ircnet_status & CHAN_DYNAMICEXEMPTS)
00288 #define channel_nouserexempts(chan) (chan->ircnet_status & CHAN_NOUSEREXEMPTS)
00289 #define channel_dynamicinvites(chan) (chan->ircnet_status & CHAN_DYNAMICINVITES)
00290 #define channel_nouserinvites(chan) (chan->ircnet_status & CHAN_NOUSERINVITES)
00291 #define channel_juped(chan) (chan->status & CHAN_JUPED)
00292 #define channel_stop_cycle(chan) (chan->status & CHAN_STOP_CYCLE)
00293 #define channel_whined(chan) (chan->status & CHAN_WHINED)
00294
00295 struct msgq_head {
00296 struct msgq *head;
00297 struct msgq *last;
00298 int tot;
00299 int warned;
00300 };
00301
00302
00303 struct msgq {
00304 struct msgq *next;
00305 int len;
00306 char *msg;
00307 };
00308
00309 #endif