diff options
author | UbitUmarov | 2017-01-05 16:27:17 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-05 16:27:17 +0000 |
commit | d43a3bec19314ecb0610e1600de88c98ac186f17 (patch) | |
tree | 656d9576a468fa581bdbb8448bcc8093c6f22a78 /OpenSim/Region | |
parent | Fix some permissions checks in groups (diff) | |
download | opensim-SC_OLD-d43a3bec19314ecb0610e1600de88c98ac186f17.zip opensim-SC_OLD-d43a3bec19314ecb0610e1600de88c98ac186f17.tar.gz opensim-SC_OLD-d43a3bec19314ecb0610e1600de88c98ac186f17.tar.bz2 opensim-SC_OLD-d43a3bec19314ecb0610e1600de88c98ac186f17.tar.xz |
a few changes to estates and estate teleportHome (used kick)
Diffstat (limited to 'OpenSim/Region')
5 files changed, 78 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 8eb2b1e..efd4ca6 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -71,6 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
71 | public event ChangeDelegate OnRegionInfoChange; | 71 | public event ChangeDelegate OnRegionInfoChange; |
72 | public event ChangeDelegate OnEstateInfoChange; | 72 | public event ChangeDelegate OnEstateInfoChange; |
73 | public event MessageDelegate OnEstateMessage; | 73 | public event MessageDelegate OnEstateMessage; |
74 | public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; | ||
75 | public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; | ||
74 | 76 | ||
75 | private int m_delayCount = 0; | 77 | private int m_delayCount = 0; |
76 | 78 | ||
@@ -1193,13 +1195,20 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1193 | 1195 | ||
1194 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) | 1196 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) |
1195 | { | 1197 | { |
1198 | EstateTeleportOneUserHomeRequest evOverride = OnEstateTeleportOneUserHomeRequest; | ||
1199 | if(evOverride != null) | ||
1200 | { | ||
1201 | evOverride(remover_client, invoice, senderID, prey); | ||
1202 | return; | ||
1203 | } | ||
1204 | |||
1196 | if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) | 1205 | if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) |
1197 | return; | 1206 | return; |
1198 | 1207 | ||
1199 | if (prey != UUID.Zero) | 1208 | if (prey != UUID.Zero) |
1200 | { | 1209 | { |
1201 | ScenePresence s = Scene.GetScenePresence(prey); | 1210 | ScenePresence s = Scene.GetScenePresence(prey); |
1202 | if (s != null) | 1211 | if (s != null && !s.IsDeleted && !s.IsInTransit) |
1203 | { | 1212 | { |
1204 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) | 1213 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
1205 | { | 1214 | { |
@@ -1212,6 +1221,13 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1212 | 1221 | ||
1213 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) | 1222 | private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) |
1214 | { | 1223 | { |
1224 | EstateTeleportAllUsersHomeRequest evOverride = OnEstateTeleportAllUsersHomeRequest; | ||
1225 | if(evOverride != null) | ||
1226 | { | ||
1227 | evOverride(remover_client, invoice, senderID); | ||
1228 | return; | ||
1229 | } | ||
1230 | |||
1215 | if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) | 1231 | if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) |
1216 | return; | 1232 | return; |
1217 | 1233 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs index 73e706c..2c0c882 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateConnector.cs | |||
@@ -46,16 +46,19 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | protected XEstateModule m_EstateModule; | 48 | protected XEstateModule m_EstateModule; |
49 | private string token; | ||
49 | 50 | ||
50 | public EstateConnector(XEstateModule module) | 51 | public EstateConnector(XEstateModule module, string _token) |
51 | { | 52 | { |
52 | m_EstateModule = module; | 53 | m_EstateModule = module; |
54 | token = _token; | ||
53 | } | 55 | } |
54 | 56 | ||
55 | public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID) | 57 | public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID) |
56 | { | 58 | { |
57 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 59 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
58 | sendData["METHOD"] = "teleport_home_one_user"; | 60 | sendData["METHOD"] = "teleport_home_one_user"; |
61 | sendData["TOKEN"] = token; | ||
59 | 62 | ||
60 | sendData["EstateID"] = EstateID.ToString(); | 63 | sendData["EstateID"] = EstateID.ToString(); |
61 | sendData["PreyID"] = PreyID.ToString(); | 64 | sendData["PreyID"] = PreyID.ToString(); |
@@ -67,6 +70,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
67 | { | 70 | { |
68 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 71 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
69 | sendData["METHOD"] = "teleport_home_all_users"; | 72 | sendData["METHOD"] = "teleport_home_all_users"; |
73 | sendData["TOKEN"] = token; | ||
70 | 74 | ||
71 | sendData["EstateID"] = EstateID.ToString(); | 75 | sendData["EstateID"] = EstateID.ToString(); |
72 | 76 | ||
@@ -77,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
77 | { | 81 | { |
78 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 82 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
79 | sendData["METHOD"] = "update_covenant"; | 83 | sendData["METHOD"] = "update_covenant"; |
84 | sendData["TOKEN"] = token; | ||
80 | 85 | ||
81 | sendData["CovenantID"] = CovenantID.ToString(); | 86 | sendData["CovenantID"] = CovenantID.ToString(); |
82 | sendData["EstateID"] = EstateID.ToString(); | 87 | sendData["EstateID"] = EstateID.ToString(); |
@@ -99,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
99 | { | 104 | { |
100 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 105 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
101 | sendData["METHOD"] = "update_estate"; | 106 | sendData["METHOD"] = "update_estate"; |
107 | sendData["TOKEN"] = token; | ||
102 | 108 | ||
103 | sendData["EstateID"] = EstateID.ToString(); | 109 | sendData["EstateID"] = EstateID.ToString(); |
104 | 110 | ||
@@ -119,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
119 | { | 125 | { |
120 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 126 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
121 | sendData["METHOD"] = "estate_message"; | 127 | sendData["METHOD"] = "estate_message"; |
128 | sendData["TOKEN"] = token; | ||
122 | 129 | ||
123 | sendData["EstateID"] = EstateID.ToString(); | 130 | sendData["EstateID"] = EstateID.ToString(); |
124 | sendData["FromID"] = FromID.ToString(); | 131 | sendData["FromID"] = FromID.ToString(); |
@@ -132,47 +139,43 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
132 | { | 139 | { |
133 | List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID); | 140 | List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID); |
134 | 141 | ||
135 | UUID ScopeID = UUID.Zero; | 142 | // Don't send to the same instance twice |
143 | List<string> done = new List<string>(); | ||
136 | 144 | ||
137 | // Handle local regions locally | 145 | // Handle local regions locally |
138 | // | ||
139 | lock (m_EstateModule.Scenes) | 146 | lock (m_EstateModule.Scenes) |
140 | { | 147 | { |
141 | foreach (Scene s in m_EstateModule.Scenes) | 148 | foreach (Scene s in m_EstateModule.Scenes) |
142 | { | 149 | { |
143 | if (regions.Contains(s.RegionInfo.RegionID)) | 150 | RegionInfo sreg = s.RegionInfo; |
151 | if (regions.Contains(sreg.RegionID)) | ||
144 | { | 152 | { |
145 | // All regions in one estate are in the same scope. | 153 | string url = sreg.ExternalHostName + ":" + sreg.HttpPort; |
146 | // Use that scope. | 154 | regions.Remove(sreg.RegionID); |
147 | // | 155 | if(!done.Contains(url)) // we may have older regs with same url lost in dbs |
148 | ScopeID = s.RegionInfo.ScopeID; | 156 | done.Add(url); |
149 | regions.Remove(s.RegionInfo.RegionID); | ||
150 | } | 157 | } |
151 | } | 158 | } |
152 | } | 159 | } |
153 | 160 | ||
154 | // Our own region should always be in the above list. | 161 | if(regions.Count == 0) |
155 | // In a standalone this would not be true. But then, | 162 | return; |
156 | // Scope ID is not relevat there. Use first scope. | ||
157 | // | ||
158 | if (ScopeID == UUID.Zero) | ||
159 | ScopeID = m_EstateModule.Scenes[0].RegionInfo.ScopeID; | ||
160 | 163 | ||
161 | // Don't send to the same instance twice | 164 | Scene baseScene = m_EstateModule.Scenes[0]; |
162 | // | 165 | UUID ScopeID = baseScene.RegionInfo.ScopeID; |
163 | List<string> done = new List<string>(); | 166 | IGridService gridService = baseScene.GridService; |
167 | if(gridService == null) | ||
168 | return; | ||
164 | 169 | ||
165 | // Send to remote regions | 170 | // Send to remote regions |
166 | // | ||
167 | foreach (UUID regionID in regions) | 171 | foreach (UUID regionID in regions) |
168 | { | 172 | { |
169 | GridRegion region = m_EstateModule.Scenes[0].GridService.GetRegionByUUID(ScopeID, regionID); | 173 | GridRegion region = gridService.GetRegionByUUID(ScopeID, regionID); |
170 | if (region != null) | 174 | if (region != null) |
171 | { | 175 | { |
172 | string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; | 176 | string url = region.ExternalHostName + ":" + region.HttpPort; |
173 | if (done.Contains(url)) | 177 | if(done.Contains(url)) |
174 | continue; | 178 | continue; |
175 | |||
176 | Call(region, sendData); | 179 | Call(region, sendData); |
177 | done.Add(url); | 180 | done.Add(url); |
178 | } | 181 | } |
@@ -185,7 +188,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
185 | // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString); | 188 | // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString); |
186 | try | 189 | try |
187 | { | 190 | { |
188 | string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; | 191 | string url = ""; |
192 | if(string.IsNullOrEmpty(region.ServerURI)) | ||
193 | url = "http://" + region.ExternalHostName + ":" + region.HttpPort; | ||
194 | else | ||
195 | url = region.ServerURI; | ||
196 | |||
189 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 197 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
190 | url + "/estate", | 198 | url + "/estate", |
191 | reqString); | 199 | reqString); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs index 4bb3799..a7195af 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs | |||
@@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
51 | 51 | ||
52 | protected List<Scene> m_Scenes = new List<Scene>(); | 52 | protected List<Scene> m_Scenes = new List<Scene>(); |
53 | protected bool m_InInfoUpdate = false; | 53 | protected bool m_InInfoUpdate = false; |
54 | private string token = "7db8eh2gvgg45jj"; | ||
54 | 55 | ||
55 | public bool InInfoUpdate | 56 | public bool InInfoUpdate |
56 | { | 57 | { |
@@ -69,17 +70,19 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
69 | { | 70 | { |
70 | int port = 0; | 71 | int port = 0; |
71 | 72 | ||
72 | IConfig estateConfig = config.Configs["Estate"]; | 73 | IConfig estateConfig = config.Configs["Estates"]; |
73 | if (estateConfig != null) | 74 | if (estateConfig != null) |
74 | { | 75 | { |
75 | port = estateConfig.GetInt("Port", 0); | 76 | port = estateConfig.GetInt("Port", 0); |
77 | // this will need to came from somewhere else | ||
78 | token = estateConfig.GetString("Token", token); | ||
76 | } | 79 | } |
77 | 80 | ||
78 | m_EstateConnector = new EstateConnector(this); | 81 | m_EstateConnector = new EstateConnector(this, token); |
79 | 82 | ||
80 | // Instantiate the request handler | 83 | // Instantiate the request handler |
81 | IHttpServer server = MainServer.GetHttpServer((uint)port); | 84 | IHttpServer server = MainServer.GetHttpServer((uint)port); |
82 | server.AddStreamHandler(new EstateRequestHandler(this)); | 85 | server.AddStreamHandler(new EstateRequestHandler(this, token)); |
83 | } | 86 | } |
84 | 87 | ||
85 | public void PostInitialise() | 88 | public void PostInitialise() |
@@ -94,8 +97,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
94 | { | 97 | { |
95 | lock (m_Scenes) | 98 | lock (m_Scenes) |
96 | m_Scenes.Add(scene); | 99 | m_Scenes.Add(scene); |
97 | |||
98 | scene.EventManager.OnNewClient += OnNewClient; | ||
99 | } | 100 | } |
100 | 101 | ||
101 | public void RegionLoaded(Scene scene) | 102 | public void RegionLoaded(Scene scene) |
@@ -105,12 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
105 | em.OnRegionInfoChange += OnRegionInfoChange; | 106 | em.OnRegionInfoChange += OnRegionInfoChange; |
106 | em.OnEstateInfoChange += OnEstateInfoChange; | 107 | em.OnEstateInfoChange += OnEstateInfoChange; |
107 | em.OnEstateMessage += OnEstateMessage; | 108 | em.OnEstateMessage += OnEstateMessage; |
109 | em.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest; | ||
110 | em.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest; | ||
108 | } | 111 | } |
109 | 112 | ||
110 | public void RemoveRegion(Scene scene) | 113 | public void RemoveRegion(Scene scene) |
111 | { | 114 | { |
112 | scene.EventManager.OnNewClient -= OnNewClient; | ||
113 | |||
114 | lock (m_Scenes) | 115 | lock (m_Scenes) |
115 | m_Scenes.Remove(scene); | 116 | m_Scenes.Remove(scene); |
116 | } | 117 | } |
@@ -181,13 +182,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
181 | m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message); | 182 | m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message); |
182 | } | 183 | } |
183 | 184 | ||
184 | private void OnNewClient(IClientAPI client) | ||
185 | { | ||
186 | client.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest; | ||
187 | client.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest; | ||
188 | |||
189 | } | ||
190 | |||
191 | private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey) | 185 | private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey) |
192 | { | 186 | { |
193 | if (prey == UUID.Zero) | 187 | if (prey == UUID.Zero) |
@@ -205,16 +199,18 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
205 | 199 | ||
206 | foreach (Scene s in Scenes) | 200 | foreach (Scene s in Scenes) |
207 | { | 201 | { |
208 | if (s == scene) | ||
209 | continue; // Already handles by estate module | ||
210 | if (s.RegionInfo.EstateSettings.EstateID != estateID) | 202 | if (s.RegionInfo.EstateSettings.EstateID != estateID) |
211 | continue; | 203 | continue; |
212 | 204 | ||
213 | ScenePresence p = scene.GetScenePresence(prey); | 205 | ScenePresence p = scene.GetScenePresence(prey); |
214 | if (p != null && !p.IsChildAgent) | 206 | if (p != null && !p.IsChildAgent ) |
215 | { | 207 | { |
216 | p.ControllingClient.SendTeleportStart(16); | 208 | if(!p.IsDeleted && !p.IsInTransit) |
217 | scene.TeleportClientHome(prey, p.ControllingClient); | 209 | { |
210 | p.ControllingClient.SendTeleportStart(16); | ||
211 | scene.TeleportClientHome(prey, p.ControllingClient); | ||
212 | } | ||
213 | return; | ||
218 | } | 214 | } |
219 | } | 215 | } |
220 | 216 | ||
@@ -235,8 +231,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
235 | 231 | ||
236 | foreach (Scene s in Scenes) | 232 | foreach (Scene s in Scenes) |
237 | { | 233 | { |
238 | if (s == scene) | ||
239 | continue; // Already handles by estate module | ||
240 | if (s.RegionInfo.EstateSettings.EstateID != estateID) | 234 | if (s.RegionInfo.EstateSettings.EstateID != estateID) |
241 | continue; | 235 | continue; |
242 | 236 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs index 1dcaed3..756b54d 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs | |||
@@ -48,11 +48,13 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
48 | 48 | ||
49 | protected XEstateModule m_EstateModule; | 49 | protected XEstateModule m_EstateModule; |
50 | protected Object m_RequestLock = new Object(); | 50 | protected Object m_RequestLock = new Object(); |
51 | private string token; | ||
51 | 52 | ||
52 | public EstateRequestHandler(XEstateModule fmodule) | 53 | public EstateRequestHandler(XEstateModule fmodule, string _token) |
53 | : base("POST", "/estate") | 54 | : base("POST", "/estate") |
54 | { | 55 | { |
55 | m_EstateModule = fmodule; | 56 | m_EstateModule = fmodule; |
57 | token = _token; | ||
56 | } | 58 | } |
57 | 59 | ||
58 | protected override byte[] ProcessRequest(string path, Stream requestData, | 60 | protected override byte[] ProcessRequest(string path, Stream requestData, |
@@ -75,6 +77,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
75 | if (!request.ContainsKey("METHOD")) | 77 | if (!request.ContainsKey("METHOD")) |
76 | return FailureResult(); | 78 | return FailureResult(); |
77 | 79 | ||
80 | if (!request.ContainsKey("TOKEN")) | ||
81 | return FailureResult(); | ||
82 | |||
83 | string reqToken = request["TOKEN"].ToString(); | ||
84 | request.Remove("TOKEN"); | ||
85 | |||
86 | if(token != reqToken) | ||
87 | return FailureResult(); | ||
88 | |||
78 | string method = request["METHOD"].ToString(); | 89 | string method = request["METHOD"].ToString(); |
79 | request.Remove("METHOD"); | 90 | request.Remove("METHOD"); |
80 | 91 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 461c880..6b8b999 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | event ChangeDelegate OnRegionInfoChange; | 39 | event ChangeDelegate OnRegionInfoChange; |
40 | event ChangeDelegate OnEstateInfoChange; | 40 | event ChangeDelegate OnEstateInfoChange; |
41 | event MessageDelegate OnEstateMessage; | 41 | event MessageDelegate OnEstateMessage; |
42 | event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; | ||
43 | event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; | ||
42 | 44 | ||
43 | uint GetRegionFlags(); | 45 | uint GetRegionFlags(); |
44 | bool IsManager(UUID avatarID); | 46 | bool IsManager(UUID avatarID); |