/* * EGGDROP compile-time settings * * IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT. */ /* * Settings which toggle certain features of the bot to be enabled * or disabled -- use "#define" to enable and "#undef" to disable */ /* not connected to any server ("in limbo") -- this is currently */ /* still just barely supported */ #undef NO_IRC /* define this if you have problems with "zombie" processes */ #define HUNT_ZOMBIES /* if you want the bot to die when it receives the TERM or HUP */ /* signals, define this */ #undef DIE_ON_TERMHUP /* if you'd rather use an external editor (and it IS a wise idea), */ /* define it here -- the internal editor is crappy and currently only */ /* supports one user at a time, anyway */ #define EXT_EDITOR "/bin/red" /* red is a version of ed with the '!' command disabled, but isn't */ /* available on some linux systems :( */ /* add the 'exec' command (ie, give masters access to your shell)? */ #undef EXEC /* add the 'simul' command (masters can manipulate other people on */ /* the party line)? */ #undef SIMUL /* have a separate user level called "owner" (+n) which is above master */ /* and has exclusive use of chattr/die/edit/exec/set/tcl ? */ #define OWNER /* allow people from other bots (in your bot-net) to boot people off */ /* your bot's party line? */ #define REMOTE_BOOTS /* enable console mode 'r'? this mode shows every raw message from the */ /* server to people with console 'r' selected -- will take a bit more */ /* cpu. this also enables TCL bind 'raw' */ #undef USE_CONSOLE_R /* maximum number of dcc connections you will allow */ #define MAXDCC 40 /* maximum number of lines to queue to the server */ #define MAXQMSG 200 /* maximum number of tandem bots you will ever have in a chain */ #define MAXTAND 100 /* maximum number of logfiles to allow */ #define MAXLOGS 5 /* time (in seconds) to wait for someone to return from a netsplit */ #define WAIT_SPLIT 300 /* time (in seconds) that someone must have been off-channel before */ /* re-displaying their info */ #define WAIT_INFO 180 /* time (in seconds) that a dcc file transfer can remain inactive */ /* before being timed out */ #define WAIT_DCC_XFER 300 /**********************************************************************/ /***** THINGS TO TRY CHANGING IF YOU CAN'T GET EGGDROP TO COMPILE *****/ /**********************************************************************/ /* undefine this if your system chokes on "rename()" commands */ #define RENAME /* undefine this if you get errors with the "rusage()" function calls */ /* consequence: you won't get CPU time usage reports */ #define RUSAGE /* define this if your compiler stumbles on the "dirent" struct */ #undef USE_DIRECT_INSTEAD /* if your compiler can't find "dirent.h", try this: */ #undef NO_DIRENT_H /* if your compiler complains about signals, try this: */ #undef WEIRD_SIGNALS /* if your compiler doesn't have/need unistd.h, try this: */ #undef FORGET_UNISTD /* if your compiler seems to choke on the 'pid_t' stuff, define this: */ #undef CANT_DO_PID /***********************************************************************/ /***** I DON'T SEE ANY POINT IN EDITING ANYTHING BELOW THIS LINE *****/ /***********************************************************************/ #ifdef sun #define _POSIX_SOURCE #define USE_DIRECT_INSTEAD #endif #ifndef _POSIX_SOURCE #define NO_DIRENT_H #endif #ifndef _POSIX_SOURCE #ifndef sa_handler #ifndef LINUX #ifndef IRIX #ifndef BSD386 #define WEIRD_SIGNALS #endif #endif #endif #endif #endif #ifdef SVR4 #undef RUSAGE #undef WEIRD_SIGNALS #undef NO_DIRENT_H #define getdtablesize() OPEN_MAX #endif #ifdef IRIX #define USE_DIRECT_INSTEAD #endif /* hp-ux has no: getdtablesize, sigvec, srandom, getrusage, random */ #ifdef HPUX #undef RUSAGE #undef WEIRD_SIGNALS #define USE_DIRECT_INSTEAD #define getdtablesize() MAXDCC+10 #define srandom(x) srand(x) #define random() (rand()/16) #endif #ifdef WEIRD_SIGNALS #define sigaction sigvec #define sa_handler sv_handler #define sa_mask sv_mask #define sa_flags sv_flags /* and they probably won't have sigemptyset, dammit */ #define sigemptyset(x) ((*(int *)(x))=0) #endif #ifdef USE_DIRECT_INSTEAD #define dirent direct #endif /* figure out wait type */ #ifdef BSD386 #define WAIT_T int #endif #ifdef AIX #define WAIT_T int #endif #ifdef _POSIX_SOURCE #define WAIT_T int #endif #ifdef SVR4 #define WAIT_T int #endif #ifdef ULTRIX #define WAIT_T int #endif #ifndef WAIT_T #define WAIT_T union wait #endif #ifdef CANT_DO_PID #define pid_t int #endif /* handy aliases for memory tracking and core dumps */ #define nmalloc(x) n_malloc((x),__FILE__,__LINE__) #define nfree(x) n_free((x),__FILE__,__LINE__) #define context { strcpy(cx_file,__FILE__); cx_line=__LINE__; } #define malloc(x) dont_use_old_malloc(x) #define free(x) dont_use_old_free(x) #undef atol #define atol my_atol /* using the math library will cause 'log' to be a bit... wrong :) */ #define log my_log /***********************************************************************/ /* public structure of all the dcc connections */ struct dcc_t { int sock; unsigned long addr; unsigned int port; char nick[10]; char host[121]; unsigned char type; union { struct chat_info *chat; struct file_info *file; struct edit_info *edit; struct xfer_info *xfer; struct tand_info *tand; struct relay_info *relay; struct fork_info *fork; struct script_info *script; void *other; } u; /* special use depending on type */ }; /* standard chat modes */ #define DCC_CHAT 1 /* dcc-chat: command mode */ #define DCC_CHAT_PASS 2 /* receiving password for dcc chat */ #define DCC_TELNET_ID 7 /* telnetter identifying self */ #define DCC_TELNET_NEW 17 /* new user via telnet, giving nick */ #define DCC_TELNET_PW 18 /* new user via telnet, setting password */ struct chat_info { char *away; /* non-NULL if user is away */ unsigned long status; /* status flags */ time_t timer; /* last time the user typed something */ int msgs_per_sec; /* used to stop flooding */ int con_flags; /* with console: what to show */ int channel; /* 0=party line, -1=off */ }; #define DCC_TELNET 6 /* acceptor socket for telnet */ /* (no other info defined) */ #define DCC_FILES 8 /* file subsystem */ #define DCC_FILES_PASS 15 /* awaiting password, file subsystem */ struct file_info { struct chat_info *chat; char dir[121]; }; #define DCC_EDIT 9 /* editing a file (masters) */ struct edit_info { struct chat_info *chat; int lines,curlin; char filename[121]; /* other info needed for editing a file */ /* of course, i was too lazy to ever get around to using this */ }; #define DCC_SEND 3 /* receiving file */ #define DCC_GET 4 /* sending file */ #define DCC_GET_PENDING 5 /* waiting for connect to send file */ struct xfer_info { char filename[121]; char dir[121]; /* used when uploads go to the current dir */ unsigned long length; unsigned long sent; char buf[41]; /* temporary storage for byte counts */ unsigned char sofar; /* how much of the byte count received */ time_t pending; /* used to expire stale file offerings */ }; #define DCC_TANDEM 10 /* communication with a tandem-bot */ #define DCC_TANDEM_NEW 11 /* connecting to a tandem-bot... */ struct tand_info { unsigned long status; time_t timer; char version[121]; /* channel/version info */ void *user; /* when transferring userlist */ }; #define DCC_RELAY 12 /* relayed connection to a bot */ #define DCC_RELAYING 13 /* dcc chat user vanishing to relay connection */ struct relay_info { struct chat_info *chat; int sock; }; #define DCC_FORK 14 /* forked out to telnet */ struct fork_info { union { struct chat_info *chat; struct file_info *file; struct tand_info *tand; struct relay_info *relay; struct xfer_info *xfer; void *other; } u; unsigned char type; unsigned int pid; int x; /* differentiates for relay */ }; #define DCC_SCRIPT 19 /* dcc user in an interactive script */ struct script_info { unsigned char type; union { struct chat_info *chat; struct file_info *file; void *other; } u; char command[121]; }; #define DCC_LOST 16 /* lost in a child proess */ /* for dcc chat & files: */ #define STAT_UNUSED1 1 #define STAT_MASTER 2 /* is bot-master (full access) */ #define STAT_XFER 4 /* has 'x' flag on chat line */ #define STAT_CHAT 8 /* in file-system but may return */ #define STAT_TALK 16 /* using enhanced 'talk' script */ #define STAT_UNUSED3 32 #define STAT_TELNET 64 /* connected via telnet */ #define STAT_UNUSED2 128 #define STAT_PARTY 256 /* only on party line via 'p' flag */ /* for dcc tandem: */ #define STAT_PINGED 1 /* waiting for ping to return */ #define STAT_SHARE 2 /* sharing user data with the bot */ #define STAT_CALLED 4 /* this bot called me */ #define STAT_OFFERED 8 /* offered her the user file */ #define STAT_SENDING 16 /* in the process of sending a user list */ #define STAT_GETTING 32 /* in the process of getting a user list */ #define STAT_WARNED 64 /* warned him about unleaflike behavior */ #define STAT_LEAF 128 /* this bot is a leaf only */ #define USER_OP 1 /* o bot will op the user */ #define USER_DEOP 2 /* d bot makes sure user never gets op */ #define USER_OWNER 4 /* n user is the bot owner */ #define USER_KICK 8 /* k user is auto-kicked */ #define USER_MASTER 16 /* m user has full bot access */ #define USER_FRIEND 32 /* f user exempt from revenge */ #define USER_XFER 64 /* x user has file area access */ #define USER_UNDEF_1 128 #define USER_TANDEM 256 /* t user is a tandem eggdrop-bot */ #define USER_PARTY 512 /* p user has party line access */ #define USER_COMMON 1024 /* c user is actually a public irc site */ #define USER_FLAG1 2048 /* 1 user-defined flag #1 */ #define USER_FLAG2 4096 /* 2 user-defined flag #2 */ #define USER_FLAG3 8192 /* 3 user-defined flag #3 */ #define USER_FLAG4 16384 /* 4 user-defined flag #4 */ #define USER_FLAG5 32768 /* 5 user-defined flag #5 */ #define USER_PURGE 16777216 #define USER_MASK (USER_COMMON|USER_PARTY|USER_TANDEM|USER_UNDEF_1| \ USER_XFER|USER_FRIEND|USER_MASTER|USER_KICK| \ USER_OWNER|USER_DEOP|USER_OP|BOT_SHARE|BOT_AUTO| \ BOT_LEAF|BOT_REJECT) #ifndef OWNER #undef USER_OWNER #define USER_OWNER USER_MASTER #endif /* ???????P ????rlas 54321cpt ?xfmkndo */ /* (undef) (bots) (users) (users) */ /* flags specifically for bots */ #define BOT_SHARE 65536 /* s bot shares user files */ #define BOT_AUTO 131072 /* a make automatic connection */ #define BOT_LEAF 262144 /* l may not link other bots */ #define BOT_REJECT 524288 /* r automatically reject anywhere */ #define BOT_UNDEF_1 1048576 #define BOT_UNDEF_2 2097152 #define BOT_UNDEF_3 4194304 #define BOT_UNDEF_4 8388608 /* for detecting floods: */ #define _NICK 0 #define _PRIVMSG 1 #define _NOTICE 2 #define _CTCP 3 #define _JOIN 4 /* for local console: */ #define STDIN 0 #define STDOUT 1 #define STDERR 2 /* logfile display flags */ #define LOG_MSGS 1 /* m msgs/notice/ctcps */ #define LOG_PUBLIC 2 /* p public msg/notice/ctcps */ #define LOG_CHAN 4 /* j channel joins/parts/etc */ #define LOG_MODES 8 /* k mode changes/kicks/bans */ #define LOG_CMDS 16 /* c user dcc or msg commands */ #define LOG_MISC 32 /* o other misc bot things */ #define LOG_TAND 64 /* b tandembot notices */ #define LOG_RAW 128 /* r raw server stuff coming in */ #define LOG_FILES 256 /* x file transfer commands and stats */ #define LOG_ALL 511 /* (dump to all logfiles) */