diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
12 files changed, 178 insertions, 60 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d458364..f54e41a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | 37 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 38 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
39 | { | 39 | { |
40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule | 40 | public class AttachmentsModule : IAttachmentsModule, IRegionModule |
41 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -67,6 +67,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
67 | get { return false; } | 67 | get { return false; } |
68 | } | 68 | } |
69 | 69 | ||
70 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) | ||
71 | { | ||
72 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | ||
73 | |||
74 | // If we can't take it, we can't attach it! | ||
75 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); | ||
76 | if (part == null) | ||
77 | return; | ||
78 | |||
79 | if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) | ||
80 | return; | ||
81 | |||
82 | // Calls attach with a Zero position | ||
83 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) | ||
84 | { | ||
85 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | ||
86 | |||
87 | // Save avatar attachment information | ||
88 | ScenePresence presence; | ||
89 | if (m_scene.AvatarFactory != null && m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
90 | { | ||
91 | m_log.Info( | ||
92 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
93 | + ", AttachmentPoint: " + AttachmentPt); | ||
94 | |||
95 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | |||
70 | public bool AttachObject( | 100 | public bool AttachObject( |
71 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) | 101 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) |
72 | { | 102 | { |
@@ -138,12 +168,87 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
138 | 168 | ||
139 | return true; | 169 | return true; |
140 | } | 170 | } |
171 | |||
172 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
173 | { | ||
174 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | ||
175 | |||
176 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); | ||
177 | } | ||
178 | |||
179 | public UUID RezSingleAttachmentFromInventory( | ||
180 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | ||
181 | { | ||
182 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | ||
183 | |||
184 | if (updateInventoryStatus) | ||
185 | { | ||
186 | if (att == null) | ||
187 | { | ||
188 | ShowDetachInUserInventory(itemID, remoteClient); | ||
189 | } | ||
190 | |||
191 | SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); | ||
192 | } | ||
193 | |||
194 | if (null == att) | ||
195 | return UUID.Zero; | ||
196 | else | ||
197 | return att.UUID; | ||
198 | } | ||
199 | |||
200 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | ||
201 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
202 | { | ||
203 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
204 | if (invAccess != null) | ||
205 | { | ||
206 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, | ||
207 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
208 | false, false, remoteClient.AgentId, true); | ||
209 | |||
210 | // m_log.DebugFormat( | ||
211 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
212 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
213 | |||
214 | if (objatt != null) | ||
215 | { | ||
216 | bool tainted = false; | ||
217 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | ||
218 | tainted = true; | ||
219 | |||
220 | AttachObject( | ||
221 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
222 | //objatt.ScheduleGroupForFullUpdate(); | ||
223 | |||
224 | if (tainted) | ||
225 | objatt.HasGroupChanged = true; | ||
226 | |||
227 | // Fire after attach, so we don't get messy perms dialogs | ||
228 | // 3 == AttachedRez | ||
229 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | ||
230 | |||
231 | // Do this last so that event listeners have access to all the effects of the attachment | ||
232 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | m_log.WarnFormat( | ||
237 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
238 | itemID, remoteClient.Name, AttachmentPt); | ||
239 | } | ||
240 | |||
241 | return objatt; | ||
242 | } | ||
243 | |||
244 | return null; | ||
245 | } | ||
141 | 246 | ||
142 | public UUID SetAttachmentInventoryStatus( | 247 | public UUID SetAttachmentInventoryStatus( |
143 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 248 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
144 | { | 249 | { |
145 | m_log.DebugFormat( | 250 | m_log.DebugFormat( |
146 | "[ATTACHMENTS MODULEY]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | 251 | "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", |
147 | remoteClient.Name, att.Name, itemID); | 252 | remoteClient.Name, att.Name, itemID); |
148 | 253 | ||
149 | if (!att.IsDeleted) | 254 | if (!att.IsDeleted) |
@@ -204,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
204 | if (m_scene.AvatarFactory != null) | 309 | if (m_scene.AvatarFactory != null) |
205 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 310 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); |
206 | } | 311 | } |
207 | } | 312 | } |
208 | 313 | ||
209 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) | 314 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) |
210 | { | 315 | { |
@@ -222,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
222 | } | 327 | } |
223 | 328 | ||
224 | DetachSingleAttachmentToInv(itemID, remoteClient); | 329 | DetachSingleAttachmentToInv(itemID, remoteClient); |
225 | } | 330 | } |
226 | 331 | ||
227 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | 332 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. |
228 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | 333 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? |
@@ -252,6 +357,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
252 | } | 357 | } |
253 | } | 358 | } |
254 | } | 359 | } |
255 | } | 360 | } |
256 | } | 361 | } |
257 | } \ No newline at end of file | 362 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index de324c0..312db38 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -394,11 +394,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
394 | public IClientAPI LocateClientObject(UUID agentID) | 394 | public IClientAPI LocateClientObject(UUID agentID) |
395 | { | 395 | { |
396 | Scene scene = GetClientScene(agentID); | 396 | Scene scene = GetClientScene(agentID); |
397 | if(scene == null) | 397 | if (scene == null) |
398 | return null; | 398 | return null; |
399 | 399 | ||
400 | ScenePresence presence = scene.GetScenePresence(agentID); | 400 | ScenePresence presence = scene.GetScenePresence(agentID); |
401 | if(presence == null) | 401 | if (presence == null) |
402 | return null; | 402 | return null; |
403 | 403 | ||
404 | return presence.ControllingClient; | 404 | return presence.ControllingClient; |
@@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
481 | m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID); | 481 | m_log.DebugFormat("[FRIENDS]: {0} offered friendship to {1}", principalID, friendID); |
482 | 482 | ||
483 | // This user wants to be friends with the other user. | 483 | // This user wants to be friends with the other user. |
484 | // Let's add both relations to the DB, but one of them is inactive (-1) | 484 | // Let's add the relation backwards, in case the other is not online |
485 | FriendsService.StoreFriend(friendID, principalID.ToString(), 0); | 485 | FriendsService.StoreFriend(friendID, principalID.ToString(), 0); |
486 | 486 | ||
487 | // Now let's ask the other user to be friends with this user | 487 | // Now let's ask the other user to be friends with this user |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index c0d3f31..ad050a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
108 | if (!m_Enabled) | 108 | if (!m_Enabled) |
109 | return; | 109 | return; |
110 | 110 | ||
111 | lock(m_Scenes) | 111 | lock (m_Scenes) |
112 | { | 112 | { |
113 | m_Scenes.Remove(scene); | 113 | m_Scenes.Remove(scene); |
114 | } | 114 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 0fc467b..16e05b7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -576,7 +576,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
576 | foreach (SceneObjectPart part in partList) | 576 | foreach (SceneObjectPart part in partList) |
577 | { | 577 | { |
578 | if (part.OwnerID != item.Owner) | 578 | if (part.OwnerID != item.Owner) |
579 | { | 579 | { |
580 | part.LastOwnerID = part.OwnerID; | 580 | part.LastOwnerID = part.OwnerID; |
581 | part.OwnerID = item.Owner; | 581 | part.OwnerID = item.Owner; |
582 | part.Inventory.ChangeInventoryOwner(item.Owner); | 582 | part.Inventory.ChangeInventoryOwner(item.Owner); |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 0195c03..aaa318c 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -56,6 +56,9 @@ | |||
56 | <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> | 56 | <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> |
57 | <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" /> | 57 | <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" /> |
58 | <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" /> | 58 | <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" /> |
59 | |||
60 | <RegionModule id="LocalGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.LocalGridUserServicesConnector" /> | ||
61 | |||
59 | <RegionModule id="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" /> | 62 | <RegionModule id="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" /> |
60 | <RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" /> | 63 | <RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" /> |
61 | <!-- Service connectors IN modules --> | 64 | <!-- Service connectors IN modules --> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index 292ff8e..63a28fc 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
61 | m_LocalConnector = new LocalPresenceServicesConnector(config); | 61 | m_LocalConnector = new LocalPresenceServicesConnector(config); |
62 | 62 | ||
63 | // Let's stick in a test presence | 63 | // Let's stick in a test presence |
64 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); | 64 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); |
65 | } | 65 | } |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
80 | p.Data = new Dictionary<string, string>(); | 80 | p.Data = new Dictionary<string, string>(); |
81 | p.Data["Online"] = true.ToString(); | 81 | p.Data["Online"] = true.ToString(); |
82 | m_presenceData.Add(UUID.Zero, p); | 82 | m_presenceData.Add(UUID.Zero, p); |
83 | */ | 83 | */ |
84 | 84 | ||
85 | string user1 = UUID.Zero.ToString(); | 85 | string user1 = UUID.Zero.ToString(); |
86 | UUID session1 = UUID.Zero; | 86 | UUID session1 = UUID.Zero; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 07fee79..30ebb21 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -73,33 +73,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
73 | IConfig userConfig = source.Configs["UserAccountService"]; | 73 | IConfig userConfig = source.Configs["UserAccountService"]; |
74 | if (userConfig == null) | 74 | if (userConfig == null) |
75 | { | 75 | { |
76 | m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpenSim.ini"); | 76 | m_log.Error("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: UserAccountService missing from OpenSim.ini"); |
77 | return; | 77 | return; |
78 | } | 78 | } |
79 | 79 | ||
80 | string serviceDll = userConfig.GetString("LocalServiceModule", | 80 | string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty); |
81 | String.Empty); | ||
82 | 81 | ||
83 | if (serviceDll == String.Empty) | 82 | if (serviceDll == String.Empty) |
84 | { | 83 | { |
85 | m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section UserService"); | 84 | m_log.Error("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: No LocalServiceModule named in section UserService"); |
86 | return; | 85 | return; |
87 | } | 86 | } |
88 | 87 | ||
89 | Object[] args = new Object[] { source }; | 88 | Object[] args = new Object[] { source }; |
90 | m_UserService = | 89 | m_UserService = ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, args); |
91 | ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, | ||
92 | args); | ||
93 | 90 | ||
94 | if (m_UserService == null) | 91 | if (m_UserService == null) |
95 | { | 92 | { |
96 | m_log.Error("[USER CONNECTOR]: Can't load user account service"); | 93 | m_log.ErrorFormat( |
94 | "[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll); | ||
97 | return; | 95 | return; |
98 | } | 96 | } |
99 | m_Enabled = true; | 97 | m_Enabled = true; |
100 | m_Cache = new UserAccountCache(); | 98 | m_Cache = new UserAccountCache(); |
101 | 99 | ||
102 | m_log.Info("[USER CONNECTOR]: Local user connector enabled"); | 100 | m_log.Info("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Local user connector enabled"); |
103 | } | 101 | } |
104 | } | 102 | } |
105 | } | 103 | } |
@@ -134,6 +132,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
134 | { | 132 | { |
135 | if (!m_Enabled) | 133 | if (!m_Enabled) |
136 | return; | 134 | return; |
135 | |||
136 | m_log.InfoFormat("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Enabled local user accounts for region {0}", scene.RegionInfo.RegionName); | ||
137 | } | 137 | } |
138 | 138 | ||
139 | #endregion | 139 | #endregion |
@@ -142,26 +142,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
142 | 142 | ||
143 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | 143 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
144 | { | 144 | { |
145 | UserAccount account = m_Cache.Get(userID); | 145 | bool inCache = false; |
146 | if (account != null) | 146 | UserAccount account = m_Cache.Get(userID, out inCache); |
147 | if (inCache) | ||
147 | return account; | 148 | return account; |
148 | 149 | ||
149 | account = m_UserService.GetUserAccount(scopeID, userID); | 150 | account = m_UserService.GetUserAccount(scopeID, userID); |
150 | if (account != null) | 151 | m_Cache.Cache(userID, account); |
151 | m_Cache.Cache(account); | ||
152 | 152 | ||
153 | return account; | 153 | return account; |
154 | } | 154 | } |
155 | 155 | ||
156 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 156 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
157 | { | 157 | { |
158 | UserAccount account = m_Cache.Get(firstName + " " + lastName); | 158 | bool inCache = false; |
159 | if (account != null) | 159 | UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); |
160 | if (inCache) | ||
160 | return account; | 161 | return account; |
161 | 162 | ||
162 | account = m_UserService.GetUserAccount(scopeID, firstName, lastName); | 163 | account = m_UserService.GetUserAccount(scopeID, firstName, lastName); |
163 | if (account != null) | 164 | if (account != null) |
164 | m_Cache.Cache(account); | 165 | m_Cache.Cache(account.PrincipalID, account); |
165 | 166 | ||
166 | return account; | 167 | return account; |
167 | } | 168 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 1140692..488dbd5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -119,26 +119,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
119 | 119 | ||
120 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) | 120 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) |
121 | { | 121 | { |
122 | UserAccount account = m_Cache.Get(userID); | 122 | bool inCache = false; |
123 | if (account != null) | 123 | UserAccount account = m_Cache.Get(userID, out inCache); |
124 | if (inCache) | ||
124 | return account; | 125 | return account; |
125 | 126 | ||
126 | account = base.GetUserAccount(scopeID, userID); | 127 | account = base.GetUserAccount(scopeID, userID); |
127 | if (account != null) | 128 | m_Cache.Cache(userID, account); |
128 | m_Cache.Cache(account); | ||
129 | 129 | ||
130 | return account; | 130 | return account; |
131 | } | 131 | } |
132 | 132 | ||
133 | public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 133 | public override UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
134 | { | 134 | { |
135 | UserAccount account = m_Cache.Get(firstName + " " + lastName); | 135 | bool inCache = false; |
136 | if (account != null) | 136 | UserAccount account = m_Cache.Get(firstName + " " + lastName, out inCache); |
137 | if (inCache) | ||
137 | return account; | 138 | return account; |
138 | 139 | ||
139 | account = base.GetUserAccount(scopeID, firstName, lastName); | 140 | account = base.GetUserAccount(scopeID, firstName, lastName); |
140 | if (account != null) | 141 | if (account != null) |
141 | m_Cache.Cache(account); | 142 | m_Cache.Cache(account.PrincipalID, account); |
142 | 143 | ||
143 | return account; | 144 | return account; |
144 | } | 145 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e430fc7..a355661 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -36,50 +36,58 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
36 | { | 36 | { |
37 | public class UserAccountCache | 37 | public class UserAccountCache |
38 | { | 38 | { |
39 | //private static readonly ILog m_log = | 39 | private static readonly ILog m_log = |
40 | // LogManager.GetLogger( | 40 | LogManager.GetLogger( |
41 | // MethodBase.GetCurrentMethod().DeclaringType); | 41 | MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | private ExpiringCache<UUID, UserAccount> m_UUIDCache; | |
43 | private ICnmCache<UUID, UserAccount> m_UUIDCache; | 43 | private ExpiringCache<string, UUID> m_NameCache; |
44 | private Dictionary<string, UUID> m_NameCache; | ||
45 | 44 | ||
46 | public UserAccountCache() | 45 | public UserAccountCache() |
47 | { | 46 | { |
48 | // Warning: the size values are a bit fuzzy. What matters | 47 | // Warning: the size values are a bit fuzzy. What matters |
49 | // most for this cache is the count value (128 entries). | 48 | // most for this cache is the count value (128 entries). |
50 | m_UUIDCache = CnmSynchronizedCache<UUID, UserAccount>.Synchronized(new CnmMemoryCache<UUID, UserAccount>( | 49 | m_UUIDCache = new ExpiringCache<UUID, UserAccount>(); |
51 | 128, 128*512, TimeSpan.FromMinutes(30.0))); | 50 | m_NameCache = new ExpiringCache<string, UUID>(); // this one is unbound |
52 | m_NameCache = new Dictionary<string, UUID>(); // this one is unbound | ||
53 | } | 51 | } |
54 | 52 | ||
55 | public void Cache(UserAccount account) | 53 | public void Cache(UUID userID, UserAccount account) |
56 | { | 54 | { |
57 | m_UUIDCache.Set(account.PrincipalID, account, 512); | 55 | // Cache even null accounts |
58 | m_NameCache[account.Name] = account.PrincipalID; | 56 | m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); |
57 | if (account != null) | ||
58 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | ||
59 | 59 | ||
60 | //m_log.DebugFormat("[USER CACHE]: cached user {0} {1}", account.FirstName, account.LastName); | 60 | m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); |
61 | } | 61 | } |
62 | 62 | ||
63 | public UserAccount Get(UUID userID) | 63 | public UserAccount Get(UUID userID, out bool inCache) |
64 | { | 64 | { |
65 | UserAccount account = null; | 65 | UserAccount account = null; |
66 | inCache = false; | ||
66 | if (m_UUIDCache.TryGetValue(userID, out account)) | 67 | if (m_UUIDCache.TryGetValue(userID, out account)) |
67 | { | 68 | { |
68 | //m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName); | 69 | //m_log.DebugFormat("[USER CACHE]: Account {0} {1} found in cache", account.FirstName, account.LastName); |
70 | inCache = true; | ||
69 | return account; | 71 | return account; |
70 | } | 72 | } |
71 | 73 | ||
72 | return null; | 74 | return null; |
73 | } | 75 | } |
74 | 76 | ||
75 | public UserAccount Get(string name) | 77 | public UserAccount Get(string name, out bool inCache) |
76 | { | 78 | { |
77 | if (!m_NameCache.ContainsKey(name)) | 79 | inCache = false; |
80 | if (!m_NameCache.Contains(name)) | ||
78 | return null; | 81 | return null; |
79 | 82 | ||
80 | UserAccount account = null; | 83 | UserAccount account = null; |
81 | if (m_UUIDCache.TryGetValue(m_NameCache[name], out account)) | 84 | UUID uuid = UUID.Zero; |
82 | return account; | 85 | if (m_NameCache.TryGetValue(name, out uuid)) |
86 | if (m_UUIDCache.TryGetValue(uuid, out account)) | ||
87 | { | ||
88 | inCache = true; | ||
89 | return account; | ||
90 | } | ||
83 | 91 | ||
84 | return null; | 92 | return null; |
85 | } | 93 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index e0cdb36..bf856c8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -183,7 +183,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
183 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 183 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
184 | { | 184 | { |
185 | //If we are forcing a position for them to go | 185 | //If we are forcing a position for them to go |
186 | if( forcedPosition != null ) | 186 | if (forcedPosition != null) |
187 | { | 187 | { |
188 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | 188 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); |
189 | 189 | ||
@@ -199,7 +199,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
199 | forcedPosition = null; | 199 | forcedPosition = null; |
200 | } | 200 | } |
201 | //if we are far away, teleport | 201 | //if we are far away, teleport |
202 | else if(Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3 ) | 202 | else if (Vector3.Distance(clientAvatar.AbsolutePosition,forcedPosition.Value) > 3) |
203 | { | 203 | { |
204 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); | 204 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}",forcedPosition.Value,clientAvatar.AbsolutePosition)); |
205 | clientAvatar.Teleport(forcedPosition.Value); | 205 | clientAvatar.Teleport(forcedPosition.Value); |
@@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
340 | 340 | ||
341 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 341 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
342 | { | 342 | { |
343 | avatar.ControllingClient.SendAlertMessage( | 343 | avatar.ControllingClient.SendAlertMessage( |
344 | "You are not allowed on this parcel because the land owner has restricted access."); | 344 | "You are not allowed on this parcel because the land owner has restricted access."); |
345 | 345 | ||
346 | } | 346 | } |
@@ -475,7 +475,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
475 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); | 475 | ForceAvatarToPosition(clientAvatar, m_scene.GetNearestAllowedPosition(clientAvatar)); |
476 | } | 476 | } |
477 | } | 477 | } |
478 | else if ( parcel.IsRestrictedFromLand(clientAvatar.UUID)) | 478 | else if (parcel.IsRestrictedFromLand(clientAvatar.UUID)) |
479 | { | 479 | { |
480 | //once we've sent the message once, keep going toward the target until we are done | 480 | //once we've sent the message once, keep going toward the target until we are done |
481 | if (forcedPosition == null) | 481 | if (forcedPosition == null) |
@@ -487,7 +487,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
487 | else | 487 | else |
488 | { | 488 | { |
489 | //when we are finally in a safe place, lets release the forced position lock | 489 | //when we are finally in a safe place, lets release the forced position lock |
490 | forcedPosition = null; | 490 | forcedPosition = null; |
491 | } | 491 | } |
492 | } | 492 | } |
493 | } | 493 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 27d9fdb..e85136a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -287,7 +287,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
287 | entry.Flags = AccessList.Ban; | 287 | entry.Flags = AccessList.Ban; |
288 | entry.Time = new DateTime(); | 288 | entry.Time = new DateTime(); |
289 | //See if they are on the list, but make sure the owner isn't banned | 289 | //See if they are on the list, but make sure the owner isn't banned |
290 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar ) | 290 | if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) |
291 | { | 291 | { |
292 | //They are banned, so lets send them a notice about this parcel | 292 | //They are banned, so lets send them a notice about this parcel |
293 | return true; | 293 | return true; |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 845c4c2..5c7f3b7 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -618,7 +618,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
618 | return objectOwnerMask; | 618 | return objectOwnerMask; |
619 | 619 | ||
620 | // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set | 620 | // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set |
621 | if (IsEstateManager(user) && m_RegionOwnerIsGod) | 621 | if (m_RegionOwnerIsGod && IsEstateManager(user) && !IsAdministrator(objectOwner)) |
622 | return objectOwnerMask; | 622 | return objectOwnerMask; |
623 | 623 | ||
624 | // Admin should be able to edit anything in the sim (including admin objects) | 624 | // Admin should be able to edit anything in the sim (including admin objects) |