1 /* chanserv.h - Channel service bot
2 * Copyright 2000-2004 srvx Development Team
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version. Important limitations are
8 * listed in the COPYING file that accompanies this software.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, email srvx-maintainers@srvx.net.
28 UL_PRESENT = UL_MASTER,
53 #define CHANNEL_NODELETE 0x00000001 /* (1 << 0) */
54 #define CHANNEL_SUSPENDED 0x00000002 /* (1 << 1) */
55 #define CHANNEL_INFO_LINES 0x00000004 /* (1 << 2) */
56 #define CHANNEL_VOICE_ALL 0x00000008 /* (1 << 3) */
57 /* No longer used. */ /* (1 << 4) */
58 #define CHANNEL_DYNAMIC_LIMIT 0x00000020 /* (1 << 5) */
59 #define CHANNEL_TOPIC_SNARF 0x00000040 /* (1 << 6) */
60 #define CHANNEL_PEON_INVITE 0x00000080 /* (1 << 7) */
61 /* Flags with values over 0x20000000 or (1 << 29) will not work
62 * because chanData.flags is a 30-bit field.
65 #define IsProtected(x) ((x)->flags & CHANNEL_NODELETE)
66 #define IsSuspended(x) ((x)->flags & CHANNEL_SUSPENDED)
70 struct chanNode *channel;
71 struct mod_chanmode modes;
83 unsigned int flags : 30;
84 unsigned int may_opchan : 1;
86 unsigned int last_refresh;
87 unsigned short banCount;
88 unsigned short userCount;
89 unsigned short lvlOpts[NUM_LEVEL_OPTIONS];
90 unsigned char chOpts[NUM_CHAR_OPTIONS];
92 struct userData *users;
95 struct suspended *suspended;
96 struct chanData *prev;
97 struct chanData *next;
100 #define USER_AUTO_OP 0x00000001
101 #define USER_SUSPENDED 0x00000002
102 #define USER_AUTO_INVITE 0x00000004
103 #define USER_FLAGS_SIZE 7
105 #define IsUserAutoOp(USER) (!((USER)->flags & USER_AUTO_OP))
106 #define IsUserSuspended(USER) ((USER)->flags & USER_SUSPENDED)
107 #define IsUserAutoInvite(USER) ((USER)->flags & USER_AUTO_INVITE)
111 struct handle_info *handle;
112 struct chanData *channel;
116 unsigned short access;
117 unsigned int present : 1;
118 unsigned int flags : USER_FLAGS_SIZE;
120 /* linked list of userDatas for a chanData */
121 struct userData *prev;
122 struct userData *next;
123 /* linked list of userDatas for a handle_info */
124 struct userData *u_prev;
125 struct userData *u_next;
130 char mask[NICKLEN + USERLEN + HOSTLEN + 3];
131 char owner[NICKLEN+1];
132 struct chanData *channel;
140 struct banData *prev;
141 struct banData *next;
146 struct chanData *cData;
149 time_t issued, expires, revoked;
150 struct suspended *previous;
153 struct do_not_register
155 char chan_name[CHANNELLEN+1];
156 char setter[NICKSERV_HANDLE_LEN+1];
161 void init_chanserv(const char *nick);
162 void del_channel_user(struct userData *user, int do_gc);
163 struct channelList *chanserv_support_channels(void);
164 unsigned short user_level_from_name(const char *name, unsigned short clamp_level);
165 struct do_not_register *chanserv_is_dnr(const char *chan_name, struct handle_info *handle);
166 int check_user_level(struct chanNode *channel, struct userNode *user, enum levelOption opt, int allow_override, int exempt_owner);