eggdrop.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 32 /* 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 RELEASE_TIME 8
  51. #define ESCAPESHELL "`\\|#*()[]& "
  52. #if (NICKMAX < 9) || (NICKMAX > 32)
  53. # include "invalid NICKMAX value"
  54. #endif
  55. #if (HANDLEN < 9) || (HANDLEN > 32)
  56. # include "invalid HANDLEN value"
  57. #endif
  58. #if HANDLEN > NICKMAX
  59. # include "HANDLEN MUST BE <= NICKMAX"
  60. #endif
  61. /* NAME_MAX is what POSIX defines, but BSD calls it MAXNAMLEN.
  62. * Use 255 if we can't find anything else.
  63. */
  64. #ifndef NAME_MAX
  65. # ifdef MAXNAMLEN
  66. # define NAME_MAX MAXNAMLEN
  67. # else
  68. # define NAME_MAX 255
  69. # endif
  70. #endif
  71. /* Almost every module needs some sort of time thingy, so... */
  72. #if TIME_WITH_SYS_TIME
  73. # include <sys/time.h>
  74. # include <time.h>
  75. #else
  76. # if HAVE_SYS_TIME_H
  77. # include <sys/time.h>
  78. # else
  79. # include <time.h>
  80. # endif
  81. #endif
  82. #if !HAVE_SRANDOM
  83. # define srandom(x) srand(x)
  84. #endif
  85. #if !HAVE_RANDOM
  86. # define random() (rand()/16)
  87. #endif
  88. /* Use high-order bits for getting the random integer. With random()
  89. * modulo would probably be sufficient but on systems lacking random(),
  90. * the function will be just renamed rand().
  91. */
  92. //#define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * n)
  93. #define randint(n) (unsigned long) (random() / (RANDOM_MAX + 1.0) * ((signed) (n) < 0 ? (signed) (-(n)) : (signed) (n)))
  94. /***********************************************************************/
  95. enum { /* TAKE A GUESS */
  96. OK,
  97. ERROR
  98. };
  99. /* chan & global */
  100. #define FLOOD_PRIVMSG 0
  101. #define FLOOD_NOTICE 1
  102. #define FLOOD_CTCP 2
  103. #define FLOOD_NICK 3
  104. #define FLOOD_JOIN 4
  105. #define FLOOD_KICK 5
  106. #define FLOOD_DEOP 6
  107. #define FLOOD_PART 7
  108. #define FLOOD_CHAN_MAX 8
  109. #define FLOOD_GLOBAL_MAX 3
  110. #define FEATURE_1 BIT0
  111. #define FEATURE_2 BIT1
  112. #define HAVE_F1 ((conf.features & FEATURE_1))
  113. #define HAVE_F2 ((conf.features & FEATURE_2))
  114. #define HAVE_TAKE (1)
  115. #define HAVE_MDOP (1)
  116. #define HUB BIT0
  117. #define LEAF BIT1
  118. #define AUTH BIT2
  119. #define AUTH_CHAN BIT3
  120. #define AUTH_MSG BIT4
  121. #define AUTH_NOT BIT5
  122. #define AUTH_ALL (AUTH|AUTH_CHAN|AUTH_MSG|AUTH_NOT)
  123. #define have_cmd(name, flags) ((!is_restricted_cmd(name)) && (!(flags & (HUB|LEAF)) || (flags & HUB && conf.bot->hub) || (flags & LEAF && !conf.bot->hub)))
  124. #endif /* _EGG_EGGDROP_H */