fixed non-ASCII chat and IM

afrisby
Jeff Ames 2007-11-08 07:14:46 +00:00
parent 0b4e15bc35
commit fc3e247956
3 changed files with 6 additions and 5 deletions

View File

@ -251,6 +251,7 @@ namespace OpenSim.Region.ClientStack
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
{ {
Encoding enc = Encoding.ASCII; Encoding enc = Encoding.ASCII;
Encoding encUTF8 = Encoding.UTF8;
ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
msg.AgentData.AgentID = fromAgent; msg.AgentData.AgentID = fromAgent;
msg.AgentData.SessionID = fromAgentSession; msg.AgentData.SessionID = fromAgentSession;
@ -264,7 +265,7 @@ namespace OpenSim.Region.ClientStack
msg.MessageBlock.RegionID = LLUUID.Random(); msg.MessageBlock.RegionID = LLUUID.Random();
msg.MessageBlock.Timestamp = timeStamp; msg.MessageBlock.Timestamp = timeStamp;
msg.MessageBlock.ToAgentID = toAgent; msg.MessageBlock.ToAgentID = toAgent;
msg.MessageBlock.Message = enc.GetBytes(message + "\0"); msg.MessageBlock.Message = encUTF8.GetBytes(message + "\0");
msg.MessageBlock.BinaryBucket = new byte[0]; msg.MessageBlock.BinaryBucket = new byte[0];
OutPacket(msg); OutPacket(msg);

View File

@ -83,7 +83,7 @@ namespace OpenSim.Region.ClientStack
break; break;
case PacketType.ChatFromViewer: case PacketType.ChatFromViewer:
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack; ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack;
if (Util.FieldToString(inchatpack.ChatData.Message) == "") if (Helpers.FieldToUTF8String(inchatpack.ChatData.Message) == "")
{ {
//empty message so don't bother with it //empty message so don't bother with it
break; break;
@ -101,7 +101,7 @@ namespace OpenSim.Region.ClientStack
ChatFromViewerArgs args = new ChatFromViewerArgs(); ChatFromViewerArgs args = new ChatFromViewerArgs();
args.Channel = channel; args.Channel = channel;
args.From = fromName; args.From = fromName;
args.Message = Util.FieldToString(message); args.Message = Helpers.FieldToUTF8String(message);
args.Type = (ChatTypeEnum) type; args.Type = (ChatTypeEnum) type;
args.Position = fromPos; args.Position = fromPos;
@ -114,7 +114,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.ImprovedInstantMessage: case PacketType.ImprovedInstantMessage:
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack; ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message);
if (OnInstantMessage != null) if (OnInstantMessage != null)
{ {
OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
ChatFromViewerArgs args = new ChatFromViewerArgs(); ChatFromViewerArgs args = new ChatFromViewerArgs();
args.Message = Util.FieldToString(message); args.Message = Helpers.FieldToUTF8String(message);
args.Channel = channel; args.Channel = channel;
args.Type = type; args.Type = type;
args.Position = fromPos; args.Position = fromPos;