diff options
Diffstat (limited to '')
6 files changed, 159 insertions, 20 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 508baf7..ef2494a 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -315,7 +315,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
315 | 315 | ||
316 | try | 316 | try |
317 | { | 317 | { |
318 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000, false); | 318 | OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false); |
319 | bool success = result["success"].AsBoolean(); | 319 | bool success = result["success"].AsBoolean(); |
320 | if (result.ContainsKey("_Result")) | 320 | if (result.ContainsKey("_Result")) |
321 | { | 321 | { |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ee3b858..daebf8b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -185,15 +185,15 @@ namespace OpenSim.Services.GridService | |||
185 | 185 | ||
186 | if (!m_AllowDuplicateNames) | 186 | if (!m_AllowDuplicateNames) |
187 | { | 187 | { |
188 | List<RegionData> dupe = m_Database.Get(regionInfos.RegionName, scopeID); | 188 | List<RegionData> dupe = m_Database.Get(Util.EscapeForLike(regionInfos.RegionName), scopeID); |
189 | if (dupe != null && dupe.Count > 0) | 189 | if (dupe != null && dupe.Count > 0) |
190 | { | 190 | { |
191 | foreach (RegionData d in dupe) | 191 | foreach (RegionData d in dupe) |
192 | { | 192 | { |
193 | if (d.RegionID != regionInfos.RegionID) | 193 | if (d.RegionID != regionInfos.RegionID) |
194 | { | 194 | { |
195 | m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", | 195 | m_log.WarnFormat("[GRID SERVICE]: Region tried to register using a duplicate name. New region: {0} ({1}), existing region: {2} ({3}).", |
196 | regionInfos.RegionName, regionInfos.RegionID); | 196 | regionInfos.RegionName, regionInfos.RegionID, d.RegionName, d.RegionID); |
197 | return "Duplicate region name"; | 197 | return "Duplicate region name"; |
198 | } | 198 | } |
199 | } | 199 | } |
@@ -359,7 +359,7 @@ namespace OpenSim.Services.GridService | |||
359 | 359 | ||
360 | public GridRegion GetRegionByName(UUID scopeID, string name) | 360 | public GridRegion GetRegionByName(UUID scopeID, string name) |
361 | { | 361 | { |
362 | List<RegionData> rdatas = m_Database.Get(name, scopeID); | 362 | List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(name), scopeID); |
363 | if ((rdatas != null) && (rdatas.Count > 0)) | 363 | if ((rdatas != null) && (rdatas.Count > 0)) |
364 | return RegionData2RegionInfo(rdatas[0]); // get the first | 364 | return RegionData2RegionInfo(rdatas[0]); // get the first |
365 | 365 | ||
@@ -377,7 +377,7 @@ namespace OpenSim.Services.GridService | |||
377 | { | 377 | { |
378 | // m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); | 378 | // m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); |
379 | 379 | ||
380 | List<RegionData> rdatas = m_Database.Get(name + "%", scopeID); | 380 | List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(name) + "%", scopeID); |
381 | 381 | ||
382 | int count = 0; | 382 | int count = 0; |
383 | List<GridRegion> rinfos = new List<GridRegion>(); | 383 | List<GridRegion> rinfos = new List<GridRegion>(); |
@@ -586,7 +586,7 @@ namespace OpenSim.Services.GridService | |||
586 | 586 | ||
587 | string regionName = cmd[3]; | 587 | string regionName = cmd[3]; |
588 | 588 | ||
589 | List<RegionData> regions = m_Database.Get(regionName, UUID.Zero); | 589 | List<RegionData> regions = m_Database.Get(Util.EscapeForLike(regionName), UUID.Zero); |
590 | if (regions == null || regions.Count < 1) | 590 | if (regions == null || regions.Count < 1) |
591 | { | 591 | { |
592 | MainConsole.Instance.Output("No region with name {0} found", regionName); | 592 | MainConsole.Instance.Output("No region with name {0} found", regionName); |
@@ -716,7 +716,7 @@ namespace OpenSim.Services.GridService | |||
716 | return; | 716 | return; |
717 | } | 717 | } |
718 | 718 | ||
719 | List<RegionData> regions = m_Database.Get(cmd[3], UUID.Zero); | 719 | List<RegionData> regions = m_Database.Get(Util.EscapeForLike(cmd[3]), UUID.Zero); |
720 | if (regions == null || regions.Count < 1) | 720 | if (regions == null || regions.Count < 1) |
721 | { | 721 | { |
722 | MainConsole.Instance.Output("Region not found"); | 722 | MainConsole.Instance.Output("Region not found"); |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 743d089..073197f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -387,7 +387,7 @@ namespace OpenSim.Services.GridService | |||
387 | m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName); | 387 | m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName); |
388 | GridRegion regInfo = null; | 388 | GridRegion regInfo = null; |
389 | 389 | ||
390 | List<RegionData> regions = m_Database.Get(mapName, m_ScopeID); | 390 | List<RegionData> regions = m_Database.Get(Util.EscapeForLike(mapName), m_ScopeID); |
391 | if (regions != null && regions.Count > 0) | 391 | if (regions != null && regions.Count > 0) |
392 | { | 392 | { |
393 | OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); | 393 | OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); |
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 0c9cfd3..e8d7cca 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs | |||
@@ -61,13 +61,13 @@ namespace OpenSim.Services.HypergridService | |||
61 | protected static IGridService m_GridService; | 61 | protected static IGridService m_GridService; |
62 | protected static IPresenceService m_PresenceService; | 62 | protected static IPresenceService m_PresenceService; |
63 | protected static IUserAgentService m_UserAgentService; | 63 | protected static IUserAgentService m_UserAgentService; |
64 | protected static IOfflineIMService m_OfflineIMService; | ||
64 | 65 | ||
65 | protected static IInstantMessageSimConnector m_IMSimConnector; | 66 | protected static IInstantMessageSimConnector m_IMSimConnector; |
66 | 67 | ||
67 | protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>(); | 68 | protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>(); |
68 | private static ExpiringCache<UUID, GridRegion> m_RegionCache; | 69 | private static ExpiringCache<UUID, GridRegion> m_RegionCache; |
69 | 70 | ||
70 | private static string m_RestURL; | ||
71 | private static bool m_ForwardOfflineGroupMessages; | 71 | private static bool m_ForwardOfflineGroupMessages; |
72 | private static bool m_InGatekeeper; | 72 | private static bool m_InGatekeeper; |
73 | 73 | ||
@@ -111,9 +111,14 @@ namespace OpenSim.Services.HypergridService | |||
111 | return; | 111 | return; |
112 | } | 112 | } |
113 | 113 | ||
114 | m_RestURL = cnf.GetString("OfflineMessageURL", string.Empty); | ||
115 | m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false); | 114 | m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false); |
116 | 115 | ||
116 | if (m_InGatekeeper) | ||
117 | { | ||
118 | string offlineIMService = cnf.GetString("OfflineIMService", string.Empty); | ||
119 | if (offlineIMService != string.Empty) | ||
120 | m_OfflineIMService = ServerUtils.LoadPlugin<IOfflineIMService>(offlineIMService, args); | ||
121 | } | ||
117 | } | 122 | } |
118 | } | 123 | } |
119 | 124 | ||
@@ -329,18 +334,28 @@ namespace OpenSim.Services.HypergridService | |||
329 | 334 | ||
330 | private bool UndeliveredMessage(GridInstantMessage im) | 335 | private bool UndeliveredMessage(GridInstantMessage im) |
331 | { | 336 | { |
332 | if (m_RestURL != string.Empty && (im.offline != 0) | 337 | if (m_OfflineIMService == null) |
333 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 338 | return false; |
334 | { | ||
335 | // m_log.DebugFormat("[HG IM SERVICE]: Message saved"); | ||
336 | 339 | ||
337 | return SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( | 340 | if (im.dialog != (byte)InstantMessageDialog.MessageFromObject && |
338 | "POST", m_RestURL + "/SaveMessage/", im); | 341 | im.dialog != (byte)InstantMessageDialog.MessageFromAgent && |
339 | } | 342 | im.dialog != (byte)InstantMessageDialog.GroupNotice && |
340 | else | 343 | im.dialog != (byte)InstantMessageDialog.GroupInvitation && |
344 | im.dialog != (byte)InstantMessageDialog.InventoryOffered) | ||
341 | { | 345 | { |
342 | return false; | 346 | return false; |
343 | } | 347 | } |
348 | |||
349 | if (!m_ForwardOfflineGroupMessages) | ||
350 | { | ||
351 | if (im.dialog == (byte)InstantMessageDialog.GroupNotice || | ||
352 | im.dialog == (byte)InstantMessageDialog.GroupInvitation) | ||
353 | return false; | ||
354 | } | ||
355 | |||
356 | // m_log.DebugFormat("[HG IM SERVICE]: Message saved"); | ||
357 | string reason = string.Empty; | ||
358 | return m_OfflineIMService.StoreMessage(im, out reason); | ||
344 | } | 359 | } |
345 | } | 360 | } |
346 | } \ No newline at end of file | 361 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Interfaces/IOfflineIMService.cs b/OpenSim/Services/Interfaces/IOfflineIMService.cs new file mode 100644 index 0000000..2848967 --- /dev/null +++ b/OpenSim/Services/Interfaces/IOfflineIMService.cs | |||
@@ -0,0 +1,115 @@ | |||
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 | |||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IOfflineIMService | ||
36 | { | ||
37 | List<GridInstantMessage> GetMessages(UUID principalID); | ||
38 | bool StoreMessage(GridInstantMessage im, out string reason); | ||
39 | } | ||
40 | |||
41 | public class OfflineIMDataUtils | ||
42 | { | ||
43 | public static GridInstantMessage GridInstantMessage(Dictionary<string, object> dict) | ||
44 | { | ||
45 | GridInstantMessage im = new GridInstantMessage(); | ||
46 | |||
47 | if (dict.ContainsKey("BinaryBucket") && dict["BinaryBucket"] != null) | ||
48 | im.binaryBucket = OpenMetaverse.Utils.HexStringToBytes(dict["BinaryBucket"].ToString(), true); | ||
49 | |||
50 | if (dict.ContainsKey("Dialog") && dict["Dialog"] != null) | ||
51 | im.dialog = byte.Parse(dict["Dialog"].ToString()); | ||
52 | |||
53 | if (dict.ContainsKey("FromAgentID") && dict["FromAgentID"] != null) | ||
54 | im.fromAgentID = new Guid(dict["FromAgentID"].ToString()); | ||
55 | |||
56 | if (dict.ContainsKey("FromAgentName") && dict["FromAgentName"] != null) | ||
57 | im.fromAgentName = dict["FromAgentName"].ToString(); | ||
58 | else | ||
59 | im.fromAgentName = string.Empty; | ||
60 | |||
61 | if (dict.ContainsKey("FromGroup") && dict["FromGroup"] != null) | ||
62 | im.fromGroup = bool.Parse(dict["FromGroup"].ToString()); | ||
63 | |||
64 | if (dict.ContainsKey("SessionID") && dict["SessionID"] != null) | ||
65 | im.imSessionID = new Guid(dict["SessionID"].ToString()); | ||
66 | |||
67 | if (dict.ContainsKey("Message") && dict["Message"] != null) | ||
68 | im.message = dict["Message"].ToString(); | ||
69 | else | ||
70 | im.message = string.Empty; | ||
71 | |||
72 | if (dict.ContainsKey("Offline") && dict["Offline"] != null) | ||
73 | im.offline = byte.Parse(dict["Offline"].ToString()); | ||
74 | |||
75 | if (dict.ContainsKey("EstateID") && dict["EstateID"] != null) | ||
76 | im.ParentEstateID = UInt32.Parse(dict["EstateID"].ToString()); | ||
77 | |||
78 | if (dict.ContainsKey("Position") && dict["Position"] != null) | ||
79 | im.Position = Vector3.Parse(dict["Position"].ToString()); | ||
80 | |||
81 | if (dict.ContainsKey("RegionID") && dict["RegionID"] != null) | ||
82 | im.RegionID = new Guid(dict["RegionID"].ToString()); | ||
83 | |||
84 | if (dict.ContainsKey("Timestamp") && dict["Timestamp"] != null) | ||
85 | im.timestamp = UInt32.Parse(dict["Timestamp"].ToString()); | ||
86 | |||
87 | if (dict.ContainsKey("ToAgentID") && dict["ToAgentID"] != null) | ||
88 | im.toAgentID = new Guid(dict["ToAgentID"].ToString()); | ||
89 | |||
90 | return im; | ||
91 | } | ||
92 | |||
93 | public static Dictionary<string, object> GridInstantMessage(GridInstantMessage im) | ||
94 | { | ||
95 | Dictionary<string, object> dict = new Dictionary<string, object>(); | ||
96 | |||
97 | dict["BinaryBucket"] = OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, im.binaryBucket.Length, null); | ||
98 | dict["Dialog"] = im.dialog.ToString(); | ||
99 | dict["FromAgentID"] = im.fromAgentID.ToString(); | ||
100 | dict["FromAgentName"] = im.fromAgentName == null ? string.Empty : im.fromAgentName; | ||
101 | dict["FromGroup"] = im.fromGroup.ToString(); | ||
102 | dict["SessionID"] = im.imSessionID.ToString(); | ||
103 | dict["Message"] = im.message == null ? string.Empty : im.message; | ||
104 | dict["Offline"] = im.offline.ToString(); | ||
105 | dict["EstateID"] = im.ParentEstateID.ToString(); | ||
106 | dict["Position"] = im.Position.ToString(); | ||
107 | dict["RegionID"] = im.RegionID.ToString(); | ||
108 | dict["Timestamp"] = im.timestamp.ToString(); | ||
109 | dict["ToAgentID"] = im.toAgentID.ToString(); | ||
110 | |||
111 | return dict; | ||
112 | } | ||
113 | |||
114 | } | ||
115 | } | ||
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 00faa44..7bad4b0 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -219,9 +219,15 @@ namespace OpenSim.Services.InventoryService | |||
219 | 219 | ||
220 | XInventoryFolder root = null; | 220 | XInventoryFolder root = null; |
221 | foreach (XInventoryFolder folder in folders) | 221 | foreach (XInventoryFolder folder in folders) |
222 | { | ||
222 | if (folder.folderName == "My Inventory") | 223 | if (folder.folderName == "My Inventory") |
224 | { | ||
223 | root = folder; | 225 | root = folder; |
224 | if (folders == null) // oops | 226 | break; |
227 | } | ||
228 | } | ||
229 | |||
230 | if (root == null) // oops | ||
225 | root = folders[0]; | 231 | root = folders[0]; |
226 | 232 | ||
227 | return ConvertToOpenSim(root); | 233 | return ConvertToOpenSim(root); |
@@ -249,6 +255,9 @@ namespace OpenSim.Services.InventoryService | |||
249 | { | 255 | { |
250 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); | 256 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); |
251 | 257 | ||
258 | if (type == AssetType.RootFolder) | ||
259 | return rootFolder; | ||
260 | |||
252 | XInventoryFolder[] folders = m_Database.GetFolders( | 261 | XInventoryFolder[] folders = m_Database.GetFolders( |
253 | new string[] { "agentID", "parentFolderID", "type"}, | 262 | new string[] { "agentID", "parentFolderID", "type"}, |
254 | new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); | 263 | new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); |