gameServer/HWProtoCore.hs
changeset 15909 7409084d891f
parent 15905 bf92592915c6
--- a/gameServer/HWProtoCore.hs	Sun Oct 16 13:14:16 2022 +0300
+++ b/gameServer/HWProtoCore.hs	Sun Oct 16 20:15:57 2022 +0300
@@ -143,20 +143,21 @@
 handleCmd_loggedin ["MSG", nickMsg] = do
     thisCl <- thisClient
     thisNick <- clientNick
-    clChans <- thisClientChans
-    let addEcho nick msg a = AnswerClients clChans ["CHAT", thisNick, B.concat ["/msg [", nick, "] ", msg]] : a
+    clChansProto <- thisClientChansProto
+    let echoByProto nick msg p = if p < 60 then ["CHAT", thisNick, B.concat ["/msg [", nick, "] ", msg]] else ["MSG_ECHO", nick, msg]
+    let addEcho nick msg a = AnswerClientsByProto clChansProto (echoByProto nick msg) : a
     let sendingMsgAllowed clientInfo = case allowMsgState clientInfo of
           AllowAll -> True
           AllowRegistered -> isRegistered thisCl
           AllowNone -> False
+    let answerByProto msg p = if p < 60 then ["CHAT", thisNick, B.concat ["[direct] ", msg]] else ["MSG", thisNick, msg]
     let sendNickMsg nick msg = do
           (_, rnc) <- ask
           maybeClientId <- clientByNick nick
           case maybeClientId of
               Just cl -> let ci = client rnc cl in
                   if sendingMsgAllowed ci  then
-                      return [AnswerClients [sendChan ci]
-                              ["CHAT", thisNick, B.concat ["[direct] ", msg]]]
+                      return [AnswerClientsByProto [(sendChan ci, clientProto ci)] (answerByProto msg)]
                   else
                       return [Warning $ loc "Player is not allowing direct messages."]
               Nothing -> return [Warning $ loc "Player is not online."]