@@ -174,7 +174,7 @@ public async Task Get([FromHeader(Name = "is-reconnect")] bool bIsReconnect)
174174 }
175175 catch ( OperationCanceledException )
176176 {
177- // No message received in 30s — send a keep-alive pong and continue waiting
177+ // No message received in 30s — send a keep-alive pong and continue waiting
178178 wsSess . SendPong ( ) ;
179179 continue ;
180180 }
@@ -373,18 +373,21 @@ private async Task ProcessWSMessage(UserWebSocketInstance sourceWS, UserSession
373373 {
374374 outboundMsg . message = String . Format ( "{0} {1}" , sourceUserData . m_strDisplayName , chatMessage . message ) ;
375375 outboundMsg . admin = false ; // dont care for actions
376+ outboundMsg . name_change = false ;
376377 }
377378 else
378379 {
379380 if ( sourceUserData . IsAdmin ( ) )
380381 {
381382 outboundMsg . message = String . Format ( "[\u2605 \u2605 GO STAFF\u2605 \u2605 ] [{0}] {1}" , sourceUserData . m_strDisplayName , chatMessage . message ) ;
382383 outboundMsg . admin = true ;
384+ outboundMsg . name_change = false ;
383385 }
384386 else
385387 {
386388 outboundMsg . message = String . Format ( "[{0}] {1}" , sourceUserData . m_strDisplayName , chatMessage . message ) ;
387389 outboundMsg . admin = false ;
390+ outboundMsg . name_change = false ;
388391 }
389392 }
390393
@@ -474,6 +477,9 @@ private async Task ProcessWSMessage(UserWebSocketInstance sourceWS, UserSession
474477 "admin" ,
475478 "staff" ,
476479 "mass^" ,
480+ "mas^" ,
481+ "m4ss^" ,
482+ "m4s^" ,
477483 "moderator" ,
478484 "hitler" ,
479485 "h1tler" ,
@@ -491,20 +497,24 @@ private async Task ProcessWSMessage(UserWebSocketInstance sourceWS, UserSession
491497 string strNameRequestLower = nameChangeRequest . name . ToLower ( ) ;
492498
493499 // dont allow protected names
494- foreach ( string strProtectedName in lstProtectedNames )
500+ if ( ! sourceUserData . IsAdmin ( ) )
495501 {
496- if ( strNameRequestLower . Contains ( strProtectedName ) )
502+ foreach ( string strProtectedName in lstProtectedNames )
497503 {
498- // response back to user
499- WebSocketMessage_NetworkRoomChatMessageOutbound outboundMsg = new WebSocketMessage_NetworkRoomChatMessageOutbound ( ) ;
500- outboundMsg . msg_id = ( int ) EWebSocketMessageID . NETWORK_ROOM_CHAT_FROM_SERVER ;
501- outboundMsg . message = String . Format ( "--NAME CHANGE-- The display name you tried to set contains a protected word/phrase ({0} - {1})" , nameChangeRequest . name , strProtectedName ) ;
502- outboundMsg . admin = true ; // dont care for actions
503- outboundMsg . action = false ;
504- byte [ ] bytesJSON = Encoding . UTF8 . GetBytes ( JsonSerializer . Serialize ( outboundMsg ) ) ;
505- sourceUserSession . QueueWebsocketSend ( bytesJSON ) ;
506-
507- return ;
504+ if ( strNameRequestLower . Contains ( strProtectedName ) )
505+ {
506+ // response back to user
507+ WebSocketMessage_NetworkRoomChatMessageOutbound outboundMsg = new WebSocketMessage_NetworkRoomChatMessageOutbound ( ) ;
508+ outboundMsg . msg_id = ( int ) EWebSocketMessageID . NETWORK_ROOM_CHAT_FROM_SERVER ;
509+ outboundMsg . message = String . Format ( "--NAME CHANGE-- The display name you tried to set contains a protected word/phrase ({0} - {1})" , nameChangeRequest . name , strProtectedName ) ;
510+ outboundMsg . admin = true ; // dont care for actions
511+ outboundMsg . action = false ;
512+ outboundMsg . name_change = true ;
513+ byte [ ] bytesJSON = Encoding . UTF8 . GetBytes ( JsonSerializer . Serialize ( outboundMsg ) ) ;
514+ sourceUserSession . QueueWebsocketSend ( bytesJSON ) ;
515+
516+ return ;
517+ }
508518 }
509519 }
510520
@@ -516,6 +526,7 @@ private async Task ProcessWSMessage(UserWebSocketInstance sourceWS, UserSession
516526 outboundMsg . message = String . Format ( "--NAME CHANGE-- Display names cannot begin or end with spaces ({0})" , nameChangeRequest . name ) ;
517527 outboundMsg . admin = true ; // dont care for actions
518528 outboundMsg . action = false ;
529+ outboundMsg . name_change = true ;
519530 byte [ ] bytesJSON = Encoding . UTF8 . GetBytes ( JsonSerializer . Serialize ( outboundMsg ) ) ;
520531 sourceUserSession . QueueWebsocketSend ( bytesJSON ) ;
521532
@@ -542,6 +553,7 @@ private async Task ProcessWSMessage(UserWebSocketInstance sourceWS, UserSession
542553 outboundMsg . message = String . Format ( "--NAME CHANGE-- {0} has changed their display name to {1}" , sourceUserData . m_strDisplayName , nameChangeRequest . name ) ;
543554 outboundMsg . admin = true ;
544555 outboundMsg . action = false ;
556+ outboundMsg . name_change = true ;
545557
546558 // Serialize once before broadcasting
547559 byte [ ] bytesJSON = Encoding . UTF8 . GetBytes ( JsonSerializer . Serialize ( outboundMsg ) ) ;
@@ -582,6 +594,7 @@ private async Task ProcessWSMessage(UserWebSocketInstance sourceWS, UserSession
582594 outboundMsg . message = String . Format ( "--NAME CHANGE-- The display name you tried to set is already in use by another user ({0})" , nameChangeRequest . name ) ;
583595 outboundMsg . admin = true ; // dont care for actions
584596 outboundMsg . action = false ;
597+ outboundMsg . name_change = true ;
585598 byte [ ] bytesJSON = Encoding . UTF8 . GetBytes ( JsonSerializer . Serialize ( outboundMsg ) ) ;
586599 sourceUserSession . QueueWebsocketSend ( bytesJSON ) ;
587600 }
0 commit comments