Issue with Private Message case sensitivity

Options
I'm having an issue with private messages on my chat in Unity.
I made it like in World of Warcraft where you have to type ' /w ' in order to send a PM, but the problem is the TargetUserID is case sensitive when I don't want it to be.

Here's a sample of the code I'm using:

foreach(PhotonPlayer pp in PhotonNetwork.otherPlayers)
{
if(String.Equals(targetUser, pp.NickName, StringComparison.OrdinalIgnoreCase))
{
targetUser = targetUser.ToLower();
this.chatClient.SendPrivateMessage(targetUser, message);
}
else
{
this.currentChanText.text += noUserFoundText;
}
}
Where "pp" is a PhotonPlayer variable.

Now if I type the targetUser's name exactly as it appears on the screen, the private message goes through.
If I type a targetUser that's not part of my group, I publish an error message, and all that works fine.
However, if I type a targerUser with different cases (i.e.: aphelion vs Aphelion), the message appears for the sender but nothing shows up on the Target's side. Also no errors appear in chat or in my Console.

I tried forcing the targetUser string to Lower case, upper case, etc but I get the same issue.

What exactly am I missing here?

Thanks!

Answers

  • Aphelion
    Options
    I guess I should have marked this as a Question. I can't delete or edit the post to reflect this, sadly and I don't want to have a duplicate thread.

    Can someone help me on this one?