diff options
Diffstat (limited to 'OpenSim/Region')
19 files changed, 641 insertions, 117 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 0103761..ef6dedb 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -114,6 +114,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
114 | private IAssetService m_assetService; | 114 | private IAssetService m_assetService; |
115 | private bool m_dumpAssetsToFile = false; | 115 | private bool m_dumpAssetsToFile = false; |
116 | private string m_regionName; | 116 | private string m_regionName; |
117 | private int m_levelUpload = 0; | ||
117 | 118 | ||
118 | public BunchOfCaps(Scene scene, Caps caps) | 119 | public BunchOfCaps(Scene scene, Caps caps) |
119 | { | 120 | { |
@@ -124,7 +125,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
124 | { | 125 | { |
125 | IConfig sconfig = config.Configs["Startup"]; | 126 | IConfig sconfig = config.Configs["Startup"]; |
126 | if (sconfig != null) | 127 | if (sconfig != null) |
128 | { | ||
127 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 129 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
130 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); | ||
131 | } | ||
128 | } | 132 | } |
129 | 133 | ||
130 | m_assetService = m_Scene.AssetService; | 134 | m_assetService = m_Scene.AssetService; |
@@ -367,21 +371,37 @@ namespace OpenSim.Region.ClientStack.Linden | |||
367 | llsdRequest.asset_type == "animation" || | 371 | llsdRequest.asset_type == "animation" || |
368 | llsdRequest.asset_type == "sound") | 372 | llsdRequest.asset_type == "sound") |
369 | { | 373 | { |
374 | ScenePresence avatar = null; | ||
370 | IClientAPI client = null; | 375 | IClientAPI client = null; |
371 | IScene scene = null; | 376 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); |
372 | if (GetClient != null) | 377 | |
378 | // check user level | ||
379 | if (avatar != null) | ||
373 | { | 380 | { |
374 | client = GetClient(m_HostCapsObj.AgentID); | 381 | client = avatar.ControllingClient; |
375 | scene = client.Scene; | 382 | |
383 | if (avatar.UserLevel < m_levelUpload) | ||
384 | { | ||
385 | if (client != null) | ||
386 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
376 | 387 | ||
377 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | 388 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
389 | errorResponse.uploader = ""; | ||
390 | errorResponse.state = "error"; | ||
391 | return errorResponse; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | // check funds | ||
396 | if (client != null) | ||
397 | { | ||
398 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); | ||
378 | 399 | ||
379 | if (mm != null) | 400 | if (mm != null) |
380 | { | 401 | { |
381 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) | 402 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) |
382 | { | 403 | { |
383 | if (client != null) | 404 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
384 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
385 | 405 | ||
386 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 406 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); |
387 | errorResponse.uploader = ""; | 407 | errorResponse.uploader = ""; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 1117f2a..91872c5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |||
@@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
56 | // private IAssetService m_assetService; | 56 | // private IAssetService m_assetService; |
57 | private bool m_dumpAssetsToFile = false; | 57 | private bool m_dumpAssetsToFile = false; |
58 | private bool m_enabled = true; | 58 | private bool m_enabled = true; |
59 | private int m_levelUpload = 0; | ||
59 | 60 | ||
60 | #region IRegionModuleBase Members | 61 | #region IRegionModuleBase Members |
61 | 62 | ||
@@ -72,6 +73,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
72 | return; | 73 | return; |
73 | 74 | ||
74 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); | 75 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); |
76 | m_levelUpload = meshConfig.GetInt("LevelUpload", 0); | ||
75 | } | 77 | } |
76 | 78 | ||
77 | public void AddRegion(Scene pScene) | 79 | public void AddRegion(Scene pScene) |
@@ -137,25 +139,41 @@ namespace OpenSim.Region.ClientStack.Linden | |||
137 | // llsdRequest.asset_type == "animation" || | 139 | // llsdRequest.asset_type == "animation" || |
138 | // llsdRequest.asset_type == "sound") | 140 | // llsdRequest.asset_type == "sound") |
139 | // { | 141 | // { |
142 | // check user level | ||
143 | ScenePresence avatar = null; | ||
140 | IClientAPI client = null; | 144 | IClientAPI client = null; |
145 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
141 | 146 | ||
142 | 147 | if (avatar != null) | |
148 | { | ||
149 | client = avatar.ControllingClient; | ||
150 | |||
151 | if (avatar.UserLevel < m_levelUpload) | ||
152 | { | ||
153 | if (client != null) | ||
154 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
155 | |||
156 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | ||
157 | errorResponse.rsvp = ""; | ||
158 | errorResponse.state = "error"; | ||
159 | return errorResponse; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | // check funds | ||
143 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); | 164 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); |
144 | 165 | ||
145 | if (mm != null) | 166 | if (mm != null) |
146 | { | 167 | { |
147 | if (m_scene.TryGetClient(agentID, out client)) | 168 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) |
148 | { | 169 | { |
149 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) | 170 | if (client != null) |
150 | { | 171 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
151 | if (client != null) | 172 | |
152 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 173 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
153 | 174 | errorResponse.rsvp = ""; | |
154 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 175 | errorResponse.state = "error"; |
155 | errorResponse.rsvp = ""; | 176 | return errorResponse; |
156 | errorResponse.state = "error"; | ||
157 | return errorResponse; | ||
158 | } | ||
159 | } | 177 | } |
160 | } | 178 | } |
161 | // } | 179 | // } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c40c0ec..d0920d2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
59 | /// Handles new client connections | 59 | /// Handles new client connections |
60 | /// Constructor takes a single Packet and authenticates everything | 60 | /// Constructor takes a single Packet and authenticates everything |
61 | /// </summary> | 61 | /// </summary> |
62 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector | 62 | public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IClientIPEndpoint, IStatsCollector |
63 | { | 63 | { |
64 | /// <value> | 64 | /// <value> |
65 | /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. | 65 | /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. |
@@ -460,6 +460,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
460 | // DebugPacketLevel = 1; | 460 | // DebugPacketLevel = 1; |
461 | 461 | ||
462 | RegisterInterface<IClientIM>(this); | 462 | RegisterInterface<IClientIM>(this); |
463 | RegisterInterface<IClientInventory>(this); | ||
463 | RegisterInterface<IClientChat>(this); | 464 | RegisterInterface<IClientChat>(this); |
464 | RegisterInterface<IClientIPEndpoint>(this); | 465 | RegisterInterface<IClientIPEndpoint>(this); |
465 | 466 | ||
@@ -12421,5 +12422,129 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12421 | if (reply != null) | 12422 | if (reply != null) |
12422 | OutPacket(reply, ThrottleOutPacketType.Task); | 12423 | OutPacket(reply, ThrottleOutPacketType.Task); |
12423 | } | 12424 | } |
12425 | |||
12426 | public void SendRemoveInventoryItems(UUID[] items) | ||
12427 | { | ||
12428 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
12429 | |||
12430 | if (eq == null) | ||
12431 | { | ||
12432 | m_log.DebugFormat("[LLCLIENT]: Null event queue"); | ||
12433 | return; | ||
12434 | } | ||
12435 | |||
12436 | OSDMap llsd = new OSDMap(3); | ||
12437 | |||
12438 | OSDMap AgentDataMap = new OSDMap(1); | ||
12439 | AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | ||
12440 | AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); | ||
12441 | |||
12442 | OSDArray AgentData = new OSDArray(1); | ||
12443 | AgentData.Add(AgentDataMap); | ||
12444 | |||
12445 | llsd.Add("AgentData", AgentData); | ||
12446 | |||
12447 | OSDArray ItemData = new OSDArray(); | ||
12448 | |||
12449 | foreach (UUID item in items) | ||
12450 | { | ||
12451 | OSDMap ItemDataMap = new OSDMap(2); | ||
12452 | ItemDataMap.Add("ItemID", OSD.FromUUID(item)); | ||
12453 | ItemDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | ||
12454 | |||
12455 | ItemData.Add(ItemDataMap); | ||
12456 | } | ||
12457 | |||
12458 | llsd.Add("ItemData", ItemData); | ||
12459 | |||
12460 | eq.Enqueue(BuildEvent("RemoveInventoryItem", | ||
12461 | llsd), AgentId); | ||
12462 | } | ||
12463 | |||
12464 | public void SendRemoveInventoryFolders(UUID[] folders) | ||
12465 | { | ||
12466 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
12467 | |||
12468 | if (eq == null) | ||
12469 | { | ||
12470 | m_log.DebugFormat("[LLCLIENT]: Null event queue"); | ||
12471 | return; | ||
12472 | } | ||
12473 | |||
12474 | OSDMap llsd = new OSDMap(3); | ||
12475 | |||
12476 | OSDMap AgentDataMap = new OSDMap(1); | ||
12477 | AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | ||
12478 | AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); | ||
12479 | |||
12480 | OSDArray AgentData = new OSDArray(1); | ||
12481 | AgentData.Add(AgentDataMap); | ||
12482 | |||
12483 | llsd.Add("AgentData", AgentData); | ||
12484 | |||
12485 | OSDArray FolderData = new OSDArray(); | ||
12486 | |||
12487 | foreach (UUID folder in folders) | ||
12488 | { | ||
12489 | OSDMap FolderDataMap = new OSDMap(2); | ||
12490 | FolderDataMap.Add("FolderID", OSD.FromUUID(folder)); | ||
12491 | FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | ||
12492 | |||
12493 | FolderData.Add(FolderDataMap); | ||
12494 | } | ||
12495 | |||
12496 | llsd.Add("FolderData", FolderData); | ||
12497 | |||
12498 | eq.Enqueue(BuildEvent("RemoveInventoryFolder", | ||
12499 | llsd), AgentId); | ||
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 (InventoryFolderBase folder 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 (InventoryItemBase item in items) | ||
12542 | { | ||
12543 | OSDMap ItemDataMap = new OSDMap(); | ||
12544 | ItemData.Add(ItemDataMap); | ||
12545 | } | ||
12546 | |||
12547 | llsd.Add("ItemData", ItemData); | ||
12548 | } | ||
12424 | } | 12549 | } |
12425 | } | 12550 | } |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 95e3aec..874693e 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
47 | 47 | ||
48 | protected Scene m_Scene; | 48 | protected Scene m_Scene; |
49 | private bool m_dumpAssetsToFile = false; | 49 | private bool m_dumpAssetsToFile = false; |
50 | private int m_levelUpload = 0; | ||
50 | 51 | ||
51 | /// <summary> | 52 | /// <summary> |
52 | /// Each agent has its own singleton collection of transactions | 53 | /// Each agent has its own singleton collection of transactions |
@@ -56,8 +57,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
56 | 57 | ||
57 | #region IRegionModule Members | 58 | #region IRegionModule Members |
58 | 59 | ||
59 | public void Initialise(IConfigSource config) | 60 | public void Initialise(IConfigSource source) |
60 | { | 61 | { |
62 | IConfig sconfig = source.Configs["Startup"]; | ||
63 | if (sconfig != null) | ||
64 | { | ||
65 | m_levelUpload = sconfig.GetInt("LevelUpload", 0); | ||
66 | } | ||
61 | } | 67 | } |
62 | 68 | ||
63 | public void AddRegion(Scene scene) | 69 | public void AddRegion(Scene scene) |
@@ -241,7 +247,21 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
241 | (AssetType)type == AssetType.Animation) && | 247 | (AssetType)type == AssetType.Animation) && |
242 | tempFile == false) | 248 | tempFile == false) |
243 | { | 249 | { |
250 | ScenePresence avatar = null; | ||
244 | Scene scene = (Scene)remoteClient.Scene; | 251 | Scene scene = (Scene)remoteClient.Scene; |
252 | scene.TryGetScenePresence(remoteClient.AgentId, out avatar); | ||
253 | |||
254 | // check user level | ||
255 | if (avatar != null) | ||
256 | { | ||
257 | if (avatar.UserLevel < m_levelUpload) | ||
258 | { | ||
259 | remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
260 | return; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | // check funds | ||
245 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | 265 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); |
246 | 266 | ||
247 | if (mm != null) | 267 | if (mm != null) |
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/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a2d833b..a422552 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -60,6 +60,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
60 | set { m_MaxTransferDistance = value; } | 60 | set { m_MaxTransferDistance = value; } |
61 | } | 61 | } |
62 | 62 | ||
63 | private int m_levelHGTeleport = 0; | ||
64 | |||
63 | protected bool m_Enabled = false; | 65 | protected bool m_Enabled = false; |
64 | protected Scene m_aScene; | 66 | protected Scene m_aScene; |
65 | protected List<Scene> m_Scenes = new List<Scene>(); | 67 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -101,7 +103,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
101 | { | 103 | { |
102 | IConfig transferConfig = source.Configs["EntityTransfer"]; | 104 | IConfig transferConfig = source.Configs["EntityTransfer"]; |
103 | if (transferConfig != null) | 105 | if (transferConfig != null) |
106 | { | ||
104 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | 107 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); |
108 | m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0); | ||
109 | } | ||
105 | 110 | ||
106 | m_agentsInTransit = new List<UUID>(); | 111 | m_agentsInTransit = new List<UUID>(); |
107 | m_Enabled = true; | 112 | m_Enabled = true; |
@@ -228,6 +233,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
228 | return; | 233 | return; |
229 | } | 234 | } |
230 | 235 | ||
236 | // check if HyperGrid teleport is allowed, based on user level | ||
237 | int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID); | ||
238 | |||
239 | if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport)) | ||
240 | { | ||
241 | m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent."); | ||
242 | sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted"); | ||
243 | return; | ||
244 | } | ||
245 | |||
231 | uint curX = 0, curY = 0; | 246 | uint curX = 0, curY = 0; |
232 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | 247 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); |
233 | int curCellX = (int)(curX / Constants.RegionSize); | 248 | int curCellX = (int)(curX / Constants.RegionSize); |
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; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Client; | ||
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Services.Connectors.Hypergrid; | 36 | using 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/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 10ab6d0..77573c3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
167 | 167 | ||
168 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 168 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
169 | { | 169 | { |
170 | return new List<InventoryFolderBase>(); | 170 | return m_RemoteConnector.GetInventorySkeleton(userId); |
171 | } | 171 | } |
172 | 172 | ||
173 | public InventoryCollection GetUserInventory(UUID userID) | 173 | public InventoryCollection GetUserInventory(UUID userID) |
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 4c501f6..6885327 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs | |||
@@ -93,7 +93,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
93 | void JoinGroupRequest(IClientAPI remoteClient, UUID GroupID); | 93 | void JoinGroupRequest(IClientAPI remoteClient, UUID GroupID); |
94 | void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); | 94 | void LeaveGroupRequest(IClientAPI remoteClient, UUID GroupID); |
95 | void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); | 95 | void EjectGroupMemberRequest(IClientAPI remoteClient, UUID GroupID, UUID EjecteeID); |
96 | void EjectGroupMember(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID EjecteeID); | ||
96 | void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); | 97 | void InviteGroupRequest(IClientAPI remoteClient, UUID GroupID, UUID InviteeID, UUID RoleID); |
98 | void InviteGroup(IClientAPI remoteClient, UUID agentID, UUID GroupID, UUID InviteeID, UUID RoleID); | ||
97 | void NotifyChange(UUID GroupID); | 99 | void NotifyChange(UUID GroupID); |
98 | } | 100 | } |
99 | } \ No newline at end of file | 101 | } \ No newline at end of file |
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/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 853491b..470ce2e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -72,9 +72,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
72 | public delegate void OnNewClientDelegate(IClientAPI client); | 72 | public delegate void OnNewClientDelegate(IClientAPI client); |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Deprecated in favour of OnClientConnect. | 75 | /// Triggered when a new client is added to the scene. |
76 | /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. | ||
77 | /// </summary> | 76 | /// </summary> |
77 | /// <remarks> | ||
78 | /// Triggered before OnClientLogin. | ||
79 | /// </remarks> | ||
78 | public event OnNewClientDelegate OnNewClient; | 80 | public event OnNewClientDelegate OnNewClient; |
79 | 81 | ||
80 | /// <summary> | 82 | /// <summary> |
@@ -192,6 +194,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
192 | 194 | ||
193 | public delegate void ClientClosed(UUID clientID, Scene scene); | 195 | public delegate void ClientClosed(UUID clientID, Scene scene); |
194 | 196 | ||
197 | /// <summary> | ||
198 | /// Fired when a client is removed from a scene. | ||
199 | /// </summary> | ||
200 | /// <remarks> | ||
201 | /// At the point of firing, the scene still contains the client's scene presence. | ||
202 | /// </remarks> | ||
195 | public event ClientClosed OnClientClosed; | 203 | public event ClientClosed OnClientClosed; |
196 | 204 | ||
197 | public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); | 205 | public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fc1034d..cac178d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1881,8 +1881,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | 1881 | ||
1882 | foreach (SceneObjectGroup group in PrimsFromDB) | 1882 | foreach (SceneObjectGroup group in PrimsFromDB) |
1883 | { | 1883 | { |
1884 | EventManager.TriggerOnSceneObjectLoaded(group); | ||
1885 | AddRestoredSceneObject(group, true, true); | 1884 | AddRestoredSceneObject(group, true, true); |
1885 | EventManager.TriggerOnSceneObjectLoaded(group); | ||
1886 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 1886 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
1887 | rootPart.Flags &= ~PrimFlags.Scripted; | 1887 | rootPart.Flags &= ~PrimFlags.Scripted; |
1888 | rootPart.TrimPermissions(); | 1888 | rootPart.TrimPermissions(); |
@@ -2800,14 +2800,6 @@ 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 | ||
2804 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
2805 | { | ||
2806 | m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); | ||
2807 | InventoryFolderBase suitcase = InventoryService.GetRootFolder(client.AgentId); | ||
2808 | client.SendBulkUpdateInventory(suitcase); | ||
2809 | } | ||
2810 | |||
2811 | EventManager.TriggerOnNewClient(client); | 2803 | EventManager.TriggerOnNewClient(client); |
2812 | if (vialogin) | 2804 | if (vialogin) |
2813 | { | 2805 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a23dc31..ee8a236 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using System.Timers; | 32 | using System.Timers; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | ||
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Client; | 37 | using OpenSim.Framework.Client; |
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
@@ -1236,6 +1237,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1236 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1237 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1237 | } | 1238 | } |
1238 | 1239 | ||
1240 | // HACK HACK -- just seeing how the viewer responds | ||
1241 | // Let's send the Suitcase or the real root folder folder for incoming HG agents | ||
1242 | // Visiting agents get their suitcase contents; incoming local users get their real root folder's content | ||
1243 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); | ||
1244 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
1245 | { | ||
1246 | // HACK FOR NOW. JUST TESTING, SO KEEPING EVERYONE ELSE OUT OF THESE TESTS | ||
1247 | IConfig config = m_scene.Config.Configs["HGEntityTransferModule"]; | ||
1248 | if (config != null && config.GetBoolean("RestrictInventoryAccessAbroad", false)) | ||
1249 | { | ||
1250 | m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); | ||
1251 | InventoryFolderBase root = m_scene.InventoryService.GetRootFolder(client.AgentId); | ||
1252 | //InventoryCollection rootContents = InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
1253 | client.SendBulkUpdateInventory(root); | ||
1254 | } | ||
1255 | } | ||
1256 | |||
1239 | // m_log.DebugFormat( | 1257 | // m_log.DebugFormat( |
1240 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", | 1258 | // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", |
1241 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); | 1259 | // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 0be0a19..4dbac1d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -221,15 +221,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | // Called to indicate that the module has been added to the region | ||
225 | public void AddRegion(Scene scene) | 224 | public void AddRegion(Scene scene) |
226 | { | 225 | { |
227 | |||
228 | if (m_pluginEnabled) | 226 | if (m_pluginEnabled) |
229 | { | 227 | { |
230 | lock (vlock) | 228 | lock (vlock) |
231 | { | 229 | { |
232 | |||
233 | string channelId; | 230 | string channelId; |
234 | 231 | ||
235 | string sceneUUID = scene.RegionInfo.RegionID.ToString(); | 232 | string sceneUUID = scene.RegionInfo.RegionID.ToString(); |
@@ -273,23 +270,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
273 | } | 270 | } |
274 | } | 271 | } |
275 | 272 | ||
276 | |||
277 | // Create a dictionary entry unconditionally. This eliminates the | 273 | // Create a dictionary entry unconditionally. This eliminates the |
278 | // need to check for a parent in the core code. The end result is | 274 | // need to check for a parent in the core code. The end result is |
279 | // the same, if the parent table entry is an empty string, then | 275 | // the same, if the parent table entry is an empty string, then |
280 | // region channels will be created as first-level channels. | 276 | // region channels will be created as first-level channels. |
281 | 277 | lock (m_parents) | |
282 | lock (m_parents) | 278 | { |
283 | if (m_parents.ContainsKey(sceneUUID)) | 279 | if (m_parents.ContainsKey(sceneUUID)) |
284 | { | 280 | { |
285 | RemoveRegion(scene); | 281 | RemoveRegion(scene); |
286 | m_parents.Add(sceneUUID, channelId); | 282 | m_parents.Add(sceneUUID, channelId); |
287 | } | 283 | } |
288 | else | 284 | else |
289 | { | 285 | { |
290 | m_parents.Add(sceneUUID, channelId); | 286 | m_parents.Add(sceneUUID, channelId); |
291 | } | 287 | } |
292 | 288 | } | |
293 | } | 289 | } |
294 | 290 | ||
295 | // we need to capture scene in an anonymous method | 291 | // we need to capture scene in an anonymous method |
@@ -298,26 +294,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
298 | { | 294 | { |
299 | OnRegisterCaps(scene, agentID, caps); | 295 | OnRegisterCaps(scene, agentID, caps); |
300 | }; | 296 | }; |
301 | |||
302 | } | 297 | } |
303 | |||
304 | } | 298 | } |
305 | 299 | ||
306 | // Called to indicate that all loadable modules have now been added | ||
307 | public void RegionLoaded(Scene scene) | 300 | public void RegionLoaded(Scene scene) |
308 | { | 301 | { |
309 | // Do nothing. | 302 | // Do nothing. |
310 | } | 303 | } |
311 | 304 | ||
312 | // Called to indicate that the region is going away. | ||
313 | public void RemoveRegion(Scene scene) | 305 | public void RemoveRegion(Scene scene) |
314 | { | 306 | { |
315 | |||
316 | if (m_pluginEnabled) | 307 | if (m_pluginEnabled) |
317 | { | 308 | { |
318 | lock (vlock) | 309 | lock (vlock) |
319 | { | 310 | { |
320 | |||
321 | string channelId; | 311 | string channelId; |
322 | 312 | ||
323 | string sceneUUID = scene.RegionInfo.RegionID.ToString(); | 313 | string sceneUUID = scene.RegionInfo.RegionID.ToString(); |
@@ -328,10 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
328 | // iteration over the set of chidren identified. | 318 | // iteration over the set of chidren identified. |
329 | // This assumes that there is just one directory per | 319 | // This assumes that there is just one directory per |
330 | // region. | 320 | // region. |
331 | |||
332 | if (VivoxTryGetDirectory(sceneUUID + "D", out channelId)) | 321 | if (VivoxTryGetDirectory(sceneUUID + "D", out channelId)) |
333 | { | 322 | { |
334 | |||
335 | m_log.DebugFormat("[VivoxVoice]: region {0}: uuid {1}: located directory id {2}", | 323 | m_log.DebugFormat("[VivoxVoice]: region {0}: uuid {1}: located directory id {2}", |
336 | sceneName, sceneUUID, channelId); | 324 | sceneName, sceneUUID, channelId); |
337 | 325 | ||
@@ -360,7 +348,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
360 | 348 | ||
361 | lock (m_parents) | 349 | lock (m_parents) |
362 | { | 350 | { |
363 | if (m_parents.ContainsKey(sceneUUID)) | 351 | if (m_parents.ContainsKey(sceneUUID)) |
364 | { | 352 | { |
365 | m_parents.Remove(sceneUUID); | 353 | m_parents.Remove(sceneUUID); |
366 | } | 354 | } |
@@ -459,11 +447,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
459 | { | 447 | { |
460 | try | 448 | try |
461 | { | 449 | { |
462 | |||
463 | ScenePresence avatar = null; | 450 | ScenePresence avatar = null; |
464 | string avatarName = null; | 451 | string avatarName = null; |
465 | 452 | ||
466 | if (scene == null) throw new Exception("[VivoxVoice][PROVISIONVOICE] Invalid scene"); | 453 | if (scene == null) |
454 | throw new Exception("[VivoxVoice][PROVISIONVOICE]: Invalid scene"); | ||
467 | 455 | ||
468 | avatar = scene.GetScenePresence(agentID); | 456 | avatar = scene.GetScenePresence(agentID); |
469 | while (avatar == null) | 457 | while (avatar == null) |
@@ -566,7 +554,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
566 | } | 554 | } |
567 | } | 555 | } |
568 | } | 556 | } |
569 | } while (retry); | 557 | } |
558 | while (retry); | ||
570 | 559 | ||
571 | if (code != "OK") | 560 | if (code != "OK") |
572 | { | 561 | { |
@@ -676,7 +665,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
676 | } | 665 | } |
677 | } | 666 | } |
678 | 667 | ||
679 | |||
680 | /// <summary> | 668 | /// <summary> |
681 | /// Callback for a client request for a private chat channel | 669 | /// Callback for a client request for a private chat channel |
682 | /// </summary> | 670 | /// </summary> |
@@ -698,10 +686,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
698 | return "<llsd>true</llsd>"; | 686 | return "<llsd>true</llsd>"; |
699 | } | 687 | } |
700 | 688 | ||
701 | |||
702 | private string RegionGetOrCreateChannel(Scene scene, LandData land) | 689 | private string RegionGetOrCreateChannel(Scene scene, LandData land) |
703 | { | 690 | { |
704 | |||
705 | string channelUri = null; | 691 | string channelUri = null; |
706 | string channelId = null; | 692 | string channelId = null; |
707 | 693 | ||
@@ -709,11 +695,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
709 | string landName; | 695 | string landName; |
710 | string parentId; | 696 | string parentId; |
711 | 697 | ||
712 | lock (m_parents) parentId = m_parents[scene.RegionInfo.RegionID.ToString()]; | 698 | lock (m_parents) |
699 | parentId = m_parents[scene.RegionInfo.RegionID.ToString()]; | ||
713 | 700 | ||
714 | // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same | 701 | // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same |
715 | // as the directory ID. Otherwise, it reflects the parcel's ID. | 702 | // as the directory ID. Otherwise, it reflects the parcel's ID. |
716 | |||
717 | if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) | 703 | if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) |
718 | { | 704 | { |
719 | landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name); | 705 | landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name); |
@@ -741,8 +727,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
741 | 727 | ||
742 | m_log.DebugFormat("[VivoxVoice]: Region:Parcel \"{0}\": parent channel id {1}: retrieved parcel channel_uri {2} ", | 728 | m_log.DebugFormat("[VivoxVoice]: Region:Parcel \"{0}\": parent channel id {1}: retrieved parcel channel_uri {2} ", |
743 | landName, parentId, channelUri); | 729 | landName, parentId, channelUri); |
744 | |||
745 | |||
746 | } | 730 | } |
747 | 731 | ||
748 | return channelUri; | 732 | return channelUri; |
@@ -761,7 +745,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
761 | return VivoxCall(requrl, false); | 745 | return VivoxCall(requrl, false); |
762 | } | 746 | } |
763 | 747 | ||
764 | |||
765 | private static readonly string m_vivoxLogoutPath = "https://{0}/api2/viv_signout.php?auth_token={1}"; | 748 | private static readonly string m_vivoxLogoutPath = "https://{0}/api2/viv_signout.php?auth_token={1}"; |
766 | 749 | ||
767 | /// <summary> | 750 | /// <summary> |
@@ -828,7 +811,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
828 | /// | 811 | /// |
829 | /// In this case the call handles parent and description as optional values. | 812 | /// In this case the call handles parent and description as optional values. |
830 | /// </summary> | 813 | /// </summary> |
831 | |||
832 | private bool VivoxTryCreateChannel(string parent, string channelId, string description, out string channelUri) | 814 | private bool VivoxTryCreateChannel(string parent, string channelId, string description, out string channelUri) |
833 | { | 815 | { |
834 | string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", channelId, m_authToken); | 816 | string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", channelId, m_authToken); |
@@ -864,7 +846,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
864 | /// channel name space. | 846 | /// channel name space. |
865 | /// The parent and description are optional values. | 847 | /// The parent and description are optional values. |
866 | /// </summary> | 848 | /// </summary> |
867 | |||
868 | private bool VivoxTryCreateDirectory(string dirId, string description, out string channelId) | 849 | private bool VivoxTryCreateDirectory(string dirId, string description, out string channelId) |
869 | { | 850 | { |
870 | string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", dirId, m_authToken); | 851 | string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", dirId, m_authToken); |
@@ -901,7 +882,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
901 | /// are required in a later phase. | 882 | /// are required in a later phase. |
902 | /// In this case the call handles parent and description as optional values. | 883 | /// In this case the call handles parent and description as optional values. |
903 | /// </summary> | 884 | /// </summary> |
904 | |||
905 | private bool VivoxTryGetChannel(string channelParent, string channelName, | 885 | private bool VivoxTryGetChannel(string channelParent, string channelName, |
906 | out string channelId, out string channelUri) | 886 | out string channelId, out string channelUri) |
907 | { | 887 | { |
@@ -1044,6 +1024,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1044 | // return VivoxCall(requrl, true); | 1024 | // return VivoxCall(requrl, true); |
1045 | // } | 1025 | // } |
1046 | 1026 | ||
1027 | private static readonly string m_vivoxChannelDel = "https://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}"; | ||
1028 | |||
1047 | /// <summary> | 1029 | /// <summary> |
1048 | /// Delete a channel. | 1030 | /// Delete a channel. |
1049 | /// Once again, there a multitude of options possible. In the simplest case | 1031 | /// Once again, there a multitude of options possible. In the simplest case |
@@ -1056,8 +1038,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1056 | /// In this case the call handles parent and description as optional values. | 1038 | /// In this case the call handles parent and description as optional values. |
1057 | /// </summary> | 1039 | /// </summary> |
1058 | 1040 | ||
1059 | private static readonly string m_vivoxChannelDel = "https://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}"; | ||
1060 | |||
1061 | private XmlElement VivoxDeleteChannel(string parent, string channelid) | 1041 | private XmlElement VivoxDeleteChannel(string parent, string channelid) |
1062 | { | 1042 | { |
1063 | string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken); | 1043 | string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken); |
@@ -1068,12 +1048,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1068 | return VivoxCall(requrl, true); | 1048 | return VivoxCall(requrl, true); |
1069 | } | 1049 | } |
1070 | 1050 | ||
1051 | private static readonly string m_vivoxChannelSearch = "https://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}"; | ||
1052 | |||
1071 | /// <summary> | 1053 | /// <summary> |
1072 | /// Return information on channels in the given directory | 1054 | /// Return information on channels in the given directory |
1073 | /// </summary> | 1055 | /// </summary> |
1074 | 1056 | ||
1075 | private static readonly string m_vivoxChannelSearch = "https://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}"; | ||
1076 | |||
1077 | private XmlElement VivoxListChildren(string channelid) | 1057 | private XmlElement VivoxListChildren(string channelid) |
1078 | { | 1058 | { |
1079 | string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken); | 1059 | string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken); |
@@ -1118,7 +1098,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1118 | /// The outcome of the call can be determined by examining the | 1098 | /// The outcome of the call can be determined by examining the |
1119 | /// status value in the hash table. | 1099 | /// status value in the hash table. |
1120 | /// </summary> | 1100 | /// </summary> |
1121 | |||
1122 | private XmlElement VivoxCall(string requrl, bool admin) | 1101 | private XmlElement VivoxCall(string requrl, bool admin) |
1123 | { | 1102 | { |
1124 | 1103 | ||
@@ -1164,7 +1143,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1164 | /// <summary> | 1143 | /// <summary> |
1165 | /// Just say if it worked. | 1144 | /// Just say if it worked. |
1166 | /// </summary> | 1145 | /// </summary> |
1167 | |||
1168 | private bool IsOK(XmlElement resp) | 1146 | private bool IsOK(XmlElement resp) |
1169 | { | 1147 | { |
1170 | string status; | 1148 | string status; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index d39b847..9ff3652 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
84 | private bool m_groupsEnabled = false; | 84 | private bool m_groupsEnabled = false; |
85 | private bool m_groupNoticesEnabled = true; | 85 | private bool m_groupNoticesEnabled = true; |
86 | private bool m_debugEnabled = false; | 86 | private bool m_debugEnabled = false; |
87 | private int m_levelGroupCreate = 0; | ||
87 | 88 | ||
88 | #region IRegionModuleBase Members | 89 | #region IRegionModuleBase Members |
89 | 90 | ||
@@ -115,6 +116,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
115 | 116 | ||
116 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); | 117 | m_groupNoticesEnabled = groupsConfig.GetBoolean("NoticesEnabled", true); |
117 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); | 118 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false); |
119 | m_levelGroupCreate = groupsConfig.GetInt("LevelGroupCreate", 0); | ||
118 | } | 120 | } |
119 | } | 121 | } |
120 | 122 | ||
@@ -708,13 +710,29 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
708 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); | 710 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); |
709 | return UUID.Zero; | 711 | return UUID.Zero; |
710 | } | 712 | } |
713 | |||
714 | // check user level | ||
715 | ScenePresence avatar = null; | ||
716 | Scene scene = (Scene)remoteClient.Scene; | ||
717 | scene.TryGetScenePresence(remoteClient.AgentId, out avatar); | ||
718 | |||
719 | if (avatar != null) | ||
720 | { | ||
721 | if (avatar.UserLevel < m_levelGroupCreate) | ||
722 | { | ||
723 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); | ||
724 | return UUID.Zero; | ||
725 | } | ||
726 | } | ||
727 | |||
728 | // check funds | ||
711 | // is there is a money module present ? | 729 | // is there is a money module present ? |
712 | IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>(); | 730 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); |
713 | if (money != null) | 731 | if (money != null) |
714 | { | 732 | { |
715 | // do the transaction, that is if the agent has got sufficient funds | 733 | // do the transaction, that is if the agent has got sufficient funds |
716 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { | 734 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { |
717 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group."); | 735 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); |
718 | return UUID.Zero; | 736 | return UUID.Zero; |
719 | } | 737 | } |
720 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation"); | 738 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation"); |
@@ -939,17 +957,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
939 | 957 | ||
940 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) | 958 | public void EjectGroupMemberRequest(IClientAPI remoteClient, UUID groupID, UUID ejecteeID) |
941 | { | 959 | { |
942 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 960 | EjectGroupMember(remoteClient, GetRequestingAgentID(remoteClient), groupID, ejecteeID); |
961 | } | ||
943 | 962 | ||
963 | public void EjectGroupMember(IClientAPI remoteClient, UUID agentID, UUID groupID, UUID ejecteeID) | ||
964 | { | ||
965 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | ||
944 | 966 | ||
945 | // Todo: Security check? | 967 | // Todo: Security check? |
946 | m_groupData.RemoveAgentFromGroup(GetRequestingAgentID(remoteClient), ejecteeID, groupID); | 968 | m_groupData.RemoveAgentFromGroup(agentID, ejecteeID, groupID); |
947 | 969 | ||
948 | remoteClient.SendEjectGroupMemberReply(GetRequestingAgentID(remoteClient), groupID, true); | 970 | string agentName; |
971 | RegionInfo regionInfo; | ||
949 | 972 | ||
950 | GroupRecord groupInfo = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); | 973 | // remoteClient provided or just agentID? |
974 | if (remoteClient != null) | ||
975 | { | ||
976 | agentName = remoteClient.Name; | ||
977 | regionInfo = remoteClient.Scene.RegionInfo; | ||
978 | remoteClient.SendEjectGroupMemberReply(agentID, groupID, true); | ||
979 | } | ||
980 | else | ||
981 | { | ||
982 | IClientAPI client = GetActiveClient(agentID); | ||
983 | |||
984 | if (client != null) | ||
985 | { | ||
986 | agentName = client.Name; | ||
987 | regionInfo = client.Scene.RegionInfo; | ||
988 | client.SendEjectGroupMemberReply(agentID, groupID, true); | ||
989 | } | ||
990 | else | ||
991 | { | ||
992 | regionInfo = m_sceneList[0].RegionInfo; | ||
993 | UserAccount acc = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, agentID); | ||
951 | 994 | ||
952 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, ejecteeID); | 995 | if (acc != null) |
996 | { | ||
997 | agentName = acc.FirstName + " " + acc.LastName; | ||
998 | } | ||
999 | else | ||
1000 | { | ||
1001 | agentName = "Unknown member"; | ||
1002 | } | ||
1003 | } | ||
1004 | } | ||
1005 | |||
1006 | GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); | ||
1007 | |||
1008 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, ejecteeID); | ||
953 | if ((groupInfo == null) || (account == null)) | 1009 | if ((groupInfo == null) || (account == null)) |
954 | { | 1010 | { |
955 | return; | 1011 | return; |
@@ -959,23 +1015,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
959 | GridInstantMessage msg = new GridInstantMessage(); | 1015 | GridInstantMessage msg = new GridInstantMessage(); |
960 | 1016 | ||
961 | msg.imSessionID = UUID.Zero.Guid; | 1017 | msg.imSessionID = UUID.Zero.Guid; |
962 | msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; | 1018 | msg.fromAgentID = agentID.Guid; |
963 | // msg.fromAgentID = info.GroupID; | 1019 | // msg.fromAgentID = info.GroupID; |
964 | msg.toAgentID = ejecteeID.Guid; | 1020 | msg.toAgentID = ejecteeID.Guid; |
965 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 1021 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
966 | msg.timestamp = 0; | 1022 | msg.timestamp = 0; |
967 | msg.fromAgentName = remoteClient.Name; | 1023 | msg.fromAgentName = agentName; |
968 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName); | 1024 | msg.message = string.Format("You have been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName); |
969 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; | 1025 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.MessageFromAgent; |
970 | msg.fromGroup = false; | 1026 | msg.fromGroup = false; |
971 | msg.offline = (byte)0; | 1027 | msg.offline = (byte)0; |
972 | msg.ParentEstateID = 0; | 1028 | msg.ParentEstateID = 0; |
973 | msg.Position = Vector3.Zero; | 1029 | msg.Position = Vector3.Zero; |
974 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1030 | msg.RegionID = regionInfo.RegionID.Guid; |
975 | msg.binaryBucket = new byte[0]; | 1031 | msg.binaryBucket = new byte[0]; |
976 | OutgoingInstantMessage(msg, ejecteeID); | 1032 | OutgoingInstantMessage(msg, ejecteeID); |
977 | 1033 | ||
978 | |||
979 | // Message to ejector | 1034 | // Message to ejector |
980 | // Interop, received special 210 code for ejecting a group member | 1035 | // Interop, received special 210 code for ejecting a group member |
981 | // this only works within the comms servers domain, and won't work hypergrid | 1036 | // this only works within the comms servers domain, and won't work hypergrid |
@@ -985,26 +1040,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
985 | 1040 | ||
986 | msg = new GridInstantMessage(); | 1041 | msg = new GridInstantMessage(); |
987 | msg.imSessionID = UUID.Zero.Guid; | 1042 | msg.imSessionID = UUID.Zero.Guid; |
988 | msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; | 1043 | msg.fromAgentID = agentID.Guid; |
989 | msg.toAgentID = GetRequestingAgentID(remoteClient).Guid; | 1044 | msg.toAgentID = agentID.Guid; |
990 | msg.timestamp = 0; | 1045 | msg.timestamp = 0; |
991 | msg.fromAgentName = remoteClient.Name; | 1046 | msg.fromAgentName = agentName; |
992 | if (account != null) | 1047 | if (account != null) |
993 | { | 1048 | { |
994 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, account.FirstName + " " + account.LastName); | 1049 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, account.FirstName + " " + account.LastName); |
995 | } | 1050 | } |
996 | else | 1051 | else |
997 | { | 1052 | { |
998 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, "Unknown member"); | 1053 | msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", agentName, groupInfo.GroupName, "Unknown member"); |
999 | } | 1054 | } |
1000 | msg.dialog = (byte)210; //interop | 1055 | msg.dialog = (byte)210; //interop |
1001 | msg.fromGroup = false; | 1056 | msg.fromGroup = false; |
1002 | msg.offline = (byte)0; | 1057 | msg.offline = (byte)0; |
1003 | msg.ParentEstateID = 0; | 1058 | msg.ParentEstateID = 0; |
1004 | msg.Position = Vector3.Zero; | 1059 | msg.Position = Vector3.Zero; |
1005 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1060 | msg.RegionID = regionInfo.RegionID.Guid; |
1006 | msg.binaryBucket = new byte[0]; | 1061 | msg.binaryBucket = new byte[0]; |
1007 | OutgoingInstantMessage(msg, GetRequestingAgentID(remoteClient)); | 1062 | OutgoingInstantMessage(msg, agentID); |
1008 | 1063 | ||
1009 | 1064 | ||
1010 | // SL sends out messages to everyone in the group | 1065 | // SL sends out messages to everyone in the group |
@@ -1014,16 +1069,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1014 | 1069 | ||
1015 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) | 1070 | public void InviteGroupRequest(IClientAPI remoteClient, UUID groupID, UUID invitedAgentID, UUID roleID) |
1016 | { | 1071 | { |
1072 | InviteGroup(remoteClient, GetRequestingAgentID(remoteClient), groupID, invitedAgentID, roleID); | ||
1073 | } | ||
1074 | |||
1075 | public void InviteGroup(IClientAPI remoteClient, UUID agentID, UUID groupID, UUID invitedAgentID, UUID roleID) | ||
1076 | { | ||
1017 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 1077 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
1018 | 1078 | ||
1079 | string agentName; | ||
1080 | RegionInfo regionInfo; | ||
1081 | |||
1082 | // remoteClient provided or just agentID? | ||
1083 | if (remoteClient != null) | ||
1084 | { | ||
1085 | agentName = remoteClient.Name; | ||
1086 | regionInfo = remoteClient.Scene.RegionInfo; | ||
1087 | } | ||
1088 | else | ||
1089 | { | ||
1090 | IClientAPI client = GetActiveClient(agentID); | ||
1091 | |||
1092 | if (client != null) | ||
1093 | { | ||
1094 | agentName = client.Name; | ||
1095 | regionInfo = client.Scene.RegionInfo; | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | regionInfo = m_sceneList[0].RegionInfo; | ||
1100 | UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(regionInfo.ScopeID, agentID); | ||
1101 | |||
1102 | if (account != null) | ||
1103 | { | ||
1104 | agentName = account.FirstName + " " + account.LastName; | ||
1105 | } | ||
1106 | else | ||
1107 | { | ||
1108 | agentName = "Unknown member"; | ||
1109 | } | ||
1110 | } | ||
1111 | } | ||
1112 | |||
1019 | // Todo: Security check, probably also want to send some kind of notification | 1113 | // Todo: Security check, probably also want to send some kind of notification |
1020 | UUID InviteID = UUID.Random(); | 1114 | UUID InviteID = UUID.Random(); |
1021 | 1115 | ||
1022 | m_groupData.AddAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID, groupID, roleID, invitedAgentID); | 1116 | m_groupData.AddAgentToGroupInvite(agentID, InviteID, groupID, roleID, invitedAgentID); |
1023 | 1117 | ||
1024 | // Check to see if the invite went through, if it did not then it's possible | 1118 | // Check to see if the invite went through, if it did not then it's possible |
1025 | // the remoteClient did not validate or did not have permission to invite. | 1119 | // the remoteClient did not validate or did not have permission to invite. |
1026 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID); | 1120 | GroupInviteInfo inviteInfo = m_groupData.GetAgentToGroupInvite(agentID, InviteID); |
1027 | 1121 | ||
1028 | if (inviteInfo != null) | 1122 | if (inviteInfo != null) |
1029 | { | 1123 | { |
@@ -1035,19 +1129,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1035 | 1129 | ||
1036 | msg.imSessionID = inviteUUID; | 1130 | msg.imSessionID = inviteUUID; |
1037 | 1131 | ||
1038 | // msg.fromAgentID = GetRequestingAgentID(remoteClient).Guid; | 1132 | // msg.fromAgentID = agentID.Guid; |
1039 | msg.fromAgentID = groupID.Guid; | 1133 | msg.fromAgentID = groupID.Guid; |
1040 | msg.toAgentID = invitedAgentID.Guid; | 1134 | msg.toAgentID = invitedAgentID.Guid; |
1041 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | 1135 | //msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); |
1042 | msg.timestamp = 0; | 1136 | msg.timestamp = 0; |
1043 | msg.fromAgentName = remoteClient.Name; | 1137 | msg.fromAgentName = agentName; |
1044 | msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", remoteClient.Name); | 1138 | msg.message = string.Format("{0} has invited you to join a group. There is no cost to join this group.", agentName); |
1045 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; | 1139 | msg.dialog = (byte)OpenMetaverse.InstantMessageDialog.GroupInvitation; |
1046 | msg.fromGroup = true; | 1140 | msg.fromGroup = true; |
1047 | msg.offline = (byte)0; | 1141 | msg.offline = (byte)0; |
1048 | msg.ParentEstateID = 0; | 1142 | msg.ParentEstateID = 0; |
1049 | msg.Position = Vector3.Zero; | 1143 | msg.Position = Vector3.Zero; |
1050 | msg.RegionID = remoteClient.Scene.RegionInfo.RegionID.Guid; | 1144 | msg.RegionID = regionInfo.RegionID.Guid; |
1051 | msg.binaryBucket = new byte[20]; | 1145 | msg.binaryBucket = new byte[20]; |
1052 | 1146 | ||
1053 | OutgoingInstantMessage(msg, invitedAgentID); | 1147 | OutgoingInstantMessage(msg, invitedAgentID); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index d140c26..0dc2aa2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3026,5 +3026,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3026 | 3026 | ||
3027 | return String.Empty; | 3027 | return String.Empty; |
3028 | } | 3028 | } |
3029 | |||
3030 | /// <summary> | ||
3031 | /// Invite user to the group this object is set to | ||
3032 | /// </summary> | ||
3033 | /// <param name="agentId"></param> | ||
3034 | /// <returns></returns> | ||
3035 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | ||
3036 | { | ||
3037 | CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); | ||
3038 | m_host.AddScriptLPS(1); | ||
3039 | |||
3040 | UUID agent = new UUID(agentId); | ||
3041 | |||
3042 | // groups module is required | ||
3043 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
3044 | if (groupsModule == null) return ScriptBaseClass.FALSE; | ||
3045 | |||
3046 | // object has to be set to a group, but not group owned | ||
3047 | if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE; | ||
3048 | |||
3049 | // object owner has to be in that group and required permissions | ||
3050 | GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID); | ||
3051 | if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0) return ScriptBaseClass.FALSE; | ||
3052 | |||
3053 | // check if agent is in that group already | ||
3054 | //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent); | ||
3055 | //if (member != null) return ScriptBaseClass.FALSE; | ||
3056 | |||
3057 | // invited agent has to be present in this scene | ||
3058 | if (World.GetScenePresence(agent) == null) return ScriptBaseClass.FALSE; | ||
3059 | |||
3060 | groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero); | ||
3061 | |||
3062 | return ScriptBaseClass.TRUE; | ||
3063 | } | ||
3064 | |||
3065 | /// <summary> | ||
3066 | /// Eject user from the group this object is set to | ||
3067 | /// </summary> | ||
3068 | /// <param name="agentId"></param> | ||
3069 | /// <returns></returns> | ||
3070 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | ||
3071 | { | ||
3072 | CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); | ||
3073 | m_host.AddScriptLPS(1); | ||
3074 | |||
3075 | UUID agent = new UUID(agentId); | ||
3076 | |||
3077 | // groups module is required | ||
3078 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
3079 | if (groupsModule == null) return ScriptBaseClass.FALSE; | ||
3080 | |||
3081 | // object has to be set to a group, but not group owned | ||
3082 | if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE; | ||
3083 | |||
3084 | // object owner has to be in that group and required permissions | ||
3085 | GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID); | ||
3086 | if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0) return ScriptBaseClass.FALSE; | ||
3087 | |||
3088 | // agent has to be in that group | ||
3089 | //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent); | ||
3090 | //if (member == null) return ScriptBaseClass.FALSE; | ||
3091 | |||
3092 | // ejectee can be offline | ||
3093 | |||
3094 | groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent); | ||
3095 | |||
3096 | return ScriptBaseClass.TRUE; | ||
3097 | } | ||
3029 | } | 3098 | } |
3030 | } | 3099 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f4c4b1..444a681 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -231,5 +231,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
231 | LSL_String osUnixTimeToTimestamp(long time); | 231 | LSL_String osUnixTimeToTimestamp(long time); |
232 | 232 | ||
233 | LSL_String osGetInventoryDesc(string item); | 233 | LSL_String osGetInventoryDesc(string item); |
234 | |||
235 | LSL_Integer osInviteToGroup(LSL_Key agentId); | ||
236 | LSL_Integer osEjectFromGroup(LSL_Key agentId); | ||
234 | } | 237 | } |
235 | } | 238 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 09e5992..680cefb4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -868,5 +868,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
868 | { | 868 | { |
869 | return m_OSSL_Functions.osGetInventoryDesc(item); | 869 | return m_OSSL_Functions.osGetInventoryDesc(item); |
870 | } | 870 | } |
871 | |||
872 | public LSL_Integer osInviteToGroup(LSL_Key agentId) | ||
873 | { | ||
874 | return m_OSSL_Functions.osInviteToGroup(agentId); | ||
875 | } | ||
876 | |||
877 | public LSL_Integer osEjectFromGroup(LSL_Key agentId) | ||
878 | { | ||
879 | return m_OSSL_Functions.osEjectFromGroup(agentId); | ||
880 | } | ||
871 | } | 881 | } |
872 | } | 882 | } |