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,
57 #define CHANNEL_NODELETE 0x00000001 /* (1 << 0) */
58 #define CHANNEL_SUSPENDED 0x00000002 /* (1 << 1) */
59 #define CHANNEL_INFO_LINES 0x00000004 /* (1 << 2) - DEPRECATED */
60 #define CHANNEL_VOICE_ALL 0x00000008 /* (1 << 3) - DEPRECATED */
61 /* No longer used. */ /* (1 << 4) */
62 #define CHANNEL_DYNAMIC_LIMIT 0x00000020 /* (1 << 5) */
63 #define CHANNEL_TOPIC_SNARF 0x00000040 /* (1 << 6) - DEPRECATED */
64 #define CHANNEL_PEON_INVITE 0x00000080 /* (1 << 7) - DEPRECATED */
65 /* Flags with values over 0x20000000 or (1 << 29) will not work
66 * because chanData.flags is a 30-bit field.
69 #define IsProtected(x) ((x)->flags & CHANNEL_NODELETE)
70 #define IsSuspended(x) ((x)->flags & CHANNEL_SUSPENDED)
74 struct chanNode *channel;
75 struct mod_chanmode modes;
87 unsigned int flags : 30;
88 unsigned int may_opchan : 1;
90 unsigned int last_refresh;
91 unsigned short banCount;
92 unsigned short userCount;
93 unsigned short lvlOpts[NUM_LEVEL_OPTIONS];
94 unsigned char chOpts[NUM_CHAR_OPTIONS];
96 struct userData *users;
99 struct suspended *suspended;
100 struct chanData *prev;
101 struct chanData *next;
104 #define USER_AUTO_OP 0x00000001
105 #define USER_SUSPENDED 0x00000002
106 #define USER_AUTO_INVITE 0x00000004
107 #define USER_FLAGS_SIZE 7
109 #define IsUserAutoOp(USER) (!((USER)->flags & USER_AUTO_OP))
110 #define IsUserSuspended(USER) ((USER)->flags & USER_SUSPENDED)
111 #define IsUserAutoInvite(USER) ((USER)->flags & USER_AUTO_INVITE)
115 struct handle_info *handle;
116 struct chanData *channel;
120 unsigned short access;
121 unsigned int present : 1;
122 unsigned int flags : USER_FLAGS_SIZE;
124 /* linked list of userDatas for a chanData */
125 struct userData *prev;
126 struct userData *next;
127 /* linked list of userDatas for a handle_info */
128 struct userData *u_prev;
129 struct userData *u_next;
134 char mask[NICKLEN + USERLEN + HOSTLEN + 3];
135 char owner[NICKLEN+1];
136 struct chanData *channel;
144 struct banData *prev;
145 struct banData *next;
150 struct chanData *cData;
153 time_t issued, expires, revoked;
154 struct suspended *previous;
157 struct do_not_register
159 char chan_name[CHANNELLEN+1];
160 char setter[NICKSERV_HANDLE_LEN+1];
165 void init_chanserv(const char *nick);
166 void del_channel_user(struct userData *user, int do_gc);
167 struct channelList *chanserv_support_channels(void);
168 unsigned short user_level_from_name(const char *name, unsigned short clamp_level);
169 struct do_not_register *chanserv_is_dnr(const char *chan_name, struct handle_info *handle);
170 int check_user_level(struct chanNode *channel, struct userNode *user, enum levelOption opt, int allow_override, int exempt_owner);