Fix recently-introduced bug in channel connect/disconnect broadcasts
authorAri Johnson <ari@theari.com>
Wed, 16 Dec 2015 01:18:30 +0000 (20:18 -0500)
committerAri Johnson <ari@theari.com>
Wed, 16 Dec 2015 01:18:30 +0000 (20:18 -0500)
hdrs/extchat.h
src/extchat.c

index b005bb236485f5a910402697661d3d164079c756..2c9fef17011df2ef37a426b8e5aa8e720f4e0913 100644 (file)
@@ -69,6 +69,7 @@ struct chanuser {
 #define CB_CHECKQUIET 0x1      /* Check for quiet flag on recipients */
 #define CB_NOSPOOF    0x2      /* Use nospoof emits */
 #define CB_PRESENCE   0x4      /* This is a presence message, not sound */
+#define CB_NONAME     0x8      /* Omit player name from broadcast */
 
 #define CUdbref(u) ((u)->who)
 #define CUtype(u) ((u)->type)
index c685b9cb446215815a26b927d6d2c6a0cc50b511..3f2a4615ed5dda8a55d16c4e26b3d0890954c2e0 100644 (file)
@@ -3072,8 +3072,8 @@ chat_player_announce(dbref player, char *msg, int ungag)
     if (u) {
       if (!Channel_Quiet(c) && (Channel_Admin(c) || Channel_Director(c)
                                || (!Chanuser_Hide(u) && !Dark(player))))
-       format_channel_broadcast(c, u, player, CB_CHECKQUIET | CB_PRESENCE,
-                                msg, NULL);
+       format_channel_broadcast(c, u, player, CB_CHECKQUIET | CB_PRESENCE
+                                | CB_NONAME, msg, NULL);
       if (ungag)
        CUtype(u) &= ~CU_GAG;
     }
@@ -3708,7 +3708,10 @@ format_channel_broadcast(CHAN *chan, CHANUSER *u, dbref victim, int flags,
   else if (u &&CUtitle(u))
     title = CUtitle(u);
 
-  if (Channel_NoNames(chan)) {
+  if (flags & CB_NONAME) {
+    flags &= ~CB_NONAME;
+    snprintf(buff, BUFFER_LEN, "%s %s", ChanObjName(chan), msg);
+  } else if (Channel_NoNames(chan)) {
     if (Channel_NoTitles(chan) || !title)
       snprintf(buff, BUFFER_LEN, "%s %s %s", ChanObjName(chan), "Someone", msg);
     else