Merge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/opensim into presence-refactor
commit
42122388ef
|
@ -102,8 +102,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
|
m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
|
m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
|
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
|
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
|
m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
|
||||||
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
|
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
|
||||||
|
|
|
@ -65,9 +65,13 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
|
|
||||||
public void Initialise (OpenSimBase openSim)
|
public void Initialise (OpenSimBase openSim)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[REGIONMODULES]: Initializing...");
|
|
||||||
m_openSim = openSim;
|
m_openSim = openSim;
|
||||||
openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
|
}
|
||||||
|
|
||||||
|
public void PostInitialise ()
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[REGIONMODULES]: Initializing...");
|
||||||
|
m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
|
||||||
|
|
||||||
// Who we are
|
// Who we are
|
||||||
string id = AddinManager.CurrentAddin.Id;
|
string id = AddinManager.CurrentAddin.Id;
|
||||||
|
@ -81,9 +85,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
|
|
||||||
// The [Modules] section in the ini file
|
// The [Modules] section in the ini file
|
||||||
IConfig modulesConfig =
|
IConfig modulesConfig =
|
||||||
openSim.ConfigSource.Source.Configs["Modules"];
|
m_openSim.ConfigSource.Source.Configs["Modules"];
|
||||||
if (modulesConfig == null)
|
if (modulesConfig == null)
|
||||||
modulesConfig = openSim.ConfigSource.Source.AddConfig("Modules");
|
modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
|
||||||
|
|
||||||
// Scan modules and load all that aren't disabled
|
// Scan modules and load all that aren't disabled
|
||||||
foreach (TypeExtensionNode node in
|
foreach (TypeExtensionNode node in
|
||||||
|
@ -195,7 +199,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
|
|
||||||
// OK, we're up and running
|
// OK, we're up and running
|
||||||
m_sharedInstances.Add(module);
|
m_sharedInstances.Add(module);
|
||||||
module.Initialise(openSim.ConfigSource.Source);
|
module.Initialise(m_openSim.ConfigSource.Source);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Immediately run PostInitialise on shared modules
|
// Immediately run PostInitialise on shared modules
|
||||||
|
@ -205,10 +209,6 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IPlugin implementation
|
#region IPlugin implementation
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,6 +24,7 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
@ -36,9 +37,10 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
public class InstantMessageModule : IRegionModule
|
public class InstantMessageModule : ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Is this module enabled?
|
/// Is this module enabled?
|
||||||
|
@ -51,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
|
|
||||||
private IMessageTransferModule m_TransferModule = null;
|
private IMessageTransferModule m_TransferModule = null;
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (config.Configs["Messaging"] != null)
|
if (config.Configs["Messaging"] != null)
|
||||||
{
|
{
|
||||||
|
@ -62,6 +64,12 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
lock (m_scenes)
|
lock (m_scenes)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +82,39 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_TransferModule =
|
||||||
|
scene.RequestModuleInterface<IMessageTransferModule>();
|
||||||
|
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[INSTANT MESSAGE]: No message transfer module, IM will not work!");
|
||||||
|
scene.EventManager.OnClientConnect -= OnClientConnect;
|
||||||
|
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||||
|
|
||||||
|
m_scenes.Clear();
|
||||||
|
m_enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_scenes)
|
||||||
|
{
|
||||||
|
m_scenes.Remove(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OnClientConnect(IClientCore client)
|
void OnClientConnect(IClientCore client)
|
||||||
{
|
{
|
||||||
IClientIM clientIM;
|
IClientIM clientIM;
|
||||||
|
@ -85,15 +126,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_TransferModule =
|
|
||||||
m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
|
|
||||||
|
|
||||||
if (m_TransferModule == null)
|
|
||||||
m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
|
|
||||||
"IM will not work!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -105,9 +137,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
get { return "InstantMessageModule"; }
|
get { return "InstantMessageModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -40,18 +40,17 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
public class MessageTransferModule : IRegionModule, IMessageTransferModule
|
public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
// private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
protected bool m_Gridmode = false;
|
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
|
protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
|
||||||
|
|
||||||
public event UndeliveredMessage OnUndeliveredMessage;
|
public event UndeliveredMessage OnUndeliveredMessage;
|
||||||
|
|
||||||
public virtual void Initialise(Scene scene, IConfigSource config)
|
public virtual void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig cnf = config.Configs["Messaging"];
|
IConfig cnf = config.Configs["Messaging"];
|
||||||
if (cnf != null && cnf.GetString(
|
if (cnf != null && cnf.GetString(
|
||||||
|
@ -62,20 +61,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnf = config.Configs["Startup"];
|
m_Enabled = true;
|
||||||
if (cnf != null)
|
}
|
||||||
m_Gridmode = cnf.GetBoolean("gridmode", false);
|
|
||||||
|
|
||||||
// m_Enabled = true;
|
public virtual void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
{
|
{
|
||||||
if (m_Scenes.Count == 0)
|
|
||||||
{
|
|
||||||
MainServer.Instance.AddXmlRPCHandler(
|
|
||||||
"grid_instant_message", processXMLRPCGridInstantMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
|
m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
|
||||||
scene.RegisterModuleInterface<IMessageTransferModule>(this);
|
scene.RegisterModuleInterface<IMessageTransferModule>(this);
|
||||||
m_Scenes.Add(scene);
|
m_Scenes.Add(scene);
|
||||||
|
@ -84,6 +79,26 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
|
|
||||||
public virtual void PostInitialise()
|
public virtual void PostInitialise()
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MainServer.Instance.AddXmlRPCHandler(
|
||||||
|
"grid_instant_message", processXMLRPCGridInstantMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock(m_Scenes)
|
||||||
|
{
|
||||||
|
m_Scenes.Remove(scene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Close()
|
public virtual void Close()
|
||||||
|
@ -95,9 +110,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
get { return "MessageTransferModule"; }
|
get { return "MessageTransferModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsSharedModule
|
public virtual Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result)
|
public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result)
|
||||||
|
@ -148,15 +163,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Gridmode)
|
|
||||||
{
|
|
||||||
//m_log.DebugFormat("[INSTANT MESSAGE]: Delivering via grid");
|
|
||||||
// Still here, try send via Grid
|
|
||||||
SendGridInstantMessageViaXMLRPC(im, result);
|
SendGridInstantMessageViaXMLRPC(im, result);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleUndeliveredMessage(im, result);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ using OpenSim.Framework.Client;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.MuteList
|
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
public class MuteListModule : IRegionModule
|
public class MuteListModule : ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -47,11 +47,8 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
|
||||||
private List<Scene> m_SceneList = new List<Scene>();
|
private List<Scene> m_SceneList = new List<Scene>();
|
||||||
private string m_RestURL = String.Empty;
|
private string m_RestURL = String.Empty;
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (!enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IConfig cnf = config.Configs["Messaging"];
|
IConfig cnf = config.Configs["Messaging"];
|
||||||
if (cnf == null)
|
if (cnf == null)
|
||||||
{
|
{
|
||||||
|
@ -59,18 +56,13 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnf != null && cnf.GetString(
|
if (cnf != null && cnf.GetString("MuteListModule", "None") !=
|
||||||
"MuteListModule", "None") !=
|
|
||||||
"MuteListModule")
|
"MuteListModule")
|
||||||
{
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_SceneList)
|
|
||||||
{
|
|
||||||
if (m_SceneList.Count == 0)
|
|
||||||
{
|
|
||||||
m_RestURL = cnf.GetString("MuteListURL", "");
|
m_RestURL = cnf.GetString("MuteListURL", "");
|
||||||
if (m_RestURL == "")
|
if (m_RestURL == "")
|
||||||
{
|
{
|
||||||
|
@ -79,19 +71,38 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_SceneList.Contains(scene))
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_SceneList)
|
||||||
|
{
|
||||||
m_SceneList.Add(scene);
|
m_SceneList.Add(scene);
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_SceneList.Count == 0)
|
lock (m_SceneList)
|
||||||
|
{
|
||||||
|
m_SceneList.Remove(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_log.Debug("[MUTE LIST] Mute list enabled");
|
m_log.Debug("[MUTE LIST] Mute list enabled");
|
||||||
|
@ -102,26 +113,15 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
|
||||||
get { return "MuteListModule"; }
|
get { return "MuteListModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// private IClientAPI FindClient(UUID agentID)
|
|
||||||
// {
|
|
||||||
// foreach (Scene s in m_SceneList)
|
|
||||||
// {
|
|
||||||
// ScenePresence presence = s.GetScenePresence(agentID);
|
|
||||||
// if (presence != null && !presence.IsChildAgent)
|
|
||||||
// return presence.ControllingClient;
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void OnNewClient(IClientAPI client)
|
private void OnNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnMuteListRequest += OnMuteListRequest;
|
client.OnMuteListRequest += OnMuteListRequest;
|
||||||
|
|
|
@ -40,37 +40,30 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
public class OfflineMessageModule : IRegionModule
|
public class OfflineMessageModule : ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool enabled = true;
|
private bool enabled = true;
|
||||||
private List<Scene> m_SceneList = new List<Scene>();
|
private List<Scene> m_SceneList = new List<Scene>();
|
||||||
private string m_RestURL = String.Empty;
|
private string m_RestURL = String.Empty;
|
||||||
|
IMessageTransferModule m_TransferModule = null;
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (!enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IConfig cnf = config.Configs["Messaging"];
|
IConfig cnf = config.Configs["Messaging"];
|
||||||
if (cnf == null)
|
if (cnf == null)
|
||||||
{
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cnf != null && cnf.GetString(
|
if (cnf != null && cnf.GetString("OfflineMessageModule", "None") !=
|
||||||
"OfflineMessageModule", "None") !=
|
|
||||||
"OfflineMessageModule")
|
"OfflineMessageModule")
|
||||||
{
|
{
|
||||||
enabled = false;
|
enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_SceneList)
|
|
||||||
{
|
|
||||||
if (m_SceneList.Count == 0)
|
|
||||||
{
|
|
||||||
m_RestURL = cnf.GetString("OfflineMessageURL", "");
|
m_RestURL = cnf.GetString("OfflineMessageURL", "");
|
||||||
if (m_RestURL == "")
|
if (m_RestURL == "")
|
||||||
{
|
{
|
||||||
|
@ -79,40 +72,57 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!m_SceneList.Contains(scene))
|
|
||||||
|
public void AddRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_SceneList)
|
||||||
|
{
|
||||||
m_SceneList.Add(scene);
|
m_SceneList.Add(scene);
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule>();
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
|
||||||
|
enabled = false;
|
||||||
|
m_SceneList.Clear();
|
||||||
|
|
||||||
|
m_log.Error("[OFFLINE MESSAGING] No message transfer module is enabled. Diabling offline messages");
|
||||||
|
}
|
||||||
|
m_TransferModule.OnUndeliveredMessage += UndeliveredMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_SceneList)
|
||||||
|
{
|
||||||
|
m_SceneList.Remove(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_SceneList.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IMessageTransferModule trans = m_SceneList[0].RequestModuleInterface<IMessageTransferModule>();
|
|
||||||
if (trans == null)
|
|
||||||
{
|
|
||||||
enabled = false;
|
|
||||||
|
|
||||||
lock (m_SceneList)
|
|
||||||
{
|
|
||||||
foreach (Scene s in m_SceneList)
|
|
||||||
s.EventManager.OnNewClient -= OnNewClient;
|
|
||||||
|
|
||||||
m_SceneList.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Error("[OFFLINE MESSAGING] No message transfer module is enabled. Diabling offline messages");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
trans.OnUndeliveredMessage += UndeliveredMessage;
|
|
||||||
|
|
||||||
m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled");
|
m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,9 +131,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
get { return "OfflineMessageModule"; }
|
get { return "OfflineMessageModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -39,60 +40,28 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
{
|
{
|
||||||
public class PresenceModule : IRegionModule, IPresenceModule
|
public class PresenceModule : ISharedRegionModule, IPresenceModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private bool m_Enabled = false;
|
|
||||||
private bool m_Gridmode = false;
|
|
||||||
|
|
||||||
// some default scene for doing things that aren't connected to a specific scene. Avoids locking.
|
|
||||||
private Scene m_initialScene;
|
|
||||||
|
|
||||||
private List<Scene> m_Scenes = new List<Scene>();
|
|
||||||
|
|
||||||
// we currently are only interested in root-agents. If the root isn't here, we don't know the region the
|
|
||||||
// user is in, so we have to ask the messaging server anyway.
|
|
||||||
private Dictionary<UUID, Scene> m_RootAgents =
|
|
||||||
new Dictionary<UUID, Scene>();
|
|
||||||
|
|
||||||
public event PresenceChange OnPresenceChange;
|
public event PresenceChange OnPresenceChange;
|
||||||
public event BulkPresenceData OnBulkPresenceData;
|
public event BulkPresenceData OnBulkPresenceData;
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
lock (m_Scenes)
|
|
||||||
{
|
|
||||||
// This is a shared module; Initialise will be called for every region on this server.
|
|
||||||
// Only check config once for the first region.
|
|
||||||
if (m_Scenes.Count == 0)
|
|
||||||
{
|
|
||||||
IConfig cnf = config.Configs["Messaging"];
|
|
||||||
if (cnf != null && cnf.GetString(
|
|
||||||
"PresenceModule", "PresenceModule") !=
|
|
||||||
"PresenceModule")
|
|
||||||
return;
|
|
||||||
|
|
||||||
cnf = config.Configs["Startup"];
|
|
||||||
if (cnf != null)
|
|
||||||
m_Gridmode = cnf.GetBoolean("gridmode", false);
|
|
||||||
|
|
||||||
m_Enabled = true;
|
|
||||||
|
|
||||||
m_initialScene = scene;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Gridmode)
|
public void AddRegion(Scene scene)
|
||||||
NotifyMessageServerOfStartup(scene);
|
{
|
||||||
|
|
||||||
m_Scenes.Add(scene);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IPresenceModule>(this);
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
public void RemoveRegion(Scene scene)
|
||||||
scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
|
{
|
||||||
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -101,26 +70,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
if (!m_Gridmode || !m_Enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (OnPresenceChange != null)
|
|
||||||
{
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
// on shutdown, users are kicked, too
|
|
||||||
foreach (KeyValuePair<UUID, Scene> pair in m_RootAgents)
|
|
||||||
{
|
|
||||||
OnPresenceChange(new PresenceInfo(pair.Key, UUID.Zero));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (m_Scenes)
|
|
||||||
{
|
|
||||||
foreach (Scene scene in m_Scenes)
|
|
||||||
NotifyMessageServerOfShutdown(scene);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -128,315 +77,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||||
get { return "PresenceModule"; }
|
get { return "PresenceModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RequestBulkPresenceData(UUID[] users)
|
public void RequestBulkPresenceData(UUID[] users)
|
||||||
{
|
{
|
||||||
if (OnBulkPresenceData != null)
|
|
||||||
{
|
|
||||||
PresenceInfo[] result = new PresenceInfo[users.Length];
|
|
||||||
if (m_Gridmode)
|
|
||||||
{
|
|
||||||
// first check the local information
|
|
||||||
List<UUID> uuids = new List<UUID>(); // the uuids to check remotely
|
|
||||||
List<int> indices = new List<int>(); // just for performance.
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < uuids.Count; ++i)
|
|
||||||
{
|
|
||||||
Scene scene;
|
|
||||||
if (m_RootAgents.TryGetValue(users[i], out scene))
|
|
||||||
{
|
|
||||||
result[i] = new PresenceInfo(users[i], scene.RegionInfo.RegionID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uuids.Add(users[i]);
|
|
||||||
indices.Add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we have filtered out all the local root agents. The rest we have to request info about
|
|
||||||
Dictionary<UUID, FriendRegionInfo> infos = m_initialScene.GetFriendRegionInfos(uuids);
|
|
||||||
for (int i = 0; i < uuids.Count; ++i)
|
|
||||||
{
|
|
||||||
FriendRegionInfo info;
|
|
||||||
if (infos.TryGetValue(uuids[i], out info) && info.isOnline)
|
|
||||||
{
|
|
||||||
UUID regionID = info.regionID;
|
|
||||||
if (regionID == UUID.Zero)
|
|
||||||
{
|
|
||||||
// TODO this is the old messaging-server protocol; only the regionHandle is available.
|
|
||||||
// Fetch region-info to get the id
|
|
||||||
uint x = 0, y = 0;
|
|
||||||
Utils.LongToUInts(info.regionHandle, out x, out y);
|
|
||||||
GridRegion regionInfo = m_initialScene.GridService.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID,
|
|
||||||
(int)x, (int)y);
|
|
||||||
regionID = regionInfo.RegionID;
|
|
||||||
}
|
|
||||||
result[indices[i]] = new PresenceInfo(uuids[i], regionID);
|
|
||||||
}
|
|
||||||
else result[indices[i]] = new PresenceInfo(uuids[i], UUID.Zero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// in standalone mode, we have all the info locally available.
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < users.Length; ++i)
|
|
||||||
{
|
|
||||||
Scene scene;
|
|
||||||
if (m_RootAgents.TryGetValue(users[i], out scene))
|
|
||||||
{
|
|
||||||
result[i] = new PresenceInfo(users[i], scene.RegionInfo.RegionID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result[i] = new PresenceInfo(users[i], UUID.Zero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// tell everyone
|
|
||||||
OnBulkPresenceData(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// new client doesn't mean necessarily that user logged in, it just means it entered one of the
|
|
||||||
// the regions on this server
|
|
||||||
public void OnNewClient(IClientAPI client)
|
public void OnNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnConnectionClosed += OnConnectionClosed;
|
|
||||||
client.OnLogout += OnLogout;
|
|
||||||
|
|
||||||
// KLUDGE: See handler for details.
|
|
||||||
client.OnEconomyDataRequest += OnEconomyDataRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
// connection closed just means *one* client connection has been closed. It doesn't mean that the
|
|
||||||
// user has logged off; it might have just TPed away.
|
|
||||||
public void OnConnectionClosed(IClientAPI client)
|
|
||||||
{
|
|
||||||
// TODO: Have to think what we have to do here...
|
|
||||||
// Should we just remove the root from the list (if scene matches)?
|
|
||||||
if (!(client.Scene is Scene))
|
|
||||||
return;
|
|
||||||
Scene scene = (Scene)client.Scene;
|
|
||||||
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
Scene rootScene;
|
|
||||||
if (!(m_RootAgents.TryGetValue(client.AgentId, out rootScene)) || scene != rootScene)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_RootAgents.Remove(client.AgentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should it have logged off, we'll do the logout part in OnLogout, even if no root is stored
|
|
||||||
// anymore. It logged off, after all...
|
|
||||||
}
|
|
||||||
|
|
||||||
// Triggered when the user logs off.
|
|
||||||
public void OnLogout(IClientAPI client)
|
|
||||||
{
|
|
||||||
if (!(client.Scene is Scene))
|
|
||||||
return;
|
|
||||||
Scene scene = (Scene)client.Scene;
|
|
||||||
|
|
||||||
// On logout, we really remove the client from rootAgents, even if the scene doesn't match
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
if (m_RootAgents.ContainsKey(client.AgentId)) m_RootAgents.Remove(client.AgentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// now inform the messaging server and anyone who is interested
|
|
||||||
NotifyMessageServerOfAgentLeaving(client.AgentId, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
|
|
||||||
if (OnPresenceChange != null) OnPresenceChange(new PresenceInfo(client.AgentId, UUID.Zero));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnSetRootAgentScene(UUID agentID, Scene scene)
|
|
||||||
{
|
|
||||||
// OnSetRootAgentScene can be called from several threads at once (with different agentID).
|
|
||||||
// Concurrent access to m_RootAgents is prone to failure on multi-core/-processor systems without
|
|
||||||
// correct locking).
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
Scene rootScene;
|
|
||||||
if (m_RootAgents.TryGetValue(agentID, out rootScene) && scene == rootScene)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_RootAgents[agentID] = scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
// inform messaging server that agent changed the region
|
|
||||||
Util.FireAndForget(
|
|
||||||
delegate(object o)
|
|
||||||
{
|
|
||||||
NotifyMessageServerOfAgentLocation(agentID, scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEconomyDataRequest(UUID agentID)
|
|
||||||
{
|
|
||||||
// KLUDGE: This is the only way I found to get a message (only) after login was completed and the
|
|
||||||
// client is connected enough to receive UDP packets.
|
|
||||||
// This packet seems to be sent only once, just after connection was established to the first
|
|
||||||
// region after login.
|
|
||||||
// We use it here to trigger a presence update; the old update-on-login was never be heard by
|
|
||||||
// the freshly logged in viewer, as it wasn't connected to the region at that time.
|
|
||||||
// TODO: Feel free to replace this by a better solution if you find one.
|
|
||||||
|
|
||||||
// get the agent. This should work every time, as we just got a packet from it
|
|
||||||
ScenePresence agent = null;
|
|
||||||
lock (m_Scenes)
|
|
||||||
{
|
|
||||||
foreach (Scene scene in m_Scenes)
|
|
||||||
{
|
|
||||||
agent = scene.GetScenePresence(agentID);
|
|
||||||
if (agent != null) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// just to be paranoid...
|
|
||||||
if (agent == null)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Got a packet from agent {0} who can't be found anymore!?", agentID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we are a bit premature here, but the next packet will switch this child agent to root.
|
|
||||||
if (OnPresenceChange != null) OnPresenceChange(new PresenceInfo(agentID, agent.Scene.RegionInfo.RegionID));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnMakeChildAgent(ScenePresence agent)
|
|
||||||
{
|
|
||||||
// OnMakeChildAgent can be called from several threads at once (with different agent).
|
|
||||||
// Concurrent access to m_RootAgents is prone to failure on multi-core/-processor systems without
|
|
||||||
// correct locking).
|
|
||||||
lock (m_RootAgents)
|
|
||||||
{
|
|
||||||
Scene rootScene;
|
|
||||||
if (m_RootAgents.TryGetValue(agent.UUID, out rootScene) && agent.Scene == rootScene)
|
|
||||||
{
|
|
||||||
m_RootAgents.Remove(agent.UUID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// don't notify the messaging-server; either this agent just had been downgraded and another one will be upgraded
|
|
||||||
// to root momentarily (which will notify the messaging-server), or possibly it will be closed in a moment,
|
|
||||||
// which will update the messaging-server, too.
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyMessageServerOfStartup(Scene scene)
|
|
||||||
{
|
|
||||||
Hashtable xmlrpcdata = new Hashtable();
|
|
||||||
xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString();
|
|
||||||
ArrayList SendParams = new ArrayList();
|
|
||||||
SendParams.Add(xmlrpcdata);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
XmlRpcRequest UpRequest = new XmlRpcRequest("region_startup", SendParams);
|
|
||||||
XmlRpcResponse resp = UpRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)resp.Value;
|
|
||||||
if (responseData == null || (!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of region startup for region {0}", scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyMessageServerOfShutdown(Scene scene)
|
|
||||||
{
|
|
||||||
if (m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL == string.Empty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Hashtable xmlrpcdata = new Hashtable();
|
|
||||||
xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString();
|
|
||||||
ArrayList SendParams = new ArrayList();
|
|
||||||
SendParams.Add(xmlrpcdata);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
XmlRpcRequest DownRequest = new XmlRpcRequest("region_shutdown", SendParams);
|
|
||||||
XmlRpcResponse resp = DownRequest.Send(scene.CommsManager.NetworkServersInfo.MessagingURL, 5000);
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)resp.Value;
|
|
||||||
if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyMessageServerOfAgentLocation(UUID agentID, UUID region, ulong regionHandle)
|
|
||||||
{
|
|
||||||
if (m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL == string.Empty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Hashtable xmlrpcdata = new Hashtable();
|
|
||||||
xmlrpcdata["AgentID"] = agentID.ToString();
|
|
||||||
xmlrpcdata["RegionUUID"] = region.ToString();
|
|
||||||
xmlrpcdata["RegionHandle"] = regionHandle.ToString();
|
|
||||||
ArrayList SendParams = new ArrayList();
|
|
||||||
SendParams.Add(xmlrpcdata);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
XmlRpcRequest LocationRequest = new XmlRpcRequest("agent_location", SendParams);
|
|
||||||
XmlRpcResponse resp = LocationRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)resp.Value;
|
|
||||||
if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of agent location for {0}", agentID.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of agent location for {0}", agentID.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NotifyMessageServerOfAgentLeaving(UUID agentID, UUID region, ulong regionHandle)
|
|
||||||
{
|
|
||||||
if (m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL == string.Empty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Hashtable xmlrpcdata = new Hashtable();
|
|
||||||
xmlrpcdata["AgentID"] = agentID.ToString();
|
|
||||||
xmlrpcdata["RegionUUID"] = region.ToString();
|
|
||||||
xmlrpcdata["RegionHandle"] = regionHandle.ToString();
|
|
||||||
ArrayList SendParams = new ArrayList();
|
|
||||||
SendParams.Add(xmlrpcdata);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
XmlRpcRequest LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams);
|
|
||||||
XmlRpcResponse resp = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);
|
|
||||||
|
|
||||||
Hashtable responseData = (Hashtable)resp.Value;
|
|
||||||
if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of agent leaving for {0}", agentID.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of agent leaving for {0}", agentID.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
{
|
{
|
||||||
public class InventoryTransferModule : IInventoryTransferModule, IRegionModule
|
public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log
|
private static readonly ILog m_log
|
||||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -50,10 +50,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
new Dictionary<UUID, Scene>();
|
new Dictionary<UUID, Scene>();
|
||||||
|
|
||||||
private IMessageTransferModule m_TransferModule = null;
|
private IMessageTransferModule m_TransferModule = null;
|
||||||
|
private bool m_Enabled = true;
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (config.Configs["Messaging"] != null)
|
if (config.Configs["Messaging"] != null)
|
||||||
{
|
{
|
||||||
|
@ -62,11 +63,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
if (config.Configs["Messaging"].GetString(
|
if (config.Configs["Messaging"].GetString(
|
||||||
"InventoryTransferModule", "InventoryTransferModule") !=
|
"InventoryTransferModule", "InventoryTransferModule") !=
|
||||||
"InventoryTransferModule")
|
"InventoryTransferModule")
|
||||||
|
{
|
||||||
|
m_Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_Scenelist.Contains(scene))
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
m_Scenelist.Add(scene);
|
m_Scenelist.Add(scene);
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IInventoryTransferModule>(this);
|
scene.RegisterModuleInterface<IInventoryTransferModule>(this);
|
||||||
|
@ -75,16 +83,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
scene.EventManager.OnClientClosed += ClientLoggedOut;
|
||||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
|
||||||
|
m_Enabled = false;
|
||||||
|
|
||||||
|
m_Scenelist.Clear();
|
||||||
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||||
|
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
scene.EventManager.OnClientClosed -= ClientLoggedOut;
|
||||||
|
scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
|
||||||
|
m_Scenelist.Remove(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (m_Scenelist.Count > 0)
|
|
||||||
{
|
|
||||||
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
|
|
||||||
if (m_TransferModule == null)
|
|
||||||
m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -96,9 +124,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
get { return "InventoryModule"; }
|
get { return "InventoryModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -37,27 +37,33 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Lure
|
namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||||
{
|
{
|
||||||
public class LureModule : IRegionModule
|
public class LureModule : ISharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private readonly List<Scene> m_scenes = new List<Scene>();
|
private readonly List<Scene> m_scenes = new List<Scene>();
|
||||||
|
|
||||||
private IMessageTransferModule m_TransferModule = null;
|
private IMessageTransferModule m_TransferModule = null;
|
||||||
|
private bool m_Enabled = true;
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
if (config.Configs["Messaging"] != null)
|
if (config.Configs["Messaging"] != null)
|
||||||
{
|
{
|
||||||
if (config.Configs["Messaging"].GetString(
|
if (config.Configs["Messaging"].GetString(
|
||||||
"LureModule", "LureModule") !=
|
"LureModule", "LureModule") !=
|
||||||
"LureModule")
|
"LureModule")
|
||||||
return;
|
m_Enabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_scenes)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_scenes.Contains(scene))
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (m_scenes)
|
||||||
{
|
{
|
||||||
m_scenes.Add(scene);
|
m_scenes.Add(scene);
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
|
@ -65,6 +71,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||||
OnGridInstantMessage;
|
OnGridInstantMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_TransferModule =
|
||||||
|
scene.RequestModuleInterface<IMessageTransferModule>();
|
||||||
|
|
||||||
|
if (m_TransferModule == null)
|
||||||
|
{
|
||||||
|
m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
|
||||||
|
"lures will not work!");
|
||||||
|
|
||||||
|
m_Enabled = false;
|
||||||
|
m_scenes.Clear();
|
||||||
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
scene.EventManager.OnIncomingInstantMessage -=
|
||||||
|
OnGridInstantMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRegion(Scene scene)
|
||||||
|
{
|
||||||
|
lock (m_scenes)
|
||||||
|
{
|
||||||
|
m_scenes.Remove(scene);
|
||||||
|
scene.EventManager.OnNewClient -= OnNewClient;
|
||||||
|
scene.EventManager.OnIncomingInstantMessage -=
|
||||||
|
OnGridInstantMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnNewClient(IClientAPI client)
|
void OnNewClient(IClientAPI client)
|
||||||
|
@ -76,12 +114,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
m_TransferModule =
|
|
||||||
m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
|
|
||||||
|
|
||||||
if (m_TransferModule == null)
|
|
||||||
m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
|
|
||||||
"lures will not work!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -93,9 +125,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
|
||||||
get { return "LureModule"; }
|
get { return "LureModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
|
||||||
|
|
|
@ -17,6 +17,14 @@
|
||||||
<RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" />
|
<RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" />
|
||||||
<RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
|
<RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
|
||||||
<RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" />
|
<RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" />
|
||||||
|
<RegionModule id="FriendsModule" type="OpenSim.Region.CoreModules.Avatar.Friends.FriendsModule" />
|
||||||
|
<RegionModule id="PresenceModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.PresenceModule" />
|
||||||
|
<RegionModule id="MuteListModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.MuteListModule" />
|
||||||
|
<RegionModule id="OfflineMessageModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.OfflineMessageModule" />
|
||||||
|
<RegionModule id="InstantMessageModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.InstantMessageModule" />
|
||||||
|
<RegionModule id="MessageTransferModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.MessageTransferModule" />
|
||||||
|
<RegionModule id="LureModule" type="OpenSim.Region.CoreModules.Avatar.Lure.LureModule" />
|
||||||
|
<RegionModule id="InventoryTransferModule" type="OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.InventoryTransferModule" />
|
||||||
<RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" />
|
<RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" />
|
||||||
<RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
|
<RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
|
||||||
<RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
|
<RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
|
||||||
|
|
|
@ -31,13 +31,13 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
public struct PresenceInfo
|
public struct PresenceInfo
|
||||||
{
|
{
|
||||||
public UUID userID;
|
public string UserID;
|
||||||
public UUID regionID;
|
public UUID RegionID;
|
||||||
|
|
||||||
public PresenceInfo(UUID userID, UUID regionID)
|
public PresenceInfo(string userID, UUID regionID)
|
||||||
{
|
{
|
||||||
this.userID = userID;
|
UserID = userID;
|
||||||
this.regionID = regionID;
|
RegionID = regionID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue