29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
36 using OpenSim.Framework;
37 using OpenSim.Region.Framework.Interfaces;
38 using OpenSim.Region.Framework.Scenes;
39 using OpenSim.Services.Interfaces;
40 using OpenSim.Server.Base;
41 using OpenSim.Framework.Servers;
42 using OpenSim.Framework.Servers.HttpServer;
47 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"XEstate")]
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 protected List<Scene> m_Scenes =
new List<Scene>();
53 protected bool m_InInfoUpdate =
false;
55 public bool InInfoUpdate
57 get {
return m_InInfoUpdate; }
58 set { m_InInfoUpdate = value; }
61 public List<Scene> Scenes
63 get {
return m_Scenes; }
72 IConfig estateConfig = config.Configs[
"Estate"];
73 if (estateConfig != null)
75 port = estateConfig.GetInt(
"Port", 0);
81 IHttpServer server = MainServer.GetHttpServer((uint)port);
98 scene.EventManager.OnNewClient += OnNewClient;
105 em.OnRegionInfoChange += OnRegionInfoChange;
106 em.OnEstateInfoChange += OnEstateInfoChange;
107 em.OnEstateMessage += OnEstateMessage;
112 scene.EventManager.OnNewClient -= OnNewClient;
115 m_Scenes.Remove(scene);
120 get {
return "EstateModule"; }
123 public Type ReplaceableInterface
128 private Scene FindScene(UUID RegionID)
130 foreach (
Scene s
in Scenes)
139 private void OnRegionInfoChange(UUID RegionID)
141 Scene s = FindScene(RegionID);
146 m_EstateConnector.SendUpdateCovenant(s.RegionInfo.EstateSettings.EstateID, s.RegionInfo.RegionSettings.Covenant);
149 private void OnEstateInfoChange(UUID RegionID)
151 Scene s = FindScene(RegionID);
156 m_EstateConnector.SendUpdateEstate(s.RegionInfo.EstateSettings.EstateID);
159 private void OnEstateMessage(UUID RegionID, UUID FromID,
string FromName,
string Message)
161 Scene senderScenes = FindScene(RegionID);
162 if (senderScenes == null)
165 uint estateID = senderScenes.RegionInfo.EstateSettings.EstateID;
167 foreach (
Scene s
in Scenes)
175 dm.SendNotificationToUsersInRegion(FromID, FromName,
181 m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message);
186 client.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
187 client.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
191 private void OnEstateTeleportOneUserHomeRequest(
IClientAPI client, UUID invoice, UUID senderID, UUID prey)
193 if (prey ==
UUID.Zero)
199 Scene scene = (Scene)client.
Scene;
206 foreach (Scene s
in Scenes)
216 p.ControllingClient.SendTeleportStart(16);
217 scene.TeleportClientHome(prey, p.ControllingClient);
221 m_EstateConnector.SendTeleportHomeOneUser(estateID, prey);
224 private void OnEstateTeleportAllUsersHomeRequest(
IClientAPI client, UUID invoice, UUID senderID)
226 if (!(client.
Scene is Scene))
229 Scene scene = (Scene)client.
Scene;
236 foreach (Scene s
in Scenes)
246 p.ControllingClient.SendTeleportStart(16);
247 scene.TeleportClientHome(p.ControllingClient.AgentId, p.ControllingClient);
252 m_EstateConnector.SendTeleportHomeAllUsers(estateID);
EstateSettings EstateSettings
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) for given URLs.
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
ScenePermissions Permissions
bool CanIssueEstateCommand(UUID user, bool ownerCommand)
virtual RegionInfo RegionInfo
EstateConnector m_EstateConnector