mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
we both got in each others's ways; still respect the ignored players list (#1051)
This commit is contained in:
parent
082d58108f
commit
fdcce870d9
|
|
@ -539,7 +539,8 @@ object AvatarActor {
|
||||||
* `false`, otherwise
|
* `false`, otherwise
|
||||||
*/
|
*/
|
||||||
def onlineIfNotIgnored(onlinePlayerName: String, observerName: String): Boolean = {
|
def onlineIfNotIgnored(onlinePlayerName: String, observerName: String): Boolean = {
|
||||||
LivePlayerList.WorldPopulation({ case (_, a) => a.name.equals(onlinePlayerName) }).headOption match {
|
val onlinePlayerNameLower = onlinePlayerName.toLowerCase()
|
||||||
|
LivePlayerList.WorldPopulation({ case (_, a) => a.name.toLowerCase().equals(onlinePlayerNameLower) }).headOption match {
|
||||||
case Some(onlinePlayer) => onlineIfNotIgnored(onlinePlayer, observerName)
|
case Some(onlinePlayer) => onlineIfNotIgnored(onlinePlayer, observerName)
|
||||||
case _ => false
|
case _ => false
|
||||||
}
|
}
|
||||||
|
|
@ -582,7 +583,8 @@ object AvatarActor {
|
||||||
* `false`, otherwise
|
* `false`, otherwise
|
||||||
*/
|
*/
|
||||||
def onlineIfNotIgnored(onlinePlayer: Avatar, observedName: String): Boolean = {
|
def onlineIfNotIgnored(onlinePlayer: Avatar, observedName: String): Boolean = {
|
||||||
!onlinePlayer.people.ignored.exists { f => f.name.equals(observedName) }
|
val observedNameLower = observedName.toLowerCase()
|
||||||
|
!onlinePlayer.people.ignored.exists { f => f.name.toLowerCase().equals(observedNameLower) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -72,25 +72,40 @@ class ChatService(context: ActorContext[ChatService.Command]) extends AbstractBe
|
||||||
}
|
}
|
||||||
val subs = subscriptions.filter(_.channel == channel)
|
val subs = subscriptions.filter(_.channel == channel)
|
||||||
message.messageType match {
|
message.messageType match {
|
||||||
case CMT_TELL | CMT_GMTELL =>
|
case mtype @ (CMT_TELL | CMT_GMTELL) =>
|
||||||
subs.find(_.session.player.Name == session.player.Name).foreach {
|
val playerName = session.player.Name
|
||||||
case JoinChannel(sender, _, _) =>
|
val playerNameLower = playerName.toLowerCase()
|
||||||
|
val recipientName = message.recipient
|
||||||
|
val recipientNameLower = recipientName.toLowerCase()
|
||||||
|
(
|
||||||
|
subs.find(_.session.player.Name.toLowerCase().equals(playerNameLower)),
|
||||||
|
subs.find(_.session.player.Name.toLowerCase().equals(recipientNameLower))
|
||||||
|
) match {
|
||||||
|
case (Some(JoinChannel(sender, _, _)), Some(JoinChannel(receiver, _, _))) =>
|
||||||
|
val replyType = if (mtype == CMT_TELL) { U_CMT_TELLFROM } else { U_CMT_GMTELLFROM }
|
||||||
sender ! MessageResponse(
|
sender ! MessageResponse(
|
||||||
session,
|
session,
|
||||||
message.copy(messageType = if (message.messageType == CMT_TELL) U_CMT_TELLFROM else U_CMT_GMTELLFROM),
|
message.copy(messageType = replyType),
|
||||||
|
channel
|
||||||
|
)
|
||||||
|
receiver ! MessageResponse(session, message.copy(recipient = playerName), channel)
|
||||||
|
case (None, Some(JoinChannel(receiver, _, _))) =>
|
||||||
|
log.warn(s"ChatMsg->$mtype: can not find subscription object for: sender=$playerName")
|
||||||
|
receiver ! MessageResponse(session, message.copy(recipient = playerName), channel)
|
||||||
|
case (Some(JoinChannel(sender, _, _)), None) =>
|
||||||
|
val replyType = if (mtype == CMT_TELL) { U_CMT_TELLFROM } else { U_CMT_GMTELLFROM }
|
||||||
|
sender ! MessageResponse(
|
||||||
|
session,
|
||||||
|
message.copy(messageType = replyType),
|
||||||
channel
|
channel
|
||||||
)
|
)
|
||||||
subs.find(_.session.player.Name.toLowerCase() == message.recipient.toLowerCase()) match {
|
|
||||||
case Some(JoinChannel(receiver, _, _)) =>
|
|
||||||
receiver ! MessageResponse(session, message.copy(recipient = session.player.Name), channel)
|
|
||||||
case None =>
|
|
||||||
sender ! MessageResponse(
|
sender ! MessageResponse(
|
||||||
session,
|
session,
|
||||||
ChatMsg(ChatMessageType.UNK_45, wideContents = false, "", "@NoTell_Target", None),
|
ChatMsg(ChatMessageType.UNK_45, wideContents = false, "", "@NoTell_Target", None),
|
||||||
channel
|
channel
|
||||||
)
|
)
|
||||||
}
|
case (None, None) =>
|
||||||
|
log.error(s"ChatMsg->$mtype: can not find subscription object for: sender=$playerName")
|
||||||
}
|
}
|
||||||
|
|
||||||
case CMT_SILENCE =>
|
case CMT_SILENCE =>
|
||||||
|
|
@ -117,13 +132,13 @@ class ChatService(context: ActorContext[ChatService.Command]) extends AbstractBe
|
||||||
if (recipient.session.player.silenced) {
|
if (recipient.session.player.silenced) {
|
||||||
sender.actor ! MessageResponse(
|
sender.actor ! MessageResponse(
|
||||||
session,
|
session,
|
||||||
ChatMsg(UNK_229, true, "", "@silence_disabled_ack", None),
|
ChatMsg(UNK_229, wideContents = true, "", "@silence_disabled_ack", None),
|
||||||
channel
|
channel
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
sender.actor ! MessageResponse(
|
sender.actor ! MessageResponse(
|
||||||
session,
|
session,
|
||||||
ChatMsg(UNK_229, true, "", "@silence_enabled_ack", None),
|
ChatMsg(UNK_229, wideContents = true, "", "@silence_enabled_ack", None),
|
||||||
channel
|
channel
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -131,14 +146,14 @@ class ChatService(context: ActorContext[ChatService.Command]) extends AbstractBe
|
||||||
case None =>
|
case None =>
|
||||||
sender.actor ! MessageResponse(
|
sender.actor ! MessageResponse(
|
||||||
session,
|
session,
|
||||||
ChatMsg(UNK_229, true, "", s"unknown player '$name'", None),
|
ChatMsg(UNK_229, wideContents = true, "", s"unknown player '$name'", None),
|
||||||
channel
|
channel
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
case (Some(sender), _, _, error) =>
|
case (Some(sender), _, _, error) =>
|
||||||
sender.actor ! MessageResponse(
|
sender.actor ! MessageResponse(
|
||||||
session,
|
session,
|
||||||
ChatMsg(UNK_229, false, "", error.getOrElse("usage: /silence <name> [<time>]"), None),
|
ChatMsg(UNK_229, wideContents = false, "", error.getOrElse("usage: /silence <name> [<time>]"), None),
|
||||||
channel
|
channel
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue