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 b005bb2..2c9fef1 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 c685b9c..3f2a461 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