aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorUbitUmarov2017-05-11 17:30:57 +0100
committerUbitUmarov2017-05-11 17:30:57 +0100
commit5968c6372a0620a158c88c70b439cb7c3bf256bb (patch)
treedc60212ded72f9d67a86e8c75b0cd932273bfd8f /OpenSim/Region/CoreModules
parent add a grid services god account (diff)
downloadopensim-SC-5968c6372a0620a158c88c70b439cb7c3bf256bb.zip
opensim-SC-5968c6372a0620a158c88c70b439cb7c3bf256bb.tar.gz
opensim-SC-5968c6372a0620a158c88c70b439cb7c3bf256bb.tar.bz2
opensim-SC-5968c6372a0620a158c88c70b439cb7c3bf256bb.tar.xz
let new regions know about grid services god
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs100
1 files changed, 74 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index f699c0c..6e6974a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -59,21 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
59 59
60 /// <summary>Special UUID for actions that apply to all agents</summary> 60 /// <summary>Special UUID for actions that apply to all agents</summary>
61 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); 61 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
62 private static readonly UUID UUID_GRID_GOD = new UUID("6571e388-6218-4574-87db-f9379718315e");
62 63
63 protected Scene m_scene; 64 protected Scene m_scene;
64 protected IDialogModule m_dialogModule; 65 protected IDialogModule m_dialogModule;
65 66
66 protected IDialogModule DialogModule
67 {
68 get
69 {
70 if (m_dialogModule == null)
71 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
72
73 return m_dialogModule;
74 }
75 }
76
77 public void Initialise(IConfigSource source) 67 public void Initialise(IConfigSource source)
78 { 68 {
79 } 69 }
@@ -97,6 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
97 87
98 public void RegionLoaded(Scene scene) 88 public void RegionLoaded(Scene scene)
99 { 89 {
90 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
100 } 91 }
101 92
102 public void Close() {} 93 public void Close() {}
@@ -152,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
152 if (god == null || god.ControllingClient.SessionId != godSessionID) 143 if (god == null || god.ControllingClient.SessionId != godSessionID)
153 return String.Empty; 144 return String.Empty;
154 145
155 KickUser(godID, agentID, kickFlags, Util.StringToBytes1024(reason)); 146 KickUser(godID, agentID, kickFlags, reason);
156 } 147 }
157 else 148 else
158 { 149 {
@@ -173,8 +164,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
173 164
174 sp.GrantGodlikePowers(token, godLike); 165 sp.GrantGodlikePowers(token, godLike);
175 166
176 if (godLike && !sp.IsViewerUIGod && DialogModule != null) 167 if (godLike && !sp.IsViewerUIGod && m_dialogModule != null)
177 DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); 168 m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
169 }
170
171 public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason)
172 {
173 KickUser(godID, agentID, kickflags, Utils.BytesToString(reason));
178 } 174 }
179 175
180 /// <summary> 176 /// <summary>
@@ -184,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
184 /// <param name="agentID">the person that is being kicked</param> 180 /// <param name="agentID">the person that is being kicked</param>
185 /// <param name="kickflags">Tells what to do to the user</param> 181 /// <param name="kickflags">Tells what to do to the user</param>
186 /// <param name="reason">The message to send to the user after it's been turned into a field</param> 182 /// <param name="reason">The message to send to the user after it's been turned into a field</param>
187 public void KickUser(UUID godID, UUID agentID, uint kickflags, byte[] reason) 183 public void KickUser(UUID godID, UUID agentID, uint kickflags, string reason)
188 { 184 {
189 // assuming automatic god rights on this for fast griefing reaction 185 // assuming automatic god rights on this for fast griefing reaction
190 // this is also needed for kick via message 186 // this is also needed for kick via message
@@ -200,10 +196,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
200 if(agentID == ALL_AGENTS) 196 if(agentID == ALL_AGENTS)
201 { 197 {
202 m_scene.ForEachRootScenePresence(delegate(ScenePresence p) 198 m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
199 {
200 if (p.UUID != godID)
203 { 201 {
204 if (p.UUID != godID && godlevel > p.GodController.GodLevel) 202 if(godlevel > p.GodController.GodLevel)
205 doKickmodes(godID, p, kickflags, reason); 203 doKickmodes(godID, p, kickflags, reason);
206 }); 204 else if(m_dialogModule != null)
205 m_dialogModule.SendAlertToUser(p.UUID, "Kick from " + godID.ToString() + " ignored, kick reason: " + reason);
206 }
207 });
207 return; 208 return;
208 } 209 }
209 210
@@ -217,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
217 m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); 218 m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
218 transferModule.SendInstantMessage(new GridInstantMessage( 219 transferModule.SendInstantMessage(new GridInstantMessage(
219 m_scene, godID, "God", agentID, (byte)250, false, 220 m_scene, godID, "God", agentID, (byte)250, false,
220 Utils.BytesToString(reason), UUID.Zero, true, 221 reason, UUID.Zero, true,
221 new Vector3(), new byte[] {(byte)kickflags}, true), 222 new Vector3(), new byte[] {(byte)kickflags}, true),
222 delegate(bool success) {} ); 223 delegate(bool success) {} );
223 } 224 }
@@ -225,7 +226,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
225 } 226 }
226 227
227 if (godlevel <= sp.GodController.GodLevel) // no god wars 228 if (godlevel <= sp.GodController.GodLevel) // no god wars
229 {
230 if(m_dialogModule != null)
231 m_dialogModule.SendAlertToUser(sp.UUID, "Kick from " + godID.ToString() + " ignored, kick reason: " + reason);
228 return; 232 return;
233 }
229 234
230 if(sp.UUID == godID) 235 if(sp.UUID == godID)
231 return; 236 return;
@@ -233,29 +238,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
233 doKickmodes(godID, sp, kickflags, reason); 238 doKickmodes(godID, sp, kickflags, reason);
234 } 239 }
235 240
236 private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, byte[] reason) 241 private void doKickmodes(UUID godID, ScenePresence sp, uint kickflags, string reason)
237 { 242 {
238 switch (kickflags) 243 switch (kickflags)
239 { 244 {
240 case 0: 245 case 0:
241 KickPresence(sp, Utils.BytesToString(reason)); 246 KickPresence(sp, reason);
242 break; 247 break;
243 case 1: 248 case 1:
244 sp.AllowMovement = false; 249 sp.AllowMovement = false;
245 m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason)); 250 if(m_dialogModule != null)
246 m_dialogModule.SendAlertToUser(godID, "User Frozen"); 251 {
252 m_dialogModule.SendAlertToUser(sp.UUID, reason);
253 m_dialogModule.SendAlertToUser(godID, "User Frozen");
254 }
247 break; 255 break;
248 case 2: 256 case 2:
249 sp.AllowMovement = true; 257 sp.AllowMovement = true;
250 m_dialogModule.SendAlertToUser(sp.UUID, Utils.BytesToString(reason)); 258 if(m_dialogModule != null)
251 m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); 259 {
260 m_dialogModule.SendAlertToUser(sp.UUID, reason);
261 m_dialogModule.SendAlertToUser(godID, "User Unfrozen");
262 }
252 break; 263 break;
253 default: 264 default:
254 break; 265 break;
255 } 266 }
256 } 267 }
257 268
258
259 private void KickPresence(ScenePresence sp, string reason) 269 private void KickPresence(ScenePresence sp, string reason)
260 { 270 {
261 if(sp.IsDeleted || sp.IsChildAgent) 271 if(sp.IsDeleted || sp.IsChildAgent)
@@ -264,6 +274,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
264 sp.Scene.CloseAgent(sp.UUID, true); 274 sp.Scene.CloseAgent(sp.UUID, true);
265 } 275 }
266 276
277 public void GridKickUser(UUID agentID, string reason)
278 {
279 int godlevel = 240; // grid god default
280
281 ScenePresence sp = m_scene.GetScenePresence(agentID);
282 if (sp == null || sp.IsChildAgent)
283 {
284 IMessageTransferModule transferModule =
285 m_scene.RequestModuleInterface<IMessageTransferModule>();
286 if (transferModule != null)
287 {
288 m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID);
289 transferModule.SendInstantMessage(new GridInstantMessage(
290 m_scene, UUID_GRID_GOD, "GRID", agentID, (byte)250, false,
291 reason, UUID.Zero, true,
292 new Vector3(), new byte[] {0}, true),
293 delegate(bool success) {} );
294 }
295 return;
296 }
297
298 if(sp.IsDeleted)
299 return;
300
301 if (godlevel <= sp.GodController.GodLevel) // no god wars
302 {
303 if(m_dialogModule != null)
304 m_dialogModule.SendAlertToUser(sp.UUID, "GRID kick detected and ignored, kick reason: " + reason);
305 return;
306 }
307
308 sp.ControllingClient.Kick(reason);
309 sp.Scene.CloseAgent(sp.UUID, true);
310 }
311
267 private void OnIncomingInstantMessage(GridInstantMessage msg) 312 private void OnIncomingInstantMessage(GridInstantMessage msg)
268 { 313 {
269 if (msg.dialog == (uint)250) // Nonlocal kick 314 if (msg.dialog == (uint)250) // Nonlocal kick
@@ -273,7 +318,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
273 UUID godID = new UUID(msg.fromAgentID); 318 UUID godID = new UUID(msg.fromAgentID);
274 uint kickMode = (uint)msg.binaryBucket[0]; 319 uint kickMode = (uint)msg.binaryBucket[0];
275 320
276 KickUser(godID, agentID, kickMode, Util.StringToBytes1024(reason)); 321 if(godID == UUID_GRID_GOD)
322 GridKickUser(agentID, reason);
323 else
324 KickUser(godID, agentID, kickMode, reason);
277 } 325 }
278 } 326 }
279 } 327 }