eggdrop.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. #define MAX_SOCKETS 300
  26. /* Handy string lengths */
  27. #define SALT1LEN 32
  28. #define SALT2LEN 16
  29. #define MAXPASSLEN 15
  30. #define PACKNAMELEN 32
  31. #define UHOSTMAX 291 + NICKMAX /* 32 (ident) + 3 (\0, !, @) + NICKMAX */
  32. #define DIRMAX 1024 /* paranoia */
  33. #define BADHANDCHARS "-,+*=:!.@#;$%&"
  34. #define MAX_BOTS 500
  35. #define SERVLEN 60
  36. #define RESULT_LEN 1024
  37. /*
  38. * The 'configure' script should make this next part automatic,
  39. * so you shouldn't need to adjust anything below.
  40. */
  41. #define NICKLEN NICKMAX + 1
  42. #define UHOSTLEN UHOSTMAX + 1
  43. #define DIRLEN DIRMAX + 1
  44. #define NOTENAMELEN ((HANDLEN << 1) + 1)
  45. #define BADPASSCHARS "-+"
  46. #define LISTSEPERATORS ",=:; "
  47. #define BADREPEATEDRAND "*"
  48. #define RANDSPECIAL "#*+,-./;<=>?[]^_{}|"
  49. #define RANDSPECIALLEN 19
  50. #define ESCAPESHELL "`\\|#*()[]& "
  51. #if (NICKMAX < 9) || (NICKMAX > 32)
  52. # include "invalid NICKMAX value"
  53. #endif
  54. #if (HANDLEN < 9) || (HANDLEN > 32)
  55. # include "invalid HANDLEN value"
  56. #endif
  57. #if HANDLEN > NICKMAX
  58. # include "HANDLEN MUST BE <= NICKMAX"
  59. #endif
  60. /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
  61. * Use 255 if we can't find anything else.
  62. */
  63. #ifndef NAME_MAX
  64. # ifdef MAXNAMLEN
  65. # define NAME_MAX MAXNAMLEN
  66. # else
  67. # define NAME_MAX 255
  68. # endif
  69. #endif
  70. /* Almost every module needs some sort of time thingy, so... */
  71. #if TIME_WITH_SYS_TIME
  72. # include <sys/time.h>
  73. # include <time.h>
  74. #else
  75. # if HAVE_SYS_TIME_H
  76. # include <sys/time.h>
  77. # else
  78. # include <time.h>
  79. # endif
  80. #endif
  81. #if !HAVE_SRANDOM
  82. # define srandom(x) srand(x)
  83. #endif
  84. #if !HAVE_RANDOM
  85. # define random() (rand()/16)
  86. #endif
  87. /* Use high-order bits for getting the random integer. With random()
  88. * modulo would probably be sufficient but on systems lacking random(),
  89. * the function will be just renamed rand().
  90. */
  91. //#define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * n)
  92. #define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * ((signed) (n) < 0 ? (signed) (-(n)) : (signed) (n)))
  93. /***********************************************************************/
  94. enum { /* TAKE A GUESS */
  95. OK,
  96. ERROR
  97. };
  98. /* chan & global */
  99. #define FLOOD_PRIVMSG 0
  100. #define FLOOD_NOTICE 1
  101. #define FLOOD_CTCP 2
  102. #define FLOOD_NICK 3
  103. #define FLOOD_JOIN 4
  104. #define FLOOD_KICK 5
  105. #define FLOOD_DEOP 6
  106. #define FLOOD_PART 7
  107. #define FLOOD_CHAN_MAX 8
  108. #define FLOOD_GLOBAL_MAX 3
  109. #define FEATURE_NO_TAKE BIT0
  110. #define FEATURE_NO_MDOP BIT1
  111. #define HAVE_TAKE (!(conf.features & FEATURE_NO_TAKE))
  112. #define HAVE_MDOP (!(conf.features & FEATURE_NO_MDOP))
  113. #define HUB BIT0
  114. #define LEAF BIT1
  115. #define AUTH BIT2
  116. #define AUTH_CHAN BIT3
  117. #define AUTH_MSG BIT4
  118. #define AUTH_NOT BIT5
  119. #define AUTH_ALL AUTH|AUTH_CHAN|AUTH_MSG|AUTH_NOT
  120. #define have_cmd(name, flags) ((!is_restricted_cmd(name)) && (!(flags & (HUB|LEAF)) || (flags & HUB && conf.bot->hub) || (flags & LEAF && !conf.bot->hub)))
  121. #endif /* _EGG_EGGDROP_H */