# Patch name: su-patch # Patch version: 1.1 # Author's name: Colt Ramsden # Author's email: coltr@txucom.net # Version of PennMUSH: 1.7.7p15 # Date patch made: Tue Jun 24 01:29:41 CST 2003 # Author is willing to support (yes/no): yes # Patch format: Context # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # *** src/bsd.c.orig Mon Jun 02 14:29:08 2003 --- src/bsd.c Sat Jun 21 20:06:27 2003 *************** *** 388,392 **** static void process_commands(void); static int do_command(DESC *d, char *command); ! static int dump_messages(DESC *d, dbref player, int new); static int check_connect(DESC *d, const char *msg); static void parse_connect(const char *msg, char *command, char *user, --- 388,392 ---- static void process_commands(void); static int do_command(DESC *d, char *command); ! int dump_messages(DESC *d, dbref player, int new); static int check_connect(DESC *d, const char *msg); static void parse_connect(const char *msg, char *command, char *user, *************** *** 2563,2567 **** } ! static int dump_messages(DESC *d, dbref player, int isnew) { --- 2563,2567 ---- } ! int dump_messages(DESC *d, dbref player, int isnew) { *** cmdlocal.c.orig Mon Jun 02 14:29:18 2003 --- cmdlocal.c Tue Jun 24 19:20:07 2003 *************** *** 17,20 **** --- 17,25 ---- #include "cmds.h" #include "confmagic.h" + #include "log.h" + #include "dbdefs.h" + #include "flags.h" + + extern int dump_messages(DESC *d, dbref player, int new); extern HASHTAB htab_reserved_aliases; *************** *** 54,57 **** --- 57,103 ---- #endif + COMMAND (cmd_local_su) { + DESC *d; + dbref su_player; + + /* validate name */ + if ((su_player = lookup_player(arg_left)) == NOTHING) + { + notify(player, "@su: user does not exist"); + return; + } + + /* validate password, let GOD su to anyone */ + if (!God(player)) + { + if (!password_check(su_player, arg_right)) + { + notify(player, "@su: incorrect password"); + return; + } + } + + /* make sure su_player is not CONNECTED...something + * about people being towed to #1 -- bugfix */ + if (Connected(su_player)) + { + notify(player, "@su: user is already connected"); + return; + } + + /* get descriptor */ + d = player_desc(player); + + /* add log entry */ + do_log(LT_CONN, 0, 0, T("[%d/%s/%s] @su from %s(#%d) to %s(#%d) in %s(#%d)"), + d->descriptor, d->addr, d->ip, Name(player), player, Name(su_player), + su_player, Name(Location(su_player)), Location(su_player)); + + clear_flag_internal(player, "CONNECTED"); + + if (dump_messages(d, su_player, 0) == 0) + d->connected = 2; + + notify_format(su_player, "@su: '%s' to '%s' successful", Name(player), Name(su_player)); + } + /* Called during the command init sequence. *************** *** 76,78 **** --- 122,125 ---- cmd_local_silly); #endif + command_add("@SU", CMD_T_PLAYER | CMD_T_EQSPLIT, "WIZARD", 0, NULL, cmd_local_su); } *** local_cmd_su.hlp.old Tue Jun 24 17:19:35 2003 --- local_cmd_su.hlp Sun Jun 22 15:36:55 2003 *************** *** 0 **** --- 1,6 ---- + & @su + @su = + + Switches from current player to while still connected. + + Only Wizards may use @su.