flags.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * flags.h
  3. *
  4. */
  5. #ifndef _EGG_FLAGS_H
  6. #define _EGG_FLAGS_H
  7. struct flag_record {
  8. int match;
  9. int global;
  10. int udef_global;
  11. int bot;
  12. int chan;
  13. int udef_chan;
  14. };
  15. #define FR_GLOBAL 0x00000001
  16. #define FR_BOT 0x00000002
  17. #define FR_CHAN 0x00000004
  18. #define FR_OR 0x40000000
  19. #define FR_AND 0x20000000
  20. #define FR_ANYWH 0x10000000
  21. #define FR_ALL 0x0fffffff
  22. /*
  23. * userflags:
  24. * abcdefgh?jklmnopqr?tuvwxy?
  25. * + user defined A-Z
  26. * unused letters: isz
  27. *
  28. * botflags:
  29. * 0123456789ab????ghi??l???p?rs???????
  30. * unused letters: cdefjkmnoqtuvwxyz
  31. *
  32. * chanflags:
  33. * a??defg???klmno?qr??uv?xyz
  34. * + user defined A-Z
  35. * unused letters: bchijpstw
  36. */
  37. #define ROLE_KICK_MDOP (role)
  38. #define ROLE_KICK_MEAN (role)
  39. #define DEFLAG_BADCOOKIE 1
  40. #define DEFLAG_MANUALOP 2
  41. #ifdef G_MEAN
  42. #define DEFLAG_MEAN_DEOP 3
  43. #define DEFLAG_MEAN_KICK 4
  44. #define DEFLAG_MEAN_BAN 5
  45. #endif
  46. #define DEFLAG_MDOP 6
  47. //#define USER_VALID 0x03fbfeff /* all USER_ flags in use */
  48. //#define CHAN_VALID 0x03777c79 /* all flags that can be chan specific */
  49. #define USER_VALID 0x03ffffff
  50. #define CHAN_VALID 0x03ffffff
  51. #define BOT_VALID 0x7fe689C1 /* all BOT_ flags in use */
  52. #define USER_ADMIN 0x00000001 /* a user is an admin */
  53. #define USER_BOT 0x00000002 /* b user is a bot */
  54. #define USER_CHANHUB 0x00000004 /* c bot is a chanhub */
  55. #define USER_DEOP 0x00000008 /* d user is global de-op */
  56. #define USER_EXEMPT 0x00000010 /* e exempted from stopnethack */
  57. #define USER_FRIEND 0x00000020 /* f user is global friend */
  58. #define USER_G 0x00000040 /* g unused */
  59. #define USER_H 0x00000080 /* h unused */
  60. #define USER_HUBA 0x00000100 /* i access to HUBS/SECHUBS(+s) */
  61. #define USER_CHUBA 0x00000200 /* j access to CHANHUBS(+c) */
  62. #define USER_KICK 0x00000400 /* k user is global auto-kick */
  63. #define USER_DOLIMIT 0x00000800 /* l bot sets limit on channel(s) */
  64. #define USER_MASTER 0x00001000 /* m user has full bot access */
  65. #define USER_OWNER 0x00002000 /* n user is the bot owner */
  66. #define USER_OP 0x00004000 /* o user is +o on all channels */
  67. #define USER_PARTY 0x00008000 /* p user can CHAT on partyline:*needs (+i or +j) */
  68. #define USER_QUIET 0x00010000 /* q user is global de-voice */
  69. #define USER_R 0x00020000 /* r unused */
  70. #define USER_SECHUB 0x00040000 /* s bot is a sechub */
  71. #define USER_T 0x00080000 /* t unused */
  72. #define USER_UPDATEHUB 0x00100000 /* u bot is the updatehub */
  73. #define USER_VOICE 0x00200000 /* v user is +v on all channels */
  74. #define USER_WASOPTEST 0x00400000 /* w wasop test needed for stopnethack */
  75. #define USER_NOFLOOD 0x00800000 /* x user is exempt from flood kicks */
  76. #define USER_DOVOICE 0x01000000 /* y bot gives voices */
  77. #define USER_UNSHARED 0x02000000 /* z not shared with sharebots */
  78. #define USER_DEFAULT 0x40000000 /* use default-flags */
  79. #define bot_hublevel(x) ( ( (x) && (x->flags & USER_BOT) && (get_user(&USERENTRY_BOTADDR, x)) ) ? \
  80. ( ((struct bot_addr *) get_user(&USERENTRY_BOTADDR, x))->hublevel ? \
  81. ((struct bot_addr *) get_user(&USERENTRY_BOTADDR, x))->hublevel : 999) \
  82. : 999)
  83. /* Flags specifically for bots
  84. */
  85. #define BOT_A 0x00000001 /* a unused */
  86. #define BOT_BOT 0x00000002 /* b sanity bot flag */
  87. #define BOT_C 0x00000004 /* c unused */
  88. #define BOT_D 0x00000008 /* d unused */
  89. #define BOT_E 0x00000010 /* e unused */
  90. #define BOT_F 0x00000020 /* f unused */
  91. #define BOT_GLOBAL 0x00000040 /* g all channel are shared */
  92. #define BOT_HUB 0x00000080 /* h auto-link to ONE of these
  93. bots */
  94. #define BOT_ISOLATE 0x00000100 /* i isolate party line from
  95. botnet */
  96. #define BOT_J 0x00000200 /* j unused */
  97. #define BOT_K 0x00000400 /* k unused */
  98. #define BOT_LEAF 0x00000800 /* l may not link other bots */
  99. #define BOT_M 0x00001000 /* m unused */
  100. #define BOT_N 0x00002000 /* n unused */
  101. #define BOT_O 0x00004000 /* o unused */
  102. #define BOT_PASSIVE 0x00008000 /* p share passively with this
  103. bot */
  104. #define BOT_Q 0x00010000 /* q unused */
  105. #define BOT_REJECT 0x00020000 /* r automatically reject
  106. anywhere */
  107. #define BOT_AGGRESSIVE 0x00040000 /* s bot shares user files */
  108. #define BOT_T 0x00080000 /* t unused */
  109. #define BOT_U 0x00100000 /* u unused */
  110. #define BOT_V 0x00200000 /* v unused */
  111. #define BOT_W 0x00400000 /* w unused */
  112. #define BOT_X 0x00800000 /* x unused */
  113. #define BOT_Y 0x01000000 /* y unused */
  114. #define BOT_Z 0x02000000 /* z unused */
  115. #define BOT_FLAG0 0x00200000 /* 0 user-defined flag #0 */
  116. #define BOT_FLAG1 0x00400000 /* 1 user-defined flag #1 */
  117. #define BOT_FLAG2 0x00800000 /* 2 user-defined flag #2 */
  118. #define BOT_FLAG3 0x01000000 /* 3 user-defined flag #3 */
  119. #define BOT_FLAG4 0x02000000 /* 4 user-defined flag #4 */
  120. #define BOT_FLAG5 0x04000000 /* 5 user-defined flag #5 */
  121. #define BOT_FLAG6 0x08000000 /* 6 user-defined flag #6 */
  122. #define BOT_FLAG7 0x10000000 /* 7 user-defined flag #7 */
  123. #define BOT_FLAG8 0x20000000 /* 8 user-defined flag #8 */
  124. #define BOT_FLAG9 0x40000000 /* 9 user-defined flag #9 */
  125. #define BOT_SHARE (BOT_AGGRESSIVE|BOT_PASSIVE)
  126. /* Flag checking macros
  127. */
  128. #define chan_op(x) ((x).chan & USER_OP)
  129. #define glob_op(x) ((x).global & USER_OP)
  130. #define chan_deop(x) ((x).chan & USER_DEOP)
  131. #define glob_deop(x) ((x).global & USER_DEOP)
  132. #define glob_master(x) ((x).global & USER_MASTER)
  133. #define glob_bot(x) ((x).global & USER_BOT)
  134. #define glob_owner(x) ((x).global & USER_OWNER)
  135. #define chan_master(x) ((x).chan & USER_MASTER)
  136. #define chan_owner(x) ((x).chan & USER_OWNER)
  137. #define chan_kick(x) ((x).chan & USER_KICK)
  138. #define glob_kick(x) ((x).global & USER_KICK)
  139. #define chan_voice(x) ((x).chan & USER_VOICE)
  140. #define glob_voice(x) ((x).global & USER_VOICE)
  141. #define chan_wasoptest(x) ((x).chan & USER_WASOPTEST)
  142. #define glob_wasoptest(x) ((x).global & USER_WASOPTEST)
  143. #define chan_quiet(x) ((x).chan & USER_QUIET)
  144. #define glob_quiet(x) ((x).global & USER_QUIET)
  145. #define chan_friend(x) ((x).chan & USER_FRIEND)
  146. #define glob_friend(x) ((x).global & USER_FRIEND)
  147. #define glob_party(x) ((x).global & USER_PARTY)
  148. #define glob_hilite(x) ((x).global & USER_HIGHLITE)
  149. #define chan_exempt(x) ((x).chan & USER_EXEMPT)
  150. #define glob_exempt(x) ((x).global & USER_EXEMPT)
  151. #define glob_admin(x) ((x).global & USER_ADMIN)
  152. #define glob_huba(x) ((x).global & USER_HUBA)
  153. #define glob_chuba(x) ((x).global & USER_CHUBA)
  154. #define glob_dolimit(x) ((x).global & USER_DOLIMIT)
  155. #define chan_dolimit(x) ((x).chan & USER_DOLIMIT)
  156. #define glob_dovoice(x) ((x).global & USER_DOVOICE)
  157. #define chan_dovoice(x) ((x).chan & USER_DOVOICE)
  158. #define glob_noflood(x) ((x).global & USER_NOFLOOD)
  159. #define chan_noflood(x) ((x).chan & USER_NOFLOOD)
  160. #define glob_chanhub(x) ((x).global & USER_CHANHUB)
  161. #define glob_sechub(x) ((x).global & USER_SECHUB)
  162. //#define bot_global(x) ((x).bot & BOT_GLOBAL)
  163. #define bot_global(x) (1)
  164. #define bot_chan(x) ((x).chan & BOT_AGGRESSIVE)
  165. #define bot_shared(x) ((x).bot & BOT_SHARE)
  166. #ifndef MAKING_MODS
  167. void get_user_flagrec(struct userrec *, struct flag_record *, const char *);
  168. void set_user_flagrec(struct userrec *, struct flag_record *, const char *);
  169. void break_down_flags(const char *, struct flag_record *, struct flag_record *);
  170. int build_flags(char *, struct flag_record *, struct flag_record *);
  171. int flagrec_eq(struct flag_record *, struct flag_record *);
  172. int flagrec_ok(struct flag_record *, struct flag_record *);
  173. int sanity_check(int);
  174. int chan_sanity_check(int, int);
  175. char geticon(int);
  176. #endif /* MAKING_MODS */
  177. #endif /* _EGG_FLAGS_H */