From 2b82570455f87ebf00acfb8507966af45993ebef Mon Sep 17 00:00:00 2001
From: Ari Johnson <ari@cobramush.org>
Date: Wed, 21 Feb 2007 14:38:36 +0000
Subject: [PATCH] page player= now pages with a blank line instead of paging
 the last-paged player with the new player name

---
 hdrs/game.h  | 3 ++-
 src/cmds.c   | 5 ++++-
 src/speech.c | 7 ++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/hdrs/game.h b/hdrs/game.h
index 6d7f4c4..f84a64e 100644
--- a/hdrs/game.h
+++ b/hdrs/game.h
@@ -132,7 +132,8 @@ enum wall_type { WALL_ALL };
 extern void do_wall(dbref player, const char *message, enum wall_type target,
 		    int emit);
 extern void do_page(dbref player, const char *arg1, const char *arg2,
-		    dbref cause, int noeval, int multipage, int override);
+		    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_think(dbref player, const char *message);
 #define PEMIT_SILENT 0x1
diff --git a/src/cmds.c b/src/cmds.c
index 96ab42c..5cf0ce3 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -1093,18 +1093,21 @@ COMMAND (cmd_leave) {
 
 COMMAND (cmd_page) {
   char *t;
+  int has_eq = 0;
   if ((arg_right) && (*arg_right)) {
     t = arg_right;
   } else {
     t = NULL;
   }
+  if (args_raw && *args_raw && strchr(args_raw, '='))
+    has_eq = 1;
   if (SW_ISSET(sw, SWITCH_PORT))
     do_page_port(player, arg_left, t);
   else
     do_page(player, arg_left, t, cause, SW_ISSET(sw, SWITCH_NOEVAL),
 	    !(SW_ISSET(sw, SWITCH_BLIND) ||
 	      (!(SW_ISSET(sw, SWITCH_LIST)) && (BLIND_PAGE))),
-	    SW_ISSET(sw, SWITCH_OVERRIDE));
+	    SW_ISSET(sw, SWITCH_OVERRIDE), has_eq);
 }
 
 COMMAND (cmd_pose) {
diff --git a/src/speech.c b/src/speech.c
index ad3ca0c..fac55a7 100644
--- a/src/speech.c
+++ b/src/speech.c
@@ -615,10 +615,11 @@ do_wall(dbref player, const char *message, enum wall_type target, int emit)
  * \param noeval if 1, page/noeval.
  * \param multipage if 1, a page/list; if 0, a page/blind.
  * \param override if 1, page/override.
+ * \param has_eq if 1, the command had an = in it.
  */
 void
 do_page(dbref player, const char *arg1, const char *arg2, dbref cause,
-	int noeval, int multipage, int override)
+	int noeval, int multipage, int override, int has_eq)
 {
   dbref target;
   const char *message;
@@ -644,8 +645,8 @@ do_page(dbref player, const char *arg1, const char *arg2, dbref cause,
   if (!tbuf2)
     mush_panic("Unable to allocate memory in do_page");
 
-  if (arg2 && *arg2 && *arg1) {
-    /* page to=msg. Always evaluate to, maybe evaluate msg */
+  if (*arg1 && has_eq) {
+    /* page to=[msg]. Always evaluate to, maybe evaluate msg */
     process_expression(tbuf2, &tp2, &arg1, player, cause, cause,
 		       PE_DEFAULT, PT_DEFAULT, NULL);
     *tp2 = '\0';
-- 
2.30.2