diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
39 files changed, 1171 insertions, 493 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 22c301b..389fb7b 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -203,10 +203,10 @@ namespace Flotsam.RegionModules.AssetCache | |||
203 | m_CacheDirectoryTierLen = 4; | 203 | m_CacheDirectoryTierLen = 4; |
204 | } | 204 | } |
205 | 205 | ||
206 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand); | 206 | MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache status", "fcache status", "Display cache status", HandleConsoleCommand); |
207 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand); | 207 | MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache clear", "fcache clear [file] [memory]", "Remove all assets in the cache. If file or memory is specified then only this cache is cleared.", HandleConsoleCommand); |
208 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); | 208 | MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache assets", "fcache assets", "Attempt a deep scan and cache of all assets in all scenes", HandleConsoleCommand); |
209 | MainConsole.Instance.Commands.AddCommand(Name, true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); | 209 | MainConsole.Instance.Commands.AddCommand("Assets", true, "fcache expire", "fcache expire <datetime>", "Purge cached assets older then the specified date/time", HandleConsoleCommand); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index ffe7718..325067c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -51,12 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
51 | m_scene.RegisterModuleInterface<IDialogModule>(this); | 51 | m_scene.RegisterModuleInterface<IDialogModule>(this); |
52 | 52 | ||
53 | m_scene.AddCommand( | 53 | m_scene.AddCommand( |
54 | this, "alert", "alert <message>", | 54 | "Users", this, "alert", "alert <message>", |
55 | "Send an alert to everyone", | 55 | "Send an alert to everyone", |
56 | HandleAlertConsoleCommand); | 56 | HandleAlertConsoleCommand); |
57 | 57 | ||
58 | m_scene.AddCommand( | 58 | m_scene.AddCommand( |
59 | this, "alert-user", "alert-user <first> <last> <message>", | 59 | "Users", this, "alert-user", "alert-user <first> <last> <message>", |
60 | "Send an alert to a user", | 60 | "Send an alert to a user", |
61 | HandleAlertConsoleCommand); | 61 | HandleAlertConsoleCommand); |
62 | } | 62 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index c266fe5..be767c4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
212 | scene.EventManager.OnClientLogin += OnClientLogin; | 212 | scene.EventManager.OnClientLogin += OnClientLogin; |
213 | } | 213 | } |
214 | 214 | ||
215 | public void RegionLoaded(Scene scene) | 215 | public virtual void RegionLoaded(Scene scene) |
216 | { | 216 | { |
217 | } | 217 | } |
218 | 218 | ||
@@ -550,7 +550,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
550 | UUID principalID = new UUID(im.fromAgentID); | 550 | UUID principalID = new UUID(im.fromAgentID); |
551 | UUID friendID = new UUID(im.toAgentID); | 551 | UUID friendID = new UUID(im.toAgentID); |
552 | 552 | ||
553 | m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2}", principalID, im.fromAgentName, friendID); | 553 | m_log.DebugFormat("[FRIENDS]: {0} ({1}) offered friendship to {2} ({3})", principalID, client.FirstName + client.LastName, friendID, im.fromAgentName); |
554 | |||
555 | // Check that the friendship doesn't exist yet | ||
556 | FriendInfo[] finfos = GetFriends(principalID); | ||
557 | if (finfos != null) | ||
558 | { | ||
559 | FriendInfo f = GetFriend(finfos, friendID); | ||
560 | if (f != null) | ||
561 | { | ||
562 | client.SendAgentAlertMessage("This person is already your friend. Please delete it first if you want to reestablish the friendship.", false); | ||
563 | return; | ||
564 | } | ||
565 | } | ||
554 | 566 | ||
555 | // This user wants to be friends with the other user. | 567 | // This user wants to be friends with the other user. |
556 | // Let's add the relation backwards, in case the other is not online | 568 | // Let's add the relation backwards, in case the other is not online |
@@ -561,7 +573,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
561 | } | 573 | } |
562 | } | 574 | } |
563 | 575 | ||
564 | private void ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) | 576 | protected virtual bool ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) |
565 | { | 577 | { |
566 | // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID) | 578 | // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID) |
567 | // We stick this agent's ID as imSession, so that it's directly available on the receiving end | 579 | // We stick this agent's ID as imSession, so that it's directly available on the receiving end |
@@ -570,7 +582,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
570 | 582 | ||
571 | // Try the local sim | 583 | // Try the local sim |
572 | if (LocalFriendshipOffered(friendID, im)) | 584 | if (LocalFriendshipOffered(friendID, im)) |
573 | return; | 585 | return true; |
574 | 586 | ||
575 | // The prospective friend is not here [as root]. Let's forward. | 587 | // The prospective friend is not here [as root]. Let's forward. |
576 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | 588 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); |
@@ -581,9 +593,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
581 | { | 593 | { |
582 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | 594 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); |
583 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); | 595 | m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); |
596 | return true; | ||
584 | } | 597 | } |
585 | } | 598 | } |
586 | // If the prospective friend is not online, he'll get the message upon login. | 599 | // If the prospective friend is not online, he'll get the message upon login. |
600 | return false; | ||
587 | } | 601 | } |
588 | 602 | ||
589 | protected virtual string GetFriendshipRequesterName(UUID agentID) | 603 | protected virtual string GetFriendshipRequesterName(UUID agentID) |
@@ -592,7 +606,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
592 | return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; | 606 | return (account == null) ? "Unknown" : account.FirstName + " " + account.LastName; |
593 | } | 607 | } |
594 | 608 | ||
595 | private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) | 609 | protected virtual void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) |
596 | { | 610 | { |
597 | m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); | 611 | m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", client.AgentId, friendID); |
598 | 612 | ||
@@ -603,7 +617,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
603 | { | 617 | { |
604 | StoreFriendships(client.AgentId, friendID); | 618 | StoreFriendships(client.AgentId, friendID); |
605 | 619 | ||
606 | // Update the local cache | 620 | // Update the local cache. |
607 | RecacheFriends(client); | 621 | RecacheFriends(client); |
608 | 622 | ||
609 | // | 623 | // |
@@ -756,7 +770,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
756 | 770 | ||
757 | #region Local | 771 | #region Local |
758 | 772 | ||
759 | public bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) | 773 | public virtual bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) |
760 | { | 774 | { |
761 | IClientAPI friendClient = LocateClientObject(toID); | 775 | IClientAPI friendClient = LocateClientObject(toID); |
762 | if (friendClient != null) | 776 | if (friendClient != null) |
@@ -912,7 +926,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
912 | return FriendsService.GetFriends(client.AgentId); | 926 | return FriendsService.GetFriends(client.AgentId); |
913 | } | 927 | } |
914 | 928 | ||
915 | private void RecacheFriends(IClientAPI client) | 929 | protected void RecacheFriends(IClientAPI client) |
916 | { | 930 | { |
917 | // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event | 931 | // FIXME: Ideally, we want to avoid doing this here since it sits the EventManager.OnMakeRootAgent event |
918 | // is on the critical path for transferring an avatar from one region to another. | 932 | // is on the critical path for transferring an avatar from one region to another. |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 9c53fc4..e50a84a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | IUserManagement m_uMan; | 53 | IUserManagement m_uMan; |
54 | IUserManagement UserManagementModule | 54 | public IUserManagement UserManagementModule |
55 | { | 55 | { |
56 | get | 56 | get |
57 | { | 57 | { |
@@ -61,6 +61,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | protected HGFriendsServicesConnector m_HGFriendsConnector = new HGFriendsServicesConnector(); | ||
65 | protected HGStatusNotifier m_StatusNotifier; | ||
66 | |||
64 | #region ISharedRegionModule | 67 | #region ISharedRegionModule |
65 | public override string Name | 68 | public override string Name |
66 | { | 69 | { |
@@ -76,6 +79,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
76 | scene.RegisterModuleInterface<IFriendsSimConnector>(this); | 79 | scene.RegisterModuleInterface<IFriendsSimConnector>(this); |
77 | } | 80 | } |
78 | 81 | ||
82 | public override void RegionLoaded(Scene scene) | ||
83 | { | ||
84 | if (!m_Enabled) | ||
85 | return; | ||
86 | if (m_StatusNotifier == null) | ||
87 | m_StatusNotifier = new HGStatusNotifier(this); | ||
88 | } | ||
89 | |||
79 | #endregion | 90 | #endregion |
80 | 91 | ||
81 | #region IFriendsSimConnector | 92 | #region IFriendsSimConnector |
@@ -94,6 +105,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
94 | 105 | ||
95 | #endregion | 106 | #endregion |
96 | 107 | ||
108 | protected override void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) | ||
109 | { | ||
110 | // Update the local cache. Yes, we need to do it right here | ||
111 | // because the HGFriendsService placed something on the DB | ||
112 | // from under the sim | ||
113 | base.OnApproveFriendRequest(client, agentID, friendID, callingCardFolders); | ||
114 | } | ||
115 | |||
97 | protected override bool CacheFriends(IClientAPI client) | 116 | protected override bool CacheFriends(IClientAPI client) |
98 | { | 117 | { |
99 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name); | 118 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name); |
@@ -183,91 +202,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
183 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID); | 202 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetOnlineFriends for {0}", userID); |
184 | } | 203 | } |
185 | 204 | ||
186 | //protected override void GetOnlineFriends(UUID userID, List<string> friendList, /*collector*/ List<UUID> online) | ||
187 | //{ | ||
188 | // // Let's single out the UUIs | ||
189 | // List<string> localFriends = new List<string>(); | ||
190 | // List<string> foreignFriends = new List<string>(); | ||
191 | // string tmp = string.Empty; | ||
192 | |||
193 | // foreach (string s in friendList) | ||
194 | // { | ||
195 | // UUID id; | ||
196 | // if (UUID.TryParse(s, out id)) | ||
197 | // localFriends.Add(s); | ||
198 | // else if (Util.ParseUniversalUserIdentifier(s, out id, out tmp, out tmp, out tmp, out tmp)) | ||
199 | // { | ||
200 | // foreignFriends.Add(s); | ||
201 | // // add it here too, who knows maybe the foreign friends happens to be on this grid | ||
202 | // localFriends.Add(id.ToString()); | ||
203 | // } | ||
204 | // } | ||
205 | |||
206 | // // OK, see who's present on this grid | ||
207 | // List<string> toBeRemoved = new List<string>(); | ||
208 | // PresenceInfo[] presence = PresenceService.GetAgents(localFriends.ToArray()); | ||
209 | // foreach (PresenceInfo pi in presence) | ||
210 | // { | ||
211 | // UUID presenceID; | ||
212 | // if (UUID.TryParse(pi.UserID, out presenceID)) | ||
213 | // { | ||
214 | // online.Add(presenceID); | ||
215 | // foreach (string s in foreignFriends) | ||
216 | // if (s.StartsWith(pi.UserID)) | ||
217 | // toBeRemoved.Add(s); | ||
218 | // } | ||
219 | // } | ||
220 | |||
221 | // foreach (string s in toBeRemoved) | ||
222 | // foreignFriends.Remove(s); | ||
223 | |||
224 | // // OK, let's send this up the stack, and leave a closure here | ||
225 | // // collecting online friends in other grids | ||
226 | // Util.FireAndForget(delegate { CollectOnlineFriendsElsewhere(userID, foreignFriends); }); | ||
227 | |||
228 | //} | ||
229 | |||
230 | //private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends) | ||
231 | //{ | ||
232 | // // let's divide the friends on a per-domain basis | ||
233 | // Dictionary<string, List<string>> friendsPerDomain = new Dictionary<string, List<string>>(); | ||
234 | // foreach (string friend in foreignFriends) | ||
235 | // { | ||
236 | // UUID friendID; | ||
237 | // if (!UUID.TryParse(friend, out friendID)) | ||
238 | // { | ||
239 | // // it's a foreign friend | ||
240 | // string url = string.Empty, tmp = string.Empty; | ||
241 | // if (Util.ParseUniversalUserIdentifier(friend, out friendID, out url, out tmp, out tmp, out tmp)) | ||
242 | // { | ||
243 | // if (!friendsPerDomain.ContainsKey(url)) | ||
244 | // friendsPerDomain[url] = new List<string>(); | ||
245 | // friendsPerDomain[url].Add(friend); | ||
246 | // } | ||
247 | // } | ||
248 | // } | ||
249 | |||
250 | // // Now, call those worlds | ||
251 | |||
252 | // foreach (KeyValuePair<string, List<string>> kvp in friendsPerDomain) | ||
253 | // { | ||
254 | // List<string> ids = new List<string>(); | ||
255 | // foreach (string f in kvp.Value) | ||
256 | // ids.Add(f); | ||
257 | // UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); | ||
258 | // List<UUID> online = uConn.GetOnlineFriends(userID, ids); | ||
259 | // // Finally send the notifications to the user | ||
260 | // // this whole process may take a while, so let's check at every | ||
261 | // // iteration that the user is still here | ||
262 | // IClientAPI client = LocateClientObject(userID); | ||
263 | // if (client != null) | ||
264 | // client.SendAgentOnline(online.ToArray()); | ||
265 | // else | ||
266 | // break; | ||
267 | // } | ||
268 | |||
269 | //} | ||
270 | |||
271 | protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) | 205 | protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) |
272 | { | 206 | { |
273 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID); | 207 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID); |
@@ -305,25 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
305 | if (friendsPerDomain.ContainsKey("local")) | 239 | if (friendsPerDomain.ContainsKey("local")) |
306 | base.StatusNotify(friendsPerDomain["local"], userID, online); | 240 | base.StatusNotify(friendsPerDomain["local"], userID, online); |
307 | 241 | ||
308 | foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain) | 242 | m_StatusNotifier.Notify(userID, friendsPerDomain, online); |
309 | { | ||
310 | if (kvp.Key != "local") | ||
311 | { | ||
312 | // For the others, call the user agent service | ||
313 | List<string> ids = new List<string>(); | ||
314 | foreach (FriendInfo f in kvp.Value) | ||
315 | ids.Add(f.Friend); | ||
316 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); | ||
317 | List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online); | ||
318 | |||
319 | if (online && friendsOnline.Count > 0) | ||
320 | { | ||
321 | IClientAPI client = LocateClientObject(userID); | ||
322 | if (client != null) | ||
323 | client.SendAgentOnline(friendsOnline.ToArray()); | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | 243 | ||
328 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID); | 244 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID); |
329 | } | 245 | } |
@@ -335,26 +251,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
335 | return true; | 251 | return true; |
336 | 252 | ||
337 | // fid is not a UUID... | 253 | // fid is not a UUID... |
338 | string url = string.Empty, tmp = string.Empty; | 254 | string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty; |
339 | if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out first, out last, out tmp)) | 255 | if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp)) |
340 | { | 256 | { |
341 | IUserManagement userMan = m_Scenes[0].RequestModuleInterface<IUserManagement>(); | 257 | if (!agentID.Equals(UUID.Zero)) |
342 | userMan.AddUser(agentID, first, last, url); | 258 | { |
259 | m_uMan.AddUser(agentID, f, l, url); | ||
343 | 260 | ||
344 | return true; | 261 | string name = m_uMan.GetUserName(agentID); |
262 | string[] parts = name.Trim().Split(new char[] { ' ' }); | ||
263 | if (parts.Length == 2) | ||
264 | { | ||
265 | first = parts[0]; | ||
266 | last = parts[1]; | ||
267 | } | ||
268 | else | ||
269 | { | ||
270 | first = f; | ||
271 | last = l; | ||
272 | } | ||
273 | return true; | ||
274 | } | ||
345 | } | 275 | } |
346 | return false; | 276 | return false; |
347 | } | 277 | } |
348 | 278 | ||
349 | protected override string GetFriendshipRequesterName(UUID agentID) | 279 | protected override string GetFriendshipRequesterName(UUID agentID) |
350 | { | 280 | { |
351 | // For the time being we assume that HG friendship requests can only happen | 281 | return m_uMan.GetUserName(agentID); |
352 | // when avies are on the same region. | ||
353 | IClientAPI client = LocateClientObject(agentID); | ||
354 | if (client != null) | ||
355 | return client.FirstName + " " + client.LastName; | ||
356 | else | ||
357 | return base.GetFriendshipRequesterName(agentID); | ||
358 | } | 282 | } |
359 | 283 | ||
360 | protected override string FriendshipMessage(string friendID) | 284 | protected override string FriendshipMessage(string friendID) |
@@ -392,10 +316,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
392 | AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); | 316 | AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); |
393 | if (agentClientCircuit != null) | 317 | if (agentClientCircuit != null) |
394 | { | 318 | { |
395 | string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); | 319 | //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); |
396 | 320 | ||
397 | finfos = FriendsService.GetFriends(agentUUI); | 321 | finfos = FriendsService.GetFriends(client.AgentId.ToString()); |
398 | m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, agentUUI); | 322 | m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); |
399 | } | 323 | } |
400 | 324 | ||
401 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); | 325 | // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); |
@@ -454,16 +378,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
454 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | 378 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); |
455 | } | 379 | } |
456 | 380 | ||
457 | // Are they both local users? | 381 | // Is the requester a local user? |
458 | if (agentIsLocal && friendIsLocal) | 382 | if (agentIsLocal) |
459 | { | 383 | { |
460 | // local grid users | 384 | // local grid users |
461 | m_log.DebugFormat("[HGFRIENDS MODULE]: Users are both local"); | 385 | m_log.DebugFormat("[HGFRIENDS MODULE]: Friendship requester is local. Storing backwards."); |
386 | |||
462 | base.StoreBackwards(friendID, agentID); | 387 | base.StoreBackwards(friendID, agentID); |
463 | return; | 388 | return; |
464 | } | 389 | } |
465 | 390 | ||
466 | // no provision for this temporary friendship state | 391 | // no provision for this temporary friendship state when user is not local |
467 | //FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), 0); | 392 | //FriendsService.StoreFriend(friendID.ToString(), agentID.ToString(), 0); |
468 | } | 393 | } |
469 | 394 | ||
@@ -501,12 +426,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
501 | agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); | 426 | agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); |
502 | agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); | 427 | agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); |
503 | agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); | 428 | agentFriendService = agentClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); |
429 | RecacheFriends(agentClient); | ||
504 | } | 430 | } |
505 | if (friendClient != null) | 431 | if (friendClient != null) |
506 | { | 432 | { |
507 | friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); | 433 | friendClientCircuit = ((Scene)(friendClient.Scene)).AuthenticateHandler.GetAgentCircuitData(friendClient.CircuitCode); |
508 | friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); | 434 | friendUUI = Util.ProduceUserUniversalIdentifier(friendClientCircuit); |
509 | friendFriendService = friendClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); | 435 | friendFriendService = friendClientCircuit.ServiceURLs["FriendsServerURI"].ToString(); |
436 | RecacheFriends(friendClient); | ||
510 | } | 437 | } |
511 | 438 | ||
512 | m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}", | 439 | m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}", |
@@ -515,14 +442,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
515 | // Generate a random 8-character hex number that will sign this friendship | 442 | // Generate a random 8-character hex number that will sign this friendship |
516 | string secret = UUID.Random().ToString().Substring(0, 8); | 443 | string secret = UUID.Random().ToString().Substring(0, 8); |
517 | 444 | ||
445 | string theFriendUUID = friendUUI + ";" + secret; | ||
446 | string agentUUID = agentUUI + ";" + secret; | ||
447 | |||
518 | if (agentIsLocal) // agent is local, 'friend' is foreigner | 448 | if (agentIsLocal) // agent is local, 'friend' is foreigner |
519 | { | 449 | { |
520 | // This may happen when the agent returned home, in which case the friend is not there | 450 | // This may happen when the agent returned home, in which case the friend is not there |
521 | // We need to look for its information in the friends list itself | 451 | // We need to look for its information in the friends list itself |
452 | FriendInfo[] finfos = null; | ||
522 | bool confirming = false; | 453 | bool confirming = false; |
523 | if (friendUUI == string.Empty) | 454 | if (friendUUI == string.Empty) |
524 | { | 455 | { |
525 | FriendInfo[] finfos = GetFriends(agentID); | 456 | finfos = GetFriends(agentID); |
526 | foreach (FriendInfo finfo in finfos) | 457 | foreach (FriendInfo finfo in finfos) |
527 | { | 458 | { |
528 | if (finfo.TheirFlags == -1) | 459 | if (finfo.TheirFlags == -1) |
@@ -530,29 +461,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
530 | if (finfo.Friend.StartsWith(friendID.ToString())) | 461 | if (finfo.Friend.StartsWith(friendID.ToString())) |
531 | { | 462 | { |
532 | friendUUI = finfo.Friend; | 463 | friendUUI = finfo.Friend; |
464 | theFriendUUID = friendUUI; | ||
465 | UUID utmp = UUID.Zero; String url = String.Empty; String first = String.Empty, last = String.Empty, tmp = String.Empty; | ||
466 | // If it's confirming the friendship, we already have the full UUI with the secret | ||
467 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) | ||
468 | { | ||
469 | agentUUID = agentUUI + ";" + secret; | ||
470 | m_uMan.AddUser(utmp, first, last, url); | ||
471 | } | ||
533 | confirming = true; | 472 | confirming = true; |
473 | break; | ||
534 | } | 474 | } |
535 | } | 475 | } |
536 | } | 476 | } |
537 | } | 477 | if (!confirming) |
478 | { | ||
479 | friendUUI = m_uMan.GetUserUUI(friendID); | ||
480 | theFriendUUID = friendUUI + ";" + secret; | ||
481 | } | ||
482 | |||
483 | friendFriendService = m_uMan.GetUserServerURL(friendID, "FriendsServerURI"); | ||
484 | |||
485 | // m_log.DebugFormat("[HGFRIENDS MODULE] HG Friendship! thisUUI={0}; friendUUI={1}; foreignThisFriendService={2}; foreignFriendFriendService={3}", | ||
486 | // agentUUI, friendUUI, agentFriendService, friendFriendService); | ||
538 | 487 | ||
539 | // If it's confirming the friendship, we already have the full friendUUI with the secret | 488 | } |
540 | string theFriendUUID = confirming ? friendUUI : friendUUI + ";" + secret; | 489 | |
490 | // Delete any previous friendship relations | ||
491 | DeletePreviousRelations(agentID, friendID); | ||
541 | 492 | ||
542 | // store in the local friends service a reference to the foreign friend | 493 | // store in the local friends service a reference to the foreign friend |
543 | FriendsService.StoreFriend(agentID.ToString(), theFriendUUID, 1); | 494 | FriendsService.StoreFriend(agentID.ToString(), theFriendUUID, 1); |
544 | // and also the converse | 495 | // and also the converse |
545 | FriendsService.StoreFriend(theFriendUUID, agentID.ToString(), 1); | 496 | FriendsService.StoreFriend(theFriendUUID, agentID.ToString(), 1); |
546 | 497 | ||
547 | if (!confirming && friendClientCircuit != null) | 498 | //if (!confirming) |
548 | { | 499 | //{ |
549 | // store in the foreign friends service a reference to the local agent | 500 | // store in the foreign friends service a reference to the local agent |
550 | HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(friendFriendService, friendClientCircuit.SessionID, friendClientCircuit.ServiceSessionID); | 501 | HGFriendsServicesConnector friendsConn = null; |
551 | friendsConn.NewFriendship(friendID, agentUUI + ";" + secret); | 502 | if (friendClientCircuit != null) // the friend is here, validate session |
552 | } | 503 | friendsConn = new HGFriendsServicesConnector(friendFriendService, friendClientCircuit.SessionID, friendClientCircuit.ServiceSessionID); |
504 | else // the friend is not here, he initiated the request in his home world | ||
505 | friendsConn = new HGFriendsServicesConnector(friendFriendService); | ||
506 | |||
507 | friendsConn.NewFriendship(friendID, agentUUID); | ||
508 | //} | ||
553 | } | 509 | } |
554 | else if (friendIsLocal) // 'friend' is local, agent is foreigner | 510 | else if (friendIsLocal) // 'friend' is local, agent is foreigner |
555 | { | 511 | { |
512 | // Delete any previous friendship relations | ||
513 | DeletePreviousRelations(agentID, friendID); | ||
514 | |||
556 | // store in the local friends service a reference to the foreign agent | 515 | // store in the local friends service a reference to the foreign agent |
557 | FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); | 516 | FriendsService.StoreFriend(friendID.ToString(), agentUUI + ";" + secret, 1); |
558 | // and also the converse | 517 | // and also the converse |
@@ -582,6 +541,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
582 | // my brain hurts now | 541 | // my brain hurts now |
583 | } | 542 | } |
584 | 543 | ||
544 | private void DeletePreviousRelations(UUID a1, UUID a2) | ||
545 | { | ||
546 | // Delete any previous friendship relations | ||
547 | FriendInfo[] finfos = null; | ||
548 | FriendInfo f = null; | ||
549 | finfos = GetFriends(a1); | ||
550 | if (finfos != null) | ||
551 | { | ||
552 | f = GetFriend(finfos, a2); | ||
553 | if (f != null) | ||
554 | { | ||
555 | FriendsService.Delete(a1, f.Friend); | ||
556 | // and also the converse | ||
557 | FriendsService.Delete(f.Friend, a1.ToString()); | ||
558 | } | ||
559 | } | ||
560 | |||
561 | finfos = GetFriends(a2); | ||
562 | if (finfos != null) | ||
563 | { | ||
564 | f = GetFriend(finfos, a1); | ||
565 | if (f != null) | ||
566 | { | ||
567 | FriendsService.Delete(a2, f.Friend); | ||
568 | // and also the converse | ||
569 | FriendsService.Delete(f.Friend, a2.ToString()); | ||
570 | } | ||
571 | } | ||
572 | } | ||
573 | |||
585 | protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) | 574 | protected override bool DeleteFriendship(UUID agentID, UUID exfriendID) |
586 | { | 575 | { |
587 | Boolean agentIsLocal = true; | 576 | Boolean agentIsLocal = true; |
@@ -684,5 +673,80 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
684 | friendConn.DeleteFriendship(foreignUser, localUser, secret); | 673 | friendConn.DeleteFriendship(foreignUser, localUser, secret); |
685 | } | 674 | } |
686 | } | 675 | } |
676 | |||
677 | protected override bool ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im) | ||
678 | { | ||
679 | if (base.ForwardFriendshipOffer(agentID, friendID, im)) | ||
680 | return true; | ||
681 | |||
682 | // OK, that didn't work, so let's try to find this user somewhere | ||
683 | if (!m_uMan.IsLocalGridUser(friendID)) | ||
684 | { | ||
685 | string friendsURL = m_uMan.GetUserServerURL(friendID, "FriendsServerURI"); | ||
686 | if (friendsURL != string.Empty) | ||
687 | { | ||
688 | m_log.DebugFormat("[HGFRIENDS MODULE]: Forwading friendship from {0} to {1} @ {2}", agentID, friendID, friendsURL); | ||
689 | GridRegion region = new GridRegion(); | ||
690 | region.ServerURI = friendsURL; | ||
691 | |||
692 | string name = im.fromAgentName; | ||
693 | if (m_uMan.IsLocalGridUser(agentID)) | ||
694 | { | ||
695 | IClientAPI agentClient = LocateClientObject(agentID); | ||
696 | AgentCircuitData agentClientCircuit = ((Scene)(agentClient.Scene)).AuthenticateHandler.GetAgentCircuitData(agentClient.CircuitCode); | ||
697 | string agentHomeService = string.Empty; | ||
698 | try | ||
699 | { | ||
700 | agentHomeService = agentClientCircuit.ServiceURLs["HomeURI"].ToString(); | ||
701 | string lastname = "@" + new Uri(agentHomeService).Authority; | ||
702 | string firstname = im.fromAgentName.Replace(" ", "."); | ||
703 | name = firstname + lastname; | ||
704 | } | ||
705 | catch (KeyNotFoundException) | ||
706 | { | ||
707 | m_log.DebugFormat("[HGFRIENDS MODULE]: Key HomeURI not found for user {0}", agentID); | ||
708 | return false; | ||
709 | } | ||
710 | catch (NullReferenceException) | ||
711 | { | ||
712 | m_log.DebugFormat("[HGFRIENDS MODULE]: Null HomeUri for local user {0}", agentID); | ||
713 | return false; | ||
714 | } | ||
715 | catch (UriFormatException) | ||
716 | { | ||
717 | m_log.DebugFormat("[HGFRIENDS MODULE]: Malformed HomeUri {0} for local user {1}", agentHomeService, agentID); | ||
718 | return false; | ||
719 | } | ||
720 | } | ||
721 | |||
722 | m_HGFriendsConnector.FriendshipOffered(region, agentID, friendID, im.message, name); | ||
723 | |||
724 | return true; | ||
725 | } | ||
726 | } | ||
727 | |||
728 | return false; | ||
729 | } | ||
730 | |||
731 | public override bool LocalFriendshipOffered(UUID toID, GridInstantMessage im) | ||
732 | { | ||
733 | if (base.LocalFriendshipOffered(toID, im)) | ||
734 | { | ||
735 | if (im.fromAgentName.Contains("@")) | ||
736 | { | ||
737 | string[] parts = im.fromAgentName.Split(new char[] { '@' }); | ||
738 | if (parts.Length == 2) | ||
739 | { | ||
740 | string[] fl = parts[0].Trim().Split(new char[] { '.' }); | ||
741 | if (fl.Length == 2) | ||
742 | m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], fl[1], "http://" + parts[1]); | ||
743 | else | ||
744 | m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], "", "http://" + parts[1]); | ||
745 | } | ||
746 | } | ||
747 | return true; | ||
748 | } | ||
749 | return false; | ||
750 | } | ||
687 | } | 751 | } |
688 | } \ No newline at end of file | 752 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs new file mode 100644 index 0000000..1fa4dd6 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs | |||
@@ -0,0 +1,69 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Linq; | ||
4 | using System.Reflection; | ||
5 | using System.Text; | ||
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Region.Framework.Interfaces; | ||
8 | using OpenSim.Services.Interfaces; | ||
9 | using OpenSim.Services.Connectors.Hypergrid; | ||
10 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | ||
11 | |||
12 | using OpenMetaverse; | ||
13 | |||
14 | using log4net; | ||
15 | |||
16 | namespace OpenSim.Region.CoreModules.Avatar.Friends | ||
17 | { | ||
18 | public class HGStatusNotifier | ||
19 | { | ||
20 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
21 | |||
22 | private HGFriendsModule m_FriendsModule; | ||
23 | |||
24 | public HGStatusNotifier(HGFriendsModule friendsModule) | ||
25 | { | ||
26 | m_FriendsModule = friendsModule; | ||
27 | } | ||
28 | |||
29 | public void Notify(UUID userID, Dictionary<string, List<FriendInfo>> friendsPerDomain, bool online) | ||
30 | { | ||
31 | foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain) | ||
32 | { | ||
33 | if (kvp.Key != "local") | ||
34 | { | ||
35 | // For the others, call the user agent service | ||
36 | List<string> ids = new List<string>(); | ||
37 | foreach (FriendInfo f in kvp.Value) | ||
38 | ids.Add(f.Friend); | ||
39 | |||
40 | if (ids.Count == 0) | ||
41 | continue; // no one to notify. caller don't do this | ||
42 | |||
43 | m_log.DebugFormat("[HG STATUS NOTIFIER]: Notifying {0} friends in {1}", ids.Count, kvp.Key); | ||
44 | // ASSUMPTION: we assume that all users for one home domain | ||
45 | // have exactly the same set of service URLs. | ||
46 | // If this is ever not true, we need to change this. | ||
47 | UUID friendID = UUID.Zero; String tmp = String.Empty; | ||
48 | if (Util.ParseUniversalUserIdentifier(ids[0], out friendID, out tmp, out tmp, out tmp, out tmp)) | ||
49 | { | ||
50 | string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI"); | ||
51 | if (friendsServerURI != string.Empty) | ||
52 | { | ||
53 | HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI); | ||
54 | |||
55 | List<UUID> friendsOnline = fConn.StatusNotification(ids, userID, online); | ||
56 | |||
57 | if (online && friendsOnline.Count > 0) | ||
58 | { | ||
59 | IClientAPI client = m_FriendsModule.LocateClientObject(userID); | ||
60 | if (client != null) | ||
61 | client.SendAgentOnline(friendsOnline.ToArray()); | ||
62 | } | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | } | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 5238325..a26c73a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -270,12 +270,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
270 | 270 | ||
271 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 271 | m_archiveWriter = new TarArchiveWriter(m_saveStream); |
272 | 272 | ||
273 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); | ||
274 | |||
273 | // Write out control file. This has to be done first so that subsequent loaders will see this file first | 275 | // Write out control file. This has to be done first so that subsequent loaders will see this file first |
274 | // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this | 276 | // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this |
275 | // not sure how to fix this though, short of going with a completely different file format. | 277 | // not sure how to fix this though, short of going with a completely different file format. |
276 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile(options)); | 278 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile(options)); |
277 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); | 279 | |
278 | |||
279 | if (inventoryFolder != null) | 280 | if (inventoryFolder != null) |
280 | { | 281 | { |
281 | m_log.DebugFormat( | 282 | m_log.DebugFormat( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 650069a..ac22c3f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
109 | 109 | ||
110 | scene.AddCommand( | 110 | scene.AddCommand( |
111 | this, "load iar", | 111 | "Archiving", this, "load iar", |
112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", | 112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", |
113 | "Load user inventory archive (IAR).", | 113 | "Load user inventory archive (IAR).", |
114 | "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" | 114 | "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" |
@@ -121,18 +121,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
121 | HandleLoadInvConsoleCommand); | 121 | HandleLoadInvConsoleCommand); |
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | this, "save iar", | 124 | "Archiving", this, "save iar", |
125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", | 125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name." + Environment.NewLine | 127 | "<first> is the user's first name.\n" |
128 | + "<last> is the user's last name." + Environment.NewLine | 128 | + "<last> is the user's last name.\n" |
129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine | 129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" |
130 | + "-h|--home=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | ||
131 | + "-c|--creators preserves information about foreign creators." + Environment.NewLine | ||
132 | + "-v|--verbose extra debug messages." + Environment.NewLine | ||
133 | + "--noassets stops assets being saved to the IAR." | ||
134 | + "<IAR path> is the filesystem path at which to save the IAR." | 130 | + "<IAR path> is the filesystem path at which to save the IAR." |
135 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | 131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) |
132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" | ||
133 | + "-c|--creators preserves information about foreign creators.\n" | ||
134 | + "-v|--verbose extra debug messages.\n" | ||
135 | + "--noassets stops assets being saved to the IAR.", | ||
136 | HandleSaveInvConsoleCommand); | 136 | HandleSaveInvConsoleCommand); |
137 | 137 | ||
138 | m_aScene = scene; | 138 | m_aScene = scene; |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 9d1538f..4ea85a8 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -69,9 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework | |||
69 | { | 69 | { |
70 | m_scene = scene; | 70 | m_scene = scene; |
71 | m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); | 71 | m_scene.RegisterModuleInterface<ICapabilitiesModule>(this); |
72 | MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", | 72 | |
73 | MainConsole.Instance.Commands.AddCommand("Comms", false, "show caps", | ||
73 | "show caps", | 74 | "show caps", |
74 | "Shows all registered capabilities", HandleShowCapsCommand); | 75 | "Shows all registered capabilities for users", HandleShowCapsCommand); |
75 | } | 76 | } |
76 | 77 | ||
77 | public void RegionLoaded(Scene scene) | 78 | public void RegionLoaded(Scene scene) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f6e4dbf..2d73594 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -304,6 +304,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | 306 | ||
307 | if (IsInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this. | ||
308 | return; | ||
309 | |||
307 | m_log.DebugFormat( | 310 | m_log.DebugFormat( |
308 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", | 311 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", |
309 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); | 312 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
@@ -444,7 +447,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
444 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", | 447 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", |
445 | sp.Name, finalDestination.RegionName); | 448 | sp.Name, finalDestination.RegionName); |
446 | 449 | ||
447 | Fail(sp, finalDestination); | 450 | Fail(sp, finalDestination, logout); |
448 | return; | 451 | return; |
449 | } | 452 | } |
450 | 453 | ||
@@ -476,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
476 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", | 479 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", |
477 | sp.Name, finalDestination.RegionName); | 480 | sp.Name, finalDestination.RegionName); |
478 | 481 | ||
479 | Fail(sp, finalDestination); | 482 | Fail(sp, finalDestination, logout); |
480 | return; | 483 | return; |
481 | } | 484 | } |
482 | 485 | ||
@@ -527,7 +530,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
527 | } | 530 | } |
528 | } | 531 | } |
529 | 532 | ||
530 | private void Fail(ScenePresence sp, GridRegion finalDestination) | 533 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) |
531 | { | 534 | { |
532 | // Client never contacted destination. Let's restore everything back | 535 | // Client never contacted destination. Let's restore everything back |
533 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); | 536 | sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); |
@@ -1861,6 +1864,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1861 | } | 1864 | } |
1862 | } | 1865 | } |
1863 | 1866 | ||
1867 | protected bool IsInTransit(UUID id) | ||
1868 | { | ||
1869 | lock (m_agentsInTransit) | ||
1870 | { | ||
1871 | if (m_agentsInTransit.Contains(id)) | ||
1872 | return true; | ||
1873 | } | ||
1874 | return false; | ||
1875 | } | ||
1876 | |||
1864 | protected bool ResetFromTransit(UUID id) | 1877 | protected bool ResetFromTransit(UUID id) |
1865 | { | 1878 | { |
1866 | lock (m_agentsInTransit) | 1879 | lock (m_agentsInTransit) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 38a7805..b277095 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
50 | 50 | ||
51 | private bool m_Initialized = false; | 51 | private bool m_Initialized = false; |
52 | 52 | ||
53 | private bool m_RestrictInventoryAccessAbroad = false; | ||
54 | |||
53 | private GatekeeperServiceConnector m_GatekeeperConnector; | 55 | private GatekeeperServiceConnector m_GatekeeperConnector; |
54 | 56 | ||
55 | #region ISharedRegionModule | 57 | #region ISharedRegionModule |
@@ -68,6 +70,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
68 | if (name == Name) | 70 | if (name == Name) |
69 | { | 71 | { |
70 | InitialiseCommon(source); | 72 | InitialiseCommon(source); |
73 | IConfig transferConfig = source.Configs["HGEntityTransfer"]; | ||
74 | if (transferConfig != null) | ||
75 | m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false); | ||
76 | |||
71 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | 77 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
72 | } | 78 | } |
73 | } | 79 | } |
@@ -170,6 +176,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
170 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); | 176 | bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); |
171 | logout = success; // flag for later logout from this grid; this is an HG TP | 177 | logout = success; // flag for later logout from this grid; this is an HG TP |
172 | 178 | ||
179 | if (success && m_RestrictInventoryAccessAbroad) | ||
180 | { | ||
181 | // TODO tell the viewer to remove the root folder | ||
182 | } | ||
183 | |||
173 | return success; | 184 | return success; |
174 | } | 185 | } |
175 | else | 186 | else |
@@ -283,6 +294,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
283 | 294 | ||
284 | } | 295 | } |
285 | 296 | ||
297 | protected override void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) | ||
298 | { | ||
299 | base.Fail(sp, finalDestination, logout); | ||
300 | if (logout && m_RestrictInventoryAccessAbroad) | ||
301 | { | ||
302 | // Restore the user's inventory, because we removed it earlier on | ||
303 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(sp.UUID); | ||
304 | if (root != null) | ||
305 | { | ||
306 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring"); | ||
307 | sp.ControllingClient.SendBulkUpdateInventory(root); | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
286 | #endregion | 312 | #endregion |
287 | 313 | ||
288 | #region IUserAgentVerificationModule | 314 | #region IUserAgentVerificationModule |
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 3f466be..7f8271d 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
72 | 72 | ||
73 | m_scene = scene; | 73 | m_scene = scene; |
74 | 74 | ||
75 | m_scene.AddCommand(this, "monitor report", | 75 | m_scene.AddCommand("General", this, "monitor report", |
76 | "monitor report", | 76 | "monitor report", |
77 | "Returns a variety of statistics about the current region and/or simulator", | 77 | "Returns a variety of statistics about the current region and/or simulator", |
78 | DebugMonitors); | 78 | DebugMonitors); |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs new file mode 100644 index 0000000..4eecaa2 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.IO; | ||
30 | using System.Reflection; | ||
31 | |||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Console; | ||
34 | using OpenSim.Region.Framework; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Services.Connectors.Hypergrid; | ||
39 | |||
40 | using OpenMetaverse; | ||
41 | using OpenMetaverse.Packets; | ||
42 | using log4net; | ||
43 | using Nini.Config; | ||
44 | |||
45 | namespace OpenSim.Region.CoreModules.Framework.UserManagement | ||
46 | { | ||
47 | public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | |||
52 | #region ISharedRegionModule | ||
53 | |||
54 | public new void Initialise(IConfigSource config) | ||
55 | { | ||
56 | string umanmod = config.Configs["Modules"].GetString("UserManagementModule", base.Name); | ||
57 | if (umanmod == Name) | ||
58 | { | ||
59 | m_Enabled = true; | ||
60 | RegisterConsoleCmds(); | ||
61 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public override string Name | ||
66 | { | ||
67 | get { return "HGUserManagementModule"; } | ||
68 | } | ||
69 | |||
70 | #endregion ISharedRegionModule | ||
71 | |||
72 | protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users) | ||
73 | { | ||
74 | if (query.Contains("@")) // First.Last@foo.com, maybe? | ||
75 | { | ||
76 | string[] words = query.Split(new char[] { '@' }); | ||
77 | if (words.Length != 2) | ||
78 | { | ||
79 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | words[0] = words[0].Trim(); // it has at least 1 | ||
84 | words[1] = words[1].Trim(); | ||
85 | |||
86 | if (words[0] == String.Empty) // query was @foo.com? | ||
87 | { | ||
88 | foreach (UserData d in m_UserCache.Values) | ||
89 | { | ||
90 | if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower())) | ||
91 | users.Add(d); | ||
92 | } | ||
93 | |||
94 | // We're done | ||
95 | return; | ||
96 | } | ||
97 | |||
98 | // words.Length == 2 and words[0] != string.empty | ||
99 | // first.last@foo.com ? | ||
100 | foreach (UserData d in m_UserCache.Values) | ||
101 | { | ||
102 | if (d.LastName.StartsWith("@") && | ||
103 | d.FirstName.ToLower().Equals(words[0].ToLower()) && | ||
104 | d.LastName.ToLower().Equals("@" + words[1].ToLower())) | ||
105 | { | ||
106 | users.Add(d); | ||
107 | // It's cached. We're done | ||
108 | return; | ||
109 | } | ||
110 | } | ||
111 | |||
112 | // This is it! Let's ask the other world | ||
113 | if (words[0].Contains(".")) | ||
114 | { | ||
115 | string[] names = words[0].Split(new char[] { '.' }); | ||
116 | if (names.Length >= 2) | ||
117 | { | ||
118 | |||
119 | string uriStr = "http://" + words[1]; | ||
120 | // Let's check that the last name is a valid address | ||
121 | try | ||
122 | { | ||
123 | new Uri(uriStr); | ||
124 | } | ||
125 | catch (UriFormatException) | ||
126 | { | ||
127 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr); | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr); | ||
132 | UUID userID = uasConn.GetUUID(names[0], names[1]); | ||
133 | if (!userID.Equals(UUID.Zero)) | ||
134 | { | ||
135 | UserData ud = new UserData(); | ||
136 | ud.Id = userID; | ||
137 | ud.FirstName = words[0]; | ||
138 | ud.LastName = "@" + words[1]; | ||
139 | users.Add(ud); | ||
140 | AddUser(userID, names[0], names[1], uriStr); | ||
141 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]); | ||
142 | } | ||
143 | else | ||
144 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]); | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | //else | ||
149 | //{ | ||
150 | // foreach (UserData d in m_UserCache.Values) | ||
151 | // { | ||
152 | // if (d.LastName.StartsWith("@") && | ||
153 | // (d.FirstName.ToLower().StartsWith(query.ToLower()) || | ||
154 | // d.LastName.ToLower().StartsWith(query.ToLower()))) | ||
155 | // users.Add(d); | ||
156 | // } | ||
157 | //} | ||
158 | } | ||
159 | |||
160 | } | ||
161 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index b4f6b5a..0397478 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -38,12 +38,13 @@ using OpenSim.Services.Interfaces; | |||
38 | using OpenSim.Services.Connectors.Hypergrid; | 38 | using OpenSim.Services.Connectors.Hypergrid; |
39 | 39 | ||
40 | using OpenMetaverse; | 40 | using OpenMetaverse; |
41 | using OpenMetaverse.Packets; | ||
41 | using log4net; | 42 | using log4net; |
42 | using Nini.Config; | 43 | using Nini.Config; |
43 | 44 | ||
44 | namespace OpenSim.Region.CoreModules.Framework.UserManagement | 45 | namespace OpenSim.Region.CoreModules.Framework.UserManagement |
45 | { | 46 | { |
46 | class UserData | 47 | public class UserData |
47 | { | 48 | { |
48 | public UUID Id { get; set; } | 49 | public UUID Id { get; set; } |
49 | public string FirstName { get; set; } | 50 | public string FirstName { get; set; } |
@@ -56,36 +57,23 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
56 | { | 57 | { |
57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 59 | ||
59 | private List<Scene> m_Scenes = new List<Scene>(); | 60 | protected bool m_Enabled; |
61 | protected List<Scene> m_Scenes = new List<Scene>(); | ||
60 | 62 | ||
61 | // The cache | 63 | // The cache |
62 | Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); | 64 | protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); |
63 | 65 | ||
64 | #region ISharedRegionModule | 66 | #region ISharedRegionModule |
65 | 67 | ||
66 | public void Initialise(IConfigSource config) | 68 | public void Initialise(IConfigSource config) |
67 | { | 69 | { |
68 | //m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled); | 70 | string umanmod = config.Configs["Modules"].GetString("UserManagementModule", Name); |
69 | //if (m_Enabled) | 71 | if (umanmod == Name) |
70 | //{ | 72 | { |
71 | // IConfig libConfig = config.Configs["LibraryService"]; | 73 | m_Enabled = true; |
72 | // if (libConfig != null) | 74 | RegisterConsoleCmds(); |
73 | // { | 75 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); |
74 | // string dllName = libConfig.GetString("LocalServiceModule", string.Empty); | 76 | } |
75 | // m_log.Debug("[LIBRARY MODULE]: Library service dll is " + dllName); | ||
76 | // if (dllName != string.Empty) | ||
77 | // { | ||
78 | // Object[] args = new Object[] { config }; | ||
79 | // m_Library = ServerUtils.LoadPlugin<ILibraryService>(dllName, args); | ||
80 | // } | ||
81 | // } | ||
82 | //} | ||
83 | MainConsole.Instance.Commands.AddCommand("grid", true, | ||
84 | "show names", | ||
85 | "show names", | ||
86 | "Show the bindings between user UUIDs and user names", | ||
87 | String.Empty, | ||
88 | HandleShowUsers); | ||
89 | } | 77 | } |
90 | 78 | ||
91 | public bool IsSharedModule | 79 | public bool IsSharedModule |
@@ -93,9 +81,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
93 | get { return true; } | 81 | get { return true; } |
94 | } | 82 | } |
95 | 83 | ||
96 | public string Name | 84 | public virtual string Name |
97 | { | 85 | { |
98 | get { return "UserManagement Module"; } | 86 | get { return "BasicUserManagementModule"; } |
99 | } | 87 | } |
100 | 88 | ||
101 | public Type ReplaceableInterface | 89 | public Type ReplaceableInterface |
@@ -105,17 +93,23 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
105 | 93 | ||
106 | public void AddRegion(Scene scene) | 94 | public void AddRegion(Scene scene) |
107 | { | 95 | { |
108 | m_Scenes.Add(scene); | 96 | if (m_Enabled) |
97 | { | ||
98 | m_Scenes.Add(scene); | ||
109 | 99 | ||
110 | scene.RegisterModuleInterface<IUserManagement>(this); | 100 | scene.RegisterModuleInterface<IUserManagement>(this); |
111 | scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); | 101 | scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient); |
112 | scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); | 102 | scene.EventManager.OnPrimsLoaded += new EventManager.PrimsLoaded(EventManager_OnPrimsLoaded); |
103 | } | ||
113 | } | 104 | } |
114 | 105 | ||
115 | public void RemoveRegion(Scene scene) | 106 | public void RemoveRegion(Scene scene) |
116 | { | 107 | { |
117 | scene.UnregisterModuleInterface<IUserManagement>(this); | 108 | if (m_Enabled) |
118 | m_Scenes.Remove(scene); | 109 | { |
110 | scene.UnregisterModuleInterface<IUserManagement>(this); | ||
111 | m_Scenes.Remove(scene); | ||
112 | } | ||
119 | } | 113 | } |
120 | 114 | ||
121 | public void RegionLoaded(Scene s) | 115 | public void RegionLoaded(Scene s) |
@@ -149,7 +143,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
149 | 143 | ||
150 | void EventManager_OnNewClient(IClientAPI client) | 144 | void EventManager_OnNewClient(IClientAPI client) |
151 | { | 145 | { |
146 | client.OnConnectionClosed += new Action<IClientAPI>(HandleConnectionClosed); | ||
152 | client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); | 147 | client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest); |
148 | client.OnAvatarPickerRequest += new AvatarPickerRequest(HandleAvatarPickerRequest); | ||
149 | } | ||
150 | |||
151 | void HandleConnectionClosed(IClientAPI client) | ||
152 | { | ||
153 | client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest); | ||
154 | client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); | ||
153 | } | 155 | } |
154 | 156 | ||
155 | void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) | 157 | void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) |
@@ -170,6 +172,77 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
170 | } | 172 | } |
171 | } | 173 | } |
172 | 174 | ||
175 | public void HandleAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) | ||
176 | { | ||
177 | //EventManager.TriggerAvatarPickerRequest(); | ||
178 | |||
179 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: HandleAvatarPickerRequest for {0}", query); | ||
180 | |||
181 | List<UserAccount> accs = m_Scenes[0].UserAccountService.GetUserAccounts(m_Scenes[0].RegionInfo.ScopeID, query); | ||
182 | |||
183 | List<UserData> users = new List<UserData>(); | ||
184 | if (accs != null) | ||
185 | { | ||
186 | foreach (UserAccount acc in accs) | ||
187 | { | ||
188 | UserData ud = new UserData(); | ||
189 | ud.FirstName = acc.FirstName; | ||
190 | ud.LastName = acc.LastName; | ||
191 | ud.Id = acc.PrincipalID; | ||
192 | users.Add(ud); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | AddAdditionalUsers(avatarID, query, users); | ||
197 | |||
198 | AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); | ||
199 | // TODO: don't create new blocks if recycling an old packet | ||
200 | |||
201 | AvatarPickerReplyPacket.DataBlock[] searchData = | ||
202 | new AvatarPickerReplyPacket.DataBlock[users.Count]; | ||
203 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); | ||
204 | |||
205 | agentData.AgentID = avatarID; | ||
206 | agentData.QueryID = RequestID; | ||
207 | replyPacket.AgentData = agentData; | ||
208 | //byte[] bytes = new byte[AvatarResponses.Count*32]; | ||
209 | |||
210 | int i = 0; | ||
211 | foreach (UserData item in users) | ||
212 | { | ||
213 | UUID translatedIDtem = item.Id; | ||
214 | searchData[i] = new AvatarPickerReplyPacket.DataBlock(); | ||
215 | searchData[i].AvatarID = translatedIDtem; | ||
216 | searchData[i].FirstName = Utils.StringToBytes((string)item.FirstName); | ||
217 | searchData[i].LastName = Utils.StringToBytes((string)item.LastName); | ||
218 | i++; | ||
219 | } | ||
220 | if (users.Count == 0) | ||
221 | { | ||
222 | searchData = new AvatarPickerReplyPacket.DataBlock[0]; | ||
223 | } | ||
224 | replyPacket.Data = searchData; | ||
225 | |||
226 | AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs(); | ||
227 | agent_data.AgentID = replyPacket.AgentData.AgentID; | ||
228 | agent_data.QueryID = replyPacket.AgentData.QueryID; | ||
229 | |||
230 | List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>(); | ||
231 | for (i = 0; i < replyPacket.Data.Length; i++) | ||
232 | { | ||
233 | AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs(); | ||
234 | data_arg.AvatarID = replyPacket.Data[i].AvatarID; | ||
235 | data_arg.FirstName = replyPacket.Data[i].FirstName; | ||
236 | data_arg.LastName = replyPacket.Data[i].LastName; | ||
237 | data_args.Add(data_arg); | ||
238 | } | ||
239 | client.SendAvatarPickerReply(agent_data, data_args); | ||
240 | } | ||
241 | |||
242 | protected virtual void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users) | ||
243 | { | ||
244 | } | ||
245 | |||
173 | #endregion Event Handlers | 246 | #endregion Event Handlers |
174 | 247 | ||
175 | private void CacheCreators(SceneObjectGroup sog) | 248 | private void CacheCreators(SceneObjectGroup sog) |
@@ -226,7 +299,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
226 | 299 | ||
227 | public string GetUserName(UUID uuid) | 300 | public string GetUserName(UUID uuid) |
228 | { | 301 | { |
229 | //m_log.DebugFormat("[XXX] GetUserName {0}", uuid); | ||
230 | string[] names = GetUserNames(uuid); | 302 | string[] names = GetUserNames(uuid); |
231 | if (names.Length == 2) | 303 | if (names.Length == 2) |
232 | { | 304 | { |
@@ -267,9 +339,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
267 | 339 | ||
268 | if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) | 340 | if (userdata.HomeURL != null && userdata.HomeURL != string.Empty) |
269 | { | 341 | { |
270 | m_log.DebugFormat( | 342 | //m_log.DebugFormat( |
271 | "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", | 343 | // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", |
272 | serverType, userdata.HomeURL, userID); | 344 | // serverType, userdata.HomeURL, userID); |
273 | 345 | ||
274 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); | 346 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); |
275 | userdata.ServerURLs = uConn.GetServerURLs(userID); | 347 | userdata.ServerURLs = uConn.GetServerURLs(userID); |
@@ -328,11 +400,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
328 | 400 | ||
329 | public void AddUser(UUID uuid, string first, string last, string homeURL) | 401 | public void AddUser(UUID uuid, string first, string last, string homeURL) |
330 | { | 402 | { |
403 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL); | ||
404 | |||
331 | AddUser(uuid, homeURL + ";" + first + " " + last); | 405 | AddUser(uuid, homeURL + ";" + first + " " + last); |
332 | } | 406 | } |
333 | 407 | ||
334 | public void AddUser (UUID id, string creatorData) | 408 | public void AddUser (UUID id, string creatorData) |
335 | { | 409 | { |
410 | //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); | ||
411 | |||
336 | UserData oldUser; | 412 | UserData oldUser; |
337 | //lock the whole block - prevent concurrent update | 413 | //lock the whole block - prevent concurrent update |
338 | lock (m_UserCache) | 414 | lock (m_UserCache) |
@@ -358,9 +434,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
358 | return; | 434 | return; |
359 | } | 435 | } |
360 | } | 436 | } |
361 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); | ||
362 | 437 | ||
363 | UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); | 438 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); |
364 | 439 | ||
365 | if (account != null) | 440 | if (account != null) |
366 | { | 441 | { |
@@ -409,9 +484,9 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
409 | lock (m_UserCache) | 484 | lock (m_UserCache) |
410 | m_UserCache[user.Id] = user; | 485 | m_UserCache[user.Id] = user; |
411 | 486 | ||
412 | // m_log.DebugFormat( | 487 | //m_log.DebugFormat( |
413 | // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", | 488 | // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", |
414 | // user.Id, user.FirstName, user.LastName, user.HomeURL); | 489 | // user.Id, user.FirstName, user.LastName, user.HomeURL); |
415 | } | 490 | } |
416 | 491 | ||
417 | public bool IsLocalGridUser(UUID uuid) | 492 | public bool IsLocalGridUser(UUID uuid) |
@@ -425,13 +500,23 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
425 | 500 | ||
426 | #endregion IUserManagement | 501 | #endregion IUserManagement |
427 | 502 | ||
503 | protected void RegisterConsoleCmds() | ||
504 | { | ||
505 | MainConsole.Instance.Commands.AddCommand("Users", true, | ||
506 | "show names", | ||
507 | "show names", | ||
508 | "Show the bindings between user UUIDs and user names", | ||
509 | String.Empty, | ||
510 | HandleShowUsers); | ||
511 | } | ||
512 | |||
428 | private void HandleShowUsers(string module, string[] cmd) | 513 | private void HandleShowUsers(string module, string[] cmd) |
429 | { | 514 | { |
430 | lock (m_UserCache) | 515 | lock (m_UserCache) |
431 | { | 516 | { |
432 | if (m_UserCache.Count == 0) | 517 | if (m_UserCache.Count == 0) |
433 | { | 518 | { |
434 | MainConsole.Instance.Output("No users not found"); | 519 | MainConsole.Instance.Output("No users found"); |
435 | return; | 520 | return; |
436 | } | 521 | } |
437 | 522 | ||
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index e22fd38..dc6efed 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <RegionModule id="UserManagementModule" type="OpenSim.Region.CoreModules.Framework.UserManagement.UserManagementModule" /> | 11 | <RegionModule id="UserManagementModule" type="OpenSim.Region.CoreModules.Framework.UserManagement.UserManagementModule" /> |
12 | <RegionModule id="HGUserManagementModule" type="OpenSim.Region.CoreModules.Framework.UserManagement.HGUserManagementModule" /> | ||
12 | <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" /> | 13 | <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" /> |
13 | <RegionModule id="HGEntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule" /> | 14 | <RegionModule id="HGEntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule" /> |
14 | <RegionModule id="InventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.BasicInventoryAccessModule" /> | 15 | <RegionModule id="InventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.BasicInventoryAccessModule" /> |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 640a60b..ef9b4e0 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
151 | 151 | ||
152 | #region IWorldComm Members | 152 | #region IWorldComm Members |
153 | 153 | ||
154 | public int ListenerCount | ||
155 | { | ||
156 | get | ||
157 | { | ||
158 | return m_listenerManager.ListenerCount; | ||
159 | } | ||
160 | } | ||
161 | |||
154 | /// <summary> | 162 | /// <summary> |
155 | /// Create a listen event callback with the specified filters. | 163 | /// Create a listen event callback with the specified filters. |
156 | /// The parameters localID,itemID are needed to uniquely identify | 164 | /// The parameters localID,itemID are needed to uniquely identify |
@@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
438 | private int m_maxhandles; | 446 | private int m_maxhandles; |
439 | private int m_curlisteners; | 447 | private int m_curlisteners; |
440 | 448 | ||
449 | /// <summary> | ||
450 | /// Total number of listeners | ||
451 | /// </summary> | ||
452 | public int ListenerCount | ||
453 | { | ||
454 | get | ||
455 | { | ||
456 | lock (m_listeners) | ||
457 | return m_listeners.Count; | ||
458 | } | ||
459 | } | ||
460 | |||
441 | public ListenerManager(int maxlisteners, int maxhandles) | 461 | public ListenerManager(int maxlisteners, int maxhandles) |
442 | { | 462 | { |
443 | m_maxlisteners = maxlisteners; | 463 | m_maxlisteners = maxlisteners; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 89abbb2..8df1c7b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -48,8 +48,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
48 | private static bool m_Enabled = false; | 48 | private static bool m_Enabled = false; |
49 | 49 | ||
50 | private IConfigSource m_Config; | 50 | private IConfigSource m_Config; |
51 | bool m_Registered = false; | 51 | private bool m_Registered = false; |
52 | GatekeeperServiceInConnector m_HypergridHandler; | 52 | private string m_LocalServiceDll = String.Empty; |
53 | private GatekeeperServiceInConnector m_HypergridHandler; | ||
54 | private UserAgentServerConnector m_UASHandler; | ||
53 | 55 | ||
54 | #region IRegionModule interface | 56 | #region IRegionModule interface |
55 | 57 | ||
@@ -63,6 +65,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
63 | if (m_Enabled) | 65 | if (m_Enabled) |
64 | { | 66 | { |
65 | m_log.Info("[HGGRID IN CONNECTOR]: Hypergrid Service In Connector enabled"); | 67 | m_log.Info("[HGGRID IN CONNECTOR]: Hypergrid Service In Connector enabled"); |
68 | IConfig fconfig = config.Configs["FriendsService"]; | ||
69 | if (fconfig != null) | ||
70 | { | ||
71 | m_LocalServiceDll = fconfig.GetString("LocalServiceModule", m_LocalServiceDll); | ||
72 | if (m_LocalServiceDll == String.Empty) | ||
73 | m_log.WarnFormat("[HGGRID IN CONNECTOR]: Friends LocalServiceModule config missing"); | ||
74 | } | ||
66 | } | 75 | } |
67 | 76 | ||
68 | } | 77 | } |
@@ -91,7 +100,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
91 | { | 100 | { |
92 | if (!m_Enabled) | 101 | if (!m_Enabled) |
93 | return; | 102 | return; |
94 | |||
95 | } | 103 | } |
96 | 104 | ||
97 | public void RemoveRegion(Scene scene) | 105 | public void RemoveRegion(Scene scene) |
@@ -112,14 +120,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
112 | m_log.Info("[HypergridService]: Starting..."); | 120 | m_log.Info("[HypergridService]: Starting..."); |
113 | 121 | ||
114 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | 122 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); |
123 | IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>(); | ||
124 | Object[] args = new Object[] { m_Config }; | ||
125 | IFriendsService friendsService = ServerUtils.LoadPlugin<IFriendsService>(m_LocalServiceDll, args); | ||
126 | |||
115 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 127 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
116 | 128 | ||
117 | IFriendsSimConnector friendsConn = scene.RequestModuleInterface<IFriendsSimConnector>(); | 129 | m_UASHandler = new UserAgentServerConnector(m_Config, MainServer.Instance, friendsConn); |
118 | new UserAgentServerConnector(m_Config, MainServer.Instance, friendsConn); | 130 | |
119 | new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); | 131 | new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); |
120 | new HGFriendsServerConnector(m_Config, MainServer.Instance, "HGFriendsService"); | 132 | |
133 | new HGFriendsServerConnector(m_Config, MainServer.Instance, "HGFriendsService", friendsConn); | ||
121 | } | 134 | } |
122 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); | 135 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); |
136 | scene.RegisterModuleInterface<IUserAgentService>(m_UASHandler.HomeUsersService); | ||
123 | } | 137 | } |
124 | 138 | ||
125 | #endregion | 139 | #endregion |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 2e6ec90..c78915f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -73,14 +73,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
73 | return; | 73 | return; |
74 | } | 74 | } |
75 | 75 | ||
76 | string serviceDll = assetConfig.GetString("LocalServiceModule", | 76 | string serviceDll = assetConfig.GetString("LocalServiceModule", String.Empty); |
77 | String.Empty); | ||
78 | 77 | ||
79 | if (serviceDll == String.Empty) | 78 | if (serviceDll == String.Empty) |
80 | { | 79 | { |
81 | m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); | 80 | m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); |
82 | return; | 81 | return; |
83 | } | 82 | } |
83 | else | ||
84 | { | ||
85 | m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Loading asset service at {0}", serviceDll); | ||
86 | } | ||
84 | 87 | ||
85 | Object[] args = new Object[] { source }; | 88 | Object[] args = new Object[] { source }; |
86 | m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args); | 89 | m_AssetService = ServerUtils.LoadPlugin<IAssetService>(serviceDll, args); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs new file mode 100644 index 0000000..f0d21e6 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using log4net; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenMetaverse; | ||
39 | |||
40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | ||
43 | { | ||
44 | public class AuthorizationService : IAuthorizationService | ||
45 | { | ||
46 | private enum AccessFlags | ||
47 | { | ||
48 | None = 0, /* No restrictions */ | ||
49 | DisallowResidents = 1, /* Only gods and managers*/ | ||
50 | DisallowForeigners = 2, /* Only local people */ | ||
51 | } | ||
52 | |||
53 | private static readonly ILog m_log = | ||
54 | LogManager.GetLogger( | ||
55 | MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | |||
57 | private IUserManagement m_UserManagement; | ||
58 | private IGridService m_GridService; | ||
59 | |||
60 | private Scene m_Scene; | ||
61 | AccessFlags m_accessValue = AccessFlags.None; | ||
62 | |||
63 | |||
64 | public AuthorizationService(IConfig config, Scene scene) | ||
65 | { | ||
66 | m_Scene = scene; | ||
67 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); | ||
68 | m_GridService = scene.GridService; | ||
69 | |||
70 | if (config != null) | ||
71 | { | ||
72 | string accessStr = config.GetString("Region_" + scene.RegionInfo.RegionName.Replace(' ', '_'), String.Empty); | ||
73 | if (accessStr != string.Empty) | ||
74 | { | ||
75 | try | ||
76 | { | ||
77 | m_accessValue = (AccessFlags)Enum.Parse(typeof(AccessFlags), accessStr); | ||
78 | } | ||
79 | catch (ArgumentException) | ||
80 | { | ||
81 | m_log.WarnFormat("[AuthorizationService]: {0} is not a valid access flag", accessStr); | ||
82 | } | ||
83 | } | ||
84 | m_log.DebugFormat("[AuthorizationService]: Region {0} access restrictions: {1}", m_Scene.RegionInfo.RegionName, m_accessValue); | ||
85 | } | ||
86 | |||
87 | } | ||
88 | |||
89 | public bool IsAuthorizedForRegion( | ||
90 | string user, string firstName, string lastName, string regionID, out string message) | ||
91 | { | ||
92 | message = "authorized"; | ||
93 | |||
94 | // This should not happen | ||
95 | if (m_Scene.RegionInfo.RegionID.ToString() != regionID) | ||
96 | { | ||
97 | m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}", | ||
98 | m_Scene.RegionInfo.RegionID, regionID); | ||
99 | return true; | ||
100 | } | ||
101 | |||
102 | if (m_accessValue == AccessFlags.None) | ||
103 | return true; | ||
104 | |||
105 | UUID userID = new UUID(user); | ||
106 | bool authorized = true; | ||
107 | if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners) | ||
108 | { | ||
109 | authorized = m_UserManagement.IsLocalGridUser(userID); | ||
110 | if (!authorized) | ||
111 | message = "no foreigner users allowed in this region"; | ||
112 | } | ||
113 | if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents) | ||
114 | { | ||
115 | authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID); | ||
116 | if (!authorized) | ||
117 | message = "only Admins and Managers allowed in this region"; | ||
118 | } | ||
119 | |||
120 | return authorized; | ||
121 | } | ||
122 | |||
123 | } | ||
124 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs index 18a7177..267fb9e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs | |||
@@ -39,13 +39,15 @@ using OpenMetaverse; | |||
39 | 39 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | 40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization |
41 | { | 41 | { |
42 | public class LocalAuthorizationServicesConnector : ISharedRegionModule, IAuthorizationService | 42 | public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private IAuthorizationService m_AuthorizationService; | 48 | private IAuthorizationService m_AuthorizationService; |
49 | private Scene m_Scene; | ||
50 | private IConfig m_AuthorizationConfig; | ||
49 | 51 | ||
50 | private bool m_Enabled = false; | 52 | private bool m_Enabled = false; |
51 | 53 | ||
@@ -69,33 +71,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
69 | string name = moduleConfig.GetString("AuthorizationServices", string.Empty); | 71 | string name = moduleConfig.GetString("AuthorizationServices", string.Empty); |
70 | if (name == Name) | 72 | if (name == Name) |
71 | { | 73 | { |
72 | IConfig authorizationConfig = source.Configs["AuthorizationService"]; | ||
73 | if (authorizationConfig == null) | ||
74 | { | ||
75 | m_log.Error("[AUTHORIZATION CONNECTOR]: AuthorizationService missing from OpenSim.ini"); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | string serviceDll = authorizationConfig.GetString("LocalServiceModule", | ||
80 | String.Empty); | ||
81 | |||
82 | if (serviceDll == String.Empty) | ||
83 | { | ||
84 | m_log.Error("[AUTHORIZATION CONNECTOR]: No LocalServiceModule named in section AuthorizationService"); | ||
85 | return; | ||
86 | } | ||
87 | |||
88 | Object[] args = new Object[] { source }; | ||
89 | m_AuthorizationService = | ||
90 | ServerUtils.LoadPlugin<IAuthorizationService>(serviceDll, | ||
91 | args); | ||
92 | |||
93 | if (m_AuthorizationService == null) | ||
94 | { | ||
95 | m_log.Error("[AUTHORIZATION CONNECTOR]: Can't load authorization service"); | ||
96 | return; | ||
97 | } | ||
98 | m_Enabled = true; | 74 | m_Enabled = true; |
75 | m_AuthorizationConfig = source.Configs["AuthorizationService"]; | ||
99 | m_log.Info("[AUTHORIZATION CONNECTOR]: Local authorization connector enabled"); | 76 | m_log.Info("[AUTHORIZATION CONNECTOR]: Local authorization connector enabled"); |
100 | } | 77 | } |
101 | } | 78 | } |
@@ -115,6 +92,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
115 | return; | 92 | return; |
116 | 93 | ||
117 | scene.RegisterModuleInterface<IAuthorizationService>(this); | 94 | scene.RegisterModuleInterface<IAuthorizationService>(this); |
95 | m_Scene = scene; | ||
118 | } | 96 | } |
119 | 97 | ||
120 | public void RemoveRegion(Scene scene) | 98 | public void RemoveRegion(Scene scene) |
@@ -126,6 +104,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
126 | if (!m_Enabled) | 104 | if (!m_Enabled) |
127 | return; | 105 | return; |
128 | 106 | ||
107 | m_AuthorizationService = new AuthorizationService(m_AuthorizationConfig, m_Scene); | ||
108 | |||
129 | m_log.InfoFormat( | 109 | m_log.InfoFormat( |
130 | "[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}", | 110 | "[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}", |
131 | scene.RegionInfo.RegionName); | 111 | scene.RegionInfo.RegionName); |
@@ -134,6 +114,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
134 | public bool IsAuthorizedForRegion( | 114 | public bool IsAuthorizedForRegion( |
135 | string userID, string firstName, string lastName, string regionID, out string message) | 115 | string userID, string firstName, string lastName, string regionID, out string message) |
136 | { | 116 | { |
117 | message = ""; | ||
118 | if (!m_Enabled) | ||
119 | return true; | ||
120 | |||
137 | return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message); | 121 | return m_AuthorizationService.IsAuthorizedForRegion(userID, firstName, lastName, regionID, out message); |
138 | } | 122 | } |
139 | } | 123 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 3c36799..540f33a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -48,8 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
48 | LogManager.GetLogger( | 48 | LogManager.GetLogger( |
49 | MethodBase.GetCurrentMethod().DeclaringType); | 49 | MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private static LocalGridServicesConnector m_MainInstance; | ||
52 | |||
53 | private IGridService m_GridService; | 51 | private IGridService m_GridService; |
54 | private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); | 52 | private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); |
55 | 53 | ||
@@ -62,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
62 | public LocalGridServicesConnector(IConfigSource source) | 60 | public LocalGridServicesConnector(IConfigSource source) |
63 | { | 61 | { |
64 | m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); | 62 | m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); |
65 | m_MainInstance = this; | ||
66 | InitialiseService(source); | 63 | InitialiseService(source); |
67 | } | 64 | } |
68 | 65 | ||
@@ -87,7 +84,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
87 | if (name == Name) | 84 | if (name == Name) |
88 | { | 85 | { |
89 | InitialiseService(source); | 86 | InitialiseService(source); |
90 | m_MainInstance = this; | ||
91 | m_Enabled = true; | 87 | m_Enabled = true; |
92 | m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); | 88 | m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); |
93 | } | 89 | } |
@@ -126,12 +122,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
126 | 122 | ||
127 | public void PostInitialise() | 123 | public void PostInitialise() |
128 | { | 124 | { |
129 | if (m_MainInstance == this) | 125 | MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours", |
130 | { | 126 | "show neighbours", |
131 | MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", | 127 | "Shows the local regions' neighbours", NeighboursCommand); |
132 | "show neighbours", | ||
133 | "Shows the local regions' neighbours", NeighboursCommand); | ||
134 | } | ||
135 | } | 128 | } |
136 | 129 | ||
137 | public void Close() | 130 | public void Close() |
@@ -143,22 +136,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
143 | if (m_Enabled) | 136 | if (m_Enabled) |
144 | scene.RegisterModuleInterface<IGridService>(this); | 137 | scene.RegisterModuleInterface<IGridService>(this); |
145 | 138 | ||
146 | if (m_MainInstance == this) | 139 | if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) |
147 | { | 140 | m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); |
148 | if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) | 141 | else |
149 | m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); | 142 | m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); |
150 | else | ||
151 | m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); | ||
152 | } | ||
153 | } | 143 | } |
154 | 144 | ||
155 | public void RemoveRegion(Scene scene) | 145 | public void RemoveRegion(Scene scene) |
156 | { | 146 | { |
157 | if (m_MainInstance == this) | 147 | m_LocalCache[scene.RegionInfo.RegionID].Clear(); |
158 | { | 148 | m_LocalCache.Remove(scene.RegionInfo.RegionID); |
159 | m_LocalCache[scene.RegionInfo.RegionID].Clear(); | ||
160 | m_LocalCache.Remove(scene.RegionInfo.RegionID); | ||
161 | } | ||
162 | } | 149 | } |
163 | 150 | ||
164 | public void RegionLoaded(Scene scene) | 151 | public void RegionLoaded(Scene scene) |
@@ -259,6 +246,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
259 | 246 | ||
260 | MainConsole.Instance.Output(caps.ToString()); | 247 | MainConsole.Instance.Output(caps.ToString()); |
261 | } | 248 | } |
262 | |||
263 | } | 249 | } |
264 | } | 250 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index b5c0af6..4be3804 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -58,6 +58,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
58 | 58 | ||
59 | private List<Scene> m_Scenes = new List<Scene>(); | 59 | private List<Scene> m_Scenes = new List<Scene>(); |
60 | 60 | ||
61 | private InventoryCache m_Cache = new InventoryCache(); | ||
62 | |||
61 | protected IUserManagement m_UserManagement; | 63 | protected IUserManagement m_UserManagement; |
62 | protected IUserManagement UserManagementModule | 64 | protected IUserManagement UserManagementModule |
63 | { | 65 | { |
@@ -312,6 +314,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
312 | public InventoryFolderBase GetRootFolder(UUID userID) | 314 | public InventoryFolderBase GetRootFolder(UUID userID) |
313 | { | 315 | { |
314 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); | 316 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); |
317 | InventoryFolderBase root = m_Cache.GetRootFolder(userID); | ||
318 | if (root != null) | ||
319 | return root; | ||
315 | 320 | ||
316 | string invURL = GetInventoryServiceURL(userID); | 321 | string invURL = GetInventoryServiceURL(userID); |
317 | 322 | ||
@@ -320,12 +325,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
320 | 325 | ||
321 | IInventoryService connector = GetConnector(invURL); | 326 | IInventoryService connector = GetConnector(invURL); |
322 | 327 | ||
323 | return connector.GetRootFolder(userID); | 328 | root = connector.GetRootFolder(userID); |
329 | |||
330 | m_Cache.Cache(userID, root); | ||
331 | |||
332 | return root; | ||
324 | } | 333 | } |
325 | 334 | ||
326 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | 335 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) |
327 | { | 336 | { |
328 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); | 337 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); |
338 | InventoryFolderBase f = m_Cache.GetFolderForType(userID, type); | ||
339 | if (f != null) | ||
340 | return f; | ||
329 | 341 | ||
330 | string invURL = GetInventoryServiceURL(userID); | 342 | string invURL = GetInventoryServiceURL(userID); |
331 | 343 | ||
@@ -334,7 +346,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
334 | 346 | ||
335 | IInventoryService connector = GetConnector(invURL); | 347 | IInventoryService connector = GetConnector(invURL); |
336 | 348 | ||
337 | return connector.GetFolderForType(userID, type); | 349 | f = connector.GetFolderForType(userID, type); |
350 | |||
351 | m_Cache.Cache(userID, type, f); | ||
352 | |||
353 | return f; | ||
338 | } | 354 | } |
339 | 355 | ||
340 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 356 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs new file mode 100644 index 0000000..0fe778d --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -0,0 +1,59 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | |||
4 | using OpenSim.Framework; | ||
5 | using OpenMetaverse; | ||
6 | |||
7 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
8 | { | ||
9 | public class InventoryCache | ||
10 | { | ||
11 | private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour | ||
12 | |||
13 | private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); | ||
14 | private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>(); | ||
15 | |||
16 | public void Cache(UUID userID, InventoryFolderBase root) | ||
17 | { | ||
18 | lock (m_RootFolders) | ||
19 | m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS); | ||
20 | } | ||
21 | |||
22 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
23 | { | ||
24 | InventoryFolderBase root = null; | ||
25 | if (m_RootFolders.TryGetValue(userID, out root)) | ||
26 | return root; | ||
27 | |||
28 | return null; | ||
29 | } | ||
30 | |||
31 | public void Cache(UUID userID, AssetType type, InventoryFolderBase folder) | ||
32 | { | ||
33 | lock (m_FolderTypes) | ||
34 | { | ||
35 | Dictionary<AssetType, InventoryFolderBase> ff = null; | ||
36 | if (!m_FolderTypes.TryGetValue(userID, out ff)) | ||
37 | { | ||
38 | ff = new Dictionary<AssetType, InventoryFolderBase>(); | ||
39 | m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS); | ||
40 | } | ||
41 | if (!ff.ContainsKey(type)) | ||
42 | ff.Add(type, folder); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
47 | { | ||
48 | Dictionary<AssetType, InventoryFolderBase> ff = null; | ||
49 | if (m_FolderTypes.TryGetValue(userID, out ff)) | ||
50 | { | ||
51 | InventoryFolderBase f = null; | ||
52 | if (ff.TryGetValue(type, out f)) | ||
53 | return f; | ||
54 | } | ||
55 | |||
56 | return null; | ||
57 | } | ||
58 | } | ||
59 | } | ||
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index 2399134..553a32d 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs | |||
@@ -47,21 +47,21 @@ namespace OpenSim.Region.CoreModules.World | |||
47 | 47 | ||
48 | public void Initialise(IConfigSource config) | 48 | public void Initialise(IConfigSource config) |
49 | { | 49 | { |
50 | MainConsole.Instance.Commands.AddCommand("access", true, | 50 | MainConsole.Instance.Commands.AddCommand("Users", true, |
51 | "login enable", | 51 | "login enable", |
52 | "login enable", | 52 | "login enable", |
53 | "Enable simulator logins", | 53 | "Enable simulator logins", |
54 | String.Empty, | 54 | String.Empty, |
55 | HandleLoginCommand); | 55 | HandleLoginCommand); |
56 | 56 | ||
57 | MainConsole.Instance.Commands.AddCommand("access", true, | 57 | MainConsole.Instance.Commands.AddCommand("Users", true, |
58 | "login disable", | 58 | "login disable", |
59 | "login disable", | 59 | "login disable", |
60 | "Disable simulator logins", | 60 | "Disable simulator logins", |
61 | String.Empty, | 61 | String.Empty, |
62 | HandleLoginCommand); | 62 | HandleLoginCommand); |
63 | 63 | ||
64 | MainConsole.Instance.Commands.AddCommand("access", true, | 64 | MainConsole.Instance.Commands.AddCommand("Users", true, |
65 | "login status", | 65 | "login status", |
66 | "login status", | 66 | "login status", |
67 | "Show login status", | 67 | "Show login status", |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index 9ec4ebe..c179a34 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -108,12 +108,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
108 | // "[ARCHIVER]: Received {0} of {1} assets requested", | 108 | // "[ARCHIVER]: Received {0} of {1} assets requested", |
109 | // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); | 109 | // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); |
110 | 110 | ||
111 | m_log.InfoFormat("[ARCHIVER]: Adding region settings to archive."); | ||
112 | |||
111 | // Write out region settings | 113 | // Write out region settings |
112 | string settingsPath | 114 | string settingsPath |
113 | = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName); | 115 | = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName); |
114 | m_archiveWriter.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(m_scene.RegionInfo.RegionSettings)); | 116 | m_archiveWriter.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(m_scene.RegionInfo.RegionSettings)); |
115 | 117 | ||
116 | m_log.InfoFormat("[ARCHIVER]: Added region settings to archive."); | 118 | m_log.InfoFormat("[ARCHIVER]: Adding parcel settings to archive."); |
117 | 119 | ||
118 | // Write out land data (aka parcel) settings | 120 | // Write out land data (aka parcel) settings |
119 | List<ILandObject>landObjects = m_scene.LandChannel.AllParcels(); | 121 | List<ILandObject>landObjects = m_scene.LandChannel.AllParcels(); |
@@ -124,7 +126,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
124 | landData.GlobalID.ToString()); | 126 | landData.GlobalID.ToString()); |
125 | m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData)); | 127 | m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData)); |
126 | } | 128 | } |
127 | m_log.InfoFormat("[ARCHIVER]: Added parcel settings to archive."); | 129 | |
130 | m_log.InfoFormat("[ARCHIVER]: Adding terrain information to archive."); | ||
128 | 131 | ||
129 | // Write out terrain | 132 | // Write out terrain |
130 | string terrainPath | 133 | string terrainPath |
@@ -135,7 +138,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
135 | m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); | 138 | m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); |
136 | ms.Close(); | 139 | ms.Close(); |
137 | 140 | ||
138 | m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); | 141 | m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); |
139 | 142 | ||
140 | // Write out scene object metadata | 143 | // Write out scene object metadata |
141 | foreach (SceneObjectGroup sceneObject in m_sceneObjects) | 144 | foreach (SceneObjectGroup sceneObject in m_sceneObjects) |
@@ -145,10 +148,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
145 | string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); | 148 | string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); |
146 | m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); | 149 | m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); |
147 | } | 150 | } |
148 | |||
149 | m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); | ||
150 | } | 151 | } |
151 | |||
152 | |||
153 | } | 152 | } |
154 | } | 153 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index ffcf063..4d459bf 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -219,12 +219,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
219 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | 219 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); |
220 | 220 | ||
221 | if (SaveAssets) | 221 | if (SaveAssets) |
222 | new AssetsRequest( | 222 | { |
223 | new AssetsArchiver(archiveWriter), assetUuids, | 223 | AssetsRequest ar |
224 | m_scene.AssetService, m_scene.UserAccountService, | 224 | = new AssetsRequest( |
225 | m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets).Execute(); | 225 | new AssetsArchiver(archiveWriter), assetUuids, |
226 | m_scene.AssetService, m_scene.UserAccountService, | ||
227 | m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets); | ||
228 | |||
229 | Util.FireAndForget(o => ar.Execute()); | ||
230 | } | ||
226 | else | 231 | else |
232 | { | ||
227 | awre.ReceivedAllAssets(new List<UUID>(), new List<UUID>()); | 233 | awre.ReceivedAllAssets(new List<UUID>(), new List<UUID>()); |
234 | } | ||
228 | } | 235 | } |
229 | catch (Exception) | 236 | catch (Exception) |
230 | { | 237 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 8e29e3c..55110dc 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -141,13 +141,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
141 | PerformAssetsRequestCallback(null); | 141 | PerformAssetsRequestCallback(null); |
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | 144 | ||
145 | m_requestCallbackTimer.Enabled = true; | ||
146 | |||
145 | foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids) | 147 | foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids) |
146 | { | 148 | { |
147 | m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); | 149 | // m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); |
150 | AssetBase asset = m_assetService.Get(kvp.Key.ToString()); | ||
151 | PreAssetRequestCallback(kvp.Key.ToString(), kvp.Value, asset); | ||
148 | } | 152 | } |
149 | |||
150 | m_requestCallbackTimer.Enabled = true; | ||
151 | } | 153 | } |
152 | 154 | ||
153 | protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) | 155 | protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs index f6d1a82..d2bbea3 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs | |||
@@ -62,58 +62,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
62 | { | 62 | { |
63 | m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); | 63 | m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); |
64 | 64 | ||
65 | m_module.Scene.AddCommand(m_module, "set terrain texture", | 65 | m_module.Scene.AddCommand("Regions", m_module, "set terrain texture", |
66 | "set terrain texture <number> <uuid> [<x>] [<y>]", | 66 | "set terrain texture <number> <uuid> [<x>] [<y>]", |
67 | "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + | 67 | "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " + |
68 | "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + | 68 | "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + |
69 | " that coordinate.", | 69 | " that coordinate.", |
70 | consoleSetTerrainTexture); | 70 | consoleSetTerrainTexture); |
71 | 71 | ||
72 | m_module.Scene.AddCommand(m_module, "set terrain heights", | 72 | m_module.Scene.AddCommand("Regions", m_module, "set terrain heights", |
73 | "set terrain heights <corner> <min> <max> [<x>] [<y>]", | 73 | "set terrain heights <corner> <min> <max> [<x>] [<y>]", |
74 | "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + | 74 | "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " + |
75 | "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + | 75 | "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" + |
76 | " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", | 76 | " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.", |
77 | consoleSetTerrainHeights); | 77 | consoleSetTerrainHeights); |
78 | |||
79 | Command showCommand | ||
80 | = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowEstatesCommand, "Shows all estates on the simulator."); | ||
81 | |||
82 | m_commander.RegisterCommand("show", showCommand); | ||
83 | 78 | ||
84 | m_module.Scene.RegisterModuleCommander(m_commander); | 79 | m_module.Scene.AddCommand( |
85 | 80 | "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); | |
86 | m_module.Scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | ||
87 | } | 81 | } |
88 | 82 | ||
89 | public void Close() | 83 | public void Close() {} |
90 | { | ||
91 | m_module.Scene.EventManager.OnPluginConsole -= EventManagerOnPluginConsole; | ||
92 | m_module.Scene.UnregisterModuleCommander(m_commander.Name); | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Processes commandline input. Do not call directly. | ||
97 | /// </summary> | ||
98 | /// <param name="args">Commandline arguments</param> | ||
99 | protected void EventManagerOnPluginConsole(string[] args) | ||
100 | { | ||
101 | if (args[0] == "estate") | ||
102 | { | ||
103 | if (args.Length == 1) | ||
104 | { | ||
105 | m_commander.ProcessConsoleCommand("help", new string[0]); | ||
106 | return; | ||
107 | } | ||
108 | |||
109 | string[] tmpArgs = new string[args.Length - 2]; | ||
110 | int i; | ||
111 | for (i = 2; i < args.Length; i++) | ||
112 | tmpArgs[i - 2] = args[i]; | ||
113 | |||
114 | m_commander.ProcessConsoleCommand(args[1], tmpArgs); | ||
115 | } | ||
116 | } | ||
117 | 84 | ||
118 | protected void consoleSetTerrainTexture(string module, string[] args) | 85 | protected void consoleSetTerrainTexture(string module, string[] args) |
119 | { | 86 | { |
@@ -201,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
201 | } | 168 | } |
202 | } | 169 | } |
203 | 170 | ||
204 | protected void ShowEstatesCommand(Object[] args) | 171 | protected void ShowEstatesCommand(string module, string[] cmd) |
205 | { | 172 | { |
206 | StringBuilder report = new StringBuilder(); | 173 | StringBuilder report = new StringBuilder(); |
207 | RegionInfo ri = m_module.Scene.RegionInfo; | 174 | RegionInfo ri = m_module.Scene.RegionInfo; |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index c303d6d..fc217b0 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -26,8 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.IO; | 31 | using System.IO; |
32 | using System.Linq; | ||
31 | using System.Reflection; | 33 | using System.Reflection; |
32 | using System.Security; | 34 | using System.Security; |
33 | using log4net; | 35 | using log4net; |
@@ -45,8 +47,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
45 | { | 47 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 49 | ||
48 | private delegate void LookupUUIDS(List<UUID> uuidLst); | ||
49 | |||
50 | public Scene Scene { get; private set; } | 50 | public Scene Scene { get; private set; } |
51 | public IUserManagement UserManager { get; private set; } | 51 | public IUserManagement UserManager { get; private set; } |
52 | 52 | ||
@@ -604,7 +604,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
604 | 604 | ||
605 | public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | 605 | public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) |
606 | { | 606 | { |
607 | uint ObjectLocalID; | ||
608 | SceneObjectPart part; | 607 | SceneObjectPart part; |
609 | 608 | ||
610 | switch (cmd) | 609 | switch (cmd) |
@@ -661,28 +660,23 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
661 | TriggerEstateMessage(senderID, senderName, message); | 660 | TriggerEstateMessage(senderID, senderName, message); |
662 | } | 661 | } |
663 | 662 | ||
664 | private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics) | 663 | private void handleEstateDebugRegionRequest( |
664 | IClientAPI remote_client, UUID invoice, UUID senderID, | ||
665 | bool disableScripts, bool disableCollisions, bool disablePhysics) | ||
665 | { | 666 | { |
666 | if (physics) | 667 | Scene.RegionInfo.RegionSettings.DisablePhysics = disablePhysics; |
667 | Scene.RegionInfo.RegionSettings.DisablePhysics = true; | 668 | Scene.RegionInfo.RegionSettings.DisableScripts = disableScripts; |
668 | else | 669 | Scene.RegionInfo.RegionSettings.DisableCollisions = disableCollisions; |
669 | Scene.RegionInfo.RegionSettings.DisablePhysics = false; | ||
670 | |||
671 | if (scripted) | ||
672 | Scene.RegionInfo.RegionSettings.DisableScripts = true; | ||
673 | else | ||
674 | Scene.RegionInfo.RegionSettings.DisableScripts = false; | ||
675 | |||
676 | if (collisionEvents) | ||
677 | Scene.RegionInfo.RegionSettings.DisableCollisions = true; | ||
678 | else | ||
679 | Scene.RegionInfo.RegionSettings.DisableCollisions = false; | ||
680 | |||
681 | |||
682 | Scene.RegionInfo.RegionSettings.Save(); | 670 | Scene.RegionInfo.RegionSettings.Save(); |
683 | TriggerRegionInfoChange(); | 671 | TriggerRegionInfoChange(); |
684 | 672 | ||
685 | Scene.SetSceneCoreDebug(scripted, collisionEvents, physics); | 673 | Scene.SetSceneCoreDebug( |
674 | new Dictionary<string, string>() { | ||
675 | { "scripting", (!disableScripts).ToString() }, | ||
676 | { "collisions", (!disableCollisions).ToString() }, | ||
677 | { "physics", (!disablePhysics).ToString() } | ||
678 | } | ||
679 | ); | ||
686 | } | 680 | } |
687 | 681 | ||
688 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) | 682 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) |
@@ -876,98 +870,76 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
876 | if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) | 870 | if (!Scene.Permissions.CanIssueEstateCommand(remoteClient.AgentId, false)) |
877 | return; | 871 | return; |
878 | 872 | ||
879 | Dictionary<uint, float> SceneData = new Dictionary<uint,float>(); | 873 | Dictionary<uint, float> sceneData = null; |
880 | List<UUID> uuidNameLookupList = new List<UUID>(); | ||
881 | 874 | ||
882 | if (reportType == 1) | 875 | if (reportType == 1) |
883 | { | 876 | { |
884 | SceneData = Scene.PhysicsScene.GetTopColliders(); | 877 | sceneData = Scene.PhysicsScene.GetTopColliders(); |
885 | } | 878 | } |
886 | else if (reportType == 0) | 879 | else if (reportType == 0) |
887 | { | 880 | { |
888 | SceneData = Scene.SceneGraph.GetTopScripts(); | 881 | IScriptModule scriptModule = Scene.RequestModuleInterface<IScriptModule>(); |
882 | |||
883 | if (scriptModule != null) | ||
884 | sceneData = scriptModule.GetObjectScriptsExecutionTimes(); | ||
889 | } | 885 | } |
890 | 886 | ||
891 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); | 887 | List<LandStatReportItem> SceneReport = new List<LandStatReportItem>(); |
892 | lock (SceneData) | 888 | if (sceneData != null) |
893 | { | 889 | { |
894 | foreach (uint obj in SceneData.Keys) | 890 | var sortedSceneData |
891 | = sceneData.Select( | ||
892 | item => new { Measurement = item.Value, Part = Scene.GetSceneObjectPart(item.Key) }); | ||
893 | |||
894 | sortedSceneData.OrderBy(item => item.Measurement); | ||
895 | |||
896 | int items = 0; | ||
897 | |||
898 | foreach (var entry in sortedSceneData) | ||
895 | { | 899 | { |
896 | SceneObjectPart prt = Scene.GetSceneObjectPart(obj); | 900 | // The object may have been deleted since we received the data. |
897 | if (prt != null) | 901 | if (entry.Part == null) |
902 | continue; | ||
903 | |||
904 | // Don't show scripts that haven't executed or where execution time is below one microsecond in | ||
905 | // order to produce a more readable report. | ||
906 | if (entry.Measurement < 0.001) | ||
907 | continue; | ||
908 | |||
909 | items++; | ||
910 | SceneObjectGroup so = entry.Part.ParentGroup; | ||
911 | |||
912 | LandStatReportItem lsri = new LandStatReportItem(); | ||
913 | lsri.LocationX = so.AbsolutePosition.X; | ||
914 | lsri.LocationY = so.AbsolutePosition.Y; | ||
915 | lsri.LocationZ = so.AbsolutePosition.Z; | ||
916 | lsri.Score = entry.Measurement; | ||
917 | lsri.TaskID = so.UUID; | ||
918 | lsri.TaskLocalID = so.LocalId; | ||
919 | lsri.TaskName = entry.Part.Name; | ||
920 | lsri.OwnerName = UserManager.GetUserName(so.OwnerID); | ||
921 | |||
922 | if (filter.Length != 0) | ||
898 | { | 923 | { |
899 | SceneObjectGroup sog = prt.ParentGroup; | 924 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) |
900 | LandStatReportItem lsri = new LandStatReportItem(); | ||
901 | lsri.LocationX = sog.AbsolutePosition.X; | ||
902 | lsri.LocationY = sog.AbsolutePosition.Y; | ||
903 | lsri.LocationZ = sog.AbsolutePosition.Z; | ||
904 | lsri.Score = SceneData[obj]; | ||
905 | lsri.TaskID = sog.UUID; | ||
906 | lsri.TaskLocalID = sog.LocalId; | ||
907 | lsri.TaskName = sog.GetPartName(obj); | ||
908 | lsri.OwnerName = "waiting"; | ||
909 | lock (uuidNameLookupList) | ||
910 | uuidNameLookupList.Add(sog.OwnerID); | ||
911 | |||
912 | if (filter.Length != 0) | ||
913 | { | 925 | { |
914 | if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter))) | ||
915 | { | ||
916 | } | ||
917 | else | ||
918 | { | ||
919 | continue; | ||
920 | } | ||
921 | } | 926 | } |
922 | 927 | else | |
923 | SceneReport.Add(lsri); | 928 | { |
929 | continue; | ||
930 | } | ||
924 | } | 931 | } |
932 | |||
933 | SceneReport.Add(lsri); | ||
934 | |||
935 | if (items >= 100) | ||
936 | break; | ||
925 | } | 937 | } |
926 | } | 938 | } |
927 | 939 | ||
928 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); | 940 | remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray()); |
929 | |||
930 | if (uuidNameLookupList.Count > 0) | ||
931 | LookupUUID(uuidNameLookupList); | ||
932 | } | ||
933 | |||
934 | private static void LookupUUIDSCompleted(IAsyncResult iar) | ||
935 | { | ||
936 | LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; | ||
937 | icon.EndInvoke(iar); | ||
938 | } | 941 | } |
939 | |||
940 | private void LookupUUID(List<UUID> uuidLst) | ||
941 | { | ||
942 | LookupUUIDS d = LookupUUIDsAsync; | ||
943 | 942 | ||
944 | d.BeginInvoke(uuidLst, | ||
945 | LookupUUIDSCompleted, | ||
946 | d); | ||
947 | } | ||
948 | |||
949 | private void LookupUUIDsAsync(List<UUID> uuidLst) | ||
950 | { | ||
951 | UUID[] uuidarr; | ||
952 | |||
953 | lock (uuidLst) | ||
954 | { | ||
955 | uuidarr = uuidLst.ToArray(); | ||
956 | } | ||
957 | |||
958 | for (int i = 0; i < uuidarr.Length; i++) | ||
959 | { | ||
960 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | ||
961 | |||
962 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | ||
963 | if (userManager != null) | ||
964 | userManager.GetUserName(uuidarr[i]); | ||
965 | |||
966 | // we drop it. It gets cached though... so we're ready for the next request. | ||
967 | // diva commnent 11/21/2010: uh?!? wft? | ||
968 | // justincc comment 21/01/2011: A side effect of userManager.GetUserName() I presume. | ||
969 | } | ||
970 | } | ||
971 | #endregion | 943 | #endregion |
972 | 944 | ||
973 | #region Outgoing Packets | 945 | #region Outgoing Packets |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cc42f7f..a0ed5a5 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
448 | 448 | ||
449 | public bool IsRestrictedFromLand(UUID avatar) | 449 | public bool IsRestrictedFromLand(UUID avatar) |
450 | { | 450 | { |
451 | ExpireAccessList(); | ||
452 | |||
453 | if (m_scene.Permissions.IsAdministrator(avatar)) | 451 | if (m_scene.Permissions.IsAdministrator(avatar)) |
454 | return false; | 452 | return false; |
455 | 453 | ||
@@ -459,20 +457,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
459 | if (avatar == LandData.OwnerID) | 457 | if (avatar == LandData.OwnerID) |
460 | return false; | 458 | return false; |
461 | 459 | ||
462 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 460 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) |
461 | return false; | ||
462 | |||
463 | return (!IsInLandAccessList(avatar)); | ||
464 | } | ||
465 | |||
466 | public bool IsInLandAccessList(UUID avatar) | ||
467 | { | ||
468 | ExpireAccessList(); | ||
469 | |||
470 | if (LandData.ParcelAccessList.FindIndex( | ||
471 | delegate(LandAccessEntry e) | ||
472 | { | ||
473 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | ||
474 | return true; | ||
475 | return false; | ||
476 | }) == -1) | ||
463 | { | 477 | { |
464 | if (LandData.ParcelAccessList.FindIndex( | 478 | return false; |
465 | delegate(LandAccessEntry e) | ||
466 | { | ||
467 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | ||
468 | return true; | ||
469 | return false; | ||
470 | }) == -1) | ||
471 | { | ||
472 | return true; | ||
473 | } | ||
474 | } | 479 | } |
475 | return false; | 480 | return true; |
476 | } | 481 | } |
477 | 482 | ||
478 | public void SendLandUpdateToClient(IClientAPI remote_client) | 483 | public void SendLandUpdateToClient(IClientAPI remote_client) |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index e3d04cd..f5a5c92 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -78,45 +78,45 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
78 | m_scene = scene; | 78 | m_scene = scene; |
79 | m_console = MainConsole.Instance; | 79 | m_console = MainConsole.Instance; |
80 | 80 | ||
81 | m_console.Commands.AddCommand("region", false, "delete object owner", | 81 | m_console.Commands.AddCommand("Regions", false, "delete object owner", |
82 | "delete object owner <UUID>", | 82 | "delete object owner <UUID>", |
83 | "Delete a scene object by owner", HandleDeleteObject); | 83 | "Delete a scene object by owner", HandleDeleteObject); |
84 | m_console.Commands.AddCommand("region", false, "delete object creator", | 84 | m_console.Commands.AddCommand("Regions", false, "delete object creator", |
85 | "delete object creator <UUID>", | 85 | "delete object creator <UUID>", |
86 | "Delete a scene object by creator", HandleDeleteObject); | 86 | "Delete a scene object by creator", HandleDeleteObject); |
87 | m_console.Commands.AddCommand("region", false, "delete object uuid", | 87 | m_console.Commands.AddCommand("Regions", false, "delete object uuid", |
88 | "delete object uuid <UUID>", | 88 | "delete object uuid <UUID>", |
89 | "Delete a scene object by uuid", HandleDeleteObject); | 89 | "Delete a scene object by uuid", HandleDeleteObject); |
90 | m_console.Commands.AddCommand("region", false, "delete object name", | 90 | m_console.Commands.AddCommand("Regions", false, "delete object name", |
91 | "delete object name <name>", | 91 | "delete object name <name>", |
92 | "Delete a scene object by name", HandleDeleteObject); | 92 | "Delete a scene object by name", HandleDeleteObject); |
93 | m_console.Commands.AddCommand("region", false, "delete object outside", | 93 | m_console.Commands.AddCommand("Regions", false, "delete object outside", |
94 | "delete object outside", | 94 | "delete object outside", |
95 | "Delete all scene objects outside region boundaries", HandleDeleteObject); | 95 | "Delete all scene objects outside region boundaries", HandleDeleteObject); |
96 | 96 | ||
97 | m_console.Commands.AddCommand( | 97 | m_console.Commands.AddCommand( |
98 | "region", | 98 | "Regions", |
99 | false, | 99 | false, |
100 | "show object uuid", | 100 | "show object uuid", |
101 | "show object uuid <UUID>", | 101 | "show object uuid <UUID>", |
102 | "Show details of a scene object with the given UUID", HandleShowObjectByUuid); | 102 | "Show details of a scene object with the given UUID", HandleShowObjectByUuid); |
103 | 103 | ||
104 | m_console.Commands.AddCommand( | 104 | m_console.Commands.AddCommand( |
105 | "region", | 105 | "Regions", |
106 | false, | 106 | false, |
107 | "show object name", | 107 | "show object name", |
108 | "show object name <name>", | 108 | "show object name <name>", |
109 | "Show details of scene objects with the given name", HandleShowObjectByName); | 109 | "Show details of scene objects with the given name", HandleShowObjectByName); |
110 | 110 | ||
111 | m_console.Commands.AddCommand( | 111 | m_console.Commands.AddCommand( |
112 | "region", | 112 | "Regions", |
113 | false, | 113 | false, |
114 | "show part uuid", | 114 | "show part uuid", |
115 | "show part uuid <UUID>", | 115 | "show part uuid <UUID>", |
116 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); | 116 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); |
117 | 117 | ||
118 | m_console.Commands.AddCommand( | 118 | m_console.Commands.AddCommand( |
119 | "region", | 119 | "Regions", |
120 | false, | 120 | false, |
121 | "show part name", | 121 | "show part name", |
122 | "show part name <name>", | 122 | "show part name <name>", |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 7023984..ac03747 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
94 | private bool m_RegionOwnerIsGod = false; | 94 | private bool m_RegionOwnerIsGod = false; |
95 | private bool m_RegionManagerIsGod = false; | 95 | private bool m_RegionManagerIsGod = false; |
96 | private bool m_ParcelOwnerIsGod = false; | 96 | private bool m_ParcelOwnerIsGod = false; |
97 | 97 | ||
98 | private bool m_SimpleBuildPermissions = false; | ||
99 | |||
98 | /// <value> | 100 | /// <value> |
99 | /// The set of users that are allowed to create scripts. This is only active if permissions are not being | 101 | /// The set of users that are allowed to create scripts. This is only active if permissions are not being |
100 | /// bypassed. This overrides normal permissions. | 102 | /// bypassed. This overrides normal permissions. |
@@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
139 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); | 141 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); |
140 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); | 142 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); |
141 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); | 143 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); |
142 | 144 | ||
145 | m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); | ||
146 | |||
143 | m_allowedScriptCreators | 147 | m_allowedScriptCreators |
144 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); | 148 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); |
145 | m_allowedScriptEditors | 149 | m_allowedScriptEditors |
@@ -206,17 +210,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
206 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; | 210 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; |
207 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; | 211 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; |
208 | 212 | ||
209 | m_scene.AddCommand(this, "bypass permissions", | 213 | m_scene.AddCommand("Users", this, "bypass permissions", |
210 | "bypass permissions <true / false>", | 214 | "bypass permissions <true / false>", |
211 | "Bypass permission checks", | 215 | "Bypass permission checks", |
212 | HandleBypassPermissions); | 216 | HandleBypassPermissions); |
213 | 217 | ||
214 | m_scene.AddCommand(this, "force permissions", | 218 | m_scene.AddCommand("Users", this, "force permissions", |
215 | "force permissions <true / false>", | 219 | "force permissions <true / false>", |
216 | "Force permissions on or off", | 220 | "Force permissions on or off", |
217 | HandleForcePermissions); | 221 | HandleForcePermissions); |
218 | 222 | ||
219 | m_scene.AddCommand(this, "debug permissions", | 223 | m_scene.AddCommand("Users", this, "debug permissions", |
220 | "debug permissions <true / false>", | 224 | "debug permissions <true / false>", |
221 | "Turn on permissions debugging", | 225 | "Turn on permissions debugging", |
222 | HandleDebugPermissions); | 226 | HandleDebugPermissions); |
@@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
824 | permission = true; | 828 | permission = true; |
825 | } | 829 | } |
826 | 830 | ||
831 | if (m_SimpleBuildPermissions && | ||
832 | (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user)) | ||
833 | permission = true; | ||
834 | |||
827 | return permission; | 835 | return permission; |
828 | } | 836 | } |
829 | 837 | ||
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 0f37ddd..fea4de0 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -66,21 +66,21 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
66 | m_Scene = scene; | 66 | m_Scene = scene; |
67 | 67 | ||
68 | scene.RegisterModuleInterface<IRestartModule>(this); | 68 | scene.RegisterModuleInterface<IRestartModule>(this); |
69 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 69 | MainConsole.Instance.Commands.AddCommand("Regions", |
70 | false, "region restart bluebox", | 70 | false, "region restart bluebox", |
71 | "region restart bluebox <message> <delta seconds>+", | 71 | "region restart bluebox <message> <delta seconds>+", |
72 | "Schedule a region restart", | 72 | "Schedule a region restart", |
73 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", | 73 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a dismissable bluebox notice. If multiple deltas are given then a notice is sent when we reach each delta.", |
74 | HandleRegionRestart); | 74 | HandleRegionRestart); |
75 | 75 | ||
76 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 76 | MainConsole.Instance.Commands.AddCommand("Regions", |
77 | false, "region restart notice", | 77 | false, "region restart notice", |
78 | "region restart notice <message> <delta seconds>+", | 78 | "region restart notice <message> <delta seconds>+", |
79 | "Schedule a region restart", | 79 | "Schedule a region restart", |
80 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", | 80 | "Schedule a region restart after a given number of seconds. If one delta is given then the region is restarted in delta seconds time. A time to restart is sent to users in the region as a transient notice. If multiple deltas are given then a notice is sent when we reach each delta.", |
81 | HandleRegionRestart); | 81 | HandleRegionRestart); |
82 | 82 | ||
83 | MainConsole.Instance.Commands.AddCommand("RestartModule", | 83 | MainConsole.Instance.Commands.AddCommand("Regions", |
84 | false, "region restart abort", | 84 | false, "region restart abort", |
85 | "region restart abort [<message>]", | 85 | "region restart abort [<message>]", |
86 | "Abort a region restart", HandleRegionRestart); | 86 | "Abort a region restart", HandleRegionRestart); |
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index a838e1e..9a954b8 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -277,18 +277,19 @@ namespace OpenSim.Region.CoreModules | |||
277 | m_frame = 0; | 277 | m_frame = 0; |
278 | 278 | ||
279 | // This one puts an entry in the main help screen | 279 | // This one puts an entry in the main help screen |
280 | m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); | 280 | // m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); |
281 | 281 | ||
282 | // This one enables the ability to type just "sun" without any parameters | 282 | // This one enables the ability to type just "sun" without any parameters |
283 | m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); | 283 | // m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand); |
284 | foreach (KeyValuePair<string, string> kvp in GetParamList()) | 284 | foreach (KeyValuePair<string, string> kvp in GetParamList()) |
285 | { | 285 | { |
286 | m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); | 286 | string sunCommand = string.Format("sun {0}", kvp.Key); |
287 | m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); | ||
287 | } | 288 | } |
288 | 289 | ||
289 | TimeZone local = TimeZone.CurrentTimeZone; | 290 | TimeZone local = TimeZone.CurrentTimeZone; |
290 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; | 291 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; |
291 | m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); | 292 | m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset); |
292 | 293 | ||
293 | // Align ticks with Second Life | 294 | // Align ticks with Second Life |
294 | 295 | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 21a9999..58925fd 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -132,13 +132,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
132 | { | 132 | { |
133 | // We need to do this because: | 133 | // We need to do this because: |
134 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." | 134 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." |
135 | string tempName = offsetX + "_ " + offsetY + "_" + filename; | 135 | string tempName = Path.GetTempFileName(); |
136 | 136 | ||
137 | Bitmap entireBitmap = null; | 137 | Bitmap entireBitmap = null; |
138 | Bitmap thisBitmap = null; | 138 | Bitmap thisBitmap = null; |
139 | if (File.Exists(filename)) | 139 | if (File.Exists(filename)) |
140 | { | 140 | { |
141 | File.Copy(filename, tempName); | 141 | File.Copy(filename, tempName, true); |
142 | entireBitmap = new Bitmap(tempName); | 142 | entireBitmap = new Bitmap(tempName); |
143 | if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) | 143 | if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) |
144 | { | 144 | { |
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
152 | } | 152 | } |
153 | 153 | ||
154 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); | 154 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); |
155 | Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); | 155 | // Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); |
156 | for (int x = 0; x < regionSizeX; x++) | 156 | for (int x = 0; x < regionSizeX; x++) |
157 | for (int y = 0; y < regionSizeY; y++) | 157 | for (int y = 0; y < regionSizeY; y++) |
158 | entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); | 158 | entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs index 7237f90..d407617 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs | |||
@@ -38,6 +38,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
38 | ITerrainChannel LoadStream(Stream stream); | 38 | ITerrainChannel LoadStream(Stream stream); |
39 | void SaveFile(string filename, ITerrainChannel map); | 39 | void SaveFile(string filename, ITerrainChannel map); |
40 | void SaveStream(Stream stream, ITerrainChannel map); | 40 | void SaveStream(Stream stream, ITerrainChannel map); |
41 | |||
42 | /// <summary> | ||
43 | /// Save a number of map tiles to a single big image file. | ||
44 | /// </summary> | ||
45 | /// <remarks> | ||
46 | /// If the image file already exists then the tiles saved will replace those already in the file - other tiles | ||
47 | /// will be untouched. | ||
48 | /// </remarks> | ||
49 | /// <param name="filename">The terrain file to save</param> | ||
50 | /// <param name="offsetX">The map x co-ordinate at which to begin the save.</param> | ||
51 | /// <param name="offsetY">The may y co-ordinate at which to begin the save.</param> | ||
52 | /// <param name="fileWidth">The number of tiles to save along the X axis.</param> | ||
53 | /// <param name="fileHeight">The number of tiles to save along the Y axis.</param> | ||
54 | /// <param name="regionSizeX">The width of a map tile.</param> | ||
55 | /// <param name="regionSizeY">The height of a map tile.</param> | ||
41 | void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY); | 56 | void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY); |
42 | } | 57 | } |
43 | } \ No newline at end of file | 58 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index cf000a4..b3c2969 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -86,6 +86,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
86 | private volatile bool m_tainted; | 86 | private volatile bool m_tainted; |
87 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); | 87 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); |
88 | 88 | ||
89 | private String m_InitialTerrain = "pinhead-island"; | ||
90 | |||
89 | /// <summary> | 91 | /// <summary> |
90 | /// Human readable list of terrain file extensions that are supported. | 92 | /// Human readable list of terrain file extensions that are supported. |
91 | /// </summary> | 93 | /// </summary> |
@@ -109,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
109 | /// <param name="config">Config for the region</param> | 111 | /// <param name="config">Config for the region</param> |
110 | public void Initialise(IConfigSource config) | 112 | public void Initialise(IConfigSource config) |
111 | { | 113 | { |
114 | IConfig terrainConfig = config.Configs["Terrain"]; | ||
115 | if (terrainConfig != null) | ||
116 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); | ||
112 | } | 117 | } |
113 | 118 | ||
114 | public void AddRegion(Scene scene) | 119 | public void AddRegion(Scene scene) |
@@ -120,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
120 | { | 125 | { |
121 | if (m_scene.Heightmap == null) | 126 | if (m_scene.Heightmap == null) |
122 | { | 127 | { |
123 | m_channel = new TerrainChannel(); | 128 | m_channel = new TerrainChannel(m_InitialTerrain); |
124 | m_scene.Heightmap = m_channel; | 129 | m_scene.Heightmap = m_channel; |
125 | m_revert = new TerrainChannel(); | 130 | m_revert = new TerrainChannel(); |
126 | UpdateRevertMap(); | 131 | UpdateRevertMap(); |
@@ -556,43 +561,56 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
556 | } | 561 | } |
557 | 562 | ||
558 | /// <summary> | 563 | /// <summary> |
559 | /// Saves the terrain to a larger terrain file. | 564 | /// Save a number of map tiles to a single big image file. |
560 | /// </summary> | 565 | /// </summary> |
566 | /// <remarks> | ||
567 | /// If the image file already exists then the tiles saved will replace those already in the file - other tiles | ||
568 | /// will be untouched. | ||
569 | /// </remarks> | ||
561 | /// <param name="filename">The terrain file to save</param> | 570 | /// <param name="filename">The terrain file to save</param> |
562 | /// <param name="fileWidth">The width of the file in units</param> | 571 | /// <param name="fileWidth">The number of tiles to save along the X axis.</param> |
563 | /// <param name="fileHeight">The height of the file in units</param> | 572 | /// <param name="fileHeight">The number of tiles to save along the Y axis.</param> |
564 | /// <param name="fileStartX">Where to begin our slice</param> | 573 | /// <param name="fileStartX">The map x co-ordinate at which to begin the save.</param> |
565 | /// <param name="fileStartY">Where to begin our slice</param> | 574 | /// <param name="fileStartY">The may y co-ordinate at which to begin the save.</param> |
566 | public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) | 575 | public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) |
567 | { | 576 | { |
568 | int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX; | 577 | int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX; |
569 | int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY; | 578 | int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY; |
570 | 579 | ||
571 | if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight) | 580 | if (offsetX < 0 || offsetX >= fileWidth || offsetY < 0 || offsetY >= fileHeight) |
572 | { | 581 | { |
573 | // this region is included in the tile request | 582 | MainConsole.Instance.OutputFormat( |
574 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 583 | "ERROR: file width + minimum X tile and file height + minimum Y tile must incorporate the current region at ({0},{1}). File width {2} from {3} and file height {4} from {5} does not.", |
584 | m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, fileWidth, fileStartX, fileHeight, fileStartY); | ||
585 | |||
586 | return; | ||
587 | } | ||
588 | |||
589 | // this region is included in the tile request | ||
590 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | ||
591 | { | ||
592 | if (filename.EndsWith(loader.Key)) | ||
575 | { | 593 | { |
576 | if (filename.EndsWith(loader.Key)) | 594 | lock (m_scene) |
577 | { | 595 | { |
578 | lock (m_scene) | 596 | loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, |
579 | { | 597 | fileWidth, fileHeight, |
580 | loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, | 598 | (int)Constants.RegionSize, |
581 | fileWidth, fileHeight, | 599 | (int)Constants.RegionSize); |
582 | (int)Constants.RegionSize, | 600 | |
583 | (int)Constants.RegionSize); | 601 | MainConsole.Instance.OutputFormat( |
584 | 602 | "Saved terrain from ({0},{1}) to ({2},{3}) from {4} to {5}", | |
585 | m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); | 603 | fileStartX, fileStartY, fileStartX + fileWidth - 1, fileStartY + fileHeight - 1, |
586 | } | 604 | m_scene.RegionInfo.RegionName, filename); |
587 | |||
588 | return; | ||
589 | } | 605 | } |
606 | |||
607 | return; | ||
590 | } | 608 | } |
591 | |||
592 | m_log.ErrorFormat( | ||
593 | "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | ||
594 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | ||
595 | } | 609 | } |
610 | |||
611 | MainConsole.Instance.OutputFormat( | ||
612 | "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | ||
613 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | ||
596 | } | 614 | } |
597 | 615 | ||
598 | /// <summary> | 616 | /// <summary> |
@@ -1179,8 +1197,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1179 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); | 1197 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); |
1180 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", | 1198 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", |
1181 | "Integer"); | 1199 | "Integer"); |
1182 | saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file", | 1200 | saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first tile on the file\n" |
1183 | "Integer"); | 1201 | + "= Example =\n" |
1202 | + "To save a PNG file for a set of map tiles 2 regions wide and 3 regions high from map co-ordinate (9910,10234)\n" | ||
1203 | + " # terrain save-tile ST06.png 2 3 9910 10234\n", | ||
1204 | "Integer"); | ||
1205 | |||
1184 | // Terrain adjustments | 1206 | // Terrain adjustments |
1185 | Command fillRegionCommand = | 1207 | Command fillRegionCommand = |
1186 | new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value."); | 1208 | new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value."); |
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index a488725..7b6fbda 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs | |||
@@ -117,24 +117,31 @@ namespace OpenSim.Region.CoreModules | |||
117 | } | 117 | } |
118 | 118 | ||
119 | // This one puts an entry in the main help screen | 119 | // This one puts an entry in the main help screen |
120 | m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); | 120 | // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); |
121 | 121 | ||
122 | // This one enables the ability to type just the base command without any parameters | 122 | // This one enables the ability to type just the base command without any parameters |
123 | m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); | 123 | // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); |
124 | 124 | ||
125 | // Get a list of the parameters for each plugin | 125 | // Get a list of the parameters for each plugin |
126 | foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) | 126 | foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) |
127 | { | 127 | { |
128 | m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); | 128 | // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); |
129 | m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); | 129 | m_scene.AddCommand( |
130 | "Regions", | ||
131 | this, | ||
132 | "wind base wind_update_rate", | ||
133 | "wind base wind_update_rate [<value>]", | ||
134 | "Get or set the wind update rate.", | ||
135 | "", | ||
136 | HandleConsoleBaseCommand); | ||
130 | 137 | ||
131 | foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) | 138 | foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) |
132 | { | 139 | { |
133 | m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); | 140 | string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); |
141 | m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand); | ||
134 | } | 142 | } |
135 | } | 143 | } |
136 | 144 | ||
137 | |||
138 | // Register event handlers for when Avatars enter the region, and frame ticks | 145 | // Register event handlers for when Avatars enter the region, and frame ticks |
139 | m_scene.EventManager.OnFrame += WindUpdate; | 146 | m_scene.EventManager.OnFrame += WindUpdate; |
140 | m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; | 147 | m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 657975b..f37dd94 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -92,7 +92,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | 94 | ||
95 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | 95 | //m_log.DebugFormat("MAP NAME=({0})", mapName); |
96 | |||
97 | // Hack to get around the fact that ll V3 now drops the port from the | ||
98 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | ||
99 | // | ||
100 | // Caller, use this magic form instead: | ||
101 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
102 | // or url encode if possible. | ||
103 | // the hacks we do with this viewer... | ||
104 | // | ||
105 | string mapNameOrig = mapName; | ||
106 | if (mapName.Contains("|")) | ||
107 | mapName = mapName.Replace('|', ':'); | ||
108 | if (mapName.Contains("+")) | ||
109 | mapName = mapName.Replace('+', ' '); | ||
110 | if (mapName.Contains("!")) | ||
111 | mapName = mapName.Replace('!', '/'); | ||
96 | 112 | ||
97 | // try to fetch from GridServer | 113 | // try to fetch from GridServer |
98 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 114 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
@@ -114,7 +130,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
114 | data.MapImageId = UUID.Zero; | 130 | data.MapImageId = UUID.Zero; |
115 | else | 131 | else |
116 | data.MapImageId = info.TerrainImage; | 132 | data.MapImageId = info.TerrainImage; |
117 | data.Name = info.RegionName; | 133 | // ugh! V2-3 is very sensitive about the result being |
134 | // exactly the same as the requested name | ||
135 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | ||
136 | data.Name = mapNameOrig; | ||
137 | else | ||
138 | data.Name = info.RegionName; | ||
118 | data.RegionFlags = 0; // TODO not used? | 139 | data.RegionFlags = 0; // TODO not used? |
119 | data.WaterHeight = 0; // not used | 140 | data.WaterHeight = 0; // not used |
120 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); | 141 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); |
@@ -138,6 +159,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
138 | // flags are agent flags sent from the viewer. | 159 | // flags are agent flags sent from the viewer. |
139 | // they have different values depending on different viewers, apparently | 160 | // they have different values depending on different viewers, apparently |
140 | remoteClient.SendMapBlock(blocks, flags); | 161 | remoteClient.SendMapBlock(blocks, flags); |
162 | |||
163 | // send extra user messages for V3 | ||
164 | // because the UI is very confusing | ||
165 | // while we don't fix the hard-coded urls | ||
166 | if (flags == 2) | ||
167 | { | ||
168 | if (regionInfos.Count == 0) | ||
169 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); | ||
170 | else if (regionInfos.Count == 1) | ||
171 | remoteClient.SendAgentAlertMessage("Region found!", false); | ||
172 | } | ||
141 | } | 173 | } |
142 | 174 | ||
143 | // private Scene GetClientScene(IClientAPI client) | 175 | // private Scene GetClientScene(IClientAPI client) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fd122da..faaf928 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
102 | m_scene.RegisterModuleInterface<IWorldMapModule>(this); | 102 | m_scene.RegisterModuleInterface<IWorldMapModule>(this); |
103 | 103 | ||
104 | m_scene.AddCommand( | 104 | m_scene.AddCommand( |
105 | this, "export-map", | 105 | "Regions", this, "export-map", |
106 | "export-map [<path>]", | 106 | "export-map [<path>]", |
107 | "Save an image of the world map", HandleExportWorldMapConsoleCommand); | 107 | "Save an image of the world map", HandleExportWorldMapConsoleCommand); |
108 | 108 | ||