diff options
Diffstat (limited to 'OpenSim')
3 files changed, 71 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 0f1a381..4c786ff 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -56,41 +56,54 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
56 | 56 | ||
57 | protected bool m_RestrictAppearanceAbroad; | 57 | protected bool m_RestrictAppearanceAbroad; |
58 | protected string m_AccountName; | 58 | protected string m_AccountName; |
59 | protected AvatarAppearance m_ExportedAppearance; | 59 | protected List<AvatarAppearance> m_ExportedAppearances; |
60 | protected List<AvatarAttachment> m_Attachs; | ||
60 | 61 | ||
61 | protected AvatarAppearance ExportedAppearance | 62 | protected List<AvatarAppearance> ExportedAppearance |
62 | { | 63 | { |
63 | get | 64 | get |
64 | { | 65 | { |
65 | if (m_ExportedAppearance != null) | 66 | if (m_ExportedAppearances != null) |
66 | return m_ExportedAppearance; | 67 | return m_ExportedAppearances; |
67 | 68 | ||
68 | string[] parts = m_AccountName.Split(); | 69 | m_ExportedAppearances = new List<AvatarAppearance>(); |
69 | if (parts.Length != 2) | 70 | m_Attachs = new List<AvatarAttachment>(); |
70 | { | 71 | |
71 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Wrong user account name format {0}. Specify 'First Last'", m_AccountName); | 72 | string[] names = m_AccountName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); |
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 | 73 | ||
84 | foreach (AvatarAttachment att in m_ExportedAppearance.GetAttachments()) | 74 | foreach (string name in names) |
85 | { | 75 | { |
86 | InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID); | 76 | string[] parts = name.Trim().Split(); |
87 | item = Scene.InventoryService.GetItem(item); | 77 | if (parts.Length != 2) |
88 | if (item != null) | 78 | { |
89 | m_ExportedAppearance.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID); | 79 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Wrong user account name format {0}. Specify 'First Last'", name); |
90 | else | 80 | return null; |
91 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to retrieve item {0} from inventory", att.ItemID); | 81 | } |
82 | UserAccount account = Scene.UserAccountService.GetUserAccount(UUID.Zero, parts[0], parts[1]); | ||
83 | if (account == null) | ||
84 | { | ||
85 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unknown account {0}", m_AccountName); | ||
86 | return null; | ||
87 | } | ||
88 | AvatarAppearance a = Scene.AvatarService.GetAppearance(account.PrincipalID); | ||
89 | if (a != null) | ||
90 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Successfully retrieved appearance for {0}", name); | ||
91 | |||
92 | foreach (AvatarAttachment att in a.GetAttachments()) | ||
93 | { | ||
94 | InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID); | ||
95 | item = Scene.InventoryService.GetItem(item); | ||
96 | if (item != null) | ||
97 | a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID); | ||
98 | else | ||
99 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to retrieve item {0} from inventory {1}", att.ItemID, name); | ||
100 | } | ||
101 | |||
102 | m_ExportedAppearances.Add(a); | ||
103 | m_Attachs.AddRange(a.GetAttachments()); | ||
92 | } | 104 | } |
93 | return m_ExportedAppearance; | 105 | |
106 | return m_ExportedAppearances; | ||
94 | } | 107 | } |
95 | } | 108 | } |
96 | 109 | ||
@@ -275,13 +288,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
275 | if (sp.Appearance.Wearables[i] == null) | 288 | if (sp.Appearance.Wearables[i] == null) |
276 | continue; | 289 | continue; |
277 | 290 | ||
278 | if (ExportedAppearance.Wearables[i] == null) | 291 | bool found = false; |
292 | foreach (AvatarAppearance a in ExportedAppearance) | ||
293 | if (a.Wearables[i] != null) | ||
294 | { | ||
295 | found = true; | ||
296 | break; | ||
297 | } | ||
298 | |||
299 | if (!found) | ||
279 | { | 300 | { |
280 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i); | 301 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i); |
281 | return false; | 302 | return false; |
282 | } | 303 | } |
283 | 304 | ||
284 | if (sp.Appearance.Wearables[i][j].AssetID != ExportedAppearance.Wearables[i][j].AssetID) | 305 | found = false; |
306 | foreach (AvatarAppearance a in ExportedAppearance) | ||
307 | if (sp.Appearance.Wearables[i][j].AssetID == a.Wearables[i][j].AssetID) | ||
308 | { | ||
309 | found = true; | ||
310 | break; | ||
311 | } | ||
312 | |||
313 | if (!found) | ||
285 | { | 314 | { |
286 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i); | 315 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Wearable not allowed to go outside {0}", i); |
287 | return false; | 316 | return false; |
@@ -290,11 +319,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
290 | } | 319 | } |
291 | 320 | ||
292 | // Check attachments | 321 | // Check attachments |
293 | |||
294 | foreach (AvatarAttachment att in sp.Appearance.GetAttachments()) | 322 | foreach (AvatarAttachment att in sp.Appearance.GetAttachments()) |
295 | { | 323 | { |
296 | bool found = false; | 324 | bool found = false; |
297 | foreach (AvatarAttachment att2 in ExportedAppearance.GetAttachments()) | 325 | foreach (AvatarAttachment att2 in m_Attachs) |
298 | { | 326 | { |
299 | if (att2.AssetID == att.AssetID) | 327 | if (att2.AssetID == att.AssetID) |
300 | { | 328 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a5fcf4d..ee5f6df 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5943,6 +5943,9 @@ Environment.Exit(1); | |||
5943 | 5943 | ||
5944 | public string GetExtraSetting(string name) | 5944 | public string GetExtraSetting(string name) |
5945 | { | 5945 | { |
5946 | if (m_extraSettings == null) | ||
5947 | return String.Empty; | ||
5948 | |||
5946 | string val; | 5949 | string val; |
5947 | 5950 | ||
5948 | if (!m_extraSettings.TryGetValue(name, out val)) | 5951 | if (!m_extraSettings.TryGetValue(name, out val)) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs index 31d0034..17971e3 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs | |||
@@ -130,37 +130,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
130 | SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val)); | 130 | SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val)); |
131 | } | 131 | } |
132 | 132 | ||
133 | private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) | 133 | private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) |
134 | { | 134 | { |
135 | SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); | 135 | SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); |
136 | 136 | ||
137 | if (hostPart == null) | 137 | if (hostPart == null) |
138 | return; | 138 | return 0; |
139 | 139 | ||
140 | if (hostPart.ParentGroup.IsAttachment) | 140 | if (hostPart.ParentGroup.IsAttachment) |
141 | return; | 141 | return 0; |
142 | 142 | ||
143 | IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>(); | 143 | IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>(); |
144 | if (attachmentsModule == null) | 144 | if (attachmentsModule == null) |
145 | return; | 145 | return 0; |
146 | 146 | ||
147 | TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script); | 147 | TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script); |
148 | if (item == null) | 148 | if (item == null) |
149 | return; | 149 | return 0; |
150 | 150 | ||
151 | if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH | 151 | if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH |
152 | return; | 152 | return 0; |
153 | 153 | ||
154 | ScenePresence target; | 154 | ScenePresence target; |
155 | if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) | 155 | if (!m_scene.TryGetScenePresence(item.PermsGranter, out target)) |
156 | return; | 156 | return 0; |
157 | 157 | ||
158 | if (target.UUID != hostPart.ParentGroup.OwnerID) | 158 | if (target.UUID != hostPart.ParentGroup.OwnerID) |
159 | { | 159 | { |
160 | uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); | 160 | uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions(); |
161 | 161 | ||
162 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) | 162 | if ((effectivePerms & (uint)PermissionMask.Transfer) == 0) |
163 | return; | 163 | return 0; |
164 | 164 | ||
165 | hostPart.ParentGroup.SetOwnerId(target.UUID); | 165 | hostPart.ParentGroup.SetOwnerId(target.UUID); |
166 | hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId); | 166 | hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId); |
@@ -183,7 +183,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments | |||
183 | hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); | 183 | hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); |
184 | } | 184 | } |
185 | 185 | ||
186 | attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true); | 186 | return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true) ? 1 : 0; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |