From a2c7b7ead0caa11e862c3eda148fa44076cd88bf Mon Sep 17 00:00:00 2001 From: Rick L Bird Date: Thu, 5 May 2011 17:53:43 -0400 Subject: [PATCH] PennMUSH 1.8.3p11 Author: allthecoolkidshaveone Date: Tue Oct 6 11:14:53 2009 +0000 Issue 111: page/port not evaluating arguments. Fixes #155 --- hdrs/game.h | 2 +- src/bsd.c | 23 ++++++++++++++++++++--- src/cmds.c | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hdrs/game.h b/hdrs/game.h index b153960..5146664 100644 --- a/hdrs/game.h +++ b/hdrs/game.h @@ -134,7 +134,7 @@ extern void do_wall(dbref player, const char *message, enum wall_type target, extern void do_page(dbref player, const char *arg1, const char *arg2, dbref cause, int noeval, int multipage, int override, int has_eq); -extern void do_page_port(dbref player, const char *arg1, const char *arg2); +extern void do_page_port(dbref player, const char *arg1, const char *arg2, bool noeval_msg); extern void do_think(dbref player, const char *message); #define PEMIT_SILENT 0x1 #define PEMIT_LIST 0x2 diff --git a/src/bsd.c b/src/bsd.c index afe8ce5..8dfe3dd 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -2970,11 +2970,12 @@ player_desc(dbref player) * \param message message to send. */ void -do_page_port(dbref player, const char *pc, const char *message) +do_page_port(dbref player, const char *pc, const char *message, bool eval_msg) { int p, key; DESC *d; const char *gap; + char mbuf[BUFFER_LEN], *mbp = mbuf; char tbuf[BUFFER_LEN], *tbp = tbuf; dbref target = NOTHING; @@ -2982,17 +2983,33 @@ do_page_port(dbref player, const char *pc, const char *message) notify(player, T("Permission denied.")); return; } - p = atoi(pc); + + process_expression(tbuf, &tbp, &pc, player, cause, cause, PE_DEFAULT, PT_DEFAULT, NULL); + *tbp = '\0'; + p = atoi(tbuf); + tbp = tbuf; + if (p <= 0) { notify(player, T("That's not a port number.")); return; } - if (!message || !*message) { + if (!message) { notify(player, T("What do you want to page with?")); return; } + if (eval_msg) { + process_expression(mbuf, &mbp, &message, player, cause, cause, PE_DEFAULT, PT_DEFAULT, NULL); + *mbp = '\0'; + message = mbuf; + } + + if (!*message) { + notify(player, T("What do you want to page with?")); + return; + } + gap = " "; switch (*message) { case SEMI_POSE_TOKEN: diff --git a/src/cmds.c b/src/cmds.c index 5488185..a674dfb 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -1238,7 +1238,7 @@ COMMAND (cmd_leave) { COMMAND (cmd_page) { if (SW_ISSET(sw, SWITCH_PORT)) - do_page_port(player, arg_left, arg_right); + do_page_port(player, cause, arg_left, arg_right, !SW_ISSET(sw, SWITCH_NOEVAL)); else do_page(player, arg_left, arg_right, cause, SW_ISSET(sw, SWITCH_NOEVAL), !(SW_ISSET(sw, SWITCH_BLIND) || -- 2.30.2