/* include file that all modules must use (except mem.c) */ /* attempt to restart the bot automagically on crashing? */ /* this seems to RARELY work -- try a crontab instead (see 'botchk') */ #undef REBOOT /* 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 /* maximum number of dcc connections you will allow */ #define MAXDCC 30 /* 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 /* undefine this if your system chokes on "rename()" commands */ #define RENAME /*************************************************************************/ /* hp machines use non-standard 'signal' and have no true random functions */ #ifdef HPUX #define sigvec signal #define srandom(x) srand(x) #define random() (rand()/16) #endif /* linux machines are too stupid to know standard signal operations: */ #ifdef LINUX #define sigvec sigaction #define sv_mask sa_mask #define sv_flags sa_flags #define sv_handler sa_handler #endif #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 /* 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; 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 */ 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 */ char *inp; /* input line for telnet connections */ }; #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 */ }; #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]; unsigned long length; unsigned long sent; char buf[4]; /* 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; int type; unsigned int pid; int x; /* differentiates for relay */ }; #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_BLIND 32 /* blinded from receiving party-line talk */ #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 us */ #define STAT_OFFERED 8 /* offered them 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 them about unleaflike behavior */ #define USER_OP 1 /* o bot will op the user */ #define USER_DEOP 2 /* d bot makes sure user never gets op */ #define USER_BAN 4 /* b user is banned */ #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_IGNORE 128 /* i user ignored */ #define USER_TANDEM 256 /* t user is a tandem eggdrop-bot */ #define USER_PARTY 512 /* p user has party line access */ #define USER_PURGE 16384 /* equivalents for +t bots */ #define BOT_SHARE 512 /* s bot shares user files */ #define BOT_AUTO 1024 /* a make automatic connection */ #define BOT_LEAF 2048 /* l may not link other bots */ #define BOT_REJECT 4096 /* r automatically reject anywhere */ /* 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_ALL 255 /* (dump to all logfiles) */