1 /* 2 * flags.h 3 */ 4 /* 5 * Copyright (C) 1997 Robey Pointer 6 * Copyright (C) 1999 - 2021 Eggheads Development Team 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 */ 22 23 #ifndef _EGG_FLAGS_H 24 #define _EGG_FLAGS_H 25 26 struct flag_record { 27 int match; 28 int global; 29 int udef_global; 30 intptr_t bot; 31 int chan; 32 int udef_chan; 33 }; 34 35 #define FR_GLOBAL 0x00000001 36 #define FR_BOT 0x00000002 37 #define FR_CHAN 0x00000004 38 #define FR_OR 0x40000000 39 #define FR_AND 0x20000000 40 #define FR_ANYWH 0x10000000 41 #define FR_ALL 0x0fffffff 42 43 /* 44 * userflags: 45 * abcdefgh?jklmnopqr?tuvwxyz + user defined A-Z 46 * unused letters: is 47 * 48 * botflags: 49 * abcde?ghij?l?n?p?rs?u0123456789 50 * unused letters: fkmoqt 51 * unusable letters: vwxyz 52 * 53 * chanflags: 54 * a??defg???klmno?qrs??vw?yz + user defined A-Z 55 * unused letters: bchijptux (s from bot flags) 56 */ 57 #define USER_VALID 0x003fbfeff /* Sum of all valid USER_ flags */ 58 #define CHAN_VALID 0x003677c79 /* Sum of all valid CHAN_ flags */ 59 #define BOT_VALID 0x07ff6abdf /* Sum of all valid BOT_ flags */ 60 61 62 #define USER_AUTOOP 0x00000001 /* a auto-op */ 63 #define USER_BOT 0x00000002 /* b user is a bot */ 64 #define USER_COMMON 0x00000004 /* c user is actually a public site */ 65 #define USER_DEOP 0x00000008 /* d user is global de-op */ 66 #define USER_EXEMPT 0x00000010 /* e exempted from stopnethack */ 67 #define USER_FRIEND 0x00000020 /* f user is global friend */ 68 #define USER_GVOICE 0x00000040 /* g auto-voice */ 69 #define USER_HIGHLITE 0x00000080 /* h highlighting (bold) */ 70 #define USER_I 0x00000100 /* i unused */ 71 #define USER_JANITOR 0x00000200 /* j user is file area master */ 72 #define USER_KICK 0x00000400 /* k user is global auto-kick */ 73 #define USER_HALFOP 0x00000800 /* l user is +h on all channels */ 74 #define USER_MASTER 0x00001000 /* m user has full bot access */ 75 #define USER_OWNER 0x00002000 /* n user is the bot owner */ 76 #define USER_OP 0x00004000 /* o user is +o on all channels */ 77 #define USER_PARTY 0x00008000 /* p user has party line access */ 78 #define USER_QUIET 0x00010000 /* q user is global de-voice */ 79 #define USER_DEHALFOP 0x00020000 /* r user is global de-halfop */ 80 #define USER_S 0x00040000 /* s unused */ 81 #define USER_BOTMAST 0x00080000 /* t user is botnet master */ 82 #define USER_UNSHARED 0x00100000 /* u not shared with sharebots */ 83 #define USER_VOICE 0x00200000 /* v user is +v on all channels */ 84 #define USER_WASOPTEST 0x00400000 /* w wasop test needed for stopnethack */ 85 #define USER_XFER 0x00800000 /* x user has file area access */ 86 #define USER_AUTOHALFOP 0x01000000 /* y auto-halfop */ 87 #define USER_WASHALFOPTEST 0x02000000 /* z washalfop test needed for stopnethack */ 88 #define USER_DEFAULT 0x40000000 /* use default-flags */ 89 90 /* Flags specifically for bots */ 91 #define BOT_ALT 0x00000001 /* a auto-link here if all hubs fail */ 92 #define BOT_SHBAN 0x00000002 /* b can share bans */ 93 #define BOT_SHCHAN 0x00000004 /* c can share channel changes */ 94 #define BOT_SHLIMITED 0x00000008 /* d shares userfiles but can't share anything */ 95 #define BOT_SHEXEMPT 0x00000010 /* e can share exempts */ 96 #define BOT_F 0x00000020 /* f unused */ 97 #define BOT_GLOBAL 0x00000040 /* g all channel are shared */ 98 #define BOT_HUB 0x00000080 /* h auto-link to ONE of these bots */ 99 #define BOT_ISOLATE 0x00000100 /* i isolate party line from botnet */ 100 #define BOT_SHINV 0x00000200 /* j can share invites */ 101 #define BOT_K 0x00000400 /* k unused */ 102 #define BOT_LEAF 0x00000800 /* l may not link other bots */ 103 #define BOT_M 0x00001000 /* m unused */ 104 #define BOT_SHIGN 0x00002000 /* n can share ignores */ 105 #define BOT_O 0x00004000 /* o unused */ 106 #define BOT_PASSIVE 0x00008000 /* p share passively with this bot */ 107 #define BOT_Q 0x00010000 /* q unused */ 108 #define BOT_REJECT 0x00020000 /* r automatically reject anywhere */ 109 #define BOT_AGGRESSIVE 0x00040000 /* s shares userfiles and can share all */ 110 #define BOT_T 0x00080000 /* t unused */ 111 #define BOT_SHUSER 0x00100000 /* u can share user changes */ 112 /* BOT_V to BOT_Z not usable as they're bitflags 32-36 */ 113 #define BOT_FLAG0 0x00200000 /* 0 user-defined flag #0 */ 114 #define BOT_FLAG1 0x00400000 /* 1 user-defined flag #1 */ 115 #define BOT_FLAG2 0x00800000 /* 2 user-defined flag #2 */ 116 #define BOT_FLAG3 0x01000000 /* 3 user-defined flag #3 */ 117 #define BOT_FLAG4 0x02000000 /* 4 user-defined flag #4 */ 118 #define BOT_FLAG5 0x04000000 /* 5 user-defined flag #5 */ 119 #define BOT_FLAG6 0x08000000 /* 6 user-defined flag #6 */ 120 #define BOT_FLAG7 0x10000000 /* 7 user-defined flag #7 */ 121 #define BOT_FLAG8 0x20000000 /* 8 user-defined flag #8 */ 122 #define BOT_FLAG9 0x40000000 /* 9 user-defined flag #9 */ 123 /* BOT_S still shares everything for backward compat, but if removed to share more precisely, 124 we need those detailed flags to still indicate the bot shares */ 125 #define BOT_SHPERMS (BOT_SHBAN|BOT_SHCHAN|BOT_SHEXEMPT|BOT_SHIGN|BOT_SHINV|BOT_SHUSER|BOT_SHLIMITED) 126 #define BOT_SHARE (BOT_AGGRESSIVE|BOT_PASSIVE|BOT_SHPERMS) 127 128 /* When adding more here, also add messages in cmds.c attr_inform */ 129 /* Bot flag checking message ID's */ 130 #define BOT_SANE_ALTOWNSHUB 0x00000001 131 #define BOT_SANE_HUBOWNSALT 0x00000002 132 #define BOT_SANE_OWNSALTHUB 0x00000004 133 #define BOT_SANE_SHPOWNSAGGR 0x00000008 134 #define BOT_SANE_AGGROWNSSHP 0x00000010 135 #define BOT_SANE_OWNSSHPAGGR 0x00000020 136 #define BOT_SANE_SHPOWNSPASS 0x00000040 137 #define BOT_SANE_PASSOWNSSHP 0x00000080 138 #define BOT_SANE_OWNSSHPPASS 0x00000100 139 #define BOT_SANE_SHAREOWNSREJ 0x00000200 140 #define BOT_SANE_REJOWNSSHARE 0x00000400 141 #define BOT_SANE_OWNSSHAREREJ 0x00000800 142 #define BOT_SANE_HUBOWNSREJ 0x00001000 143 #define BOT_SANE_REJOWNSHUB 0x00002000 144 #define BOT_SANE_OWNSHUBREJ 0x00004000 145 #define BOT_SANE_ALTOWNSREJ 0x00008000 146 #define BOT_SANE_REJOWNSALT 0x00010000 147 #define BOT_SANE_OWNSALTREJ 0x00020000 148 #define BOT_SANE_AGGROWNSPASS 0x00040000 149 #define BOT_SANE_PASSOWNSAGGR 0x00080000 150 #define BOT_SANE_OWNSAGGRPASS 0x00100000 151 #define BOT_SANE_NOSHAREOWNSGLOB 0x00200000 152 #define BOT_SANE_OWNSGLOB 0x00400000 153 /* User/Chan flag checking message ID's */ 154 #define UC_SANE_DEOPOWNSOP 0x00000001 155 #define UC_SANE_OPOWNSDEOP 0x00000002 156 #define UC_SANE_OWNSDEOPOP 0x00000004 157 #define UC_SANE_DEHALFOPOWNSHALFOP 0x00000008 158 #define UC_SANE_HALFOPOWNSDEHALFOP 0x00000010 159 #define UC_SANE_OWNSDEHALFOPHALFOP 0x00000020 160 #define UC_SANE_DEOPOWNSAUTOOP 0x00000040 161 #define UC_SANE_AUTOOPOWNSDEOP 0x00000080 162 #define UC_SANE_OWNSDEOPAUTOOP 0x00000100 163 #define UC_SANE_DEHALFOPOWNSAHALFOP 0x00000200 164 #define UC_SANE_AHALFOPOWNSDEHALFOP 0x00000400 165 #define UC_SANE_OWNSDEHALFOPAHALFOP 0x00000800 166 #define UC_SANE_QUIETOWNSVOICE 0x00001000 167 #define UC_SANE_VOICEOWNSQUIET 0x00002000 168 #define UC_SANE_OWNSQUIETVOICE 0x00004000 169 #define UC_SANE_QUIETOWNSGVOICE 0x00008000 170 #define UC_SANE_GVOICEOWNSQUIET 0x00010000 171 #define UC_SANE_OWNSQUIETGVOICE 0x00020000 172 #define UC_SANE_OWNERADDSMASTER 0x00040000 173 #define UC_SANE_MASTERADDSOP 0x00080000 174 #define UC_SANE_OPADDSHALFOP 0x00100000 175 #define UC_SANE_NOBOTOWNSAGGR 0x00200000 176 #define UC_SANE_BOTOWNSPARTY 0x00400000 177 #define UC_SANE_BOTOWNSMASTER 0x00800000 178 #define UC_SANE_BOTOWNSCOMMON 0x01000000 179 #define UC_SANE_BOTOWNSOWNER 0x02000000 180 #define UC_SANE_MASTERADDSBOTMOPJAN 0x04000000 181 #define UC_SANE_BOTMASTADDSPARTY 0x08000000 182 #define UC_SANE_JANADDSXFER 0x10000000 183 #define UC_SANE_AUTOOPADDSOP 0x20000000 184 #define UC_SANE_AUTOHALFOPADDSHALFOP 0x40000000 185 #define UC_SANE_GVOICEADDSVOICE 0x80000000 186 187 /* Flag checking macros */ 188 #define chan_op(x) ((x).chan & USER_OP) 189 #define glob_op(x) ((x).global & USER_OP) 190 #define chan_halfop(x) ((x).chan & USER_HALFOP) 191 #define glob_halfop(x) ((x).global & USER_HALFOP) 192 #define chan_deop(x) ((x).chan & USER_DEOP) 193 #define glob_deop(x) ((x).global & USER_DEOP) 194 #define chan_dehalfop(x) ((x).chan & USER_DEHALFOP) 195 #define glob_dehalfop(x) ((x).global & USER_DEHALFOP) 196 #define glob_master(x) ((x).global & USER_MASTER) 197 #define glob_bot(x) ((x).global & USER_BOT) 198 #define glob_owner(x) ((x).global & USER_OWNER) 199 #define chan_master(x) ((x).chan & USER_MASTER) 200 #define chan_owner(x) ((x).chan & USER_OWNER) 201 #define chan_autoop(x) ((x).chan & USER_AUTOOP) 202 #define glob_autoop(x) ((x).global & USER_AUTOOP) 203 #define chan_autohalfop(x) ((x).chan & USER_AUTOHALFOP) 204 #define glob_autohalfop(x) ((x).global & USER_AUTOHALFOP) 205 #define chan_gvoice(x) ((x).chan & USER_GVOICE) 206 #define glob_gvoice(x) ((x).global & USER_GVOICE) 207 #define chan_kick(x) ((x).chan & USER_KICK) 208 #define glob_kick(x) ((x).global & USER_KICK) 209 #define chan_voice(x) ((x).chan & USER_VOICE) 210 #define glob_voice(x) ((x).global & USER_VOICE) 211 #define chan_wasoptest(x) ((x).chan & USER_WASOPTEST) 212 #define glob_wasoptest(x) ((x).global & USER_WASOPTEST) 213 #define chan_washalfoptest(x) ((x).chan & USER_WASHALFOPTEST) 214 #define glob_washalfoptest(x) ((x).global & USER_WASHALFOPTEST) 215 #define chan_quiet(x) ((x).chan & USER_QUIET) 216 #define glob_quiet(x) ((x).global & USER_QUIET) 217 #define chan_friend(x) ((x).chan & USER_FRIEND) 218 #define glob_friend(x) ((x).global & USER_FRIEND) 219 #define glob_botmast(x) ((x).global & USER_BOTMAST) 220 #define glob_party(x) ((x).global & USER_PARTY) 221 #define glob_xfer(x) ((x).global & USER_XFER) 222 #define glob_hilite(x) ((x).global & USER_HIGHLITE) 223 #define chan_exempt(x) ((x).chan & USER_EXEMPT) 224 #define glob_exempt(x) ((x).global & USER_EXEMPT) 225 226 #define bot_global(x) ((x).bot & BOT_GLOBAL) 227 #define bot_chan(x) ((x).chan & BOT_AGGRESSIVE) 228 #define bot_shared(x) ((x).bot & BOT_SHARE) 229 230 231 #ifndef MAKING_MODS 232 233 void get_user_flagrec(struct userrec *, struct flag_record *, const char *); 234 void set_user_flagrec(struct userrec *, struct flag_record *, const char *); 235 void break_down_flags(const char *, struct flag_record *, struct flag_record *); 236 int build_flags(char *, struct flag_record *, struct flag_record *); 237 int flagrec_eq(struct flag_record *, struct flag_record *); 238 int flagrec_ok(struct flag_record *, struct flag_record *); 239 int sanity_check(int); 240 int user_sanity_check(int * const, int const, int const); 241 int bot_sanity_check(intptr_t * const, intptr_t const, intptr_t const); 242 int chan_sanity_check(int * const, int const, int const, int const); 243 char geticon(int); 244 245 #endif /* MAKING_MODS */ 246 247 #endif /* _EGG_FLAGS_H */ 248