diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs index b8fbe2b066..a673f7bc66 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs @@ -35,6 +35,7 @@ using log4net; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; +using OpenSim.Framework.Client; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; @@ -74,12 +75,21 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage if (!m_scenes.Contains(scene)) { m_scenes.Add(scene); - scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnClientConnect += OnClientConnect; scene.EventManager.OnGridInstantMessage += OnGridInstantMessage; } } } + void OnClientConnect(IClientCore client) + { + IClientIM clientIM; + if(client.TryGet(out clientIM)) + { + clientIM.OnInstantMessage += OnInstantMessage; + } + } + private void ReadConfig(IConfigSource config) { IConfig cnf = config.Configs["Startup"]; @@ -109,11 +119,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage #endregion - private void OnNewClient(IClientAPI client) - { - client.OnInstantMessage += OnInstantMessage; - } - private void OnInstantMessage(IClientAPI client, UUID fromAgentID, UUID fromAgentSession, UUID toAgentID, UUID imSessionID, uint timestamp, string fromAgentName,