aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2012-09-15 19:33:51 -0700
committerDiva Canto2012-09-15 19:33:51 -0700
commitde69a24574786f7517e8dc3be62e413f9e0fae22 (patch)
treecd70b7896e636dcd342deef926ddd496c4fd408a
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-de69a24574786f7517e8dc3be62e413f9e0fae22.zip
opensim-SC-de69a24574786f7517e8dc3be62e413f9e0fae22.tar.gz
opensim-SC-de69a24574786f7517e8dc3be62e413f9e0fae22.tar.bz2
opensim-SC-de69a24574786f7517e8dc3be62e413f9e0fae22.tar.xz
More on HG2.0: added the possibility of controlling the appearance that avies use to visit other grids. Not as good as I wanted, but good enough. Unfortunately we can't switch the appearance from under the avie without getting into a lot of weirdnesses because appearance is viewer-controlled. So instead, when this control is on, I'm disallowing HG-TP unless the user is wearing an allowed HG appearance -- the user gets a warning and needs to switch appearance. WARNING: I'm still not committing the config vars because this is still not ready for ppl to test.
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs154
-rw-r--r--OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs1
-rw-r--r--bin/config-include/StandaloneHypergrid.ini1
4 files changed, 173 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index c63b0a4..b51570f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -323,6 +323,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
323 return; 323 return;
324 } 324 }
325 325
326 // Validate assorted conditions
327 string reason = string.Empty;
328 if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason))
329 {
330 sp.ControllingClient.SendTeleportFailed(reason);
331 return;
332 }
333
326 // 334 //
327 // This is it 335 // This is it
328 // 336 //
@@ -354,6 +362,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
354 } 362 }
355 } 363 }
356 364
365 // Nothing to validate here
366 protected virtual bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason)
367 {
368 reason = String.Empty;
369 return true;
370 }
371
357 /// <summary> 372 /// <summary>
358 /// Determines whether this instance is within the max transfer distance. 373 /// Determines whether this instance is within the max transfer distance.
359 /// </summary> 374 /// </summary>
@@ -568,7 +583,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
568 583
569 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); 584 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent...");
570 585
571 if (!UpdateAgent(reg, finalDestination, agent)) 586 if (!UpdateAgent(reg, finalDestination, agent, sp))
572 { 587 {
573 // Region doesn't take it 588 // Region doesn't take it
574 m_log.WarnFormat( 589 m_log.WarnFormat(
@@ -695,7 +710,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
695 return success; 710 return success;
696 } 711 }
697 712
698 protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent) 713 protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent, ScenePresence sp)
699 { 714 {
700 return Scene.SimulationService.UpdateAgent(finalDestination, agent); 715 return Scene.SimulationService.UpdateAgent(finalDestination, agent);
701 } 716 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 08863c2..f3c5873 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -54,6 +54,47 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
54 54
55 private GatekeeperServiceConnector m_GatekeeperConnector; 55 private GatekeeperServiceConnector m_GatekeeperConnector;
56 56
57 protected bool m_RestrictAppearanceAbroad;
58 protected string m_AccountName;
59 protected AvatarAppearance m_ExportedAppearance;
60
61 protected AvatarAppearance ExportedAppearance
62 {
63 get
64 {
65 if (m_ExportedAppearance != null)
66 return m_ExportedAppearance;
67
68 string[] parts = m_AccountName.Split();
69 if (parts.Length != 2)
70 {
71 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Wrong user account name format {0}. Specify 'First Last'", m_AccountName);
72 return null;
73 }
74 UserAccount account = Scene.UserAccountService.GetUserAccount(UUID.Zero, parts[0], parts[1]);
75 if (account == null)
76 {
77 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unknown account {0}", m_AccountName);
78 return null;
79 }
80 m_ExportedAppearance = Scene.AvatarService.GetAppearance(account.PrincipalID);
81 if (m_ExportedAppearance != null)
82 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Successfully retrieved appearance for {0}", m_AccountName);
83
84 foreach (AvatarAttachment att in m_ExportedAppearance.GetAttachments())
85 {
86 InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID);
87 item = Scene.InventoryService.GetItem(item);
88 if (item != null)
89 m_ExportedAppearance.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID);
90 else
91 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to retrieve item {0} from inventory", att.ItemID);
92 }
93 return m_ExportedAppearance;
94 }
95 }
96
97
57 #region ISharedRegionModule 98 #region ISharedRegionModule
58 99
59 public override string Name 100 public override string Name
@@ -72,8 +113,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
72 { 113 {
73 IConfig transferConfig = source.Configs["EntityTransfer"]; 114 IConfig transferConfig = source.Configs["EntityTransfer"];
74 if (transferConfig != null) 115 if (transferConfig != null)
116 {
75 m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); 117 m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
76 118
119 m_RestrictAppearanceAbroad = transferConfig.GetBoolean("RestrictAppearanceAbroad", false);
120 if (m_RestrictAppearanceAbroad)
121 {
122 m_AccountName = transferConfig.GetString("AccountForAppearance", string.Empty);
123 if (m_AccountName == string.Empty)
124 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is on, but no account has been given for avatar appearance!");
125 }
126 }
127
77 InitialiseCommon(source); 128 InitialiseCommon(source);
78 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); 129 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
79 } 130 }
@@ -195,6 +246,109 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
195 return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout); 246 return base.CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout);
196 } 247 }
197 248
249 protected override bool ValidateGenericConditions(ScenePresence sp, GridRegion reg, GridRegion finalDestination, uint teleportFlags, out string reason)
250 {
251 reason = "Please wear your grid's allowed appearance before teleporting to another grid";
252 if (!m_RestrictAppearanceAbroad)
253 return true;
254
255 // The rest is only needed for controlling appearance
256
257 int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
258 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
259 {
260 // this user is going to another grid
261 if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID))
262 {
263 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Checking generic appearance");
264
265 // Check wearables
266 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
267 {
268 for (int j = 0; j < sp.Appearance.Wearables[i].Count; j++)
269 {
270 if (sp.Appearance.Wearables[i] == null)
271 continue;
272
273 if (ExportedAppearance.Wearables[i] == null)
274 {
275 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i);
276 return false;
277 }
278
279 if (sp.Appearance.Wearables[i][j].AssetID != ExportedAppearance.Wearables[i][j].AssetID)
280 {
281 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i);
282 return false;
283 }
284 }
285 }
286
287 // Check attachments
288
289 foreach (AvatarAttachment att in sp.Appearance.GetAttachments())
290 {
291 bool found = false;
292 foreach (AvatarAttachment att2 in ExportedAppearance.GetAttachments())
293 {
294 if (att2.AssetID == att.AssetID)
295 {
296 found = true;
297 break;
298 }
299 }
300 if (!found)
301 {
302 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Attachment not allowed to go outside {0}", att.AttachPoint);
303 return false;
304 }
305 }
306 }
307 }
308
309 reason = string.Empty;
310 return true;
311 }
312
313
314 //protected override bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agentData, ScenePresence sp)
315 //{
316 // int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID);
317 // if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
318 // {
319 // // this user is going to another grid
320 // if (m_RestrictAppearanceAbroad && Scene.UserManagementModule.IsLocalGridUser(agentData.AgentID))
321 // {
322 // // We need to strip the agent off its appearance
323 // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: RestrictAppearanceAbroad is ON. Sending generic appearance");
324
325 // // Delete existing npc attachments
326 // Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
327
328 // // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments
329 // AvatarAppearance newAppearance = new AvatarAppearance(ExportedAppearance, true);
330 // sp.Appearance = newAppearance;
331
332 // // Rez needed npc attachments
333 // Scene.AttachmentsModule.RezAttachments(sp);
334
335
336 // IAvatarFactoryModule module = Scene.RequestModuleInterface<IAvatarFactoryModule>();
337 // //module.SendAppearance(sp.UUID);
338 // module.RequestRebake(sp, false);
339
340 // Scene.AttachmentsModule.CopyAttachments(sp, agentData);
341 // agentData.Appearance = sp.Appearance;
342 // }
343 // }
344
345 // foreach (AvatarAttachment a in agentData.Appearance.GetAttachments())
346 // m_log.DebugFormat("[XXX]: {0}-{1}", a.ItemID, a.AssetID);
347
348
349 // return base.UpdateAgent(reg, finalDestination, agentData, sp);
350 //}
351
198 public override void TeleportHome(UUID id, IClientAPI client) 352 public override void TeleportHome(UUID id, IClientAPI client)
199 { 353 {
200 m_log.DebugFormat( 354 m_log.DebugFormat(
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
index 91cc6eb..556a0da 100644
--- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
+++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs
@@ -573,6 +573,7 @@ namespace OpenSim.Services.HypergridService
573 private bool IsPartOfAppearance(UUID principalID, UUID itemID) 573 private bool IsPartOfAppearance(UUID principalID, UUID itemID)
574 { 574 {
575 AvatarAppearance a = GetAppearance(principalID); 575 AvatarAppearance a = GetAppearance(principalID);
576
576 if (a == null) 577 if (a == null)
577 return false; 578 return false;
578 579
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini
index cc6c587..b0ae351 100644
--- a/bin/config-include/StandaloneHypergrid.ini
+++ b/bin/config-include/StandaloneHypergrid.ini
@@ -153,6 +153,7 @@
153 ; For the InventoryServiceInConnector 153 ; For the InventoryServiceInConnector
154 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInventoryService" 154 LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInventoryService"
155 UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService" 155 UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
156 AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
156 157
157;; The interface that local users get when they are in other grids 158;; The interface that local users get when they are in other grids
158;; This restricts/filters the asset operations from the outside 159;; This restricts/filters the asset operations from the outside