From: Ari Johnson Date: Tue, 25 Nov 2008 21:43:05 +0000 (+0000) Subject: Make #undef USE_MAILER work X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=750da7b9194e4cabd70cf973e25cf9413c344f74;p=cobramush.git Make #undef USE_MAILER work --- diff --git a/hdrs/conf.h b/hdrs/conf.h index d8f0963..8408190 100644 --- a/hdrs/conf.h +++ b/hdrs/conf.h @@ -129,7 +129,9 @@ struct options_table { char output_db[256]; /**< Name of the output database file */ char flagdb[256]; /**player, "LASTACTIVITY", tbuf1, GOD, NOTHING); announce_disconnect(d->player); +#ifdef USE_MAILER do_mail_purge(d->player); +#endif if (MAX_LOGINS) { login_number--; if (!under_limit && (login_number < MAX_LOGINS)) { @@ -1510,7 +1512,9 @@ logout_sock(DESC *d) d->cmds = 0; d->hide = 0; d->doing[0] = '\0'; +#ifdef USE_MAILER d->mailp = NULL; +#endif d->pinfo.object = NOTHING; d->pinfo.atr = NULL; d->pinfo.lock = 0; @@ -1554,7 +1558,9 @@ shutdownsock(DESC *d) tbuf1[strlen(tbuf1)+1] = '\0'; (void) atr_add(d->player, "LASTACTIVITY", tbuf1, GOD, NOTHING); announce_disconnect(d->player); +#ifdef USE_MAILER do_mail_purge(d->player); +#endif } if (MAX_LOGINS) { login_number--; @@ -1597,7 +1603,9 @@ shutdownsock(DESC *d) d->cmds = 0; d->hide = 0; d->doing[0] = '\0'; +#ifdef USE_MAILER d->mailp = NULL; +#endif strncpy(d->addr, "localhost", 100); d->addr[99] = '\0'; strncpy(d->ip, "127.0.0.1", 100); @@ -1692,7 +1700,9 @@ initializesock(int s, char *addr, char *ip, int use_ssl d->cmds = 0; d->hide = 0; d->doing[0] = '\0'; +#ifdef USE_MAILER d->mailp = NULL; +#endif strncpy(d->addr, addr, 100); d->addr[99] = '\0'; strncpy(d->ip, ip, 100); @@ -2873,7 +2883,9 @@ dump_messages(DESC *d, dbref player, int isnew) return 0; } } +#ifdef USE_MAILER d->mailp = find_exact_starting_point(player); +#endif /* check to see if this is a reconnect and also set DARK status */ is_hidden = Can_Hide(player) && Dark(player); @@ -2900,9 +2912,11 @@ dump_messages(DESC *d, dbref player, int isnew) check_last(player, d->addr, d->ip); /* set Last, Lastsite, give paycheck */ /* Check folder 0, not silently (i.e. Report lack of mail, too) */ queue_eol(d); +#ifdef USE_MAILER if (command_check_byname(player, "@MAIL")) check_mail(player, 0, 0); set_player_folder(player, 0); +#endif do_look_around(player); if (Haven(player)) notify(player, T("Your HAVEN flag is set. You cannot receive pages.")); @@ -4805,6 +4819,8 @@ hidden(dbref player) } +#ifdef USE_MAILER + /** Return the mailp of the player closest in db# to player, * or NULL if there's nobody on-line. * In the current mail system, mail is stored in a linked list, sorted @@ -4867,6 +4883,7 @@ desc_mail_clear(void) } } +#endif /* USE_MAILER */ @@ -5251,7 +5268,9 @@ load_reboot_db(void) d->raw_input = NULL; d->raw_input_at = NULL; d->quota = options.starting_quota; +#ifdef USE_MAILER d->mailp = NULL; +#endif #ifndef COMPILE_CONSOLE #ifdef HAS_OPENSSL d->ssl = NULL; @@ -5308,9 +5327,11 @@ load_reboot_db(void) strcpy(poll_msg, getstring_noalloc(f)); globals.first_start_time = getref(f); globals.reboot_count = getref(f) + 1; +#ifdef USE_MAILER DESC_ITER_CONN(d) { d->mailp = find_exact_starting_point(d->player); } +#endif #ifndef COMPILE_CONSOLE #ifdef HAS_OPENSSL if (SSLPORT) { @@ -5538,7 +5559,9 @@ COMMAND(cmd_su) { add_to_exit_path(match, player); announce_disconnect(player); match->player = target; +#ifdef USE_MAILER match->mailp = find_exact_starting_point(target); +#endif is_hidden = Can_Hide(target) && Dark(target); DESC_ITER_CONN(d) if(d->player == player) { @@ -5552,9 +5575,11 @@ COMMAND(cmd_su) { announce_connect(target, 0, num); check_last(target, match->addr, match->ip); /* set last, lastsite, give paycheck */ queue_eol(match); +#ifdef USE_MAILER if(command_check_byname(target, "@MAIL")) check_mail(target, 0, 0); set_player_folder(target, 0); +#endif do_look_around(target); if(Haven(target)) notify(player, T("Your HAVEN flag is set. You cannot receive pages.")); @@ -5665,7 +5690,9 @@ static int do_su_exit(DESC *d) { /* Clear path_entry spot */ d->su_exit_path = path_entry->next; mush_free(path_entry, "SU_PATH_ENTRY"); +#ifdef USE_MAILER d->mailp = find_exact_starting_point(d->player); +#endif is_hidden = Can_Hide(d->player) && Dark(d->player); DESC_ITER_CONN(c) if(c->player == d->player) { @@ -5678,9 +5705,11 @@ static int do_su_exit(DESC *d) { announce_connect(d->player, 0, num); check_last(d->player, d->addr, d->ip); /* set last, lastsite, give paycheck */ queue_eol(d); +#ifdef USE_MAILER if(command_check_byname(d->player, "@MAIL")) check_mail(d->player, 0, 0); set_player_folder(d->player, 0); +#endif do_look_around(d->player); if(Haven(d->player)) notify(d->player, T("Your HAVEN flag is set. You cannot receive pages.")); diff --git a/src/cmds.c b/src/cmds.c index 71912ae..eac532d 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -576,6 +576,7 @@ COMMAND (cmd_lset) { do_lset(player, arg_left, arg_right); } +#ifdef USE_MAILER COMMAND (cmd_mail) { int urgent = SW_ISSET(sw, SWITCH_URGENT); int silent = SW_ISSET(sw, SWITCH_SILENT); @@ -664,6 +665,7 @@ COMMAND (cmd_malias) { else do_malias(player, arg_left, arg_right); } +#endif COMMAND (cmd_map) { unsigned int flags = DOL_MAP; diff --git a/src/command.c b/src/command.c index 1f70c1e..d71f3a5 100644 --- a/src/command.c +++ b/src/command.c @@ -180,12 +180,14 @@ COMLIST commands[] = { CMD_T_ANY | CMD_T_NOGAGGED | CMD_T_GOD, "POWER^SITE"}, {"@LSET", NULL, cmd_lset, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, NULL}, +#ifdef USE_MAILER {"@MAIL", "NOEVAL NOSIG STATS DSTATS FSTATS DEBUG NUKE FOLDERS UNFOLDER LIST READ CLEAR UNCLEAR PURGE FILE TAG UNTAG FWD FORWARD SEND SILENT URGENT", cmd_mail, CMD_T_ANY | CMD_T_EQSPLIT, NULL}, {"@MALIAS", "SET CREATE DESTROY DESCRIBE RENAME STATS CHOWN NUKE ADD REMOVE LIST ALL WHO MEMBERS USEFLAG SEEFLAG", cmd_malias, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, NULL}, +#endif {"@MAP", "DELIMIT", cmd_map, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_NOPARSE, NULL}, {"@MOTD", "CONNECT LIST DOWN FULL", cmd_motd, diff --git a/src/conf.c b/src/conf.c index 9fd6626..fa65768 100644 --- a/src/conf.c +++ b/src/conf.c @@ -62,8 +62,10 @@ COBRA_CONF conftable[] = { {"crash_database", cf_str, options.crash_db, sizeof options.crash_db, 0, "files"} , +#ifdef USE_MAILER {"mail_database", cf_str, options.mail_db, sizeof options.mail_db, 0, "files"} , +#endif {"chat_database", cf_str, options.chatdb, sizeof options.chatdb, 0, "files"} , {"compress_suffix", cf_str, options.compresssuff, sizeof options.compresssuff, @@ -1053,7 +1055,9 @@ conf_default_set(void) options.chan_cost = 1000; options.max_player_chans = 3; options.max_channels = 200; +#ifdef USE_MAILER strcpy(options.mail_db, "data/maildb"); +#endif options.player_start = 0; options.guest_start = options.player_start; options.master_room = 2; diff --git a/src/destroy.c b/src/destroy.c index 822b38a..0867036 100644 --- a/src/destroy.c +++ b/src/destroy.c @@ -855,9 +855,11 @@ clear_player(dbref thing) char alias[BUFFER_LEN + 1]; /* Clear out mail. */ +#ifdef USE_MAILER do_mail_clear(thing, NULL); do_mail_purge(thing); malias_cleanup(thing); +#endif #ifdef CHAT_SYSTEM /* Chown any chat channels they own to God */ diff --git a/src/function.c b/src/function.c index 9dfae36..bb3bc75 100644 --- a/src/function.c +++ b/src/function.c @@ -381,7 +381,9 @@ FUNTAB flist[] = { {"FLIP", fun_flip, 1, -1, FN_REG}, {"FLOORDIV", fun_floordiv, 2, 2, FN_REG}, {"FOLD", fun_fold, 2, 4, FN_REG}, +#ifdef USE_MAILER {"FOLDERSTATS", fun_folderstats, 0, 2, FN_REG}, +#endif {"FOLLOWERS", fun_followers, 1, 1, FN_REG}, {"FOLLOWING", fun_following, 1, 1, FN_REG}, {"FOREACH", fun_foreach, 2, 4, FN_REG}, @@ -469,6 +471,7 @@ FUNTAB flist[] = { {"LVTHINGS", fun_dbwalker, 1, 1, FN_REG}, {"LWHO", fun_lwho, 0, 1, FN_REG}, {"LWHOID", fun_lwho, 0, 1, FN_REG}, +#ifdef USE_MAILER {"MAIL", fun_mail, 0, 2, FN_REG}, {"MAILFROM", fun_mailfrom, 1, 2, FN_REG}, {"MAILSTATS", fun_mailstats, 1, 1, FN_REG}, @@ -477,6 +480,7 @@ FUNTAB flist[] = { {"MAILSTATUS", fun_mailstatus, 1, 2, FN_REG}, {"MAILSUBJECT", fun_mailsubject, 1, 2, FN_REG}, {"MAILTIME", fun_mailtime, 1, 2, FN_REG}, +#endif {"MAP", fun_map, 2, 4, FN_REG}, {"MAPSQL", fun_mapsql, 2, 4, FN_REG}, {"MATCH", fun_match, 2, 3, FN_REG}, diff --git a/src/game.c b/src/game.c index fd79b95..fc90a04 100644 --- a/src/game.c +++ b/src/game.c @@ -411,6 +411,7 @@ dump_database_internal(void) perror(realtmpfl); longjmp(db_err, 1); } +#ifdef USE_MAILER sprintf(realdumpfile, "%s%s", options.mail_db, options.compresssuff); strcpy(tmpfl, make_new_epoch_file(options.mail_db, epoch)); sprintf(realtmpfl, "%s%s", tmpfl, options.compresssuff); @@ -430,6 +431,7 @@ dump_database_internal(void) longjmp(db_err, 1); } } +#endif #ifdef CHAT_SYSTEM sprintf(realdumpfile, "%s%s", options.chatdb, options.compresssuff); strcpy(tmpfl, make_new_epoch_file(options.chatdb, epoch)); @@ -508,7 +510,9 @@ mush_panic(const char *message) } else { do_rawlog(LT_ERR, T("DUMPING: %s"), panicfile); db_write(f, DBF_PANIC); +#ifdef USE_MAILER dump_mail(f); +#endif #ifdef CHAT_SYSTEM save_chatdb(f); #endif /* CHAT_SYSTEM */ @@ -858,7 +862,9 @@ init_game_dbs(void) FILE *f; int c; const char *infile, *outfile; +#ifdef USE_MAILER const char *mailfile; +#endif const char *flag_file; int panicdb; @@ -869,7 +875,9 @@ init_game_dbs(void) infile = restarting ? options.output_db : options.input_db; outfile = options.output_db; flag_file = options.flagdb; +#ifdef USE_MAILER mailfile = options.mail_db; +#endif strcpy(globals.dumpfile, outfile); /* read small text files into cache */ @@ -962,6 +970,7 @@ init_game_dbs(void) if (!GoodObject(GOD) || (!IsPlayer(GOD))) do_rawlog(LT_ERR, T("WARNING: God (#%d) is NOT a player."), GOD); +#ifdef USE_MAILER /* read mail database */ mail_init(); @@ -985,6 +994,7 @@ init_game_dbs(void) db_close(f); } } +#endif /* USE_MAILER */ #ifdef CHAT_SYSTEM init_chatdb(); diff --git a/src/prog.c b/src/prog.c index f47bd1d..613fdd4 100644 --- a/src/prog.c +++ b/src/prog.c @@ -563,7 +563,9 @@ pw_player_connect(DESC * d, char *input __attribute__ ((__unused__))) add_to_exit_path(d, d->player); announce_disconnect(d->player); d->player = d->pinfo.object; +#ifdef USE_MAILER d->mailp = (MAIL *) find_exact_starting_point(d->pinfo.object); +#endif /* We're good @su him */ is_hidden = Can_Hide(d->pinfo.object) && Dark(d->pinfo.object); DESC_ITER_CONN(match) @@ -582,8 +584,8 @@ pw_player_connect(DESC * d, char *input __attribute__ ((__unused__))) #ifdef USE_MAILER if (command_check_byname(d->pinfo.object, "@MAIL")) check_mail(d->pinfo.object, 0, 0); -#endif set_player_folder(d->pinfo.object, 0); +#endif do_look_around(d->pinfo.object); if (Haven(d->pinfo.object)) notify(d->player, diff --git a/src/timer.c b/src/timer.c index 9ddc82e..0d9ed7d 100644 --- a/src/timer.c +++ b/src/timer.c @@ -139,11 +139,13 @@ migrate_stuff(int amount) for (lptr = Locks(end_obj); lptr; lptr = L_NEXT(lptr)) if (L_KEY(lptr) != NULL_CHUNK_REFERENCE) actual++; +#ifdef USE_MAILER if (IsPlayer(end_obj)) { for (mp = find_exact_starting_point(end_obj); mp; mp = mp->next) if (mp->msgid != NULL_CHUNK_REFERENCE) actual++; } +#endif end_obj = (end_obj + 1) % db_top; } while (actual < amount && end_obj != start_obj); @@ -177,6 +179,7 @@ migrate_stuff(int amount) refs[actual] = &(lptr->key); actual++; } +#ifdef USE_MAILER if (IsPlayer(start_obj)) { for (mp = find_exact_starting_point(start_obj); mp; mp = mp->next) if (mp->msgid != NULL_CHUNK_REFERENCE) { @@ -184,6 +187,7 @@ migrate_stuff(int amount) actual++; } } +#endif start_obj = (start_obj + 1) % db_top; } while (start_obj != end_obj); diff --git a/src/wiz.c b/src/wiz.c index 2b28957..7334403 100644 --- a/src/wiz.c +++ b/src/wiz.c @@ -1076,8 +1076,10 @@ do_debug_examine(dbref player, const char *name) switch (Typeof(thing)) { case TYPE_PLAYER: +#ifdef USE_MAILER mp = desc_mail(thing); notify_format(player, T("First mail sender: %d"), mp ? mp->from : NOTHING); +#endif case TYPE_THING: notify_format(player, "Location: %d", Location(thing)); notify_format(player, "Home: %d", Home(thing));