diff --git a/OpenMetaverse/AgentManager.cs b/OpenMetaverse/AgentManager.cs index f52152e9..4b7e66e5 100644 --- a/OpenMetaverse/AgentManager.cs +++ b/OpenMetaverse/AgentManager.cs @@ -3167,7 +3167,7 @@ namespace OpenMetaverse ChatFromSimulatorPacket chat = (ChatFromSimulatorPacket)packet; - OnChat(new ChatEventArgs(Utils.BytesToString(chat.ChatData.Message), + OnChat(new ChatEventArgs(simulator, Utils.BytesToString(chat.ChatData.Message), (ChatAudibleLevel)chat.ChatData.Audible, (ChatType)chat.ChatData.ChatType, (ChatSourceType)chat.ChatData.SourceType, @@ -3979,6 +3979,7 @@ namespace OpenMetaverse /// public class ChatEventArgs : EventArgs { + private readonly Simulator m_Simulator; private readonly string m_Message; private readonly ChatAudibleLevel m_AudibleLevel; private readonly ChatType m_Type; @@ -3988,6 +3989,8 @@ namespace OpenMetaverse private readonly UUID m_OwnerID; private readonly Vector3 m_Position; + /// Get the simulator sending the message + public Simulator Simulator { get { return m_Simulator; } } /// Get the message sent public string Message { get { return m_Message; } } /// Get the audible level of the message @@ -4016,9 +4019,10 @@ namespace OpenMetaverse /// The ID of the agent or object sending the message /// The ID of the object owner, or the agent ID sending the message /// The position of the agent or object sending the message - public ChatEventArgs(string message, ChatAudibleLevel audible, ChatType type, + public ChatEventArgs(Simulator simulator, string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID sourceId, UUID ownerid, Vector3 position) { + this.m_Simulator = simulator; this.m_Message = message; this.m_AudibleLevel = audible; this.m_Type = type; diff --git a/Programs/examples/IRCGateway/IRCClient.cs b/Programs/examples/IRCGateway/IRCClient.cs index 50e15c30..0efadff4 100644 --- a/Programs/examples/IRCGateway/IRCClient.cs +++ b/Programs/examples/IRCGateway/IRCClient.cs @@ -138,7 +138,7 @@ public class IRCClient if (OnMessage != null) { int nameIndex = words[0].IndexOf('!'); - string name = words[0].Substring(1, nameIndex - 1); + string name = nameIndex > 0 ? words[0].Substring(1, nameIndex - 1) : words[0]; string address = words[0].Substring(nameIndex + 1); OnMessage(words[2], name, address, lines[i].Substring(lines[i].IndexOf(":", 1) + 1)); }