eggdrop.h 3.6 KB

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