aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Client/IClientInventory.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs48
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs78
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs29
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
7 files changed, 225 insertions, 16 deletions
diff --git a/OpenSim/Framework/Client/IClientInventory.cs b/OpenSim/Framework/Client/IClientInventory.cs
index d59f8b7..a6e0510 100644
--- a/OpenSim/Framework/Client/IClientInventory.cs
+++ b/OpenSim/Framework/Client/IClientInventory.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Framework;
30 31
31namespace OpenSim.Framework.Client 32namespace OpenSim.Framework.Client
32{ 33{
@@ -34,5 +35,6 @@ namespace OpenSim.Framework.Client
34 { 35 {
35 void SendRemoveInventoryFolders(UUID[] folders); 36 void SendRemoveInventoryFolders(UUID[] folders);
36 void SendRemoveInventoryItems(UUID[] folders); 37 void SendRemoveInventoryItems(UUID[] folders);
38 void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items);
37 } 39 }
38} 40}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index dd18b16..598bce7 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -12498,5 +12498,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12498 eq.Enqueue(BuildEvent("RemoveInventoryFolder", 12498 eq.Enqueue(BuildEvent("RemoveInventoryFolder",
12499 llsd), AgentId); 12499 llsd), AgentId);
12500 } 12500 }
12501
12502 public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items)
12503 {
12504 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
12505
12506 if (eq == null)
12507 {
12508 m_log.DebugFormat("[LLCLIENT]: Null event queue");
12509 return;
12510 }
12511
12512 OSDMap llsd = new OSDMap(3);
12513
12514 OSDMap AgentDataMap = new OSDMap(1);
12515 AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId));
12516 AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId));
12517
12518 OSDArray AgentData = new OSDArray(1);
12519 AgentData.Add(AgentDataMap);
12520
12521 llsd.Add("AgentData", AgentData);
12522
12523 OSDArray FolderData = new OSDArray();
12524
12525 foreach (UUID InventoryFolderBase in folders)
12526 {
12527 OSDMap FolderDataMap = new OSDMap(5);
12528 FolderDataMap.Add("FolderID", OSD.FromUUID(folder.ID));
12529 FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId));
12530 FolderDataMap.Add("ParentID", OSD.FromUUID(folder.ParentID));
12531 FolderDataMap.Add("Type", OSD.FromInteger(folder.Type));
12532 FolderDataMap.Add("Name", OSD.FromString(folder.Name));
12533
12534 FolderData.Add(FolderDataMap);
12535 }
12536
12537 llsd.Add("FolderData", FolderData);
12538
12539 OSDArray ItemData = new OSDArray();
12540
12541 foreach (UUID InventoryItemBase in items)
12542 {
12543 OSDMap ItemDataMap = new OSDMap();
12544 ItemData.Add(DataMap);
12545 }
12546
12547 llsd.Add("ItemData", ItemData);
12548 }
12501 } 12549 }
12502} 12550}
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 0590716..8e32fcc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -214,6 +214,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
214 214
215 public virtual void RegionLoaded(Scene scene) 215 public virtual void RegionLoaded(Scene scene)
216 { 216 {
217 scene.AddCommand(
218 "Friends", this, "friends show cache",
219 "friends show cache [<first-name> <last-name>]",
220 "Show the friends cache for the given user",
221 HandleFriendsShowCacheCommand);
217 } 222 }
218 223
219 public void RemoveRegion(Scene scene) 224 public void RemoveRegion(Scene scene)
@@ -903,7 +908,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
903 /// Get friends from local cache only 908 /// Get friends from local cache only
904 /// </summary> 909 /// </summary>
905 /// <param name="agentID"></param> 910 /// <param name="agentID"></param>
906 /// <returns></returns> 911 /// <returns>
912 /// An empty array if the user has no friends or friends have not been cached.
913 /// </returns>
907 protected FriendInfo[] GetFriends(UUID agentID) 914 protected FriendInfo[] GetFriends(UUID agentID)
908 { 915 {
909 UserFriendData friendsData; 916 UserFriendData friendsData;
@@ -952,6 +959,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
952 } 959 }
953 } 960 }
954 961
962 /// <summary>
963 /// Are friends cached on this simulator for a particular user?
964 /// </summary>
965 /// <param name="userID"></param>
966 /// <returns></returns>
967 protected bool AreFriendsCached(UUID userID)
968 {
969 lock (m_Friends)
970 return m_Friends.ContainsKey(userID);
971 }
972
955 protected virtual bool StoreRights(UUID agentID, UUID friendID, int rights) 973 protected virtual bool StoreRights(UUID agentID, UUID friendID, int rights)
956 { 974 {
957 FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), rights); 975 FriendsService.StoreFriend(agentID.ToString(), friendID.ToString(), rights);
@@ -977,5 +995,61 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
977 } 995 }
978 996
979 #endregion 997 #endregion
998
999 protected void HandleFriendsShowCacheCommand(string module, string[] cmd)
1000 {
1001 if (cmd.Length != 5)
1002 {
1003 MainConsole.Instance.OutputFormat("Usage: friends show cache [<first-name> <last-name>]");
1004 return;
1005 }
1006
1007 string firstName = cmd[3];
1008 string lastName = cmd[4];
1009
1010 IUserManagement umModule = m_Scenes[0].RequestModuleInterface<IUserManagement>();
1011 UUID userId = umModule.GetUserIdByName(firstName, lastName);
1012
1013// UserAccount ua
1014// = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, firstName, lastName);
1015
1016 if (userId == UUID.Zero)
1017 {
1018 MainConsole.Instance.OutputFormat("No such user as {0} {1}", firstName, lastName);
1019 return;
1020 }
1021
1022 if (!AreFriendsCached(userId))
1023 {
1024 MainConsole.Instance.OutputFormat("No friends cached on this simulator for {0} {1}", firstName, lastName);
1025 return;
1026 }
1027
1028 MainConsole.Instance.OutputFormat("Cached friends for {0} {1}:", firstName, lastName);
1029
1030 MainConsole.Instance.OutputFormat("UUID\n");
1031
1032 FriendInfo[] friends = GetFriends(userId);
1033
1034 foreach (FriendInfo friend in friends)
1035 {
1036// MainConsole.Instance.OutputFormat(friend.PrincipalID.ToString());
1037
1038// string friendFirstName, friendLastName;
1039//
1040// UserAccount friendUa
1041// = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, friend.PrincipalID);
1042
1043 UUID friendId;
1044 string friendName;
1045
1046 if (UUID.TryParse(friend.Friend, out friendId))
1047 friendName = umModule.GetUserName(friendId);
1048 else
1049 friendName = friend.Friend;
1050
1051 MainConsole.Instance.OutputFormat("{0} {1} {2}", friendName, friend.MyFlags, friend.TheirFlags);
1052 }
1053 }
980 } 1054 }
981} 1055} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 4a563f9..aaba7fd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Client;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Connectors.Hypergrid; 36using OpenSim.Services.Connectors.Hypergrid;
@@ -177,9 +178,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
177 logout = success; // flag for later logout from this grid; this is an HG TP 178 logout = success; // flag for later logout from this grid; this is an HG TP
178 179
179 if (success && m_RestrictInventoryAccessAbroad) 180 if (success && m_RestrictInventoryAccessAbroad)
180 { 181 RemoveRootFolderContents(sp.ControllingClient);
181 // TODO tell the viewer to remove the root folder
182 }
183 182
184 return success; 183 return success;
185 } 184 }
@@ -304,13 +303,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
304 base.Fail(sp, finalDestination, logout); 303 base.Fail(sp, finalDestination, logout);
305 if (logout && m_RestrictInventoryAccessAbroad) 304 if (logout && m_RestrictInventoryAccessAbroad)
306 { 305 {
307 // Restore the user's inventory, because we removed it earlier on 306 RestoreRootFolderContents(sp.ControllingClient);
308 InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(sp.UUID);
309 if (root != null)
310 {
311 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring");
312 sp.ControllingClient.SendBulkUpdateInventory(root);
313 }
314 } 307 }
315 } 308 }
316 309
@@ -368,6 +361,47 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
368 361
369 #endregion 362 #endregion
370 363
364 private void RemoveRootFolderContents(IClientAPI client)
365 {
366 // TODO tell the viewer to remove the root folder's content
367 if (client is IClientCore)
368 {
369 IClientCore core = (IClientCore)client;
370 IClientInventory inv;
371
372 if (core.TryGet<IClientInventory>(out inv))
373 {
374 InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
375 if (root != null)
376 {
377 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory");
378 InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID);
379 UUID[] ids = new UUID[content.Folders.Count];
380 int i = 0;
381 foreach (InventoryFolderBase f in content.Folders)
382 ids[i++] = f.ID;
383 inv.SendRemoveInventoryFolders(ids);
384 ids = new UUID[content.Items.Count];
385 i = 0;
386 foreach (InventoryItemBase it in content.Items)
387 ids[i++] = it.ID;
388 inv.SendRemoveInventoryItems(ids);
389 }
390 }
391 }
392 }
393
394 private void RestoreRootFolderContents(IClientAPI client)
395 {
396 // Restore the user's inventory, because we removed it earlier on
397 InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId);
398 if (root != null)
399 {
400 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory");
401 client.SendBulkUpdateInventory(root);
402 }
403 }
404
371 private GridRegion MakeRegion(AgentCircuitData aCircuit) 405 private GridRegion MakeRegion(AgentCircuitData aCircuit)
372 { 406 {
373 GridRegion region = new GridRegion(); 407 GridRegion region = new GridRegion();
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 0397478..f4ed67b 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -297,6 +297,35 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
297 297
298 #region IUserManagement 298 #region IUserManagement
299 299
300 public UUID GetUserIdByName(string name)
301 {
302 string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
303 if (parts.Length < 2)
304 throw new Exception("Name must have 2 components");
305
306 return GetUserIdByName(parts[0], parts[1]);
307 }
308
309 public UUID GetUserIdByName(string firstName, string lastName)
310 {
311 // TODO: Optimize for reverse lookup if this gets used by non-console commands.
312 lock (m_UserCache)
313 {
314 foreach (UserData user in m_UserCache.Values)
315 {
316 if (user.FirstName == firstName && user.LastName == lastName)
317 return user.Id;
318 }
319 }
320
321 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
322
323 if (account != null)
324 return account.PrincipalID;
325
326 return UUID.Zero;
327 }
328
300 public string GetUserName(UUID uuid) 329 public string GetUserName(UUID uuid)
301 { 330 {
302 string[] names = GetUserNames(uuid); 331 string[] names = GetUserNames(uuid);
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index bfb8369..24cd069 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -16,6 +16,21 @@ namespace OpenSim.Region.Framework.Interfaces
16 string GetUserServerURL(UUID uuid, string serverType); 16 string GetUserServerURL(UUID uuid, string serverType);
17 17
18 /// <summary> 18 /// <summary>
19 /// Get user ID by the given name.
20 /// </summary>
21 /// <param name="name"></param>
22 /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns>
23 UUID GetUserIdByName(string name);
24
25 /// <summary>
26 /// Get user ID by the given name.
27 /// </summary>
28 /// <param name="firstName"></param>
29 /// <param name="lastName"></param>
30 /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns>
31 UUID GetUserIdByName(string firstName, string lastName);
32
33 /// <summary>
19 /// Add a user. 34 /// Add a user.
20 /// </summary> 35 /// </summary>
21 /// <remarks> 36 /// <remarks>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 973be39..9559cc4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2800,12 +2800,19 @@ namespace OpenSim.Region.Framework.Scenes
2800 // Cache the user's name 2800 // Cache the user's name
2801 CacheUserName(sp, aCircuit); 2801 CacheUserName(sp, aCircuit);
2802 2802
2803 // Let's send the Suitcase folder for incoming HG agents 2803 // Let's send the Suitcase or the real root folder folder for incoming HG agents
2804 // Visiting agents get their suitcase contents; incoming local users get their real root folder's content
2804 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) 2805 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
2805 { 2806 {
2806 m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); 2807 // HACK FOR NOW. JUST TESTING, SO KEEPING EVERYONE ELSE OUT OF THESE TESTS
2807 InventoryFolderBase suitcase = InventoryService.GetRootFolder(client.AgentId); 2808 IConfig config = m_config.Configs["HGEntityTransfer"];
2808 client.SendBulkUpdateInventory(suitcase); 2809 if (config != null && config.GetBoolean("RestrictInventoryAccessAbroad", false))
2810 {
2811 m_log.DebugFormat("[SCENE]: Sending root folder to viewer...");
2812 InventoryFolderBase root = InventoryService.GetRootFolder(client.AgentId);
2813 //InventoryCollection rootContents = InventoryService.GetFolderContent(client.AgentId, root.ID);
2814 client.SendBulkUpdateInventory(root);
2815 }
2809 } 2816 }
2810 2817
2811 EventManager.TriggerOnNewClient(client); 2818 EventManager.TriggerOnNewClient(client);