1 /* chanserv.h - Channel service bot
2 * Copyright 2000-2004 srvx Development Team
4 * This file is part of srvx.
6 * srvx is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
30 UL_PRESENT = UL_MASTER,
59 #define CHANNEL_NODELETE 0x00000001 /* (1 << 0) */
60 #define CHANNEL_SUSPENDED 0x00000002 /* (1 << 1) */
61 #define CHANNEL_INFO_LINES 0x00000004 /* (1 << 2) - DEPRECATED */
62 #define CHANNEL_VOICE_ALL 0x00000008 /* (1 << 3) - DEPRECATED */
63 /* No longer used. */ /* (1 << 4) */
64 #define CHANNEL_DYNAMIC_LIMIT 0x00000020 /* (1 << 5) */
65 #define CHANNEL_TOPIC_SNARF 0x00000040 /* (1 << 6) - DEPRECATED */
66 #define CHANNEL_PEON_INVITE 0x00000080 /* (1 << 7) - DEPRECATED */
67 #define CHANNEL_OFFCHANNEL 0x00000100 /* (1 << 8) */
68 /* Flags with values over 0x20000000 or (1 << 29) will not work
69 * because chanData.flags is a 30-bit field.
72 #define IsProtected(x) ((x)->flags & CHANNEL_NODELETE)
73 #define IsSuspended(x) ((x)->flags & CHANNEL_SUSPENDED)
74 #define IsOffChannel(x) ((x)->flags & CHANNEL_OFFCHANNEL)
78 struct chanNode *channel;
79 struct mod_chanmode modes;
92 unsigned int flags : 30;
93 unsigned int may_opchan : 1;
95 unsigned int last_refresh;
96 unsigned short banCount;
97 unsigned short userCount;
98 unsigned short lvlOpts[NUM_LEVEL_OPTIONS];
99 unsigned char chOpts[NUM_CHAR_OPTIONS];
101 struct userData *users;
102 struct banData *bans;
104 struct suspended *suspended;
105 struct chanData *prev;
106 struct chanData *next;
109 #define USER_AUTO_OP 0x00000001
110 #define USER_SUSPENDED 0x00000002
111 #define USER_AUTO_INVITE 0x00000004
112 #define USER_FLAGS_SIZE 7
114 #define IsUserAutoOp(USER) (!((USER)->flags & USER_AUTO_OP))
115 #define IsUserSuspended(USER) ((USER)->flags & USER_SUSPENDED)
116 #define IsUserAutoInvite(USER) ((USER)->flags & USER_AUTO_INVITE)
120 struct handle_info *handle;
121 struct chanData *channel;
125 unsigned short access;
126 unsigned int present : 1;
127 unsigned int flags : USER_FLAGS_SIZE;
129 /* linked list of userDatas for a chanData */
130 struct userData *prev;
131 struct userData *next;
132 /* linked list of userDatas for a handle_info */
133 struct userData *u_prev;
134 struct userData *u_next;
139 char mask[NICKLEN + USERLEN + HOSTLEN + 3];
140 char owner[NICKLEN+1];
141 struct chanData *channel;
149 struct banData *prev;
150 struct banData *next;
155 struct chanData *cData;
158 time_t issued, expires, revoked;
159 struct suspended *previous;
162 struct do_not_register
164 char chan_name[CHANNELLEN+1];
165 char setter[NICKSERV_HANDLE_LEN+1];
170 void init_chanserv(const char *nick);
171 void del_channel_user(struct userData *user, int do_gc);
172 struct channelList *chanserv_support_channels(void);
173 unsigned short user_level_from_name(const char *name, unsigned short clamp_level);
174 struct do_not_register *chanserv_is_dnr(const char *chan_name, struct handle_info *handle);
175 int check_user_level(struct chanNode *channel, struct userNode *user, enum levelOption opt, int allow_override, int exempt_owner);