X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fchanserv.h;h=638a77f2777eb93582fb7852cdc73af509deaf49;hb=80d9ed728be4b02ac483f3339cbb184f6602d15b;hp=5a506d328215033253145ab4ec4271f70164c0dd;hpb=ad434d83855d3c7220729e66ac1a1faedc484377;p=srvx.git diff --git a/src/chanserv.h b/src/chanserv.h index 5a506d3..638a77f 100644 --- a/src/chanserv.h +++ b/src/chanserv.h @@ -1,11 +1,12 @@ /* chanserv.h - Channel service bot * Copyright 2000-2004 srvx Development Team * - * This program is free software; you can redistribute it and/or modify + * This file is part of srvx. + * + * srvx is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. Important limitations are - * listed in the COPYING file that accompanies this software. + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,7 +14,8 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, email srvx-maintainers@srvx.net. + * along with srvx; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _chanserv_h @@ -43,6 +45,7 @@ enum levelOption { lvlUserInfo, lvlInviteMe, lvlTopicSnarf, + lvlVote, NUM_LEVEL_OPTIONS }; @@ -54,51 +57,67 @@ enum charOption { NUM_CHAR_OPTIONS }; -#define CHANNEL_NODELETE 0x00000001 /* (1 << 0) */ -#define CHANNEL_SUSPENDED 0x00000002 /* (1 << 1) */ -#define CHANNEL_INFO_LINES 0x00000004 /* (1 << 2) - DEPRECATED */ -#define CHANNEL_VOICE_ALL 0x00000008 /* (1 << 3) - DEPRECATED */ +#define CHANNEL_NODELETE 0x00000001 /* (1 << 0) */ +#define CHANNEL_SUSPENDED 0x00000002 /* (1 << 1) */ +#define CHANNEL_INFO_LINES 0x00000004 /* (1 << 2) - DEPRECATED */ +#define CHANNEL_VOICE_ALL 0x00000008 /* (1 << 3) - DEPRECATED */ /* No longer used. */ /* (1 << 4) */ -#define CHANNEL_DYNAMIC_LIMIT 0x00000020 /* (1 << 5) */ -#define CHANNEL_TOPIC_SNARF 0x00000040 /* (1 << 6) - DEPRECATED */ +#define CHANNEL_DYNAMIC_LIMIT 0x00000020 /* (1 << 5) */ +#define CHANNEL_TOPIC_SNARF 0x00000040 /* (1 << 6) - DEPRECATED */ #define CHANNEL_PEON_INVITE 0x00000080 /* (1 << 7) - DEPRECATED */ +#define CHANNEL_OFFCHANNEL 0x00000100 /* (1 << 8) */ +#define CHANNEL_UNREVIEWED 0x00000200 /* (1 << 9) */ +#define CHANNEL_ADVTOPIC 0x00000400 /* (1 << 10) */ /* Flags with values over 0x20000000 or (1 << 29) will not work * because chanData.flags is a 30-bit field. */ -#define IsProtected(x) ((x)->flags & CHANNEL_NODELETE) -#define IsSuspended(x) ((x)->flags & CHANNEL_SUSPENDED) +#define IsProtected(x) ((x)->flags & CHANNEL_NODELETE) +#define IsSuspended(x) ((x)->flags & CHANNEL_SUSPENDED) +#define IsOffChannel(x) (((x)->flags & CHANNEL_OFFCHANNEL) && (off_channel > 1)) + +#define MAXADVTOPICENTRIES 9 struct chanData { - struct chanNode *channel; + struct chanNode *channel; struct mod_chanmode modes; - time_t registered; - time_t visited; - time_t limitAdjusted; + unsigned long registered; + unsigned long visited; + unsigned long limitAdjusted; + unsigned long ownerTransfer; + unsigned long expiry; + + char *topic; + char *greeting; + char *user_greeting; + char *registrar; + char *topic_mask; - char *topic; - char *greeting; - char *user_greeting; - char *registrar; - char *topic_mask; + char *vote; + unsigned int vote_start; + dict_t vote_options; - unsigned int flags : 30; + unsigned int flags : 30; unsigned int may_opchan : 1; unsigned int max; + unsigned int max_time; unsigned int last_refresh; unsigned short banCount; unsigned short userCount; unsigned short lvlOpts[NUM_LEVEL_OPTIONS]; unsigned char chOpts[NUM_CHAR_OPTIONS]; - struct userData *users; - struct banData *bans; + char *advtopic[MAXADVTOPICENTRIES]; + + struct userData *users; + struct banData *bans; struct dict *notes; - struct suspended *suspended; - struct chanData *prev; - struct chanData *next; + struct suspended *suspended; + struct giveownership *giveownership; + struct chanData *prev; + struct chanData *next; }; #define USER_AUTO_OP 0x00000001 @@ -112,18 +131,21 @@ struct chanData struct userData { - struct handle_info *handle; - struct chanData *channel; + struct handle_info *handle; + struct chanData *channel; - char *info; - time_t seen; + char *info; + unsigned long seen; unsigned short access; - unsigned int present : 1; + unsigned int present : 1; unsigned int flags : USER_FLAGS_SIZE; + unsigned short voted; + unsigned int votefor; + /* linked list of userDatas for a chanData */ - struct userData *prev; - struct userData *next; + struct userData *prev; + struct userData *next; /* linked list of userDatas for a handle_info */ struct userData *u_prev; struct userData *u_next; @@ -131,42 +153,73 @@ struct userData struct banData { - char mask[NICKLEN + USERLEN + HOSTLEN + 3]; - char owner[NICKLEN+1]; - struct chanData *channel; + char mask[NICKLEN + USERLEN + HOSTLEN + 3]; + char owner[NICKLEN+1]; + struct chanData *channel; - time_t set; - time_t triggered; - time_t expires; + unsigned long set; + unsigned long triggered; + unsigned long expires; - char *reason; + char *reason; - struct banData *prev; - struct banData *next; + struct banData *prev; + struct banData *next; }; struct suspended { - struct chanData *cData; - char *suspender; + struct chanData *cData; + char *suspender; char *reason; - time_t issued, expires, revoked; + unsigned long issued; + unsigned long expires; + unsigned long revoked; struct suspended *previous; }; +struct vote_option +{ + char *name; + unsigned int option_id; + char *option_str; + unsigned int voted; +}; + +struct giveownership +{ + char *staff_issuer; + + char *old_owner; + + char *target; + unsigned short target_access; + + time_t issued; + char *reason; + + struct giveownership *previous; +}; + struct do_not_register { char chan_name[CHANNELLEN+1]; char setter[NICKSERV_HANDLE_LEN+1]; - time_t set; + unsigned long set; + unsigned long expires; char reason[1]; }; +#define GetChannelUser(channel, handle) _GetChannelUser(channel, handle, 1, 0) +struct userData *_GetChannelUser(struct chanData *channel, struct handle_info *handle, int override, int allow_suspended); +struct banData *add_channel_ban(struct chanData *channel, const char *mask, char *owner, unsigned long set, unsigned long triggered, unsigned long expires, char *reason); void init_chanserv(const char *nick); void del_channel_user(struct userData *user, int do_gc); struct channelList *chanserv_support_channels(void); unsigned short user_level_from_name(const char *name, unsigned short clamp_level); struct do_not_register *chanserv_is_dnr(const char *chan_name, struct handle_info *handle); int check_user_level(struct chanNode *channel, struct userNode *user, enum levelOption opt, int allow_override, int exempt_owner); +struct mod_chanmode *find_matching_bans(struct banList *bans, struct userNode *actee, const char *mask); +void handle_new_channel_created(char *chan, struct userNode *user); #endif