eggdrop.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * eggdrop.h
  3. * Eggdrop compile-time settings
  4. *
  5. * IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  6. *
  7. */
  8. #ifndef _EGG_EGGDROP_H
  9. #define _EGG_EGGDROP_H
  10. /*
  11. * HANDLEN note:
  12. * HANDLEN defines the maximum length a handle on the bot can be.
  13. * Standard (and minimum) is 9 characters long.
  14. *
  15. * Beware that using lengths over 9 chars is 'non-standard' and if
  16. * you wish to link to other bots, they _must_ both have the same
  17. * maximum handle length.
  18. *
  19. * NICKMAX note:
  20. * You should leave this at 32 characters and modify nick-len in the
  21. * configuration file instead.
  22. */
  23. #define HANDLEN 9 /* valid values 9->NICKMAX */
  24. #define NICKMAX 32 /* valid values HANDLEN->32 */
  25. /* Handy string lengths */
  26. #define SALT1LEN 32
  27. #define SALT2LEN 16
  28. #define MAXPASSLEN 15
  29. #define PACKNAMELEN 32
  30. #define UHOSTMAX 291 + NICKMAX /* 32 (ident) + 3 (\0, !, @) + NICKMAX */
  31. #define DIRMAX 1024 /* paranoia */
  32. #define BADHANDCHARS "-,+*=:!.@#;$%&"
  33. #define MAX_BOTS 500
  34. #define SERVLEN 60
  35. /*
  36. * The 'configure' script should make this next part automatic,
  37. * so you shouldn't need to adjust anything below.
  38. */
  39. #define NICKLEN NICKMAX + 1
  40. #define UHOSTLEN UHOSTMAX + 1
  41. #define DIRLEN DIRMAX + 1
  42. #define NOTENAMELEN ((HANDLEN << 1) + 1)
  43. #define BADPASSCHARS "-+"
  44. #define LISTSEPERATORS ",=:; "
  45. #define BADREPEATEDRAND "*"
  46. #define RANDSPECIAL "#*+,-./;<=>?[]^_{}|"
  47. #define RANDSPECIALLEN 19
  48. #if (NICKMAX < 9) || (NICKMAX > 32)
  49. # include "invalid NICKMAX value"
  50. #endif
  51. #if (HANDLEN < 9) || (HANDLEN > 32)
  52. # include "invalid HANDLEN value"
  53. #endif
  54. #if HANDLEN > NICKMAX
  55. # include "HANDLEN MUST BE <= NICKMAX"
  56. #endif
  57. /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
  58. * Use 255 if we can't find anything else.
  59. */
  60. #ifndef NAME_MAX
  61. # ifdef MAXNAMLEN
  62. # define NAME_MAX MAXNAMLEN
  63. # else
  64. # define NAME_MAX 255
  65. # endif
  66. #endif
  67. /* Almost every module needs some sort of time thingy, so... */
  68. #if TIME_WITH_SYS_TIME
  69. # include <sys/time.h>
  70. # include <time.h>
  71. #else
  72. # if HAVE_SYS_TIME_H
  73. # include <sys/time.h>
  74. # else
  75. # include <time.h>
  76. # endif
  77. #endif
  78. #if !HAVE_SRANDOM
  79. # define srandom(x) srand(x)
  80. #endif
  81. #if !HAVE_RANDOM
  82. # define random() (rand()/16)
  83. #endif
  84. /* Use high-order bits for getting the random integer. With random()
  85. * modulo would probably be sufficient but on systems lacking random(),
  86. * the function will be just renamed rand().
  87. */
  88. //#define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * n)
  89. #define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * ((signed) (n) < 0 ? (signed) (-(n)) : (signed) (n)))
  90. /***********************************************************************/
  91. enum { /* TAKE A GUESS */
  92. OK,
  93. ERROR
  94. };
  95. /* chan & global */
  96. #define FLOOD_PRIVMSG 0
  97. #define FLOOD_NOTICE 1
  98. #define FLOOD_CTCP 2
  99. #define FLOOD_NICK 3
  100. #define FLOOD_JOIN 4
  101. #define FLOOD_KICK 5
  102. #define FLOOD_DEOP 6
  103. #define FLOOD_CHAN_MAX 7
  104. #define FLOOD_GLOBAL_MAX 3
  105. #define HUB BIT0
  106. #define LEAF BIT1
  107. #define AUTH BIT2
  108. #define AUTH_CHAN BIT3
  109. #define AUTH_MSG BIT4
  110. #define AUTH_NOT BIT5
  111. #define AUTH_ALL AUTH|AUTH_CHAN|AUTH_MSG|AUTH_NOT
  112. #define have_cmd(flags) (!(flags & (HUB|LEAF)) || (flags & HUB && conf.bot->hub) || (flags & LEAF && !conf.bot->hub))
  113. #endif /* _EGG_EGGDROP_H */