diff options
Diffstat (limited to 'OpenSim')
115 files changed, 1925 insertions, 660 deletions
diff --git a/OpenSim/Addons/Groups/GroupsMessagingModule.cs b/OpenSim/Addons/Groups/GroupsMessagingModule.cs index bbb5e05..e6a4765 100644 --- a/OpenSim/Addons/Groups/GroupsMessagingModule.cs +++ b/OpenSim/Addons/Groups/GroupsMessagingModule.cs | |||
@@ -56,8 +56,8 @@ namespace OpenSim.Groups | |||
56 | private IGroupsServicesConnector m_groupData = null; | 56 | private IGroupsServicesConnector m_groupData = null; |
57 | 57 | ||
58 | // Config Options | 58 | // Config Options |
59 | private bool m_groupMessagingEnabled = false; | 59 | private bool m_groupMessagingEnabled; |
60 | private bool m_debugEnabled = true; | 60 | private bool m_debugEnabled; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// If enabled, module only tries to send group IMs to online users by querying cached presence information. | 63 | /// If enabled, module only tries to send group IMs to online users by querying cached presence information. |
@@ -120,7 +120,7 @@ namespace OpenSim.Groups | |||
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | 122 | ||
123 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); | 123 | m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled); |
124 | 124 | ||
125 | m_log.InfoFormat( | 125 | m_log.InfoFormat( |
126 | "[Groups.Messaging]: GroupsMessagingModule enabled with MessageOnlineOnly = {0}, DebugEnabled = {1}", | 126 | "[Groups.Messaging]: GroupsMessagingModule enabled with MessageOnlineOnly = {0}, DebugEnabled = {1}", |
@@ -140,6 +140,14 @@ namespace OpenSim.Groups | |||
140 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; | 140 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; |
141 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 141 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
142 | scene.EventManager.OnClientLogin += OnClientLogin; | 142 | scene.EventManager.OnClientLogin += OnClientLogin; |
143 | |||
144 | scene.AddCommand( | ||
145 | "Debug", | ||
146 | this, | ||
147 | "debug groups messaging verbose", | ||
148 | "debug groups messaging verbose <true|false>", | ||
149 | "This setting turns on very verbose groups messaging debugging", | ||
150 | HandleDebugGroupsMessagingVerbose); | ||
143 | } | 151 | } |
144 | 152 | ||
145 | public void RegionLoaded(Scene scene) | 153 | public void RegionLoaded(Scene scene) |
@@ -227,6 +235,26 @@ namespace OpenSim.Groups | |||
227 | 235 | ||
228 | #endregion | 236 | #endregion |
229 | 237 | ||
238 | private void HandleDebugGroupsMessagingVerbose(object modules, string[] args) | ||
239 | { | ||
240 | if (args.Length < 5) | ||
241 | { | ||
242 | MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>"); | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | bool verbose = false; | ||
247 | if (!bool.TryParse(args[4], out verbose)) | ||
248 | { | ||
249 | MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>"); | ||
250 | return; | ||
251 | } | ||
252 | |||
253 | m_debugEnabled = verbose; | ||
254 | |||
255 | MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled); | ||
256 | } | ||
257 | |||
230 | /// <summary> | 258 | /// <summary> |
231 | /// Not really needed, but does confirm that the group exists. | 259 | /// Not really needed, but does confirm that the group exists. |
232 | /// </summary> | 260 | /// </summary> |
@@ -255,6 +283,8 @@ namespace OpenSim.Groups | |||
255 | public void SendMessageToGroup( | 283 | public void SendMessageToGroup( |
256 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) | 284 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) |
257 | { | 285 | { |
286 | int requestStartTick = Environment.TickCount; | ||
287 | |||
258 | UUID fromAgentID = new UUID(im.fromAgentID); | 288 | UUID fromAgentID = new UUID(im.fromAgentID); |
259 | 289 | ||
260 | // Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent | 290 | // Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent |
@@ -287,8 +317,6 @@ namespace OpenSim.Groups | |||
287 | // "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", | 317 | // "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online", |
288 | // groupID, groupMembersCount, groupMembers.Count()); | 318 | // groupID, groupMembersCount, groupMembers.Count()); |
289 | 319 | ||
290 | int requestStartTick = Environment.TickCount; | ||
291 | |||
292 | im.imSessionID = groupID.Guid; | 320 | im.imSessionID = groupID.Guid; |
293 | im.fromGroup = true; | 321 | im.fromGroup = true; |
294 | IClientAPI thisClient = GetActiveClient(fromAgentID); | 322 | IClientAPI thisClient = GetActiveClient(fromAgentID); |
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs index 1425a23..7450c14 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnector.cs | |||
@@ -32,29 +32,47 @@ using System.Reflection; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | 33 | ||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.ServiceAuth; | ||
35 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
36 | 37 | ||
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using log4net; | 39 | using log4net; |
40 | using Nini.Config; | ||
39 | 41 | ||
40 | namespace OpenSim.Groups | 42 | namespace OpenSim.Groups |
41 | { | 43 | { |
42 | public class GroupsServiceRemoteConnector | 44 | public class GroupsServiceRemoteConnector |
43 | { | 45 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | ||
46 | private string m_ServerURI; | 48 | private string m_ServerURI; |
47 | private string m_SecretKey; | 49 | private IServiceAuth m_Auth; |
48 | private object m_Lock = new object(); | 50 | private object m_Lock = new object(); |
49 | 51 | ||
50 | public GroupsServiceRemoteConnector(string url, string secret) | 52 | public GroupsServiceRemoteConnector(IConfigSource config) |
51 | { | 53 | { |
54 | IConfig groupsConfig = config.Configs["Groups"]; | ||
55 | string url = groupsConfig.GetString("GroupsServerURI", string.Empty); | ||
56 | if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) | ||
57 | throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url)); | ||
58 | |||
52 | m_ServerURI = url; | 59 | m_ServerURI = url; |
53 | if (!m_ServerURI.EndsWith("/")) | 60 | if (!m_ServerURI.EndsWith("/")) |
54 | m_ServerURI += "/"; | 61 | m_ServerURI += "/"; |
55 | 62 | ||
56 | m_SecretKey = secret; | 63 | /// This is from BaseServiceConnector |
57 | m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, secret key {1}", m_ServerURI, m_SecretKey); | 64 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Groups" }, "None"); |
65 | |||
66 | switch (authType) | ||
67 | { | ||
68 | case "BasicHttpAuthentication": | ||
69 | m_Auth = new BasicHttpAuthentication(config, "Groups"); | ||
70 | break; | ||
71 | } | ||
72 | /// | ||
73 | |||
74 | m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}", | ||
75 | m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); | ||
58 | } | 76 | } |
59 | 77 | ||
60 | public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, | 78 | public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, |
@@ -656,14 +674,13 @@ namespace OpenSim.Groups | |||
656 | private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData) | 674 | private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData) |
657 | { | 675 | { |
658 | sendData["METHOD"] = method; | 676 | sendData["METHOD"] = method; |
659 | if (m_SecretKey != string.Empty) | ||
660 | sendData["KEY"] = m_SecretKey; | ||
661 | 677 | ||
662 | string reply = string.Empty; | 678 | string reply = string.Empty; |
663 | lock (m_Lock) | 679 | lock (m_Lock) |
664 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 680 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
665 | m_ServerURI + "groups", | 681 | m_ServerURI + "groups", |
666 | ServerUtils.BuildQueryString(sendData)); | 682 | ServerUtils.BuildQueryString(sendData), |
683 | m_Auth); | ||
667 | 684 | ||
668 | if (reply == string.Empty) | 685 | if (reply == string.Empty) |
669 | return null; | 686 | return null; |
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs index 5fb3c19..fddda22 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRemoteConnectorModule.cs | |||
@@ -72,13 +72,7 @@ namespace OpenSim.Groups | |||
72 | 72 | ||
73 | private void Init(IConfigSource config) | 73 | private void Init(IConfigSource config) |
74 | { | 74 | { |
75 | IConfig groupsConfig = config.Configs["Groups"]; | 75 | m_GroupsService = new GroupsServiceRemoteConnector(config); |
76 | string url = groupsConfig.GetString("GroupsServerURI", string.Empty); | ||
77 | if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) | ||
78 | throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url)); | ||
79 | |||
80 | string secret = groupsConfig.GetString("SecretKey", string.Empty); | ||
81 | m_GroupsService = new GroupsServiceRemoteConnector(url, secret); | ||
82 | m_Scenes = new List<Scene>(); | 76 | m_Scenes = new List<Scene>(); |
83 | 77 | ||
84 | } | 78 | } |
diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 828965f..55ae6db 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs | |||
@@ -36,6 +36,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Server.Handlers.Base; | 40 | using OpenSim.Server.Handlers.Base; |
40 | using log4net; | 41 | using log4net; |
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
@@ -64,12 +65,14 @@ namespace OpenSim.Groups | |||
64 | key = groupsConfig.GetString("SecretKey", string.Empty); | 65 | key = groupsConfig.GetString("SecretKey", string.Empty); |
65 | m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key); | 66 | m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key); |
66 | } | 67 | } |
67 | else | 68 | // else |
68 | m_log.WarnFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName); | 69 | // m_log.DebugFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName); |
69 | 70 | ||
70 | m_GroupsService = new GroupsService(config); | 71 | m_GroupsService = new GroupsService(config); |
71 | 72 | ||
72 | server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key)); | 73 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
74 | |||
75 | server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, auth)); | ||
73 | } | 76 | } |
74 | } | 77 | } |
75 | 78 | ||
@@ -78,13 +81,11 @@ namespace OpenSim.Groups | |||
78 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 81 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
79 | 82 | ||
80 | private GroupsService m_GroupsService; | 83 | private GroupsService m_GroupsService; |
81 | private string m_SecretKey = String.Empty; | ||
82 | 84 | ||
83 | public GroupsServicePostHandler(GroupsService service, string key) : | 85 | public GroupsServicePostHandler(GroupsService service, IServiceAuth auth) : |
84 | base("POST", "/groups") | 86 | base("POST", "/groups", auth) |
85 | { | 87 | { |
86 | m_GroupsService = service; | 88 | m_GroupsService = service; |
87 | m_SecretKey = key; | ||
88 | } | 89 | } |
89 | 90 | ||
90 | protected override byte[] ProcessRequest(string path, Stream requestData, | 91 | protected override byte[] ProcessRequest(string path, Stream requestData, |
@@ -108,20 +109,6 @@ namespace OpenSim.Groups | |||
108 | string method = request["METHOD"].ToString(); | 109 | string method = request["METHOD"].ToString(); |
109 | request.Remove("METHOD"); | 110 | request.Remove("METHOD"); |
110 | 111 | ||
111 | if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required | ||
112 | { | ||
113 | // Sender didn't send key | ||
114 | if (!request.ContainsKey("KEY") || (request["KEY"] == null)) | ||
115 | return FailureResult("This service requires a secret key"); | ||
116 | |||
117 | // Sender sent wrong key | ||
118 | if (!m_SecretKey.Equals(request["KEY"])) | ||
119 | return FailureResult("Provided key does not match existing one"); | ||
120 | |||
121 | // OK, key matches. Remove it. | ||
122 | request.Remove("KEY"); | ||
123 | } | ||
124 | |||
125 | m_log.DebugFormat("[Groups.Handler]: {0}", method); | 112 | m_log.DebugFormat("[Groups.Handler]: {0}", method); |
126 | switch (method) | 113 | switch (method) |
127 | { | 114 | { |
diff --git a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs index 5ef068a..5340bcd 100644 --- a/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs +++ b/OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.OfflineIM | |||
66 | if (serviceLocation == string.Empty) | 66 | if (serviceLocation == string.Empty) |
67 | m_OfflineIMService = new OfflineIMService(config); | 67 | m_OfflineIMService = new OfflineIMService(config); |
68 | else | 68 | else |
69 | m_OfflineIMService = new OfflineIMServiceRemoteConnector(serviceLocation); | 69 | m_OfflineIMService = new OfflineIMServiceRemoteConnector(config); |
70 | 70 | ||
71 | m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); | 71 | m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages); |
72 | m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name); | 72 | m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name); |
@@ -226,10 +226,6 @@ namespace OpenSim.OfflineIM | |||
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | Scene scene = FindScene(new UUID(im.fromAgentID)); | ||
230 | if (scene == null) | ||
231 | scene = m_SceneList[0]; | ||
232 | |||
233 | string reason = string.Empty; | 229 | string reason = string.Empty; |
234 | bool success = m_OfflineIMService.StoreMessage(im, out reason); | 230 | bool success = m_OfflineIMService.StoreMessage(im, out reason); |
235 | 231 | ||
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs index eb287a4..047b8be 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | 33 | ||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.ServiceAuth; | ||
35 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | 38 | ||
@@ -46,6 +47,7 @@ namespace OpenSim.OfflineIM | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 48 | ||
48 | private string m_ServerURI = string.Empty; | 49 | private string m_ServerURI = string.Empty; |
50 | private IServiceAuth m_Auth; | ||
49 | private object m_Lock = new object(); | 51 | private object m_Lock = new object(); |
50 | 52 | ||
51 | public OfflineIMServiceRemoteConnector(string url) | 53 | public OfflineIMServiceRemoteConnector(string url) |
@@ -65,6 +67,18 @@ namespace OpenSim.OfflineIM | |||
65 | 67 | ||
66 | m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty); | 68 | m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty); |
67 | 69 | ||
70 | /// This is from BaseServiceConnector | ||
71 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Messaging" }, "None"); | ||
72 | |||
73 | switch (authType) | ||
74 | { | ||
75 | case "BasicHttpAuthentication": | ||
76 | m_Auth = new BasicHttpAuthentication(config, "Messaging"); | ||
77 | break; | ||
78 | } | ||
79 | /// | ||
80 | m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}", | ||
81 | m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString())); | ||
68 | } | 82 | } |
69 | 83 | ||
70 | #region IOfflineIMService | 84 | #region IOfflineIMService |
@@ -143,7 +157,8 @@ namespace OpenSim.OfflineIM | |||
143 | lock (m_Lock) | 157 | lock (m_Lock) |
144 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 158 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
145 | m_ServerURI + "/offlineim", | 159 | m_ServerURI + "/offlineim", |
146 | ServerUtils.BuildQueryString(sendData)); | 160 | ServerUtils.BuildQueryString(sendData), |
161 | m_Auth); | ||
147 | 162 | ||
148 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 163 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
149 | reply); | 164 | reply); |
diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs index ed5c742..c44b6cc 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRobustConnector.cs | |||
@@ -36,6 +36,7 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Server.Handlers.Base; | 40 | using OpenSim.Server.Handlers.Base; |
40 | using log4net; | 41 | using log4net; |
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
@@ -59,7 +60,9 @@ namespace OpenSim.OfflineIM | |||
59 | 60 | ||
60 | m_OfflineIMService = new OfflineIMService(config); | 61 | m_OfflineIMService = new OfflineIMService(config); |
61 | 62 | ||
62 | server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService)); | 63 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
64 | |||
65 | server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService, auth)); | ||
63 | } | 66 | } |
64 | } | 67 | } |
65 | 68 | ||
@@ -69,8 +72,8 @@ namespace OpenSim.OfflineIM | |||
69 | 72 | ||
70 | private IOfflineIMService m_OfflineIMService; | 73 | private IOfflineIMService m_OfflineIMService; |
71 | 74 | ||
72 | public OfflineIMServicePostHandler(IOfflineIMService service) : | 75 | public OfflineIMServicePostHandler(IOfflineIMService service, IServiceAuth auth) : |
73 | base("POST", "/offlineim") | 76 | base("POST", "/offlineim", auth) |
74 | { | 77 | { |
75 | m_OfflineIMService = service; | 78 | m_OfflineIMService = service; |
76 | } | 79 | } |
diff --git a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs index 690c955..02084ff 100644 --- a/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs +++ b/OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs | |||
@@ -104,7 +104,7 @@ namespace OpenSim.OfflineIM | |||
104 | using (MemoryStream mstream = new MemoryStream()) | 104 | using (MemoryStream mstream = new MemoryStream()) |
105 | { | 105 | { |
106 | XmlWriterSettings settings = new XmlWriterSettings(); | 106 | XmlWriterSettings settings = new XmlWriterSettings(); |
107 | settings.Encoding = Encoding.UTF8; | 107 | settings.Encoding = Util.UTF8NoBomEncoding; |
108 | 108 | ||
109 | using (XmlWriter writer = XmlWriter.Create(mstream, settings)) | 109 | using (XmlWriter writer = XmlWriter.Create(mstream, settings)) |
110 | { | 110 | { |
@@ -112,7 +112,7 @@ namespace OpenSim.OfflineIM | |||
112 | writer.Flush(); | 112 | writer.Flush(); |
113 | } | 113 | } |
114 | 114 | ||
115 | imXml = Util.UTF8.GetString(mstream.ToArray()); | 115 | imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray()); |
116 | } | 116 | } |
117 | 117 | ||
118 | OfflineIMData data = new OfflineIMData(); | 118 | OfflineIMData data = new OfflineIMData(); |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 7b3124a..828e943 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -56,12 +56,15 @@ namespace OpenSim.Capabilities.Handlers | |||
56 | public const string DefaultFormat = "x-j2c"; | 56 | public const string DefaultFormat = "x-j2c"; |
57 | 57 | ||
58 | // TODO: Change this to a config option | 58 | // TODO: Change this to a config option |
59 | const string REDIRECT_URL = null; | 59 | private string m_RedirectURL = null; |
60 | 60 | ||
61 | public GetTextureHandler(string path, IAssetService assService, string name, string description) | 61 | public GetTextureHandler(string path, IAssetService assService, string name, string description, string redirectURL) |
62 | : base("GET", path, name, description) | 62 | : base("GET", path, name, description) |
63 | { | 63 | { |
64 | m_assetService = assService; | 64 | m_assetService = assService; |
65 | m_RedirectURL = redirectURL; | ||
66 | if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/")) | ||
67 | m_RedirectURL += "/"; | ||
65 | } | 68 | } |
66 | 69 | ||
67 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 70 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
@@ -134,7 +137,7 @@ namespace OpenSim.Capabilities.Handlers | |||
134 | if (format != DefaultFormat) | 137 | if (format != DefaultFormat) |
135 | fullID = fullID + "-" + format; | 138 | fullID = fullID + "-" + format; |
136 | 139 | ||
137 | if (!String.IsNullOrEmpty(REDIRECT_URL)) | 140 | if (!String.IsNullOrEmpty(m_RedirectURL)) |
138 | { | 141 | { |
139 | // Only try to fetch locally cached textures. Misses are redirected | 142 | // Only try to fetch locally cached textures. Misses are redirected |
140 | texture = m_assetService.GetCached(fullID); | 143 | texture = m_assetService.GetCached(fullID); |
@@ -150,8 +153,9 @@ namespace OpenSim.Capabilities.Handlers | |||
150 | } | 153 | } |
151 | else | 154 | else |
152 | { | 155 | { |
153 | string textureUrl = REDIRECT_URL + textureID.ToString(); | 156 | string textureUrl = m_RedirectURL + "?texture_id="+ textureID.ToString(); |
154 | m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl); | 157 | m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl); |
158 | httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently; | ||
155 | httpResponse.RedirectLocation = textureUrl; | 159 | httpResponse.RedirectLocation = textureUrl; |
156 | return true; | 160 | return true; |
157 | } | 161 | } |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs index 71cf033..fa0b228 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs | |||
@@ -62,8 +62,10 @@ namespace OpenSim.Capabilities.Handlers | |||
62 | if (m_AssetService == null) | 62 | if (m_AssetService == null) |
63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | 63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); |
64 | 64 | ||
65 | string rurl = serverConfig.GetString("GetTextureRedirectURL"); | ||
66 | ; | ||
65 | server.AddStreamHandler( | 67 | server.AddStreamHandler( |
66 | new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null)); | 68 | new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null, rurl)); |
67 | } | 69 | } |
68 | } | 70 | } |
69 | } \ No newline at end of file | 71 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs index d4d6d10..8ffafa4 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests | |||
52 | // Overkill - we only really need the asset service, not a whole scene. | 52 | // Overkill - we only really need the asset service, not a whole scene. |
53 | Scene scene = new SceneHelpers().SetupScene(); | 53 | Scene scene = new SceneHelpers().SetupScene(); |
54 | 54 | ||
55 | GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null); | 55 | GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null, null); |
56 | TestOSHttpRequest req = new TestOSHttpRequest(); | 56 | TestOSHttpRequest req = new TestOSHttpRequest(); |
57 | TestOSHttpResponse resp = new TestOSHttpResponse(); | 57 | TestOSHttpResponse resp = new TestOSHttpResponse(); |
58 | req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); | 58 | req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); |
diff --git a/OpenSim/Data/MySQL/MySQLGroupsData.cs b/OpenSim/Data/MySQL/MySQLGroupsData.cs index 8e39229..afa499e 100644 --- a/OpenSim/Data/MySQL/MySQLGroupsData.cs +++ b/OpenSim/Data/MySQL/MySQLGroupsData.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Data.MySQL | |||
88 | if (string.IsNullOrEmpty(pattern)) | 88 | if (string.IsNullOrEmpty(pattern)) |
89 | pattern = "1"; | 89 | pattern = "1"; |
90 | else | 90 | else |
91 | pattern = string.Format("Name LIKE '%{0}%'", pattern); | 91 | pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern)); |
92 | 92 | ||
93 | return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern)); | 93 | return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern)); |
94 | } | 94 | } |
diff --git a/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs b/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs index 2151568..826c6fc 100644 --- a/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs +++ b/OpenSim/Data/PGSQL/PGSQLGenericTableHandler.cs | |||
@@ -300,9 +300,27 @@ namespace OpenSim.Data.PGSQL | |||
300 | m_Realm, where); | 300 | m_Realm, where); |
301 | cmd.Connection = conn; | 301 | cmd.Connection = conn; |
302 | cmd.CommandText = query; | 302 | cmd.CommandText = query; |
303 | //m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); | ||
304 | |||
305 | conn.Open(); | ||
306 | return DoQuery(cmd); | ||
307 | } | ||
308 | } | ||
303 | 309 | ||
310 | public virtual T[] Get(string where, NpgsqlParameter parameter) | ||
311 | { | ||
312 | using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString)) | ||
313 | using (NpgsqlCommand cmd = new NpgsqlCommand()) | ||
314 | { | ||
315 | |||
316 | string query = String.Format("SELECT * FROM {0} WHERE {1}", | ||
317 | m_Realm, where); | ||
318 | cmd.Connection = conn; | ||
319 | cmd.CommandText = query; | ||
304 | //m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); | 320 | //m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where); |
305 | 321 | ||
322 | cmd.Parameters.Add(parameter); | ||
323 | |||
306 | conn.Open(); | 324 | conn.Open(); |
307 | return DoQuery(cmd); | 325 | return DoQuery(cmd); |
308 | } | 326 | } |
diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs index ed75b63..669e3c8 100644 --- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs +++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs | |||
@@ -83,11 +83,15 @@ namespace OpenSim.Data.PGSQL | |||
83 | public GroupData[] RetrieveGroups(string pattern) | 83 | public GroupData[] RetrieveGroups(string pattern) |
84 | { | 84 | { |
85 | if (string.IsNullOrEmpty(pattern)) // True for where clause | 85 | if (string.IsNullOrEmpty(pattern)) // True for where clause |
86 | { | ||
86 | pattern = " true ORDER BY lower(\"Name\") LIMIT 100"; | 87 | pattern = " true ORDER BY lower(\"Name\") LIMIT 100"; |
88 | return m_Groups.Get(pattern); | ||
89 | } | ||
87 | else | 90 | else |
88 | pattern = string.Format(" lower(\"Name\") LIKE lower('%{0}%') ORDER BY lower(\"Name\") LIMIT 100", pattern); | 91 | { |
89 | 92 | pattern = " lower(\"Name\") LIKE lower('%:pattern%') ORDER BY lower(\"Name\") LIMIT 100"; | |
90 | return m_Groups.Get(pattern); | 93 | return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern)); |
94 | } | ||
91 | } | 95 | } |
92 | 96 | ||
93 | public bool DeleteGroup(UUID groupID) | 97 | public bool DeleteGroup(UUID groupID) |
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index f2fe494..0d053e4 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -321,6 +321,8 @@ namespace OpenSim.Framework | |||
321 | Mac = args["mac"].AsString(); | 321 | Mac = args["mac"].AsString(); |
322 | if (args["id0"] != null) | 322 | if (args["id0"] != null) |
323 | Id0 = args["id0"].AsString(); | 323 | Id0 = args["id0"].AsString(); |
324 | if (args["teleport_flags"] != null) | ||
325 | teleportFlags = args["teleport_flags"].AsUInteger(); | ||
324 | 326 | ||
325 | if (args["start_pos"] != null) | 327 | if (args["start_pos"] != null) |
326 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | 328 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); |
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index e7f0ca8..89e6aa1 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs | |||
@@ -35,6 +35,8 @@ using System.Threading; | |||
35 | using System.Web; | 35 | using System.Web; |
36 | using log4net; | 36 | using log4net; |
37 | 37 | ||
38 | using OpenSim.Framework.ServiceAuth; | ||
39 | |||
38 | namespace OpenSim.Framework.Communications | 40 | namespace OpenSim.Framework.Communications |
39 | { | 41 | { |
40 | /// <summary> | 42 | /// <summary> |
@@ -297,7 +299,7 @@ namespace OpenSim.Framework.Communications | |||
297 | /// <summary> | 299 | /// <summary> |
298 | /// Perform a synchronous request | 300 | /// Perform a synchronous request |
299 | /// </summary> | 301 | /// </summary> |
300 | public Stream Request() | 302 | public Stream Request(IServiceAuth auth) |
301 | { | 303 | { |
302 | lock (_lock) | 304 | lock (_lock) |
303 | { | 305 | { |
@@ -307,6 +309,8 @@ namespace OpenSim.Framework.Communications | |||
307 | _request.Timeout = 200000; | 309 | _request.Timeout = 200000; |
308 | _request.Method = RequestMethod; | 310 | _request.Method = RequestMethod; |
309 | _asyncException = null; | 311 | _asyncException = null; |
312 | if (auth != null) | ||
313 | auth.AddAuthorization(_request.Headers); | ||
310 | 314 | ||
311 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | 315 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); |
312 | try | 316 | try |
@@ -358,7 +362,7 @@ namespace OpenSim.Framework.Communications | |||
358 | } | 362 | } |
359 | } | 363 | } |
360 | 364 | ||
361 | public Stream Request(Stream src) | 365 | public Stream Request(Stream src, IServiceAuth auth) |
362 | { | 366 | { |
363 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); | 367 | _request = (HttpWebRequest) WebRequest.Create(buildUri()); |
364 | _request.KeepAlive = false; | 368 | _request.KeepAlive = false; |
@@ -367,6 +371,8 @@ namespace OpenSim.Framework.Communications | |||
367 | _request.Method = RequestMethod; | 371 | _request.Method = RequestMethod; |
368 | _asyncException = null; | 372 | _asyncException = null; |
369 | _request.ContentLength = src.Length; | 373 | _request.ContentLength = src.Length; |
374 | if (auth != null) | ||
375 | auth.AddAuthorization(_request.Headers); | ||
370 | 376 | ||
371 | m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength); | 377 | m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength); |
372 | m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); | 378 | m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); |
@@ -384,7 +390,22 @@ namespace OpenSim.Framework.Communications | |||
384 | length = src.Read(buf, 0, 1024); | 390 | length = src.Read(buf, 0, 1024); |
385 | } | 391 | } |
386 | 392 | ||
387 | _response = (HttpWebResponse) _request.GetResponse(); | 393 | try |
394 | { | ||
395 | _response = (HttpWebResponse)_request.GetResponse(); | ||
396 | } | ||
397 | catch (WebException e) | ||
398 | { | ||
399 | m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}", | ||
400 | RequestMethod, _request.RequestUri, e.Status, e.Message); | ||
401 | } | ||
402 | catch (Exception e) | ||
403 | { | ||
404 | m_log.WarnFormat( | ||
405 | "[REST]: Request {0} {1} failed with exception {2} {3}", | ||
406 | RequestMethod, _request.RequestUri, e.Message, e.StackTrace); | ||
407 | } | ||
408 | |||
388 | 409 | ||
389 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); | 410 | // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); |
390 | 411 | ||
@@ -423,7 +444,7 @@ namespace OpenSim.Framework.Communications | |||
423 | try | 444 | try |
424 | { | 445 | { |
425 | // Perform the operation; if sucessful set the result | 446 | // Perform the operation; if sucessful set the result |
426 | Stream s = Request(); | 447 | Stream s = Request(null); |
427 | ar.SetAsCompleted(s, false); | 448 | ar.SetAsCompleted(s, false); |
428 | } | 449 | } |
429 | catch (Exception e) | 450 | catch (Exception e) |
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index a967db6..260a86f 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs | |||
@@ -46,6 +46,11 @@ namespace OpenSim.Framework.Console | |||
46 | // private readonly object m_syncRoot = new object(); | 46 | // private readonly object m_syncRoot = new object(); |
47 | private const string LOGLEVEL_NONE = "(none)"; | 47 | private const string LOGLEVEL_NONE = "(none)"; |
48 | 48 | ||
49 | // Used to extract categories for colourization. | ||
50 | private Regex m_categoryRegex | ||
51 | = new Regex( | ||
52 | @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)", RegexOptions.Singleline | RegexOptions.Compiled); | ||
53 | |||
49 | private int m_cursorYPosition = -1; | 54 | private int m_cursorYPosition = -1; |
50 | private int m_cursorXPosition = 0; | 55 | private int m_cursorXPosition = 0; |
51 | private StringBuilder m_commandLine = new StringBuilder(); | 56 | private StringBuilder m_commandLine = new StringBuilder(); |
@@ -280,11 +285,8 @@ namespace OpenSim.Framework.Console | |||
280 | string outText = text; | 285 | string outText = text; |
281 | 286 | ||
282 | if (level != LOGLEVEL_NONE) | 287 | if (level != LOGLEVEL_NONE) |
283 | { | 288 | { |
284 | string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)"; | 289 | MatchCollection matches = m_categoryRegex.Matches(text); |
285 | |||
286 | Regex RE = new Regex(regex, RegexOptions.Multiline); | ||
287 | MatchCollection matches = RE.Matches(text); | ||
288 | 290 | ||
289 | if (matches.Count == 1) | 291 | if (matches.Count == 1) |
290 | { | 292 | { |
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index 709b516..4b5326a 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs | |||
@@ -213,8 +213,13 @@ namespace OpenSim.Framework.Serialization.External | |||
213 | xtw.WriteElementString("ClaimDate", Convert.ToString(landData.ClaimDate)); | 213 | xtw.WriteElementString("ClaimDate", Convert.ToString(landData.ClaimDate)); |
214 | xtw.WriteElementString("ClaimPrice", Convert.ToString(landData.ClaimPrice)); | 214 | xtw.WriteElementString("ClaimPrice", Convert.ToString(landData.ClaimPrice)); |
215 | xtw.WriteElementString("GlobalID", landData.GlobalID.ToString()); | 215 | xtw.WriteElementString("GlobalID", landData.GlobalID.ToString()); |
216 | xtw.WriteElementString("GroupID", landData.GroupID.ToString()); | 216 | |
217 | xtw.WriteElementString("IsGroupOwned", Convert.ToString(landData.IsGroupOwned)); | 217 | UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : landData.GroupID; |
218 | xtw.WriteElementString("GroupID", groupID.ToString()); | ||
219 | |||
220 | bool isGroupOwned = options.ContainsKey("wipe-owners") ? false : landData.IsGroupOwned; | ||
221 | xtw.WriteElementString("IsGroupOwned", Convert.ToString(isGroupOwned)); | ||
222 | |||
218 | xtw.WriteElementString("Bitmap", Convert.ToBase64String(landData.Bitmap)); | 223 | xtw.WriteElementString("Bitmap", Convert.ToBase64String(landData.Bitmap)); |
219 | xtw.WriteElementString("Description", landData.Description); | 224 | xtw.WriteElementString("Description", landData.Description); |
220 | xtw.WriteElementString("Flags", Convert.ToString((uint)landData.Flags)); | 225 | xtw.WriteElementString("Flags", Convert.ToString((uint)landData.Flags)); |
@@ -227,13 +232,8 @@ namespace OpenSim.Framework.Serialization.External | |||
227 | xtw.WriteElementString("MediaURL", landData.MediaURL); | 232 | xtw.WriteElementString("MediaURL", landData.MediaURL); |
228 | xtw.WriteElementString("MusicURL", landData.MusicURL); | 233 | xtw.WriteElementString("MusicURL", landData.MusicURL); |
229 | 234 | ||
230 | UUID ownerIdToWrite; | 235 | UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : landData.OwnerID; |
231 | if (options != null && options.ContainsKey("wipe-owners")) | 236 | xtw.WriteElementString("OwnerID", ownerID.ToString()); |
232 | ownerIdToWrite = UUID.Zero; | ||
233 | else | ||
234 | ownerIdToWrite = landData.OwnerID; | ||
235 | |||
236 | xtw.WriteElementString("OwnerID", ownerIdToWrite.ToString()); | ||
237 | 237 | ||
238 | xtw.WriteStartElement("ParcelAccessList"); | 238 | xtw.WriteStartElement("ParcelAccessList"); |
239 | foreach (LandAccessEntry pal in landData.ParcelAccessList) | 239 | foreach (LandAccessEntry pal in landData.ParcelAccessList) |
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index ea100ee..e81cb78 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | |||
@@ -121,7 +121,8 @@ namespace OpenSim.Framework.Serialization.Tests | |||
121 | TestHelpers.InMethod(); | 121 | TestHelpers.InMethod(); |
122 | // log4net.Config.XmlConfigurator.Configure(); | 122 | // log4net.Config.XmlConfigurator.Configure(); |
123 | 123 | ||
124 | LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, null)); | 124 | Dictionary<string, object> options = new Dictionary<string, object>(); |
125 | LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, options)); | ||
125 | Assert.That(ld, Is.Not.Null, "Deserialize(string) returned null"); | 126 | Assert.That(ld, Is.Not.Null, "Deserialize(string) returned null"); |
126 | // Assert.That(ld.AABBMax, Is.EqualTo(land.AABBMax)); | 127 | // Assert.That(ld.AABBMax, Is.EqualTo(land.AABBMax)); |
127 | // Assert.That(ld.AABBMin, Is.EqualTo(land.AABBMin)); | 128 | // Assert.That(ld.AABBMin, Is.EqualTo(land.AABBMin)); |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs index 252cc2a..f160734 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseStreamHandler.cs | |||
@@ -26,6 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Net; | ||
30 | using OpenSim.Framework.ServiceAuth; | ||
29 | 31 | ||
30 | namespace OpenSim.Framework.Servers.HttpServer | 32 | namespace OpenSim.Framework.Servers.HttpServer |
31 | { | 33 | { |
@@ -37,15 +39,30 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
37 | /// </remarks> | 39 | /// </remarks> |
38 | public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler | 40 | public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler |
39 | { | 41 | { |
40 | protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {} | 42 | protected IServiceAuth m_Auth; |
43 | |||
44 | protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) { } | ||
41 | 45 | ||
42 | protected BaseStreamHandler(string httpMethod, string path, string name, string description) | 46 | protected BaseStreamHandler(string httpMethod, string path, string name, string description) |
43 | : base(httpMethod, path, name, description) {} | 47 | : base(httpMethod, path, name, description) {} |
44 | 48 | ||
49 | protected BaseStreamHandler(string httpMethod, string path, IServiceAuth auth) | ||
50 | : base(httpMethod, path, null, null) | ||
51 | { | ||
52 | m_Auth = auth; | ||
53 | } | ||
54 | |||
45 | public virtual byte[] Handle( | 55 | public virtual byte[] Handle( |
46 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 56 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
47 | { | 57 | { |
48 | RequestsReceived++; | 58 | RequestsReceived++; |
59 | if (m_Auth != null && !m_Auth.Authenticate(httpRequest.Headers, httpResponse.AddHeader)) | ||
60 | { | ||
61 | |||
62 | httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized; | ||
63 | httpResponse.ContentType = "text/plain"; | ||
64 | return new byte[0]; | ||
65 | } | ||
49 | 66 | ||
50 | byte[] result = ProcessRequest(path, request, httpRequest, httpResponse); | 67 | byte[] result = ProcessRequest(path, request, httpRequest, httpResponse); |
51 | 68 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs index ed6a14c..2fe1a7d 100644 --- a/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/JsonRpcRequestManager.cs | |||
@@ -90,14 +90,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
90 | } | 90 | } |
91 | catch (Exception e) | 91 | catch (Exception e) |
92 | { | 92 | { |
93 | m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e); | 93 | m_log.Debug(string.Format("JsonRpc request '{0}' to {1} failed", method, uri), e); |
94 | return false; | 94 | return false; |
95 | } | 95 | } |
96 | 96 | ||
97 | if (!response.ContainsKey("_Result")) | 97 | if (!response.ContainsKey("_Result")) |
98 | { | 98 | { |
99 | m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}", | 99 | m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", |
100 | method, OSDParser.SerializeJsonString(response)); | 100 | method, uri, OSDParser.SerializeJsonString(response)); |
101 | return false; | 101 | return false; |
102 | } | 102 | } |
103 | response = (OSDMap)response["_Result"]; | 103 | response = (OSDMap)response["_Result"]; |
@@ -107,15 +107,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
107 | if (response.ContainsKey("error")) | 107 | if (response.ContainsKey("error")) |
108 | { | 108 | { |
109 | data = response["error"]; | 109 | data = response["error"]; |
110 | m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}", | 110 | m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}", |
111 | method, OSDParser.SerializeJsonString(data)); | 111 | method, uri, OSDParser.SerializeJsonString(data)); |
112 | return false; | 112 | return false; |
113 | } | 113 | } |
114 | 114 | ||
115 | if (!response.ContainsKey("result")) | 115 | if (!response.ContainsKey("result")) |
116 | { | 116 | { |
117 | m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}", | 117 | m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", |
118 | method, OSDParser.SerializeJsonString(response)); | 118 | method, uri, OSDParser.SerializeJsonString(response)); |
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | 121 | ||
@@ -161,14 +161,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
161 | } | 161 | } |
162 | catch (Exception e) | 162 | catch (Exception e) |
163 | { | 163 | { |
164 | m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e); | 164 | m_log.Debug(string.Format("JsonRpc request '{0}' to {1} failed", method, uri), e); |
165 | return false; | 165 | return false; |
166 | } | 166 | } |
167 | 167 | ||
168 | if (!response.ContainsKey("_Result")) | 168 | if (!response.ContainsKey("_Result")) |
169 | { | 169 | { |
170 | m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}", | 170 | m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}", |
171 | method, OSDParser.SerializeJsonString(response)); | 171 | method, uri, OSDParser.SerializeJsonString(response)); |
172 | return false; | 172 | return false; |
173 | } | 173 | } |
174 | response = (OSDMap)response["_Result"]; | 174 | response = (OSDMap)response["_Result"]; |
@@ -176,8 +176,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
176 | if (response.ContainsKey("error")) | 176 | if (response.ContainsKey("error")) |
177 | { | 177 | { |
178 | data = response["error"]; | 178 | data = response["error"]; |
179 | m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}", | 179 | m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}", |
180 | method, OSDParser.SerializeJsonString(data)); | 180 | method, uri, OSDParser.SerializeJsonString(data)); |
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs b/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs new file mode 100644 index 0000000..f33a045 --- /dev/null +++ b/OpenSim/Framework/ServiceAuth/BasicHttpAuthentication.cs | |||
@@ -0,0 +1,79 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections.Specialized; | ||
4 | using System.Reflection; | ||
5 | |||
6 | using Nini.Config; | ||
7 | using log4net; | ||
8 | |||
9 | namespace OpenSim.Framework.ServiceAuth | ||
10 | { | ||
11 | public class BasicHttpAuthentication : IServiceAuth | ||
12 | { | ||
13 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
14 | |||
15 | private string m_Username, m_Password; | ||
16 | private string m_CredentialsB64; | ||
17 | |||
18 | private string remove_me; | ||
19 | |||
20 | public string Credentials | ||
21 | { | ||
22 | get { return m_CredentialsB64; } | ||
23 | } | ||
24 | |||
25 | public BasicHttpAuthentication(IConfigSource config, string section) | ||
26 | { | ||
27 | remove_me = section; | ||
28 | m_Username = Util.GetConfigVarFromSections<string>(config, "HttpAuthUsername", new string[] { "Network", section }, string.Empty); | ||
29 | m_Password = Util.GetConfigVarFromSections<string>(config, "HttpAuthPassword", new string[] { "Network", section }, string.Empty); | ||
30 | string str = m_Username + ":" + m_Password; | ||
31 | byte[] encData_byte = Util.UTF8.GetBytes(str); | ||
32 | |||
33 | m_CredentialsB64 = Convert.ToBase64String(encData_byte); | ||
34 | m_log.DebugFormat("[HTTP BASIC AUTH]: {0} {1} [{2}]", m_Username, m_Password, section); | ||
35 | } | ||
36 | |||
37 | public void AddAuthorization(NameValueCollection headers) | ||
38 | { | ||
39 | //m_log.DebugFormat("[HTTP BASIC AUTH]: Adding authorization for {0}", remove_me); | ||
40 | headers["Authorization"] = "Basic " + m_CredentialsB64; | ||
41 | } | ||
42 | |||
43 | public bool Authenticate(string data) | ||
44 | { | ||
45 | string recovered = Util.Base64ToString(data); | ||
46 | if (!String.IsNullOrEmpty(recovered)) | ||
47 | { | ||
48 | string[] parts = recovered.Split(new char[] { ':' }); | ||
49 | if (parts.Length >= 2) | ||
50 | { | ||
51 | return m_Username.Equals(parts[0]) && m_Password.Equals(parts[1]); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | return false; | ||
56 | } | ||
57 | |||
58 | public bool Authenticate(NameValueCollection requestHeaders, AddHeaderDelegate d) | ||
59 | { | ||
60 | //m_log.DebugFormat("[HTTP BASIC AUTH]: Authenticate in {0}", remove_me); | ||
61 | if (requestHeaders != null) | ||
62 | { | ||
63 | string value = requestHeaders.Get("Authorization"); | ||
64 | if (value != null) | ||
65 | { | ||
66 | value = value.Trim(); | ||
67 | if (value.StartsWith("Basic ")) | ||
68 | { | ||
69 | value = value.Replace("Basic ", string.Empty); | ||
70 | if (Authenticate(value)) | ||
71 | return true; | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | d("WWW-Authenticate", "Basic realm = \"Asset Server\""); | ||
76 | return false; | ||
77 | } | ||
78 | } | ||
79 | } | ||
diff --git a/OpenSim/Framework/ServiceAuth/IServiceAuth.cs b/OpenSim/Framework/ServiceAuth/IServiceAuth.cs new file mode 100644 index 0000000..415dc12 --- /dev/null +++ b/OpenSim/Framework/ServiceAuth/IServiceAuth.cs | |||
@@ -0,0 +1,15 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Collections.Specialized; | ||
4 | |||
5 | namespace OpenSim.Framework.ServiceAuth | ||
6 | { | ||
7 | public delegate void AddHeaderDelegate(string key, string value); | ||
8 | |||
9 | public interface IServiceAuth | ||
10 | { | ||
11 | bool Authenticate(string data); | ||
12 | bool Authenticate(NameValueCollection headers, AddHeaderDelegate d); | ||
13 | void AddAuthorization(NameValueCollection headers); | ||
14 | } | ||
15 | } | ||
diff --git a/OpenSim/Framework/ServiceAuth/ServiceAuth.cs b/OpenSim/Framework/ServiceAuth/ServiceAuth.cs new file mode 100644 index 0000000..bc32d90 --- /dev/null +++ b/OpenSim/Framework/ServiceAuth/ServiceAuth.cs | |||
@@ -0,0 +1,23 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | |||
4 | using Nini.Config; | ||
5 | |||
6 | namespace OpenSim.Framework.ServiceAuth | ||
7 | { | ||
8 | public class ServiceAuth | ||
9 | { | ||
10 | public static IServiceAuth Create(IConfigSource config, string section) | ||
11 | { | ||
12 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None"); | ||
13 | |||
14 | switch (authType) | ||
15 | { | ||
16 | case "BasicHttpAuthentication": | ||
17 | return new BasicHttpAuthentication(config, section); | ||
18 | } | ||
19 | |||
20 | return null; | ||
21 | } | ||
22 | } | ||
23 | } | ||
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 70fab77..e614fd5 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -45,6 +45,8 @@ using Nwc.XmlRpc; | |||
45 | using OpenMetaverse.StructuredData; | 45 | using OpenMetaverse.StructuredData; |
46 | using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; | 46 | using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper; |
47 | 47 | ||
48 | using OpenSim.Framework.ServiceAuth; | ||
49 | |||
48 | namespace OpenSim.Framework | 50 | namespace OpenSim.Framework |
49 | { | 51 | { |
50 | /// <summary> | 52 | /// <summary> |
@@ -773,6 +775,13 @@ namespace OpenSim.Framework | |||
773 | string requestUrl, TRequest obj, Action<TResponse> action, | 775 | string requestUrl, TRequest obj, Action<TResponse> action, |
774 | int maxConnections) | 776 | int maxConnections) |
775 | { | 777 | { |
778 | MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, maxConnections, null); | ||
779 | } | ||
780 | |||
781 | public static void MakeRequest<TRequest, TResponse>(string verb, | ||
782 | string requestUrl, TRequest obj, Action<TResponse> action, | ||
783 | int maxConnections, IServiceAuth auth) | ||
784 | { | ||
776 | int reqnum = WebUtil.RequestNumber++; | 785 | int reqnum = WebUtil.RequestNumber++; |
777 | 786 | ||
778 | if (WebUtil.DebugLevel >= 3) | 787 | if (WebUtil.DebugLevel >= 3) |
@@ -786,6 +795,10 @@ namespace OpenSim.Framework | |||
786 | 795 | ||
787 | WebRequest request = WebRequest.Create(requestUrl); | 796 | WebRequest request = WebRequest.Create(requestUrl); |
788 | HttpWebRequest ht = (HttpWebRequest)request; | 797 | HttpWebRequest ht = (HttpWebRequest)request; |
798 | |||
799 | if (auth != null) | ||
800 | auth.AddAuthorization(ht.Headers); | ||
801 | |||
789 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) | 802 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) |
790 | ht.ServicePoint.ConnectionLimit = maxConnections; | 803 | ht.ServicePoint.ConnectionLimit = maxConnections; |
791 | 804 | ||
@@ -969,7 +982,7 @@ namespace OpenSim.Framework | |||
969 | /// | 982 | /// |
970 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | 983 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting |
971 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | 984 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> |
972 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) | 985 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs, IServiceAuth auth) |
973 | { | 986 | { |
974 | int reqnum = WebUtil.RequestNumber++; | 987 | int reqnum = WebUtil.RequestNumber++; |
975 | 988 | ||
@@ -984,6 +997,10 @@ namespace OpenSim.Framework | |||
984 | request.Method = verb; | 997 | request.Method = verb; |
985 | if (timeoutsecs > 0) | 998 | if (timeoutsecs > 0) |
986 | request.Timeout = timeoutsecs * 1000; | 999 | request.Timeout = timeoutsecs * 1000; |
1000 | |||
1001 | if (auth != null) | ||
1002 | auth.AddAuthorization(request.Headers); | ||
1003 | |||
987 | string respstring = String.Empty; | 1004 | string respstring = String.Empty; |
988 | 1005 | ||
989 | using (MemoryStream buffer = new MemoryStream()) | 1006 | using (MemoryStream buffer = new MemoryStream()) |
@@ -1068,10 +1085,20 @@ namespace OpenSim.Framework | |||
1068 | return respstring; | 1085 | return respstring; |
1069 | } | 1086 | } |
1070 | 1087 | ||
1088 | public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs) | ||
1089 | { | ||
1090 | return MakeRequest(verb, requestUrl, obj, timeoutsecs, null); | ||
1091 | } | ||
1092 | |||
1071 | public static string MakeRequest(string verb, string requestUrl, string obj) | 1093 | public static string MakeRequest(string verb, string requestUrl, string obj) |
1072 | { | 1094 | { |
1073 | return MakeRequest(verb, requestUrl, obj, -1); | 1095 | return MakeRequest(verb, requestUrl, obj, -1); |
1074 | } | 1096 | } |
1097 | |||
1098 | public static string MakeRequest(string verb, string requestUrl, string obj, IServiceAuth auth) | ||
1099 | { | ||
1100 | return MakeRequest(verb, requestUrl, obj, -1, auth); | ||
1101 | } | ||
1075 | } | 1102 | } |
1076 | 1103 | ||
1077 | public class SynchronousRestObjectRequester | 1104 | public class SynchronousRestObjectRequester |
@@ -1085,23 +1112,76 @@ namespace OpenSim.Framework | |||
1085 | /// </summary> | 1112 | /// </summary> |
1086 | /// <param name="verb"></param> | 1113 | /// <param name="verb"></param> |
1087 | /// <param name="requestUrl"></param> | 1114 | /// <param name="requestUrl"></param> |
1088 | /// <param name="obj"> </param> | 1115 | /// <param name="obj"></param> |
1089 | /// <returns></returns> | 1116 | /// <returns> |
1090 | /// | 1117 | /// The response. If there was an internal exception, then the default(TResponse) is returned. |
1091 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | 1118 | /// </returns> |
1092 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
1093 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) | 1119 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) |
1094 | { | 1120 | { |
1095 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0); | 1121 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0); |
1096 | } | 1122 | } |
1097 | 1123 | ||
1124 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, IServiceAuth auth) | ||
1125 | { | ||
1126 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0, auth); | ||
1127 | } | ||
1128 | /// <summary> | ||
1129 | /// Perform a synchronous REST request. | ||
1130 | /// </summary> | ||
1131 | /// <param name="verb"></param> | ||
1132 | /// <param name="requestUrl"></param> | ||
1133 | /// <param name="obj"></param> | ||
1134 | /// <param name="pTimeout"> | ||
1135 | /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) | ||
1136 | /// </param> | ||
1137 | /// <returns> | ||
1138 | /// The response. If there was an internal exception or the request timed out, | ||
1139 | /// then the default(TResponse) is returned. | ||
1140 | /// </returns> | ||
1098 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) | 1141 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) |
1099 | { | 1142 | { |
1100 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0); | 1143 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0); |
1101 | } | 1144 | } |
1102 | 1145 | ||
1146 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, IServiceAuth auth) | ||
1147 | { | ||
1148 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0, auth); | ||
1149 | } | ||
1150 | |||
1151 | /// Perform a synchronous REST request. | ||
1152 | /// </summary> | ||
1153 | /// <param name="verb"></param> | ||
1154 | /// <param name="requestUrl"></param> | ||
1155 | /// <param name="obj"></param> | ||
1156 | /// <param name="pTimeout"> | ||
1157 | /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) | ||
1158 | /// </param> | ||
1159 | /// <param name="maxConnections"></param> | ||
1160 | /// <returns> | ||
1161 | /// The response. If there was an internal exception or the request timed out, | ||
1162 | /// then the default(TResponse) is returned. | ||
1163 | /// </returns> | ||
1103 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) | 1164 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) |
1104 | { | 1165 | { |
1166 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, maxConnections, null); | ||
1167 | } | ||
1168 | |||
1169 | /// <summary> | ||
1170 | /// Perform a synchronous REST request. | ||
1171 | /// </summary> | ||
1172 | /// <param name="verb"></param> | ||
1173 | /// <param name="requestUrl"></param> | ||
1174 | /// <param name="obj"></param> | ||
1175 | /// <param name="pTimeout"> | ||
1176 | /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) | ||
1177 | /// </param> | ||
1178 | /// <param name="maxConnections"></param> | ||
1179 | /// <returns> | ||
1180 | /// The response. If there was an internal exception or the request timed out, | ||
1181 | /// then the default(TResponse) is returned. | ||
1182 | /// </returns> | ||
1183 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections, IServiceAuth auth) | ||
1184 | { | ||
1105 | int reqnum = WebUtil.RequestNumber++; | 1185 | int reqnum = WebUtil.RequestNumber++; |
1106 | 1186 | ||
1107 | if (WebUtil.DebugLevel >= 3) | 1187 | if (WebUtil.DebugLevel >= 3) |
@@ -1116,6 +1196,13 @@ namespace OpenSim.Framework | |||
1116 | 1196 | ||
1117 | WebRequest request = WebRequest.Create(requestUrl); | 1197 | WebRequest request = WebRequest.Create(requestUrl); |
1118 | HttpWebRequest ht = (HttpWebRequest)request; | 1198 | HttpWebRequest ht = (HttpWebRequest)request; |
1199 | |||
1200 | if (auth != null) | ||
1201 | auth.AddAuthorization(ht.Headers); | ||
1202 | |||
1203 | if (pTimeout != 0) | ||
1204 | ht.Timeout = pTimeout; | ||
1205 | |||
1119 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) | 1206 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) |
1120 | ht.ServicePoint.ConnectionLimit = maxConnections; | 1207 | ht.ServicePoint.ConnectionLimit = maxConnections; |
1121 | 1208 | ||
@@ -1191,8 +1278,18 @@ namespace OpenSim.Framework | |||
1191 | { | 1278 | { |
1192 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) | 1279 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) |
1193 | { | 1280 | { |
1194 | if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) | 1281 | if (hwr != null) |
1195 | return deserial; | 1282 | { |
1283 | if (hwr.StatusCode == HttpStatusCode.NotFound) | ||
1284 | return deserial; | ||
1285 | if (hwr.StatusCode == HttpStatusCode.Unauthorized) | ||
1286 | { | ||
1287 | m_log.Error(string.Format( | ||
1288 | "[SynchronousRestObjectRequester]: Web request {0} requires authentication ", | ||
1289 | requestUrl)); | ||
1290 | return deserial; | ||
1291 | } | ||
1292 | } | ||
1196 | else | 1293 | else |
1197 | m_log.Error(string.Format( | 1294 | m_log.Error(string.Format( |
1198 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ", | 1295 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ", |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 54cf285..bb932f2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
63 | private bool m_Enabled = false; | 63 | private bool m_Enabled = false; |
64 | 64 | ||
65 | // TODO: Change this to a config option | 65 | // TODO: Change this to a config option |
66 | const string REDIRECT_URL = null; | 66 | private string m_RedirectURL = null; |
67 | 67 | ||
68 | private string m_URL; | 68 | private string m_URL; |
69 | 69 | ||
@@ -78,7 +78,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
78 | m_URL = config.GetString("Cap_GetTexture", string.Empty); | 78 | m_URL = config.GetString("Cap_GetTexture", string.Empty); |
79 | // Cap doesn't exist | 79 | // Cap doesn't exist |
80 | if (m_URL != string.Empty) | 80 | if (m_URL != string.Empty) |
81 | { | ||
81 | m_Enabled = true; | 82 | m_Enabled = true; |
83 | m_RedirectURL = config.GetString("GetTextureRedirectURL"); | ||
84 | } | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public void AddRegion(Scene s) | 87 | public void AddRegion(Scene s) |
@@ -132,14 +135,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
132 | // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | 135 | // m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); |
133 | caps.RegisterHandler( | 136 | caps.RegisterHandler( |
134 | "GetTexture", | 137 | "GetTexture", |
135 | new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString())); | 138 | new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString(), m_RedirectURL)); |
136 | } | 139 | } |
137 | else | 140 | else |
138 | { | 141 | { |
139 | // m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | 142 | // m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); |
140 | IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); | 143 | IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); |
141 | if (handler != null) | 144 | if (handler != null) |
142 | handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture",m_URL); | 145 | handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture", m_URL); |
143 | else | 146 | else |
144 | caps.RegisterHandler("GetTexture", m_URL); | 147 | caps.RegisterHandler("GetTexture", m_URL); |
145 | } | 148 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs index edc5016..ee1ea1a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs | |||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests | |||
152 | 152 | ||
153 | // A sanity check that the response has the expected number of descendents for a default inventory | 153 | // A sanity check that the response has the expected number of descendents for a default inventory |
154 | // TODO: Need a more thorough check. | 154 | // TODO: Need a more thorough check. |
155 | Assert.That((int)folderOsd["descendents"], Is.EqualTo(14)); | 155 | Assert.That((int)folderOsd["descendents"], Is.EqualTo(16)); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | } \ No newline at end of file | 158 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 53217a0..c28e58d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -8949,7 +8949,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8949 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 8949 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) |
8950 | { | 8950 | { |
8951 | string assetServer = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 8951 | string assetServer = aCircuit.ServiceURLs["AssetServerURI"].ToString(); |
8952 | return ((Scene)Scene).AssetService.Get(assetServer + "/" + id); | 8952 | if (!string.IsNullOrEmpty(assetServer)) |
8953 | return ((Scene)Scene).AssetService.Get(assetServer + "/" + id); | ||
8953 | } | 8954 | } |
8954 | 8955 | ||
8955 | return null; | 8956 | return null; |
@@ -12658,16 +12659,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12658 | 12659 | ||
12659 | if (asset == null) | 12660 | if (asset == null) |
12660 | { | 12661 | { |
12661 | req.AssetInf = null; | 12662 | // Try the user's asset server |
12662 | req.AssetRequestSource = source; | 12663 | IInventoryAccessModule inventoryAccessModule = Scene.RequestModuleInterface<IInventoryAccessModule>(); |
12663 | req.IsTextureRequest = false; | 12664 | |
12664 | req.NumPackets = 0; | 12665 | string assetServerURL = string.Empty; |
12665 | req.Params = transferRequest.TransferInfo.Params; | 12666 | if (inventoryAccessModule.IsForeignUser(AgentId, out assetServerURL) && !string.IsNullOrEmpty(assetServerURL)) |
12666 | req.RequestAssetID = requestID; | 12667 | { |
12667 | req.TransferRequestID = transferRequest.TransferInfo.TransferID; | 12668 | if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("=")) |
12669 | assetServerURL = assetServerURL + "/"; | ||
12670 | |||
12671 | //m_log.DebugFormat("[LLCLIENTVIEW]: asset {0} not found in local storage. Trying user's storage.", assetServerURL + id); | ||
12672 | asset = m_scene.AssetService.Get(assetServerURL + id); | ||
12673 | } | ||
12674 | |||
12675 | if (asset == null) | ||
12676 | { | ||
12677 | req.AssetInf = null; | ||
12678 | req.AssetRequestSource = source; | ||
12679 | req.IsTextureRequest = false; | ||
12680 | req.NumPackets = 0; | ||
12681 | req.Params = transferRequest.TransferInfo.Params; | ||
12682 | req.RequestAssetID = requestID; | ||
12683 | req.TransferRequestID = transferRequest.TransferInfo.TransferID; | ||
12684 | |||
12685 | SendAssetNotFound(req); | ||
12686 | return; | ||
12687 | } | ||
12668 | 12688 | ||
12669 | SendAssetNotFound(req); | ||
12670 | return; | ||
12671 | } | 12689 | } |
12672 | 12690 | ||
12673 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) | 12691 | if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index e9b2f4f..7333769 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -774,15 +774,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
774 | (sbyte)AssetType.Object, | 774 | (sbyte)AssetType.Object, |
775 | Utils.StringToBytes(sceneObjectXml), | 775 | Utils.StringToBytes(sceneObjectXml), |
776 | sp.UUID); | 776 | sp.UUID); |
777 | m_scene.AssetService.Store(asset); | ||
778 | 777 | ||
779 | item.AssetID = asset.FullID; | 778 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
780 | item.Description = asset.Description; | ||
781 | item.Name = asset.Name; | ||
782 | item.AssetType = asset.Type; | ||
783 | item.InvType = (int)InventoryType.Object; | ||
784 | 779 | ||
785 | m_scene.InventoryService.UpdateItem(item); | 780 | invAccess.UpdateInventoryItemAsset(sp.UUID, item, asset); |
786 | 781 | ||
787 | // If the name of the object has been changed whilst attached then we want to update the inventory | 782 | // If the name of the object has been changed whilst attached then we want to update the inventory |
788 | // item in the viewer. | 783 | // item in the viewer. |
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs index af8a0c1..780d17b 100644 --- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs | |||
@@ -37,6 +37,7 @@ using System.Collections.Generic; | |||
37 | using System.Reflection; | 37 | using System.Reflection; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.ServiceAuth; | ||
40 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
@@ -54,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
54 | private string m_URL = String.Empty; | 55 | private string m_URL = String.Empty; |
55 | private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase)); | 56 | private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase)); |
56 | 57 | ||
57 | 58 | private static IServiceAuth m_Auth; | |
58 | 59 | ||
59 | public void Initialise(IConfigSource configSource) | 60 | public void Initialise(IConfigSource configSource) |
60 | { | 61 | { |
@@ -63,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
63 | return; | 64 | return; |
64 | 65 | ||
65 | m_URL = config.GetString("URL", String.Empty); | 66 | m_URL = config.GetString("URL", String.Empty); |
67 | m_Auth = ServiceAuth.Create(configSource, "XBakes"); | ||
66 | } | 68 | } |
67 | 69 | ||
68 | public void AddRegion(Scene scene) | 70 | public void AddRegion(Scene scene) |
@@ -110,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
110 | 112 | ||
111 | try | 113 | try |
112 | { | 114 | { |
113 | Stream s = rc.Request(); | 115 | Stream s = rc.Request(m_Auth); |
114 | XmlTextReader sr = new XmlTextReader(s); | 116 | XmlTextReader sr = new XmlTextReader(s); |
115 | 117 | ||
116 | sr.ReadStartElement("BakedAppearance"); | 118 | sr.ReadStartElement("BakedAppearance"); |
@@ -183,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures | |||
183 | Util.FireAndForget( | 185 | Util.FireAndForget( |
184 | delegate | 186 | delegate |
185 | { | 187 | { |
186 | rc.Request(reqStream); | 188 | rc.Request(reqStream, m_Auth); |
187 | } | 189 | } |
188 | ); | 190 | ); |
189 | } | 191 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs new file mode 100644 index 0000000..7b8c418 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs | |||
@@ -0,0 +1,286 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using log4net.Config; | ||
31 | using Nini.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Region.CoreModules.Avatar.Chat; | ||
38 | using OpenSim.Region.CoreModules.Framework; | ||
39 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
40 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Services.Interfaces; | ||
43 | using OpenSim.Tests.Common; | ||
44 | using OpenSim.Tests.Common.Mock; | ||
45 | |||
46 | namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests | ||
47 | { | ||
48 | [TestFixture] | ||
49 | public class ChatModuleTests : OpenSimTestCase | ||
50 | { | ||
51 | [TestFixtureSetUp] | ||
52 | public void FixtureInit() | ||
53 | { | ||
54 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
55 | // We must do this here so that child agent positions are updated in a predictable manner. | ||
56 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
57 | } | ||
58 | |||
59 | [TestFixtureTearDown] | ||
60 | public void TearDown() | ||
61 | { | ||
62 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
63 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
64 | // tests really shouldn't). | ||
65 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
66 | } | ||
67 | |||
68 | private void SetupNeighbourRegions(TestScene sceneA, TestScene sceneB) | ||
69 | { | ||
70 | // XXX: HTTP server is not (and should not be) necessary for this test, though it's absence makes the | ||
71 | // CapabilitiesModule complain when it can't set up HTTP endpoints. | ||
72 | // BaseHttpServer httpServer = new BaseHttpServer(99999); | ||
73 | // MainServer.AddHttpServer(httpServer); | ||
74 | // MainServer.Instance = httpServer; | ||
75 | |||
76 | // We need entity transfer modules so that when sp2 logs into the east region, the region calls | ||
77 | // EntityTransferModuleto set up a child agent on the west region. | ||
78 | // XXX: However, this is not an entity transfer so is misleading. | ||
79 | EntityTransferModule etmA = new EntityTransferModule(); | ||
80 | EntityTransferModule etmB = new EntityTransferModule(); | ||
81 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
82 | |||
83 | IConfigSource config = new IniConfigSource(); | ||
84 | config.AddConfig("Chat"); | ||
85 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
86 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
87 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
88 | |||
89 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
90 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, new ChatModule()); | ||
91 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB, new ChatModule()); | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// Tests chat between neighbour regions on the east-west axis | ||
96 | /// </summary> | ||
97 | /// <remarks> | ||
98 | /// Really, this is a combination of a child agent position update test and a chat range test. These need | ||
99 | /// to be separated later on. | ||
100 | /// </remarks> | ||
101 | [Test] | ||
102 | public void TestInterRegionChatDistanceEastWest() | ||
103 | { | ||
104 | TestHelpers.InMethod(); | ||
105 | // TestHelpers.EnableLogging(); | ||
106 | |||
107 | UUID sp1Uuid = TestHelpers.ParseTail(0x11); | ||
108 | UUID sp2Uuid = TestHelpers.ParseTail(0x12); | ||
109 | |||
110 | Vector3 sp1Position = new Vector3(6, 128, 20); | ||
111 | Vector3 sp2Position = new Vector3(250, 128, 20); | ||
112 | |||
113 | SceneHelpers sh = new SceneHelpers(); | ||
114 | TestScene sceneWest = sh.SetupScene("sceneWest", TestHelpers.ParseTail(0x1), 1000, 1000); | ||
115 | TestScene sceneEast = sh.SetupScene("sceneEast", TestHelpers.ParseTail(0x2), 1001, 1000); | ||
116 | |||
117 | SetupNeighbourRegions(sceneWest, sceneEast); | ||
118 | |||
119 | ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneEast, sp1Uuid); | ||
120 | TestClient sp1Client = (TestClient)sp1.ControllingClient; | ||
121 | |||
122 | // If we don't set agents to flying, test will go wrong as they instantly fall to z = 0. | ||
123 | // TODO: May need to create special complete no-op test physics module rather than basic physics, since | ||
124 | // physics is irrelevant to this test. | ||
125 | sp1.Flying = true; | ||
126 | |||
127 | // When sp1 logs in to sceneEast, it sets up a child agent in sceneWest and informs the sp2 client to | ||
128 | // make the connection. For this test, will simplify this chain by making the connection directly. | ||
129 | ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneWest, sp1Uuid); | ||
130 | TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient; | ||
131 | |||
132 | sp1.AbsolutePosition = sp1Position; | ||
133 | |||
134 | ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneWest, sp2Uuid); | ||
135 | TestClient sp2Client = (TestClient)sp2.ControllingClient; | ||
136 | sp2.Flying = true; | ||
137 | |||
138 | ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneEast, sp2Uuid); | ||
139 | TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient; | ||
140 | |||
141 | sp2.AbsolutePosition = sp2Position; | ||
142 | |||
143 | // We must update the scenes in order to make the root new root agents trigger position updates in their | ||
144 | // children. | ||
145 | sceneWest.Update(1); | ||
146 | sceneEast.Update(1); | ||
147 | |||
148 | // Check child positions are correct. | ||
149 | Assert.AreEqual( | ||
150 | new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z), | ||
151 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
152 | |||
153 | Assert.AreEqual( | ||
154 | new Vector3(sp2Position.X - sceneWest.RegionInfo.RegionSizeX, sp2Position.Y, sp2Position.Z), | ||
155 | sp2ChildClient.SceneAgent.AbsolutePosition); | ||
156 | |||
157 | string receivedSp1ChatMessage = ""; | ||
158 | string receivedSp2ChatMessage = ""; | ||
159 | |||
160 | sp1ChildClient.OnReceivedChatMessage | ||
161 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message; | ||
162 | sp2ChildClient.OnReceivedChatMessage | ||
163 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message; | ||
164 | |||
165 | TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage); | ||
166 | TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage); | ||
167 | |||
168 | sp1Position = new Vector3(30, 128, 20); | ||
169 | sp1.AbsolutePosition = sp1Position; | ||
170 | sceneEast.Update(1); | ||
171 | |||
172 | // Check child position is correct. | ||
173 | Assert.AreEqual( | ||
174 | new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z), | ||
175 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
176 | |||
177 | TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage); | ||
178 | TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage); | ||
179 | } | ||
180 | |||
181 | /// <summary> | ||
182 | /// Tests chat between neighbour regions on the north-south axis | ||
183 | /// </summary> | ||
184 | /// <remarks> | ||
185 | /// Really, this is a combination of a child agent position update test and a chat range test. These need | ||
186 | /// to be separated later on. | ||
187 | /// </remarks> | ||
188 | [Test] | ||
189 | public void TestInterRegionChatDistanceNorthSouth() | ||
190 | { | ||
191 | TestHelpers.InMethod(); | ||
192 | // TestHelpers.EnableLogging(); | ||
193 | |||
194 | UUID sp1Uuid = TestHelpers.ParseTail(0x11); | ||
195 | UUID sp2Uuid = TestHelpers.ParseTail(0x12); | ||
196 | |||
197 | Vector3 sp1Position = new Vector3(128, 250, 20); | ||
198 | Vector3 sp2Position = new Vector3(128, 6, 20); | ||
199 | |||
200 | SceneHelpers sh = new SceneHelpers(); | ||
201 | TestScene sceneNorth = sh.SetupScene("sceneNorth", TestHelpers.ParseTail(0x1), 1000, 1000); | ||
202 | TestScene sceneSouth = sh.SetupScene("sceneSouth", TestHelpers.ParseTail(0x2), 1000, 1001); | ||
203 | |||
204 | SetupNeighbourRegions(sceneNorth, sceneSouth); | ||
205 | |||
206 | ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneNorth, sp1Uuid); | ||
207 | TestClient sp1Client = (TestClient)sp1.ControllingClient; | ||
208 | |||
209 | // If we don't set agents to flying, test will go wrong as they instantly fall to z = 0. | ||
210 | // TODO: May need to create special complete no-op test physics module rather than basic physics, since | ||
211 | // physics is irrelevant to this test. | ||
212 | sp1.Flying = true; | ||
213 | |||
214 | // When sp1 logs in to sceneEast, it sets up a child agent in sceneNorth and informs the sp2 client to | ||
215 | // make the connection. For this test, will simplify this chain by making the connection directly. | ||
216 | ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneSouth, sp1Uuid); | ||
217 | TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient; | ||
218 | |||
219 | sp1.AbsolutePosition = sp1Position; | ||
220 | |||
221 | ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneSouth, sp2Uuid); | ||
222 | TestClient sp2Client = (TestClient)sp2.ControllingClient; | ||
223 | sp2.Flying = true; | ||
224 | |||
225 | ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneNorth, sp2Uuid); | ||
226 | TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient; | ||
227 | |||
228 | sp2.AbsolutePosition = sp2Position; | ||
229 | |||
230 | // We must update the scenes in order to make the root new root agents trigger position updates in their | ||
231 | // children. | ||
232 | sceneNorth.Update(1); | ||
233 | sceneSouth.Update(1); | ||
234 | |||
235 | // Check child positions are correct. | ||
236 | Assert.AreEqual( | ||
237 | new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z), | ||
238 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
239 | |||
240 | Assert.AreEqual( | ||
241 | new Vector3(sp2Position.X, sp2Position.Y + sceneSouth.RegionInfo.RegionSizeY, sp2Position.Z), | ||
242 | sp2ChildClient.SceneAgent.AbsolutePosition); | ||
243 | |||
244 | string receivedSp1ChatMessage = ""; | ||
245 | string receivedSp2ChatMessage = ""; | ||
246 | |||
247 | sp1ChildClient.OnReceivedChatMessage | ||
248 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message; | ||
249 | sp2ChildClient.OnReceivedChatMessage | ||
250 | += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message; | ||
251 | |||
252 | TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage); | ||
253 | TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage); | ||
254 | |||
255 | sp1Position = new Vector3(30, 128, 20); | ||
256 | sp1.AbsolutePosition = sp1Position; | ||
257 | sceneNorth.Update(1); | ||
258 | |||
259 | // Check child position is correct. | ||
260 | Assert.AreEqual( | ||
261 | new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z), | ||
262 | sp1ChildClient.SceneAgent.AbsolutePosition); | ||
263 | |||
264 | TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage); | ||
265 | TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage); | ||
266 | } | ||
267 | |||
268 | private void TestUserInRange(TestClient speakClient, string testMessage, ref string receivedMessage) | ||
269 | { | ||
270 | receivedMessage = ""; | ||
271 | |||
272 | speakClient.Chat(0, ChatTypeEnum.Say, testMessage); | ||
273 | |||
274 | Assert.AreEqual(testMessage, receivedMessage); | ||
275 | } | ||
276 | |||
277 | private void TestUserOutOfRange(TestClient speakClient, string testMessage, ref string receivedMessage) | ||
278 | { | ||
279 | receivedMessage = ""; | ||
280 | |||
281 | speakClient.Chat(0, ChatTypeEnum.Say, testMessage); | ||
282 | |||
283 | Assert.AreNotEqual(testMessage, receivedMessage); | ||
284 | } | ||
285 | } | ||
286 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index c51b30f..6f3c80a 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
210 | success = m_IMService.OutgoingInstantMessage(im, url, foreigner); | 210 | success = m_IMService.OutgoingInstantMessage(im, url, foreigner); |
211 | 211 | ||
212 | if (!success && !foreigner) | 212 | if (!success && !foreigner) |
213 | HandleUndeliveredMessage(im, result); | 213 | HandleUndeliverableMessage(im, result); |
214 | else | 214 | else |
215 | result(success); | 215 | result(success); |
216 | }); | 216 | }); |
@@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
246 | return successful; | 246 | return successful; |
247 | } | 247 | } |
248 | 248 | ||
249 | protected void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) | 249 | public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) |
250 | { | 250 | { |
251 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; | 251 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; |
252 | 252 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 40a400f..2462ff8 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
181 | SendGridInstantMessageViaXMLRPC(im, result); | 181 | SendGridInstantMessageViaXMLRPC(im, result); |
182 | } | 182 | } |
183 | 183 | ||
184 | private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) | 184 | public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) |
185 | { | 185 | { |
186 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; | 186 | UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; |
187 | 187 | ||
@@ -428,7 +428,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
428 | /// <summary> | 428 | /// <summary> |
429 | /// delegate for sending a grid instant message asynchronously | 429 | /// delegate for sending a grid instant message asynchronously |
430 | /// </summary> | 430 | /// </summary> |
431 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); | 431 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); |
432 | 432 | ||
433 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) | 433 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) |
434 | { | 434 | { |
@@ -442,138 +442,87 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
442 | { | 442 | { |
443 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; | 443 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; |
444 | 444 | ||
445 | d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); | 445 | d.BeginInvoke(im, result, GridInstantMessageCompleted, d); |
446 | } | 446 | } |
447 | 447 | ||
448 | /// <summary> | 448 | /// <summary> |
449 | /// Recursive SendGridInstantMessage over XMLRPC method. | 449 | /// Internal SendGridInstantMessage over XMLRPC method. |
450 | /// This is called from within a dedicated thread. | ||
451 | /// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from | ||
452 | /// itself, prevRegionHandle will be the last region handle that we tried to send. | ||
453 | /// If the handles are the same, we look up the user's location using the grid. | ||
454 | /// If the handles are still the same, we end. The send failed. | ||
455 | /// </summary> | 450 | /// </summary> |
456 | /// <param name="prevRegionHandle"> | 451 | /// <remarks> |
457 | /// Pass in 0 the first time this method is called. It will be called recursively with the last | 452 | /// This is called from within a dedicated thread. |
458 | /// regionhandle tried | 453 | /// </remarks> |
459 | /// </param> | 454 | private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result) |
460 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | ||
461 | { | 455 | { |
462 | UUID toAgentID = new UUID(im.toAgentID); | 456 | UUID toAgentID = new UUID(im.toAgentID); |
463 | 457 | UUID regionID; | |
464 | PresenceInfo upd = null; | 458 | bool needToLookupAgent; |
465 | |||
466 | bool lookupAgent = false; | ||
467 | 459 | ||
468 | lock (m_UserRegionMap) | 460 | lock (m_UserRegionMap) |
461 | needToLookupAgent = !m_UserRegionMap.TryGetValue(toAgentID, out regionID); | ||
462 | |||
463 | while (true) | ||
469 | { | 464 | { |
470 | if (m_UserRegionMap.ContainsKey(toAgentID)) | 465 | if (needToLookupAgent) |
471 | { | 466 | { |
472 | upd = new PresenceInfo(); | 467 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); |
473 | upd.RegionID = m_UserRegionMap[toAgentID]; | ||
474 | 468 | ||
475 | // We need to compare the current regionhandle with the previous region handle | 469 | UUID foundRegionID = UUID.Zero; |
476 | // or the recursive loop will never end because it will never try to lookup the agent again | ||
477 | if (prevRegionID == upd.RegionID) | ||
478 | { | ||
479 | lookupAgent = true; | ||
480 | } | ||
481 | } | ||
482 | else | ||
483 | { | ||
484 | lookupAgent = true; | ||
485 | } | ||
486 | } | ||
487 | |||
488 | 470 | ||
489 | // Are we needing to look-up an agent? | 471 | if (presences != null) |
490 | if (lookupAgent) | ||
491 | { | ||
492 | // Non-cached user agent lookup. | ||
493 | PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); | ||
494 | if (presences != null && presences.Length > 0) | ||
495 | { | ||
496 | foreach (PresenceInfo p in presences) | ||
497 | { | 472 | { |
498 | if (p.RegionID != UUID.Zero) | 473 | foreach (PresenceInfo p in presences) |
499 | { | 474 | { |
500 | upd = p; | 475 | if (p.RegionID != UUID.Zero) |
501 | break; | 476 | { |
477 | foundRegionID = p.RegionID; | ||
478 | break; | ||
479 | } | ||
502 | } | 480 | } |
503 | } | 481 | } |
504 | } | ||
505 | 482 | ||
506 | if (upd != null) | 483 | // If not found or the found region is the same as the last lookup, then message is undeliverable |
507 | { | 484 | if (foundRegionID == UUID.Zero || foundRegionID == regionID) |
508 | // check if we've tried this before.. | 485 | break; |
509 | // This is one way to end the recursive loop | 486 | else |
510 | // | 487 | regionID = foundRegionID; |
511 | if (upd.RegionID == prevRegionID) | ||
512 | { | ||
513 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | ||
514 | HandleUndeliveredMessage(im, result); | ||
515 | return; | ||
516 | } | ||
517 | } | 488 | } |
518 | else | 489 | |
490 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, regionID); | ||
491 | if (reginfo == null) | ||
519 | { | 492 | { |
520 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | 493 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", regionID); |
521 | HandleUndeliveredMessage(im, result); | 494 | break; |
522 | return; | ||
523 | } | 495 | } |
524 | } | ||
525 | 496 | ||
526 | if (upd != null) | 497 | // Try to send the message to the agent via the retrieved region. |
527 | { | 498 | Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); |
528 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, | 499 | msgdata["region_handle"] = 0; |
529 | upd.RegionID); | 500 | bool imresult = doIMSending(reginfo, msgdata); |
530 | if (reginfo != null) | 501 | |
502 | // If the message delivery was successful, then cache the entry. | ||
503 | if (imresult) | ||
531 | { | 504 | { |
532 | Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); | 505 | lock (m_UserRegionMap) |
533 | // Not actually used anymore, left in for compatibility | ||
534 | // Remove at next interface change | ||
535 | // | ||
536 | msgdata["region_handle"] = 0; | ||
537 | bool imresult = doIMSending(reginfo, msgdata); | ||
538 | if (imresult) | ||
539 | { | ||
540 | // IM delivery successful, so store the Agent's location in our local cache. | ||
541 | lock (m_UserRegionMap) | ||
542 | { | ||
543 | if (m_UserRegionMap.ContainsKey(toAgentID)) | ||
544 | { | ||
545 | m_UserRegionMap[toAgentID] = upd.RegionID; | ||
546 | } | ||
547 | else | ||
548 | { | ||
549 | m_UserRegionMap.Add(toAgentID, upd.RegionID); | ||
550 | } | ||
551 | } | ||
552 | result(true); | ||
553 | } | ||
554 | else | ||
555 | { | 506 | { |
556 | // try again, but lookup user this time. | 507 | m_UserRegionMap[toAgentID] = regionID; |
557 | // Warning, this must call the Async version | ||
558 | // of this method or we'll be making thousands of threads | ||
559 | // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync | ||
560 | // The version that spawns the thread is SendGridInstantMessageViaXMLRPC | ||
561 | |||
562 | // This is recursive!!!!! | ||
563 | SendGridInstantMessageViaXMLRPCAsync(im, result, | ||
564 | upd.RegionID); | ||
565 | } | 508 | } |
509 | result(true); | ||
510 | return; | ||
566 | } | 511 | } |
567 | else | 512 | |
568 | { | 513 | // If we reach this point in the first iteration of the while, then we may have unsuccessfully tried |
569 | m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); | 514 | // to use a locally cached region ID. All subsequent attempts need to lookup agent details from |
570 | HandleUndeliveredMessage(im, result); | 515 | // the presence service. |
571 | } | 516 | needToLookupAgent = true; |
572 | } | ||
573 | else | ||
574 | { | ||
575 | HandleUndeliveredMessage(im, result); | ||
576 | } | 517 | } |
518 | |||
519 | // If we reached this point then the message was not deliverable. Remove the bad cache entry and | ||
520 | // signal the delivery failure. | ||
521 | lock (m_UserRegionMap) | ||
522 | m_UserRegionMap.Remove(toAgentID); | ||
523 | |||
524 | // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); | ||
525 | HandleUndeliverableMessage(im, result); | ||
577 | } | 526 | } |
578 | 527 | ||
579 | /// <summary> | 528 | /// <summary> |
@@ -584,7 +533,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
584 | /// <returns>Bool if the message was successfully delivered at the other side.</returns> | 533 | /// <returns>Bool if the message was successfully delivered at the other side.</returns> |
585 | protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata) | 534 | protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata) |
586 | { | 535 | { |
587 | |||
588 | ArrayList SendParams = new ArrayList(); | 536 | ArrayList SendParams = new ArrayList(); |
589 | SendParams.Add(xmlrpcdata); | 537 | SendParams.Add(xmlrpcdata); |
590 | XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams); | 538 | XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 7f3d0a2..c75920d 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -226,12 +226,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | Scene scene = FindScene(new UUID(im.fromAgentID)); | ||
230 | if (scene == null) | ||
231 | scene = m_SceneList[0]; | ||
232 | |||
233 | bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( | 229 | bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( |
234 | "POST", m_RestURL+"/SaveMessage/", im); | 230 | "POST", m_RestURL+"/SaveMessage/", im, 10000); |
235 | 231 | ||
236 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 232 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
237 | { | 233 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 1ee2a7b..c4b5aac 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -484,6 +484,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
484 | { | 484 | { |
485 | remoteClient.SendAgentAlertMessage( | 485 | remoteClient.SendAgentAlertMessage( |
486 | "Error updating classified", false); | 486 | "Error updating classified", false); |
487 | return; | ||
487 | } | 488 | } |
488 | } | 489 | } |
489 | 490 | ||
@@ -510,6 +511,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
510 | { | 511 | { |
511 | remoteClient.SendAgentAlertMessage( | 512 | remoteClient.SendAgentAlertMessage( |
512 | "Error classified delete", false); | 513 | "Error classified delete", false); |
514 | return; | ||
513 | } | 515 | } |
514 | 516 | ||
515 | parameters = (OSDMap)Params; | 517 | parameters = (OSDMap)Params; |
@@ -612,6 +614,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
612 | { | 614 | { |
613 | remoteClient.SendAgentAlertMessage( | 615 | remoteClient.SendAgentAlertMessage( |
614 | "Error selecting pick", false); | 616 | "Error selecting pick", false); |
617 | return; | ||
615 | } | 618 | } |
616 | pick = (UserProfilePick) Pick; | 619 | pick = (UserProfilePick) Pick; |
617 | 620 | ||
@@ -714,6 +717,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
714 | { | 717 | { |
715 | remoteClient.SendAgentAlertMessage( | 718 | remoteClient.SendAgentAlertMessage( |
716 | "Error updating pick", false); | 719 | "Error updating pick", false); |
720 | return; | ||
717 | } | 721 | } |
718 | 722 | ||
719 | m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); | 723 | m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); |
@@ -740,6 +744,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
740 | { | 744 | { |
741 | remoteClient.SendAgentAlertMessage( | 745 | remoteClient.SendAgentAlertMessage( |
742 | "Error picks delete", false); | 746 | "Error picks delete", false); |
747 | return; | ||
743 | } | 748 | } |
744 | } | 749 | } |
745 | #endregion Picks | 750 | #endregion Picks |
@@ -807,6 +812,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
807 | object Note = note; | 812 | object Note = note; |
808 | if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) | 813 | if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) |
809 | { | 814 | { |
815 | remoteClient.SendAgentAlertMessage( | ||
816 | "Error updating note", false); | ||
810 | return; | 817 | return; |
811 | } | 818 | } |
812 | } | 819 | } |
@@ -916,6 +923,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
916 | { | 923 | { |
917 | remoteClient.SendAgentAlertMessage( | 924 | remoteClient.SendAgentAlertMessage( |
918 | "Error updating interests", false); | 925 | "Error updating interests", false); |
926 | return; | ||
919 | } | 927 | } |
920 | } | 928 | } |
921 | 929 | ||
@@ -1044,6 +1052,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
1044 | { | 1052 | { |
1045 | remoteClient.SendAgentAlertMessage( | 1053 | remoteClient.SendAgentAlertMessage( |
1046 | "Error updating properties", false); | 1054 | "Error updating properties", false); |
1055 | return; | ||
1047 | } | 1056 | } |
1048 | 1057 | ||
1049 | RequestAvatarProperties(remoteClient, newProfile.ID); | 1058 | RequestAvatarProperties(remoteClient, newProfile.ID); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 539367d..e583590 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -761,12 +761,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
761 | string reason; | 761 | string reason; |
762 | string version; | 762 | string version; |
763 | if (!Scene.SimulationService.QueryAccess( | 763 | if (!Scene.SimulationService.QueryAccess( |
764 | finalDestination, sp.ControllingClient.AgentId, homeURI, position, out version, out reason)) | 764 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, out version, out reason)) |
765 | { | 765 | { |
766 | sp.ControllingClient.SendTeleportFailed(reason); | 766 | sp.ControllingClient.SendTeleportFailed(reason); |
767 | 767 | ||
768 | m_log.DebugFormat( | 768 | m_log.DebugFormat( |
769 | "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", | 769 | "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because: {3}", |
770 | sp.Name, sp.Scene.Name, finalDestination.RegionName, reason); | 770 | sp.Name, sp.Scene.Name, finalDestination.RegionName, reason); |
771 | 771 | ||
772 | return; | 772 | return; |
@@ -1510,7 +1510,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1510 | 1510 | ||
1511 | // Check to see if we have access to the target region. | 1511 | // Check to see if we have access to the target region. |
1512 | if (neighbourRegion != null | 1512 | if (neighbourRegion != null |
1513 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, newpos, out version, out failureReason)) | 1513 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, out version, out failureReason)) |
1514 | { | 1514 | { |
1515 | // remember banned | 1515 | // remember banned |
1516 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1516 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index ce7ed26..5e831cc 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -64,6 +64,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
64 | 64 | ||
65 | private bool m_bypassPermissions = true; | 65 | private bool m_bypassPermissions = true; |
66 | 66 | ||
67 | // This simple check makes it possible to support grids in which all the simulators | ||
68 | // share all central services of the Robust server EXCEPT assets. In other words, | ||
69 | // grids where the simulators' assets are kept in one DB and the users' inventory assets | ||
70 | // are kept on another. When users rez items from inventory or take objects from world, | ||
71 | // an HG-like asset copy takes place between the 2 servers, the world asset server and | ||
72 | // the user's asset server. | ||
73 | private bool m_CheckSeparateAssets = false; | ||
74 | private string m_LocalAssetsURL = string.Empty; | ||
75 | |||
67 | // private bool m_Initialized = false; | 76 | // private bool m_Initialized = false; |
68 | 77 | ||
69 | #region INonSharedRegionModule | 78 | #region INonSharedRegionModule |
@@ -99,6 +108,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
99 | 108 | ||
100 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); | 109 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); |
101 | m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true); | 110 | m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true); |
111 | m_CheckSeparateAssets = thisModuleConfig.GetBoolean("CheckSeparateAssets", false); | ||
112 | m_LocalAssetsURL = thisModuleConfig.GetString("RegionHGAssetServerURI", string.Empty); | ||
113 | m_LocalAssetsURL = m_LocalAssetsURL.Trim(new char[] { '/' }); | ||
114 | |||
102 | } | 115 | } |
103 | else | 116 | else |
104 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | 117 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); |
@@ -240,6 +253,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
240 | return newAssetID; | 253 | return newAssetID; |
241 | } | 254 | } |
242 | 255 | ||
256 | /// | ||
257 | /// UpdateInventoryItemAsset | ||
258 | /// | ||
259 | public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) | ||
260 | { | ||
261 | if (base.UpdateInventoryItemAsset(ownerID, item, asset)) | ||
262 | { | ||
263 | UploadInventoryItem(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0); | ||
264 | return true; | ||
265 | } | ||
266 | |||
267 | return false; | ||
268 | } | ||
269 | |||
243 | /// | 270 | /// |
244 | /// Used in DeleteToInventory | 271 | /// Used in DeleteToInventory |
245 | /// | 272 | /// |
@@ -284,50 +311,98 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
284 | SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, | 311 | SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, |
285 | RezSelected, RemoveItem, fromTaskID, attachment); | 312 | RezSelected, RemoveItem, fromTaskID, attachment); |
286 | 313 | ||
287 | if (sog == null) | ||
288 | remoteClient.SendAgentAlertMessage("Unable to rez: problem accessing inventory or locating assets", false); | ||
289 | |||
290 | return sog; | 314 | return sog; |
291 | 315 | ||
292 | } | 316 | } |
293 | 317 | ||
294 | public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | 318 | public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) |
295 | { | 319 | { |
296 | string userAssetServer = string.Empty; | 320 | string senderAssetServer = string.Empty; |
297 | if (IsForeignUser(sender, out userAssetServer) && userAssetServer != string.Empty) | 321 | string receiverAssetServer = string.Empty; |
298 | m_assMapper.Get(item.AssetID, sender, userAssetServer); | 322 | bool isForeignSender, isForeignReceiver; |
323 | isForeignSender = IsForeignUser(sender, out senderAssetServer); | ||
324 | isForeignReceiver = IsForeignUser(receiver, out receiverAssetServer); | ||
325 | |||
326 | // They're both local. Nothing to do. | ||
327 | if (!isForeignSender && !isForeignReceiver) | ||
328 | return; | ||
299 | 329 | ||
300 | if (IsForeignUser(receiver, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) | 330 | // At least one of them is foreign. |
301 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); | 331 | // If both users have the same asset server, no need to transfer the asset |
332 | if (senderAssetServer.Equals(receiverAssetServer)) | ||
333 | { | ||
334 | m_log.DebugFormat("[HGScene]: Asset transfer between foreign users, but they have the same server. No transfer."); | ||
335 | return; | ||
336 | } | ||
337 | |||
338 | if (isForeignSender && senderAssetServer != string.Empty) | ||
339 | m_assMapper.Get(item.AssetID, sender, senderAssetServer); | ||
340 | |||
341 | if (isForeignReceiver && receiverAssetServer != string.Empty && m_OutboundPermission) | ||
342 | m_assMapper.Post(item.AssetID, receiver, receiverAssetServer); | ||
302 | } | 343 | } |
303 | 344 | ||
304 | public override bool IsForeignUser(UUID userID, out string assetServerURL) | 345 | public override bool IsForeignUser(UUID userID, out string assetServerURL) |
305 | { | 346 | { |
306 | assetServerURL = string.Empty; | 347 | assetServerURL = string.Empty; |
307 | 348 | ||
308 | if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID)) | 349 | if (UserManagementModule != null) |
309 | { // foreign | 350 | { |
310 | ScenePresence sp = null; | 351 | if (!m_CheckSeparateAssets) |
311 | if (m_Scene.TryGetScenePresence(userID, out sp)) | ||
312 | { | 352 | { |
313 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 353 | if (!UserManagementModule.IsLocalGridUser(userID)) |
314 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 354 | { // foreign |
315 | { | 355 | ScenePresence sp = null; |
316 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 356 | if (m_Scene.TryGetScenePresence(userID, out sp)) |
317 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | 357 | { |
358 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
359 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | ||
360 | { | ||
361 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | ||
362 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | ||
363 | } | ||
364 | } | ||
365 | else | ||
366 | { | ||
367 | assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); | ||
368 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | ||
369 | } | ||
370 | return true; | ||
318 | } | 371 | } |
319 | } | 372 | } |
320 | else | 373 | else |
321 | { | 374 | { |
322 | assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); | 375 | if (IsLocalInventoryAssetsUser(userID, out assetServerURL)) |
323 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | 376 | { |
377 | m_log.DebugFormat("[HGScene]: user {0} has local assets {1}", userID, assetServerURL); | ||
378 | return false; | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | m_log.DebugFormat("[HGScene]: user {0} has foreign assets {1}", userID, assetServerURL); | ||
383 | return true; | ||
384 | } | ||
324 | } | 385 | } |
325 | return true; | ||
326 | } | 386 | } |
327 | |||
328 | return false; | 387 | return false; |
329 | } | 388 | } |
330 | 389 | ||
390 | private bool IsLocalInventoryAssetsUser(UUID uuid, out string assetsURL) | ||
391 | { | ||
392 | assetsURL = UserManagementModule.GetUserServerURL(uuid, "AssetServerURI"); | ||
393 | if (assetsURL == string.Empty) | ||
394 | { | ||
395 | AgentCircuitData agent = m_Scene.AuthenticateHandler.GetAgentCircuitData(uuid); | ||
396 | if (agent != null) | ||
397 | { | ||
398 | assetsURL = agent.ServiceURLs["AssetServerURI"].ToString(); | ||
399 | assetsURL = assetsURL.Trim(new char[] { '/' }); | ||
400 | } | ||
401 | } | ||
402 | return m_LocalAssetsURL.Equals(assetsURL); | ||
403 | } | ||
404 | |||
405 | |||
331 | protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) | 406 | protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) |
332 | { | 407 | { |
333 | InventoryItemBase item = base.GetItem(agentID, itemID); | 408 | InventoryItemBase item = base.GetItem(agentID, itemID); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d30ce72..b4771fd 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -203,7 +203,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
203 | m_Scene.AssetService.Store(asset); | 203 | m_Scene.AssetService.Store(asset); |
204 | m_Scene.CreateNewInventoryItem( | 204 | m_Scene.CreateNewInventoryItem( |
205 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 205 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
206 | name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | 206 | name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate); |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
@@ -292,7 +292,31 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
292 | 292 | ||
293 | return UUID.Zero; | 293 | return UUID.Zero; |
294 | } | 294 | } |
295 | 295 | ||
296 | public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) | ||
297 | { | ||
298 | if (item != null && item.Owner == ownerID && asset != null) | ||
299 | { | ||
300 | item.AssetID = asset.FullID; | ||
301 | item.Description = asset.Description; | ||
302 | item.Name = asset.Name; | ||
303 | item.AssetType = asset.Type; | ||
304 | item.InvType = (int)InventoryType.Object; | ||
305 | |||
306 | m_Scene.AssetService.Store(asset); | ||
307 | m_Scene.InventoryService.UpdateItem(item); | ||
308 | |||
309 | return true; | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | m_log.ErrorFormat("[INVENTORY ACCESS MODULE]: Given invalid item for inventory update: {0}", | ||
314 | (item == null || asset == null? "null item or asset" : "wrong owner")); | ||
315 | return false; | ||
316 | } | ||
317 | |||
318 | } | ||
319 | |||
296 | public virtual List<InventoryItemBase> CopyToInventory( | 320 | public virtual List<InventoryItemBase> CopyToInventory( |
297 | DeRezAction action, UUID folderID, | 321 | DeRezAction action, UUID folderID, |
298 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) | 322 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) |
@@ -532,6 +556,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
532 | 556 | ||
533 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 557 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
534 | { | 558 | { |
559 | // Changing ownership, so apply the "Next Owner" permissions to all of the | ||
560 | // inventory item's permissions. | ||
561 | |||
535 | uint perms = effectivePerms; | 562 | uint perms = effectivePerms; |
536 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); | 563 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); |
537 | 564 | ||
@@ -546,6 +573,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
546 | } | 573 | } |
547 | else | 574 | else |
548 | { | 575 | { |
576 | // Not changing ownership. | ||
577 | // In this case we apply the permissions in the object's items ONLY to the inventory | ||
578 | // item's "Next Owner" permissions, but NOT to its "Current", "Base", etc. permissions. | ||
579 | // E.g., if the object contains a No-Transfer item then the item's "Next Owner" | ||
580 | // permissions are also No-Transfer. | ||
581 | PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref allObjectsNextOwnerPerms); | ||
582 | |||
549 | item.BasePermissions = effectivePerms; | 583 | item.BasePermissions = effectivePerms; |
550 | item.CurrentPermissions = effectivePerms; | 584 | item.CurrentPermissions = effectivePerms; |
551 | item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; | 585 | item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; |
@@ -773,12 +807,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
773 | m_log.WarnFormat( | 807 | m_log.WarnFormat( |
774 | "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", | 808 | "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", |
775 | assetID, item.Name, item.ID, remoteClient.Name); | 809 | assetID, item.Name, item.ID, remoteClient.Name); |
810 | remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0} for item {1}.", assetID, item.Name), false); | ||
776 | } | 811 | } |
777 | else | 812 | else |
778 | { | 813 | { |
779 | m_log.WarnFormat( | 814 | m_log.WarnFormat( |
780 | "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", | 815 | "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", |
781 | assetID, remoteClient.Name); | 816 | assetID, remoteClient.Name); |
817 | remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0}.", assetID), false); | ||
782 | } | 818 | } |
783 | 819 | ||
784 | return null; | 820 | return null; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs index 4470799..93dff1f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs | |||
@@ -89,35 +89,43 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | |||
89 | public bool IsAuthorizedForRegion( | 89 | public bool IsAuthorizedForRegion( |
90 | string user, string firstName, string lastName, string regionID, out string message) | 90 | string user, string firstName, string lastName, string regionID, out string message) |
91 | { | 91 | { |
92 | message = "authorized"; | ||
93 | |||
94 | // This should not happen | 92 | // This should not happen |
95 | if (m_Scene.RegionInfo.RegionID.ToString() != regionID) | 93 | if (m_Scene.RegionInfo.RegionID.ToString() != regionID) |
96 | { | 94 | { |
97 | m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}", | 95 | m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}", |
98 | m_Scene.RegionInfo.RegionID, regionID); | 96 | m_Scene.RegionInfo.RegionID, regionID); |
99 | return true; | 97 | message = string.Format("Region {0} received request to authorize for region {1}", m_Scene.RegionInfo.RegionID, regionID); |
98 | return false; | ||
100 | } | 99 | } |
101 | 100 | ||
102 | if (m_accessValue == AccessFlags.None) | 101 | if (m_accessValue == AccessFlags.None) |
102 | { | ||
103 | message = "Authorized"; | ||
103 | return true; | 104 | return true; |
105 | } | ||
104 | 106 | ||
105 | UUID userID = new UUID(user); | 107 | UUID userID = new UUID(user); |
106 | bool authorized = true; | 108 | |
107 | if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners) | 109 | if ((m_accessValue & AccessFlags.DisallowForeigners) != 0) |
108 | { | 110 | { |
109 | authorized = m_UserManagement.IsLocalGridUser(userID); | 111 | if (!m_UserManagement.IsLocalGridUser(userID)) |
110 | if (!authorized) | 112 | { |
111 | message = "no foreigner users allowed in this region"; | 113 | message = "No foreign users allowed in this region"; |
114 | return false; | ||
115 | } | ||
112 | } | 116 | } |
113 | if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents) | 117 | |
118 | if ((m_accessValue & AccessFlags.DisallowResidents) != 0) | ||
114 | { | 119 | { |
115 | authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID); | 120 | if (!(m_Scene.Permissions.IsGod(userID) || m_Scene.Permissions.IsAdministrator(userID))) |
116 | if (!authorized) | 121 | { |
117 | message = "only Admins and Managers allowed in this region"; | 122 | message = "Only Admins and Managers allowed in this region"; |
123 | return false; | ||
124 | } | ||
118 | } | 125 | } |
119 | 126 | ||
120 | return authorized; | 127 | message = "Authorized"; |
128 | return true; | ||
121 | } | 129 | } |
122 | 130 | ||
123 | } | 131 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index 516ad40..50c252c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs | |||
@@ -69,7 +69,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
69 | public void OnMakeRootAgent(ScenePresence sp) | 69 | public void OnMakeRootAgent(ScenePresence sp) |
70 | { | 70 | { |
71 | // m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); | 71 | // m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); |
72 | m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); | 72 | if (sp.PresenceType != PresenceType.Npc) |
73 | m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); | ||
73 | } | 74 | } |
74 | 75 | ||
75 | public void OnNewClient(IClientAPI client) | 76 | public void OnNewClient(IClientAPI client) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 3348b42..926ef05 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
264 | return true; | 264 | return true; |
265 | } | 265 | } |
266 | 266 | ||
267 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason) | 267 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) |
268 | { | 268 | { |
269 | reason = "Communications failure"; | 269 | reason = "Communications failure"; |
270 | version = ServiceVersion; | 270 | version = ServiceVersion; |
@@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
277 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 277 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
278 | // s.RegionInfo.RegionName, destination.RegionHandle); | 278 | // s.RegionInfo.RegionName, destination.RegionHandle); |
279 | 279 | ||
280 | return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, position, out reason); | 280 | return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); |
281 | } | 281 | } |
282 | 282 | ||
283 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | 283 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 8436488..0444e49 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
207 | return m_remoteConnector.UpdateAgent(destination, cAgentData); | 207 | return m_remoteConnector.UpdateAgent(destination, cAgentData); |
208 | } | 208 | } |
209 | 209 | ||
210 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason) | 210 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) |
211 | { | 211 | { |
212 | reason = "Communications failure"; | 212 | reason = "Communications failure"; |
213 | version = "Unknown"; | 213 | version = "Unknown"; |
@@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
216 | return false; | 216 | return false; |
217 | 217 | ||
218 | // Try local first | 218 | // Try local first |
219 | if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason)) | 219 | if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason)) |
220 | return true; | 220 | return true; |
221 | 221 | ||
222 | // else do the remote thing | 222 | // else do the remote thing |
223 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) | 223 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
224 | return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason); | 224 | return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); |
225 | 225 | ||
226 | return false; | 226 | return false; |
227 | } | 227 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index e08a42d..b31257d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -585,7 +585,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
585 | ld.GlobalID = landID; | 585 | ld.GlobalID = landID; |
586 | 586 | ||
587 | string ldPath = ArchiveConstants.CreateOarLandDataPath(ld); | 587 | string ldPath = ArchiveConstants.CreateOarLandDataPath(ld); |
588 | tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null)); | 588 | Dictionary<string, object> options = new Dictionary<string, object>(); |
589 | tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, options)); | ||
589 | tar.Close(); | 590 | tar.Close(); |
590 | 591 | ||
591 | oarStream = new MemoryStream(oarStream.ToArray()); | 592 | oarStream = new MemoryStream(oarStream.ToArray()); |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index a032bc7..eecc478 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -1106,13 +1106,14 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1106 | 1106 | ||
1107 | TerrainUploader = null; | 1107 | TerrainUploader = null; |
1108 | } | 1108 | } |
1109 | |||
1110 | m_log.DebugFormat("[CLIENT]: Terrain upload from {0} to {1} complete.", remoteClient.Name, Scene.Name); | ||
1109 | remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); | 1111 | remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); |
1112 | |||
1110 | ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>(); | 1113 | ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>(); |
1111 | 1114 | ||
1112 | if (terr != null) | 1115 | if (terr != null) |
1113 | { | 1116 | { |
1114 | m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); | ||
1115 | |||
1116 | try | 1117 | try |
1117 | { | 1118 | { |
1118 | MemoryStream terrainStream = new MemoryStream(terrainData); | 1119 | MemoryStream terrainStream = new MemoryStream(terrainData); |
@@ -1161,7 +1162,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1161 | { | 1162 | { |
1162 | if (TerrainUploader == null) | 1163 | if (TerrainUploader == null) |
1163 | { | 1164 | { |
1164 | m_log.DebugFormat("Starting to receive uploaded terrain"); | 1165 | m_log.DebugFormat( |
1166 | "[TERRAIN]: Started receiving terrain upload for region {0} from {1}", | ||
1167 | Scene.Name, remote_client.Name); | ||
1168 | |||
1165 | TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName); | 1169 | TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName); |
1166 | remote_client.OnXferReceive += TerrainUploader.XferReceive; | 1170 | remote_client.OnXferReceive += TerrainUploader.XferReceive; |
1167 | remote_client.OnAbortXfer += AbortTerrainXferHandler; | 1171 | remote_client.OnAbortXfer += AbortTerrainXferHandler; |
@@ -1182,7 +1186,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1182 | 1186 | ||
1183 | if (terr != null) | 1187 | if (terr != null) |
1184 | { | 1188 | { |
1185 | m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); | 1189 | // m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); |
1186 | if (File.Exists(Util.dataDir() + "/terrain.raw")) | 1190 | if (File.Exists(Util.dataDir() + "/terrain.raw")) |
1187 | { | 1191 | { |
1188 | File.Delete(Util.dataDir() + "/terrain.raw"); | 1192 | File.Delete(Util.dataDir() + "/terrain.raw"); |
@@ -1194,8 +1198,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1194 | input.Read(bdata, 0, (int)input.Length); | 1198 | input.Read(bdata, 0, (int)input.Length); |
1195 | remote_client.SendAlertMessage("Terrain file written, starting download..."); | 1199 | remote_client.SendAlertMessage("Terrain file written, starting download..."); |
1196 | Scene.XferManager.AddNewFile("terrain.raw", bdata); | 1200 | Scene.XferManager.AddNewFile("terrain.raw", bdata); |
1197 | // Tell client about it | 1201 | |
1198 | m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); | 1202 | m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name); |
1203 | |||
1199 | remote_client.SendInitiateDownload("terrain.raw", clientFileName); | 1204 | remote_client.SendInitiateDownload("terrain.raw", clientFileName); |
1200 | } | 1205 | } |
1201 | } | 1206 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index c35f6b7..de7ea6d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -49,6 +49,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
49 | List<Scene> m_scenes = new List<Scene>(); | 49 | List<Scene> m_scenes = new List<Scene>(); |
50 | List<UUID> m_Clients; | 50 | List<UUID> m_Clients; |
51 | 51 | ||
52 | IWorldMapModule m_WorldMap; | ||
53 | IWorldMapModule WorldMap | ||
54 | { | ||
55 | get | ||
56 | { | ||
57 | if (m_WorldMap == null) | ||
58 | m_WorldMap = m_scene.RequestModuleInterface<IWorldMapModule>(); | ||
59 | return m_WorldMap; | ||
60 | } | ||
61 | |||
62 | } | ||
63 | |||
52 | #region ISharedRegionModule Members | 64 | #region ISharedRegionModule Members |
53 | public void Initialise(IConfigSource source) | 65 | public void Initialise(IConfigSource source) |
54 | { | 66 | { |
@@ -64,6 +76,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
64 | m_scenes.Add(scene); | 76 | m_scenes.Add(scene); |
65 | scene.EventManager.OnNewClient += OnNewClient; | 77 | scene.EventManager.OnNewClient += OnNewClient; |
66 | m_Clients = new List<UUID>(); | 78 | m_Clients = new List<UUID>(); |
79 | |||
67 | } | 80 | } |
68 | 81 | ||
69 | public void RemoveRegion(Scene scene) | 82 | public void RemoveRegion(Scene scene) |
@@ -129,7 +142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
129 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
130 | { | 143 | { |
131 | List<MapBlockData> blocks = new List<MapBlockData>(); | 144 | List<MapBlockData> blocks = new List<MapBlockData>(); |
132 | MapBlockData data; | ||
133 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | 145 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) |
134 | { | 146 | { |
135 | // final block, closing the search result | 147 | // final block, closing the search result |
@@ -143,50 +155,50 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
143 | } | 155 | } |
144 | 156 | ||
145 | 157 | ||
146 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | 158 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
147 | 159 | ||
148 | // Hack to get around the fact that ll V3 now drops the port from the | ||
149 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | ||
150 | // | ||
151 | // Caller, use this magic form instead: | ||
152 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
153 | // or url encode if possible. | ||
154 | // the hacks we do with this viewer... | ||
155 | // | ||
156 | string mapNameOrig = mapName; | 160 | string mapNameOrig = mapName; |
157 | if (mapName.Contains("|")) | 161 | if (regionInfos.Count == 0) |
158 | mapName = mapName.Replace('|', ':'); | 162 | { |
159 | if (mapName.Contains("+")) | 163 | // Hack to get around the fact that ll V3 now drops the port from the |
160 | mapName = mapName.Replace('+', ' '); | 164 | // map name. See https://jira.secondlife.com/browse/VWR-28570 |
161 | if (mapName.Contains("!")) | 165 | // |
162 | mapName = mapName.Replace('!', '/'); | 166 | // Caller, use this magic form instead: |
167 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
168 | // or url encode if possible. | ||
169 | // the hacks we do with this viewer... | ||
170 | // | ||
171 | if (mapName.Contains("|")) | ||
172 | mapName = mapName.Replace('|', ':'); | ||
173 | if (mapName.Contains("+")) | ||
174 | mapName = mapName.Replace('+', ' '); | ||
175 | if (mapName.Contains("!")) | ||
176 | mapName = mapName.Replace('!', '/'); | ||
177 | |||
178 | if (mapName != mapNameOrig) | ||
179 | regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
180 | } | ||
163 | 181 | ||
164 | // try to fetch from GridServer | ||
165 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
166 | |||
167 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 182 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); |
183 | |||
168 | if (regionInfos.Count > 0) | 184 | if (regionInfos.Count > 0) |
169 | { | 185 | { |
170 | foreach (GridRegion info in regionInfos) | 186 | foreach (GridRegion info in regionInfos) |
171 | { | 187 | { |
172 | data = new MapBlockData(); | 188 | if ((flags & 2) == 2) // V2 sends this |
173 | data.Agents = 0; | 189 | { |
174 | data.Access = info.Access; | 190 | List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags); |
175 | if (flags == 2) // V2 sends this | 191 | // ugh! V2-3 is very sensitive about the result being |
176 | data.MapImageId = UUID.Zero; | 192 | // exactly the same as the requested name |
177 | else | 193 | if (regionInfos.Count == 1 && (mapName != mapNameOrig)) |
178 | data.MapImageId = info.TerrainImage; | 194 | datas.ForEach(d => d.Name = mapNameOrig); |
179 | // ugh! V2-3 is very sensitive about the result being | 195 | |
180 | // exactly the same as the requested name | 196 | blocks.AddRange(datas); |
181 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | 197 | } |
182 | data.Name = mapNameOrig; | ||
183 | else | 198 | else |
184 | data.Name = info.RegionName; | 199 | { |
185 | data.RegionFlags = 0; // TODO not used? | 200 | MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags); |
186 | data.WaterHeight = 0; // not used | 201 | } |
187 | data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX); | ||
188 | data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY); | ||
189 | blocks.Add(data); | ||
190 | } | 202 | } |
191 | } | 203 | } |
192 | 204 | ||
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index a3b0f39..b98afbc 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1064,7 +1064,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | // Fill a passed MapBlockData from a GridRegion | 1066 | // Fill a passed MapBlockData from a GridRegion |
1067 | protected MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) | 1067 | public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) |
1068 | { | 1068 | { |
1069 | MapBlockData block = new MapBlockData(); | 1069 | MapBlockData block = new MapBlockData(); |
1070 | 1070 | ||
@@ -1090,7 +1090,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1090 | return block; | 1090 | return block; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | protected List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) | 1093 | public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) |
1094 | { | 1094 | { |
1095 | List<MapBlockData> blocks = new List<MapBlockData>(); | 1095 | List<MapBlockData> blocks = new List<MapBlockData>(); |
1096 | MapBlockData block = new MapBlockData(); | 1096 | MapBlockData block = new MapBlockData(); |
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 0c0a7aa..4a06f6e 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |||
@@ -381,7 +381,7 @@ namespace OpenSim.Region.DataSnapshot | |||
381 | cli.RequestMethod = "GET"; | 381 | cli.RequestMethod = "GET"; |
382 | try | 382 | try |
383 | { | 383 | { |
384 | reply = cli.Request(); | 384 | reply = cli.Request(null); |
385 | } | 385 | } |
386 | catch (WebException) | 386 | catch (WebException) |
387 | { | 387 | { |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 3576e35..6bad018 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -38,7 +38,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
38 | public interface IInventoryAccessModule | 38 | public interface IInventoryAccessModule |
39 | { | 39 | { |
40 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); | 40 | UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); |
41 | 41 | ||
42 | bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset); | ||
43 | |||
42 | /// <summary> | 44 | /// <summary> |
43 | /// Copy objects to a user's inventory. | 45 | /// Copy objects to a user's inventory. |
44 | /// </summary> | 46 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs index b0b47a7..290b826 100644 --- a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs | |||
@@ -36,6 +36,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
36 | { | 36 | { |
37 | event UndeliveredMessage OnUndeliveredMessage; | 37 | event UndeliveredMessage OnUndeliveredMessage; |
38 | 38 | ||
39 | /// <summary> | ||
40 | /// Attempt to send an instant message to a given destination. | ||
41 | /// </summary> | ||
42 | /// <remarks> | ||
43 | /// If the message cannot be delivered for any reason, this will be signalled on the OnUndeliveredMessage | ||
44 | /// event. result(false) will also be called if the message cannot be delievered unless the type is | ||
45 | /// InstantMessageDialog.MessageFromAgent. For successful message delivery, result(true) is called. | ||
46 | /// </remarks> | ||
47 | /// <param name="im"></param> | ||
48 | /// <param name="result"></param> | ||
39 | void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); | 49 | void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); |
50 | |||
51 | /// <summary> | ||
52 | /// Appropriately handle a known undeliverable message without attempting a send. | ||
53 | /// </summary> | ||
54 | /// <remarks> | ||
55 | /// Essentially, this invokes the OnUndeliveredMessage event. | ||
56 | /// </remarks> | ||
57 | /// <param name="im"></param> | ||
58 | /// <param name="result"></param> | ||
59 | void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result); | ||
40 | } | 60 | } |
41 | } | 61 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index 65c57a6..9c781e1 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs | |||
@@ -24,6 +24,9 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System.Collections.Generic; | ||
28 | using OpenSim.Framework; | ||
29 | using OpenSim.Services.Interfaces; | ||
27 | 30 | ||
28 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
29 | { | 32 | { |
@@ -33,5 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
33 | /// Generate a map tile for the scene. a terrain texture for this scene | 36 | /// Generate a map tile for the scene. a terrain texture for this scene |
34 | /// </summary> | 37 | /// </summary> |
35 | void GenerateMaptile(); | 38 | void GenerateMaptile(); |
39 | List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag); | ||
40 | MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag); | ||
36 | } | 41 | } |
37 | } | 42 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 91f1b63..542d454 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -125,13 +125,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
125 | 125 | ||
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | } | ||
129 | |||
130 | public bool AddInventoryItem(InventoryItemBase item) | ||
131 | { | ||
132 | return AddInventoryItem(item, true); | ||
128 | } | 133 | } |
129 | 134 | ||
130 | /// <summary> | 135 | /// <summary> |
131 | /// Add the given inventory item to a user's inventory. | 136 | /// Add the given inventory item to a user's inventory. |
132 | /// </summary> | 137 | /// </summary> |
133 | /// <param name="item"></param> | 138 | /// <param name="item"></param> |
134 | public bool AddInventoryItem(InventoryItemBase item) | 139 | public bool AddInventoryItem(InventoryItemBase item, bool trigger) |
135 | { | 140 | { |
136 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) | 141 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) |
137 | { | 142 | { |
@@ -140,7 +145,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | { | 145 | { |
141 | userlevel = 1; | 146 | userlevel = 1; |
142 | } | 147 | } |
143 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | 148 | if (trigger) |
149 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
144 | 150 | ||
145 | return true; | 151 | return true; |
146 | } | 152 | } |
@@ -179,7 +185,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | { | 185 | { |
180 | userlevel = 1; | 186 | userlevel = 1; |
181 | } | 187 | } |
182 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | 188 | if (trigger) |
189 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
183 | 190 | ||
184 | if (originalFolder != UUID.Zero) | 191 | if (originalFolder != UUID.Zero) |
185 | { | 192 | { |
@@ -764,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 771 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
765 | if (invAccess != null) | 772 | if (invAccess != null) |
766 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); | 773 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); |
767 | AddInventoryItem(itemCopy); | 774 | AddInventoryItem(itemCopy, false); |
768 | 775 | ||
769 | if (!Permissions.BypassPermissions()) | 776 | if (!Permissions.BypassPermissions()) |
770 | { | 777 | { |
@@ -872,51 +879,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
872 | return; | 879 | return; |
873 | } | 880 | } |
874 | 881 | ||
875 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 882 | if (newName == String.Empty) |
883 | newName = item.Name; | ||
876 | 884 | ||
877 | if (asset != null) | 885 | if (remoteClient.AgentId == oldAgentID |
886 | || (LibraryService != null | ||
887 | && LibraryService.LibraryRootFolder != null | ||
888 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
878 | { | 889 | { |
879 | if (newName != String.Empty) | 890 | CreateNewInventoryItem( |
880 | { | 891 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, |
881 | asset.Name = newName; | 892 | newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType, |
882 | } | 893 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, |
883 | else | 894 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false); |
884 | { | 895 | } |
885 | newName = item.Name; | 896 | else |
886 | } | 897 | { |
887 | 898 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | |
888 | if (remoteClient.AgentId == oldAgentID | 899 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) |
889 | || (LibraryService != null | 900 | && (m_permissions.BypassPermissions() |
890 | && LibraryService.LibraryRootFolder != null | 901 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) |
891 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
892 | { | 902 | { |
893 | CreateNewInventoryItem( | 903 | CreateNewInventoryItem( |
894 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, | 904 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, |
895 | newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType, | 905 | item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType, |
896 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, | 906 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, |
897 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 907 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false); |
898 | } | ||
899 | else | ||
900 | { | ||
901 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | ||
902 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) | ||
903 | && (m_permissions.BypassPermissions() | ||
904 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) | ||
905 | { | ||
906 | CreateNewInventoryItem( | ||
907 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, | ||
908 | asset, (sbyte) item.InvType, | ||
909 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, | ||
910 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | ||
911 | } | ||
912 | } | 908 | } |
913 | } | 909 | } |
914 | else | ||
915 | { | ||
916 | m_log.ErrorFormat( | ||
917 | "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", | ||
918 | item.Name, item.AssetID); | ||
919 | } | ||
920 | } | 910 | } |
921 | 911 | ||
922 | /// <summary> | 912 | /// <summary> |
@@ -966,11 +956,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
966 | public void CreateNewInventoryItem( | 956 | public void CreateNewInventoryItem( |
967 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 957 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
968 | string name, string description, uint flags, uint callbackID, | 958 | string name, string description, uint flags, uint callbackID, |
969 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 959 | UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate) |
970 | { | 960 | { |
971 | CreateNewInventoryItem( | 961 | CreateNewInventoryItem( |
972 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 962 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType, |
973 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); | 963 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, |
964 | creationDate, true); | ||
974 | } | 965 | } |
975 | 966 | ||
976 | /// <summary> | 967 | /// <summary> |
@@ -994,19 +985,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
994 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> | 985 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> |
995 | private void CreateNewInventoryItem( | 986 | private void CreateNewInventoryItem( |
996 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 987 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
997 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 988 | string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType, |
998 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 989 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate, |
990 | bool assetUpload) | ||
999 | { | 991 | { |
1000 | InventoryItemBase item = new InventoryItemBase(); | 992 | InventoryItemBase item = new InventoryItemBase(); |
1001 | item.Owner = remoteClient.AgentId; | 993 | item.Owner = remoteClient.AgentId; |
1002 | item.CreatorId = creatorID; | 994 | item.CreatorId = creatorID; |
1003 | item.CreatorData = creatorData; | 995 | item.CreatorData = creatorData; |
1004 | item.ID = UUID.Random(); | 996 | item.ID = UUID.Random(); |
1005 | item.AssetID = asset.FullID; | 997 | item.AssetID = assetID; |
1006 | item.Name = name; | 998 | item.Name = name; |
1007 | item.Description = description; | 999 | item.Description = description; |
1008 | item.Flags = flags; | 1000 | item.Flags = flags; |
1009 | item.AssetType = asset.Type; | 1001 | item.AssetType = assetType; |
1010 | item.InvType = invType; | 1002 | item.InvType = invType; |
1011 | item.Folder = folderID; | 1003 | item.Folder = folderID; |
1012 | item.CurrentPermissions = currentMask; | 1004 | item.CurrentPermissions = currentMask; |
@@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1016 | item.BasePermissions = baseMask; | 1008 | item.BasePermissions = baseMask; |
1017 | item.CreationDate = creationDate; | 1009 | item.CreationDate = creationDate; |
1018 | 1010 | ||
1019 | if (AddInventoryItem(item)) | 1011 | if (AddInventoryItem(item, assetUpload)) |
1020 | { | 1012 | { |
1021 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 1013 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); |
1022 | } | 1014 | } |
@@ -1079,17 +1071,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1079 | // return; | 1071 | // return; |
1080 | // } | 1072 | // } |
1081 | 1073 | ||
1082 | AssetBase asset = new AssetBase(); | ||
1083 | asset.FullID = olditemID; | ||
1084 | asset.Type = type; | ||
1085 | asset.Name = name; | ||
1086 | asset.Description = description; | ||
1087 | |||
1088 | CreateNewInventoryItem( | 1074 | CreateNewInventoryItem( |
1089 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 1075 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
1090 | name, description, 0, callbackID, asset, invType, | 1076 | name, description, 0, callbackID, olditemID, type, invType, |
1091 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, | 1077 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, |
1092 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); | 1078 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch(), |
1079 | false); | ||
1093 | } | 1080 | } |
1094 | else | 1081 | else |
1095 | { | 1082 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e6887b4..eff24f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3751,6 +3751,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3751 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); | 3751 | RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); |
3752 | } | 3752 | } |
3753 | 3753 | ||
3754 | // Final permissions check; this time we don't allow changing the position | ||
3755 | if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason)) | ||
3756 | { | ||
3757 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | ||
3758 | return false; | ||
3759 | } | ||
3760 | |||
3754 | return true; | 3761 | return true; |
3755 | } | 3762 | } |
3756 | 3763 | ||
@@ -3760,6 +3767,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3760 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3767 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
3761 | { | 3768 | { |
3762 | acd.startpos = land.LandData.UserLocation; | 3769 | acd.startpos = land.LandData.UserLocation; |
3770 | |||
3771 | // Final permissions check; this time we don't allow changing the position | ||
3772 | if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason)) | ||
3773 | { | ||
3774 | m_authenticateHandler.RemoveCircuit(acd.circuitcode); | ||
3775 | return false; | ||
3776 | } | ||
3763 | } | 3777 | } |
3764 | } | 3778 | } |
3765 | } | 3779 | } |
@@ -3767,6 +3781,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3767 | return true; | 3781 | return true; |
3768 | } | 3782 | } |
3769 | 3783 | ||
3784 | private bool IsPositionAllowed(UUID agentID, Vector3 pos, ref string reason) | ||
3785 | { | ||
3786 | ILandObject land = LandChannel.GetLandObject(pos); | ||
3787 | if (land == null) | ||
3788 | return true; | ||
3789 | |||
3790 | if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID)) | ||
3791 | { | ||
3792 | reason = "You are banned from the region."; | ||
3793 | return false; | ||
3794 | } | ||
3795 | |||
3796 | return true; | ||
3797 | } | ||
3798 | |||
3770 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) | 3799 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3771 | { | 3800 | { |
3772 | if (posX < 0) | 3801 | if (posX < 0) |
@@ -3865,7 +3894,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3865 | if (!AuthorizationService.IsAuthorizedForRegion( | 3894 | if (!AuthorizationService.IsAuthorizedForRegion( |
3866 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) | 3895 | agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) |
3867 | { | 3896 | { |
3868 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", | 3897 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", |
3869 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); | 3898 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); |
3870 | 3899 | ||
3871 | return false; | 3900 | return false; |
@@ -4133,7 +4162,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4133 | /// <returns>true if we handled it.</returns> | 4162 | /// <returns>true if we handled it.</returns> |
4134 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) | 4163 | public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) |
4135 | { | 4164 | { |
4136 | //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); | 4165 | // m_log.DebugFormat( |
4166 | // "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}", | ||
4167 | // cAgentData.AgentID, Name, cAgentData.Position); | ||
4168 | |||
4137 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 4169 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
4138 | if (childAgentUpdate != null) | 4170 | if (childAgentUpdate != null) |
4139 | { | 4171 | { |
@@ -5150,7 +5182,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5150 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5182 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5151 | if (nearestPoint != null) | 5183 | if (nearestPoint != null) |
5152 | { | 5184 | { |
5153 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); | 5185 | m_log.Debug("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5154 | return nearestPoint.Value; | 5186 | return nearestPoint.Value; |
5155 | } | 5187 | } |
5156 | 5188 | ||
@@ -5160,7 +5192,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5160 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5192 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5161 | if (nearestPoint != null) | 5193 | if (nearestPoint != null) |
5162 | { | 5194 | { |
5163 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); | 5195 | m_log.Debug("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5164 | return nearestPoint.Value; | 5196 | return nearestPoint.Value; |
5165 | } | 5197 | } |
5166 | 5198 | ||
@@ -5169,7 +5201,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5169 | { | 5201 | { |
5170 | // Ultimate backup if we have no idea where they are and | 5202 | // Ultimate backup if we have no idea where they are and |
5171 | // the last allowed position was in another parcel | 5203 | // the last allowed position was in another parcel |
5172 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | 5204 | m_log.Debug("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); |
5173 | return avatar.lastKnownAllowedPosition; | 5205 | return avatar.lastKnownAllowedPosition; |
5174 | } | 5206 | } |
5175 | 5207 | ||
@@ -5179,7 +5211,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5179 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5211 | //Go to the edge, this happens in teleporting to a region with no available parcels |
5180 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); | 5212 | Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); |
5181 | 5213 | ||
5182 | //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); | 5214 | //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); |
5183 | 5215 | ||
5184 | return nearestRegionEdgePoint; | 5216 | return nearestRegionEdgePoint; |
5185 | } | 5217 | } |
@@ -5463,9 +5495,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5463 | /// <param name='position'></param> | 5495 | /// <param name='position'></param> |
5464 | /// <param name='reason'></param> | 5496 | /// <param name='reason'></param> |
5465 | /// <returns></returns> | 5497 | /// <returns></returns> |
5466 | public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason) | 5498 | public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) |
5467 | { | 5499 | { |
5468 | reason = "You are banned from the region"; | 5500 | reason = string.Empty; |
5469 | 5501 | ||
5470 | if (Permissions.IsGod(agentID)) | 5502 | if (Permissions.IsGod(agentID)) |
5471 | { | 5503 | { |
@@ -5525,10 +5557,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5525 | catch (Exception e) | 5557 | catch (Exception e) |
5526 | { | 5558 | { |
5527 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | 5559 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); |
5560 | reason = "Error authorizing agent: " + e.Message; | ||
5528 | return false; | 5561 | return false; |
5529 | } | 5562 | } |
5530 | 5563 | ||
5531 | if (position == Vector3.Zero) // Teleport | 5564 | if (viaTeleport) |
5532 | { | 5565 | { |
5533 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5566 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
5534 | { | 5567 | { |
@@ -5568,6 +5601,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5568 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | 5601 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) |
5569 | { | 5602 | { |
5570 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | 5603 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); |
5604 | reason = "You are banned from the region on all parcels"; | ||
5571 | return false; | 5605 | return false; |
5572 | } | 5606 | } |
5573 | } | 5607 | } |
@@ -5575,13 +5609,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
5575 | { | 5609 | { |
5576 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | 5610 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); |
5577 | if (land == null) | 5611 | if (land == null) |
5612 | { | ||
5613 | reason = "No parcel found"; | ||
5578 | return false; | 5614 | return false; |
5615 | } | ||
5579 | 5616 | ||
5580 | bool banned = land.IsBannedFromLand(agentID); | 5617 | bool banned = land.IsBannedFromLand(agentID); |
5581 | bool restricted = land.IsRestrictedFromLand(agentID); | 5618 | bool restricted = land.IsRestrictedFromLand(agentID); |
5582 | 5619 | ||
5583 | if (banned || restricted) | 5620 | if (banned || restricted) |
5621 | { | ||
5622 | if (banned) | ||
5623 | reason = "You are banned from the parcel"; | ||
5624 | else | ||
5625 | reason = "The parcel is restricted"; | ||
5584 | return false; | 5626 | return false; |
5627 | } | ||
5585 | } | 5628 | } |
5586 | 5629 | ||
5587 | reason = String.Empty; | 5630 | reason = String.Empty; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index fb8ecd5..75e1cbb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -751,7 +751,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
751 | Vector3 bbox; | 751 | Vector3 bbox; |
752 | float offsetHeight; | 752 | float offsetHeight; |
753 | 753 | ||
754 | bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); | 754 | m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); |
755 | 755 | ||
756 | for (int i = 0; i < objlist.Count; i++) | 756 | for (int i = 0; i < objlist.Count; i++) |
757 | { | 757 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8c56975..17f54c2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -208,7 +208,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
208 | // private int m_lastColCount = -1; //KF: Look for Collision chnages | 208 | // private int m_lastColCount = -1; //KF: Look for Collision chnages |
209 | // private int m_updateCount = 0; //KF: Update Anims for a while | 209 | // private int m_updateCount = 0; //KF: Update Anims for a while |
210 | // private static readonly int UPDATE_COUNT = 10; // how many frames to update for | 210 | // private static readonly int UPDATE_COUNT = 10; // how many frames to update for |
211 | private List<uint> m_lastColliders = new List<uint>(); | ||
212 | 211 | ||
213 | private TeleportFlags m_teleportFlags; | 212 | private TeleportFlags m_teleportFlags; |
214 | public TeleportFlags TeleportFlags | 213 | public TeleportFlags TeleportFlags |
@@ -271,8 +270,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
271 | //private int m_moveToPositionStateStatus; | 270 | //private int m_moveToPositionStateStatus; |
272 | //***************************************************** | 271 | //***************************************************** |
273 | 272 | ||
274 | private object m_collisionEventLock = new Object(); | ||
275 | |||
276 | private int m_movementAnimationUpdateCounter = 0; | 273 | private int m_movementAnimationUpdateCounter = 0; |
277 | 274 | ||
278 | public Vector3 PrevSitOffset { get; set; } | 275 | public Vector3 PrevSitOffset { get; set; } |
@@ -1328,6 +1325,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1328 | 1325 | ||
1329 | m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); | 1326 | m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); |
1330 | 1327 | ||
1328 | // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating | ||
1329 | // from the source simulator has completed on a V2 teleport. | ||
1330 | lock (m_originRegionIDAccessLock) | ||
1331 | m_originRegionID = UUID.Zero; | ||
1332 | |||
1331 | // Reset these so that teleporting in and walking out isn't seen | 1333 | // Reset these so that teleporting in and walking out isn't seen |
1332 | // as teleporting back | 1334 | // as teleporting back |
1333 | TeleportFlags = TeleportFlags.Default; | 1335 | TeleportFlags = TeleportFlags.Default; |
@@ -2752,7 +2754,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
2752 | part.AddSittingAvatar(this); | 2754 | part.AddSittingAvatar(this); |
2753 | 2755 | ||
2754 | cameraAtOffset = part.GetCameraAtOffset(); | 2756 | cameraAtOffset = part.GetCameraAtOffset(); |
2757 | |||
2758 | if (!part.IsRoot && cameraAtOffset == Vector3.Zero) | ||
2759 | cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset(); | ||
2760 | |||
2761 | bool cameraEyeOffsetFromRootForChild = false; | ||
2755 | cameraEyeOffset = part.GetCameraEyeOffset(); | 2762 | cameraEyeOffset = part.GetCameraEyeOffset(); |
2763 | |||
2764 | if (!part.IsRoot && cameraEyeOffset == Vector3.Zero) | ||
2765 | { | ||
2766 | cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); | ||
2767 | cameraEyeOffsetFromRootForChild = true; | ||
2768 | } | ||
2769 | |||
2770 | if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero) | ||
2771 | { | ||
2772 | if (!part.IsRoot) | ||
2773 | { | ||
2774 | cameraEyeOffset = cameraEyeOffset * part.RotationOffset; | ||
2775 | cameraAtOffset += part.OffsetPosition; | ||
2776 | } | ||
2777 | |||
2778 | cameraEyeOffset += part.OffsetPosition; | ||
2779 | } | ||
2780 | |||
2781 | // m_log.DebugFormat( | ||
2782 | // "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}", | ||
2783 | // cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name); | ||
2784 | |||
2756 | forceMouselook = part.GetForceMouselook(); | 2785 | forceMouselook = part.GetForceMouselook(); |
2757 | 2786 | ||
2758 | // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is | 2787 | // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is |
@@ -3772,10 +3801,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3772 | if (!IsChildAgent) | 3801 | if (!IsChildAgent) |
3773 | return; | 3802 | return; |
3774 | 3803 | ||
3775 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); | 3804 | // m_log.DebugFormat( |
3805 | // "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}", | ||
3806 | // Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position); | ||
3807 | |||
3776 | // Find the distance (in meters) between the two regions | 3808 | // Find the distance (in meters) between the two regions |
3777 | uint shiftx = Util.RegionToWorldLoc(rRegionX - tRegionX); | 3809 | // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the |
3778 | uint shifty = Util.RegionToWorldLoc(rRegionY - tRegionY); | 3810 | // uint |
3811 | int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize); | ||
3812 | int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize); | ||
3779 | 3813 | ||
3780 | Vector3 offset = new Vector3(shiftx, shifty, 0f); | 3814 | Vector3 offset = new Vector3(shiftx, shifty, 0f); |
3781 | 3815 | ||
@@ -3876,9 +3910,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3876 | 3910 | ||
3877 | private void CopyFrom(AgentData cAgent) | 3911 | private void CopyFrom(AgentData cAgent) |
3878 | { | 3912 | { |
3879 | lock (m_originRegionIDAccessLock) | ||
3880 | m_originRegionID = cAgent.RegionID; | ||
3881 | |||
3882 | m_callbackURI = cAgent.CallbackURI; | 3913 | m_callbackURI = cAgent.CallbackURI; |
3883 | // m_log.DebugFormat( | 3914 | // m_log.DebugFormat( |
3884 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", | 3915 | // "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", |
@@ -3951,6 +3982,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3951 | 3982 | ||
3952 | if (Scene.AttachmentsModule != null) | 3983 | if (Scene.AttachmentsModule != null) |
3953 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | 3984 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |
3985 | |||
3986 | // This must occur after attachments are copied, as it releases the CompleteMovement() calling thread | ||
3987 | // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart | ||
3988 | // script attachments can outrace this thread. | ||
3989 | lock (m_originRegionIDAccessLock) | ||
3990 | m_originRegionID = cAgent.RegionID; | ||
3954 | } | 3991 | } |
3955 | 3992 | ||
3956 | public bool CopyAgent(out IAgentData agent) | 3993 | public bool CopyAgent(out IAgentData agent) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 85650d6..e68f954 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -1343,7 +1343,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1343 | writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); | 1343 | writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); |
1344 | writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); | 1344 | writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); |
1345 | writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); | 1345 | writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); |
1346 | WriteUUID(writer, "GroupID", sop.GroupID, options); | 1346 | |
1347 | UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.GroupID; | ||
1348 | WriteUUID(writer, "GroupID", groupID, options); | ||
1347 | 1349 | ||
1348 | UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; | 1350 | UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; |
1349 | WriteUUID(writer, "OwnerID", ownerID, options); | 1351 | WriteUUID(writer, "OwnerID", ownerID, options); |
@@ -1469,7 +1471,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1469 | writer.WriteElementString("Description", item.Description); | 1471 | writer.WriteElementString("Description", item.Description); |
1470 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); | 1472 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); |
1471 | writer.WriteElementString("Flags", item.Flags.ToString()); | 1473 | writer.WriteElementString("Flags", item.Flags.ToString()); |
1472 | WriteUUID(writer, "GroupID", item.GroupID, options); | 1474 | |
1475 | UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.GroupID; | ||
1476 | WriteUUID(writer, "GroupID", groupID, options); | ||
1477 | |||
1473 | writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); | 1478 | writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); |
1474 | writer.WriteElementString("InvType", item.InvType.ToString()); | 1479 | writer.WriteElementString("InvType", item.InvType.ToString()); |
1475 | WriteUUID(writer, "ItemID", item.ItemID, options); | 1480 | WriteUUID(writer, "ItemID", item.ItemID, options); |
@@ -1490,7 +1495,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1490 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); | 1495 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); |
1491 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); | 1496 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); |
1492 | writer.WriteElementString("Type", item.Type.ToString()); | 1497 | writer.WriteElementString("Type", item.Type.ToString()); |
1493 | writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); | 1498 | |
1499 | bool ownerChanged = options.ContainsKey("wipe-owners") ? false : item.OwnerChanged; | ||
1500 | writer.WriteElementString("OwnerChanged", ownerChanged.ToString().ToLower()); | ||
1494 | 1501 | ||
1495 | writer.WriteEndElement(); // TaskInventoryItem | 1502 | writer.WriteEndElement(); // TaskInventoryItem |
1496 | } | 1503 | } |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index e797207..396f1e8 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
45 | { | 45 | { |
46 | public static class OpenSimTerrainCompressor | 46 | public static class OpenSimTerrainCompressor |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | #pragma warning disable 414 | 50 | #pragma warning disable 414 |
51 | private static string LogHeader = "[TERRAIN COMPRESSOR]"; | 51 | private static string LogHeader = "[TERRAIN COMPRESSOR]"; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index fd804cd..e1b6abb 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | |||
@@ -55,8 +55,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
55 | private IGroupsServicesConnector m_groupData = null; | 55 | private IGroupsServicesConnector m_groupData = null; |
56 | 56 | ||
57 | // Config Options | 57 | // Config Options |
58 | private bool m_groupMessagingEnabled = false; | 58 | private bool m_groupMessagingEnabled; |
59 | private bool m_debugEnabled = true; | 59 | private bool m_debugEnabled; |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// If enabled, module only tries to send group IMs to online users by querying cached presence information. | 62 | /// If enabled, module only tries to send group IMs to online users by querying cached presence information. |
@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
113 | if (m_messageOnlineAgentsOnly) | 113 | if (m_messageOnlineAgentsOnly) |
114 | m_usersOnlineCache = new ExpiringCache<UUID, PresenceInfo[]>(); | 114 | m_usersOnlineCache = new ExpiringCache<UUID, PresenceInfo[]>(); |
115 | 115 | ||
116 | m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); | 116 | m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled); |
117 | } | 117 | } |
118 | 118 | ||
119 | m_log.InfoFormat( | 119 | m_log.InfoFormat( |
@@ -127,6 +127,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
127 | return; | 127 | return; |
128 | 128 | ||
129 | scene.RegisterModuleInterface<IGroupsMessagingModule>(this); | 129 | scene.RegisterModuleInterface<IGroupsMessagingModule>(this); |
130 | |||
131 | scene.AddCommand( | ||
132 | "Debug", | ||
133 | this, | ||
134 | "debug groups messaging verbose", | ||
135 | "debug groups messaging verbose <true|false>", | ||
136 | "This setting turns on very verbose groups messaging debugging", | ||
137 | HandleDebugGroupsMessagingVerbose); | ||
130 | } | 138 | } |
131 | 139 | ||
132 | public void RegionLoaded(Scene scene) | 140 | public void RegionLoaded(Scene scene) |
@@ -218,6 +226,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
218 | 226 | ||
219 | #endregion | 227 | #endregion |
220 | 228 | ||
229 | private void HandleDebugGroupsMessagingVerbose(object modules, string[] args) | ||
230 | { | ||
231 | if (args.Length < 5) | ||
232 | { | ||
233 | MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>"); | ||
234 | return; | ||
235 | } | ||
236 | |||
237 | bool verbose = false; | ||
238 | if (!bool.TryParse(args[4], out verbose)) | ||
239 | { | ||
240 | MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>"); | ||
241 | return; | ||
242 | } | ||
243 | |||
244 | m_debugEnabled = verbose; | ||
245 | |||
246 | MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled); | ||
247 | } | ||
248 | |||
221 | /// <summary> | 249 | /// <summary> |
222 | /// Not really needed, but does confirm that the group exists. | 250 | /// Not really needed, but does confirm that the group exists. |
223 | /// </summary> | 251 | /// </summary> |
@@ -246,8 +274,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
246 | public void SendMessageToGroup( | 274 | public void SendMessageToGroup( |
247 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) | 275 | GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition) |
248 | { | 276 | { |
277 | int requestStartTick = Environment.TickCount; | ||
278 | |||
249 | List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID); | 279 | List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID); |
250 | int groupMembersCount = groupMembers.Count; | 280 | int groupMembersCount = groupMembers.Count; |
281 | HashSet<string> attemptDeliveryUuidSet = null; | ||
251 | 282 | ||
252 | if (m_messageOnlineAgentsOnly) | 283 | if (m_messageOnlineAgentsOnly) |
253 | { | 284 | { |
@@ -263,10 +294,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
263 | m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); | 294 | m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); |
264 | } | 295 | } |
265 | 296 | ||
266 | HashSet<string> onlineAgentsUuidSet = new HashSet<string>(); | 297 | attemptDeliveryUuidSet |
267 | Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID)); | 298 | = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID)); |
268 | 299 | ||
269 | groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); | 300 | //Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID)); |
301 | |||
302 | //groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); | ||
270 | 303 | ||
271 | // if (m_debugEnabled) | 304 | // if (m_debugEnabled) |
272 | // m_log.DebugFormat( | 305 | // m_log.DebugFormat( |
@@ -275,13 +308,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
275 | } | 308 | } |
276 | else | 309 | else |
277 | { | 310 | { |
311 | attemptDeliveryUuidSet | ||
312 | = new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString())); | ||
313 | |||
278 | if (m_debugEnabled) | 314 | if (m_debugEnabled) |
279 | m_log.DebugFormat( | 315 | m_log.DebugFormat( |
280 | "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", | 316 | "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", |
281 | groupID, groupMembers.Count); | 317 | groupID, groupMembers.Count); |
282 | } | 318 | } |
283 | |||
284 | int requestStartTick = Environment.TickCount; | ||
285 | 319 | ||
286 | foreach (GroupMembersData member in groupMembers) | 320 | foreach (GroupMembersData member in groupMembers) |
287 | { | 321 | { |
@@ -309,7 +343,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
309 | 343 | ||
310 | // Copy Message | 344 | // Copy Message |
311 | GridInstantMessage msg = new GridInstantMessage(); | 345 | GridInstantMessage msg = new GridInstantMessage(); |
312 | msg.imSessionID = groupID.Guid; | 346 | msg.imSessionID = im.imSessionID; |
313 | msg.fromAgentName = im.fromAgentName; | 347 | msg.fromAgentName = im.fromAgentName; |
314 | msg.message = im.message; | 348 | msg.message = im.message; |
315 | msg.dialog = im.dialog; | 349 | msg.dialog = im.dialog; |
@@ -325,26 +359,51 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
325 | 359 | ||
326 | msg.toAgentID = member.AgentID.Guid; | 360 | msg.toAgentID = member.AgentID.Guid; |
327 | 361 | ||
328 | IClientAPI client = GetActiveClient(member.AgentID); | 362 | if (attemptDeliveryUuidSet.Contains(member.AgentID.ToString())) |
329 | if (client == null) | ||
330 | { | 363 | { |
331 | // If they're not local, forward across the grid | 364 | IClientAPI client = GetActiveClient(member.AgentID); |
332 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); | 365 | if (client == null) |
333 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | 366 | { |
367 | int startTick = Environment.TickCount; | ||
368 | |||
369 | // If they're not local, forward across the grid | ||
370 | m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); | ||
371 | |||
372 | if (m_debugEnabled) | ||
373 | m_log.DebugFormat( | ||
374 | "[GROUPS-MESSAGING]: Delivering to {0} via grid took {1} ms", | ||
375 | member.AgentID, Environment.TickCount - startTick); | ||
376 | } | ||
377 | else | ||
378 | { | ||
379 | int startTick = Environment.TickCount; | ||
380 | |||
381 | ProcessMessageFromGroupSession(msg, client); | ||
382 | |||
383 | // Deliver locally, directly | ||
384 | if (m_debugEnabled) | ||
385 | m_log.DebugFormat( | ||
386 | "[GROUPS-MESSAGING]: Delivering to {0} locally took {1} ms", | ||
387 | member.AgentID, Environment.TickCount - startTick); | ||
388 | } | ||
334 | } | 389 | } |
335 | else | 390 | else |
336 | { | 391 | { |
337 | // Deliver locally, directly | 392 | int startTick = Environment.TickCount; |
338 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); | 393 | |
339 | ProcessMessageFromGroupSession(msg, client); | 394 | m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { }); |
395 | |||
396 | if (m_debugEnabled) | ||
397 | m_log.DebugFormat( | ||
398 | "[GROUPS-MESSAGING]: Handling undeliverable message for {0} took {1} ms", | ||
399 | member.AgentID, Environment.TickCount - startTick); | ||
340 | } | 400 | } |
341 | } | 401 | } |
342 | 402 | ||
343 | // Temporary for assessing how long it still takes to send messages to large online groups. | 403 | if (m_debugEnabled) |
344 | if (m_messageOnlineAgentsOnly) | ||
345 | m_log.DebugFormat( | 404 | m_log.DebugFormat( |
346 | "[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", | 405 | "[GROUPS-MESSAGING]: Total SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3} ms", |
347 | groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); | 406 | groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick); |
348 | } | 407 | } |
349 | 408 | ||
350 | #region SimGridEventHandlers | 409 | #region SimGridEventHandlers |
@@ -407,7 +466,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
407 | 466 | ||
408 | private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client) | 467 | private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client) |
409 | { | 468 | { |
410 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); | 469 | if (m_debugEnabled) |
470 | m_log.DebugFormat( | ||
471 | "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}", | ||
472 | msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog); | ||
411 | 473 | ||
412 | UUID AgentID = new UUID(msg.fromAgentID); | 474 | UUID AgentID = new UUID(msg.fromAgentID); |
413 | UUID GroupID = new UUID(msg.imSessionID); | 475 | UUID GroupID = new UUID(msg.imSessionID); |
@@ -431,8 +493,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
431 | // Add them to the session for now, and Invite them | 493 | // Add them to the session for now, and Invite them |
432 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); | 494 | m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); |
433 | 495 | ||
434 | UUID toAgentID = new UUID(msg.toAgentID); | ||
435 | |||
436 | GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); | 496 | GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); |
437 | if (groupInfo != null) | 497 | if (groupInfo != null) |
438 | { | 498 | { |
@@ -577,15 +637,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
577 | // Don't log any normal IMs (privacy!) | 637 | // Don't log any normal IMs (privacy!) |
578 | if (m_debugEnabled && im.dialog != (byte)InstantMessageDialog.MessageFromAgent) | 638 | if (m_debugEnabled && im.dialog != (byte)InstantMessageDialog.MessageFromAgent) |
579 | { | 639 | { |
580 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False"); | 640 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False"); |
581 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", (InstantMessageDialog)im.dialog); | 641 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", (InstantMessageDialog)im.dialog); |
582 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID); | 642 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID); |
583 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName); | 643 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName); |
584 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID); | 644 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID); |
585 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message); | 645 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message); |
586 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline); | 646 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline); |
587 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID); | 647 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID); |
588 | m_log.WarnFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket")); | 648 | m_log.DebugFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket")); |
589 | } | 649 | } |
590 | } | 650 | } |
591 | 651 | ||
@@ -596,7 +656,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
596 | /// </summary> | 656 | /// </summary> |
597 | private IClientAPI GetActiveClient(UUID agentID) | 657 | private IClientAPI GetActiveClient(UUID agentID) |
598 | { | 658 | { |
599 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); | 659 | if (m_debugEnabled) |
660 | m_log.DebugFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); | ||
600 | 661 | ||
601 | IClientAPI child = null; | 662 | IClientAPI child = null; |
602 | 663 | ||
@@ -608,12 +669,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
608 | { | 669 | { |
609 | if (!sp.IsChildAgent) | 670 | if (!sp.IsChildAgent) |
610 | { | 671 | { |
611 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name); | 672 | if (m_debugEnabled) |
673 | m_log.DebugFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name); | ||
674 | |||
612 | return sp.ControllingClient; | 675 | return sp.ControllingClient; |
613 | } | 676 | } |
614 | else | 677 | else |
615 | { | 678 | { |
616 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name); | 679 | if (m_debugEnabled) |
680 | m_log.DebugFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name); | ||
681 | |||
617 | child = sp.ControllingClient; | 682 | child = sp.ControllingClient; |
618 | } | 683 | } |
619 | } | 684 | } |
@@ -622,12 +687,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
622 | // If we didn't find a root, then just return whichever child we found, or null if none | 687 | // If we didn't find a root, then just return whichever child we found, or null if none |
623 | if (child == null) | 688 | if (child == null) |
624 | { | 689 | { |
625 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); | 690 | if (m_debugEnabled) |
691 | m_log.DebugFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); | ||
626 | } | 692 | } |
627 | else | 693 | else |
628 | { | 694 | { |
629 | if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); | 695 | if (m_debugEnabled) |
696 | m_log.DebugFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); | ||
630 | } | 697 | } |
698 | |||
631 | return child; | 699 | return child; |
632 | } | 700 | } |
633 | 701 | ||
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index f34152c..8a9e4d2 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -357,7 +357,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
357 | 357 | ||
358 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) | 358 | private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) |
359 | { | 359 | { |
360 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 360 | if (m_debugEnabled) |
361 | m_log.DebugFormat( | ||
362 | "[GROUPS]: {0} called for {1}, message type {2}", | ||
363 | System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog); | ||
361 | 364 | ||
362 | // Group invitations | 365 | // Group invitations |
363 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) | 366 | if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) |
@@ -551,6 +554,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
551 | 554 | ||
552 | UUID noticeID = new UUID(im.imSessionID); | 555 | UUID noticeID = new UUID(im.imSessionID); |
553 | 556 | ||
557 | if (m_debugEnabled) | ||
558 | m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId); | ||
559 | |||
554 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); | 560 | GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); |
555 | if (notice != null) | 561 | if (notice != null) |
556 | { | 562 | { |
@@ -572,6 +578,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
572 | 578 | ||
573 | remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); | 579 | remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); |
574 | } | 580 | } |
581 | else | ||
582 | { | ||
583 | if (m_debugEnabled) | ||
584 | m_log.DebugFormat( | ||
585 | "[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.", | ||
586 | noticeID, remoteClient.AgentId); | ||
587 | } | ||
575 | } | 588 | } |
576 | 589 | ||
577 | // Interop, received special 210 code for ejecting a group member | 590 | // Interop, received special 210 code for ejecting a group member |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index 71f1098..d944087 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | |||
@@ -132,6 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
132 | MessageTransferModule mtm = new MessageTransferModule(); | 132 | MessageTransferModule mtm = new MessageTransferModule(); |
133 | GroupsModule gm = new GroupsModule(); | 133 | GroupsModule gm = new GroupsModule(); |
134 | GroupsMessagingModule gmm = new GroupsMessagingModule(); | 134 | GroupsMessagingModule gmm = new GroupsMessagingModule(); |
135 | MockGroupsServicesConnector mgsc = new MockGroupsServicesConnector(); | ||
135 | 136 | ||
136 | IConfigSource configSource = new IniConfigSource(); | 137 | IConfigSource configSource = new IniConfigSource(); |
137 | 138 | ||
@@ -149,6 +150,83 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
149 | config.Set("MessagingEnabled", true); | 150 | config.Set("MessagingEnabled", true); |
150 | } | 151 | } |
151 | 152 | ||
153 | SceneHelpers.SetupSceneModules(scene, configSource, mgsc, mtm, gm, gmm); | ||
154 | |||
155 | UUID userId = TestHelpers.ParseTail(0x1); | ||
156 | string subjectText = "newman"; | ||
157 | string messageText = "Hello"; | ||
158 | string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText); | ||
159 | |||
160 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
161 | TestClient tc = (TestClient)sp.ControllingClient; | ||
162 | |||
163 | UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true); | ||
164 | gm.JoinGroupRequest(tc, groupID); | ||
165 | |||
166 | // Create a second user who doesn't want to receive notices | ||
167 | ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2)); | ||
168 | TestClient tc2 = (TestClient)sp2.ControllingClient; | ||
169 | gm.JoinGroupRequest(tc2, groupID); | ||
170 | gm.SetGroupAcceptNotices(tc2, groupID, false, true); | ||
171 | |||
172 | List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>(); | ||
173 | tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im); | ||
174 | |||
175 | List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>(); | ||
176 | tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im); | ||
177 | |||
178 | GridInstantMessage noticeIm = new GridInstantMessage(); | ||
179 | noticeIm.fromAgentID = userId.Guid; | ||
180 | noticeIm.toAgentID = groupID.Guid; | ||
181 | noticeIm.message = combinedSubjectMessage; | ||
182 | noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice; | ||
183 | |||
184 | tc.HandleImprovedInstantMessage(noticeIm); | ||
185 | |||
186 | Assert.That(spReceivedMessages.Count, Is.EqualTo(1)); | ||
187 | Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage)); | ||
188 | |||
189 | List<GroupNoticeData> notices = mgsc.GetGroupNotices(UUID.Zero, groupID); | ||
190 | Assert.AreEqual(1, notices.Count); | ||
191 | |||
192 | // OpenSimulator (possibly also SL) transport the notice ID as the session ID! | ||
193 | Assert.AreEqual(notices[0].NoticeID.Guid, spReceivedMessages[0].imSessionID); | ||
194 | |||
195 | Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0)); | ||
196 | } | ||
197 | |||
198 | /// <summary> | ||
199 | /// Run test with the MessageOnlineUsersOnly flag set. | ||
200 | /// </summary> | ||
201 | [Test] | ||
202 | public void TestSendGroupNoticeOnlineOnly() | ||
203 | { | ||
204 | TestHelpers.InMethod(); | ||
205 | // TestHelpers.EnableLogging(); | ||
206 | |||
207 | TestScene scene = new SceneHelpers().SetupScene(); | ||
208 | |||
209 | MessageTransferModule mtm = new MessageTransferModule(); | ||
210 | GroupsModule gm = new GroupsModule(); | ||
211 | GroupsMessagingModule gmm = new GroupsMessagingModule(); | ||
212 | |||
213 | IConfigSource configSource = new IniConfigSource(); | ||
214 | |||
215 | { | ||
216 | IConfig config = configSource.AddConfig("Messaging"); | ||
217 | config.Set("MessageTransferModule", mtm.Name); | ||
218 | } | ||
219 | |||
220 | { | ||
221 | IConfig config = configSource.AddConfig("Groups"); | ||
222 | config.Set("Enabled", true); | ||
223 | config.Set("Module", gm.Name); | ||
224 | config.Set("DebugEnabled", true); | ||
225 | config.Set("MessagingModule", gmm.Name); | ||
226 | config.Set("MessagingEnabled", true); | ||
227 | config.Set("MessageOnlineUsersOnly", true); | ||
228 | } | ||
229 | |||
152 | SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm); | 230 | SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm); |
153 | 231 | ||
154 | UUID userId = TestHelpers.ParseTail(0x1); | 232 | UUID userId = TestHelpers.ParseTail(0x1); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index d059b97..870c0bb 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -105,8 +105,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
105 | m_scene.LoginLock = true; | 105 | m_scene.LoginLock = true; |
106 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | 106 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; |
107 | 107 | ||
108 | // Warn level because the region cannot be used while logins are disabled | 108 | // This should always show up to the user but should not trigger warn/errors as these messages are |
109 | m_log.WarnFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); | 109 | // expected and are not simulator problems. Ideally, there would be a status level in log4net but |
110 | // failing that, we will print out to console instead. | ||
111 | MainConsole.Instance.OutputFormat("Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); | ||
110 | 112 | ||
111 | if (m_uri != string.Empty) | 113 | if (m_uri != string.Empty) |
112 | { | 114 | { |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 8e40561..f53adcb 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -147,6 +147,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
147 | terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; | 147 | terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; |
148 | 148 | ||
149 | float height = terrainHeight + actor.Size.Z; | 149 | float height = terrainHeight + actor.Size.Z; |
150 | // Console.WriteLine("height {0}, actorPosition {1}", height, actorPosition); | ||
150 | 151 | ||
151 | if (actor.Flying) | 152 | if (actor.Flying) |
152 | { | 153 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 1bcf879..1b8a454 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -399,8 +399,8 @@ public class BSActorAvatarMove : BSActor | |||
399 | m_controllingPrim.ForcePosition = m_controllingPrim.RawPosition + displacement; | 399 | m_controllingPrim.ForcePosition = m_controllingPrim.RawPosition + displacement; |
400 | } | 400 | } |
401 | } | 401 | } |
402 | m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs.ComputeStairCorrection,disp={1},force={2}", | 402 | m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs.ComputeStairCorrection,stepUp={1},isp={2},force={3}", |
403 | m_controllingPrim.LocalID, displacement, ret); | 403 | m_controllingPrim.LocalID, stepUp, displacement, ret); |
404 | 404 | ||
405 | } | 405 | } |
406 | return ret; | 406 | return ret; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 6683446..de42a4c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -598,9 +598,9 @@ public static class BSParam | |||
598 | new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", | 598 | new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", |
599 | 1.0f ), | 599 | 1.0f ), |
600 | new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", | 600 | new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", |
601 | 1.0f ), | 601 | 2.0f ), |
602 | new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", | 602 | new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", |
603 | 2 ), | 603 | 1 ), |
604 | 604 | ||
605 | new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", | 605 | new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", |
606 | 1000.0f, | 606 | 1000.0f, |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 9fa55ce..23bada9 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -639,15 +639,18 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
639 | { | 639 | { |
640 | if (collidersCount > 0) | 640 | if (collidersCount > 0) |
641 | { | 641 | { |
642 | for (int ii = 0; ii < collidersCount; ii++) | 642 | lock (PhysObjects) |
643 | { | 643 | { |
644 | uint cA = m_collisionArray[ii].aID; | 644 | for (int ii = 0; ii < collidersCount; ii++) |
645 | uint cB = m_collisionArray[ii].bID; | 645 | { |
646 | Vector3 point = m_collisionArray[ii].point; | 646 | uint cA = m_collisionArray[ii].aID; |
647 | Vector3 normal = m_collisionArray[ii].normal; | 647 | uint cB = m_collisionArray[ii].bID; |
648 | float penetration = m_collisionArray[ii].penetration; | 648 | Vector3 point = m_collisionArray[ii].point; |
649 | SendCollision(cA, cB, point, normal, penetration); | 649 | Vector3 normal = m_collisionArray[ii].normal; |
650 | SendCollision(cB, cA, point, -normal, penetration); | 650 | float penetration = m_collisionArray[ii].penetration; |
651 | SendCollision(cA, cB, point, normal, penetration); | ||
652 | SendCollision(cB, cA, point, -normal, penetration); | ||
653 | } | ||
651 | } | 654 | } |
652 | } | 655 | } |
653 | } | 656 | } |
@@ -658,14 +661,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
658 | { | 661 | { |
659 | if (updatedEntityCount > 0) | 662 | if (updatedEntityCount > 0) |
660 | { | 663 | { |
661 | for (int ii = 0; ii < updatedEntityCount; ii++) | 664 | lock (PhysObjects) |
662 | { | 665 | { |
663 | EntityProperties entprop = m_updateArray[ii]; | 666 | for (int ii = 0; ii < updatedEntityCount; ii++) |
664 | BSPhysObject pobj; | ||
665 | if (PhysObjects.TryGetValue(entprop.ID, out pobj)) | ||
666 | { | 667 | { |
667 | if (pobj.IsInitialized) | 668 | EntityProperties entprop = m_updateArray[ii]; |
668 | pobj.UpdateProperties(entprop); | 669 | BSPhysObject pobj; |
670 | if (PhysObjects.TryGetValue(entprop.ID, out pobj)) | ||
671 | { | ||
672 | if (pobj.IsInitialized) | ||
673 | pobj.UpdateProperties(entprop); | ||
674 | } | ||
669 | } | 675 | } |
670 | } | 676 | } |
671 | } | 677 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5590cd5..7d8821c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6846,12 +6846,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6846 | { | 6846 | { |
6847 | m_host.AddScriptLPS(1); | 6847 | m_host.AddScriptLPS(1); |
6848 | m_host.SetCameraEyeOffset(offset); | 6848 | m_host.SetCameraEyeOffset(offset); |
6849 | |||
6850 | if (m_host.ParentGroup.RootPart.GetCameraEyeOffset() == Vector3.Zero) | ||
6851 | m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset); | ||
6849 | } | 6852 | } |
6850 | 6853 | ||
6851 | public void llSetCameraAtOffset(LSL_Vector offset) | 6854 | public void llSetCameraAtOffset(LSL_Vector offset) |
6852 | { | 6855 | { |
6853 | m_host.AddScriptLPS(1); | 6856 | m_host.AddScriptLPS(1); |
6854 | m_host.SetCameraAtOffset(offset); | 6857 | m_host.SetCameraAtOffset(offset); |
6858 | |||
6859 | if (m_host.ParentGroup.RootPart.GetCameraAtOffset() == Vector3.Zero) | ||
6860 | m_host.ParentGroup.RootPart.SetCameraAtOffset(offset); | ||
6855 | } | 6861 | } |
6856 | 6862 | ||
6857 | public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) | 6863 | public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 6aa717d..8b8e038 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
162 | m_braceCount++; | 162 | m_braceCount++; |
163 | 163 | ||
164 | // line number | 164 | // line number |
165 | m_CSharpLine += 3; | 165 | m_CSharpLine += 9; |
166 | 166 | ||
167 | // here's the payload | 167 | // here's the payload |
168 | retstr += GenerateLine(); | 168 | retstr += GenerateLine(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index b4640ef..1efe798 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -444,7 +444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
444 | // return compileScript; | 444 | // return compileScript; |
445 | // } | 445 | // } |
446 | 446 | ||
447 | private static string CreateCSCompilerScript( | 447 | public static string CreateCSCompilerScript( |
448 | string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) | 448 | string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) |
449 | { | 449 | { |
450 | compileScript = string.Format( | 450 | compileScript = string.Format( |
@@ -472,7 +472,7 @@ namespace SecondLife | |||
472 | return compileScript; | 472 | return compileScript; |
473 | } | 473 | } |
474 | 474 | ||
475 | private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) | 475 | public static string CreateVBCompilerScript(string compileScript, string className, string baseClassName) |
476 | { | 476 | { |
477 | compileScript = String.Empty + | 477 | compileScript = String.Empty + |
478 | "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + | 478 | "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index 05a8756..713b280 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -25,12 +25,14 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.IO; | 29 | using System.IO; |
29 | using System.CodeDom.Compiler; | 30 | using System.CodeDom.Compiler; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using Microsoft.CSharp; | 32 | using Microsoft.CSharp; |
32 | using NUnit.Framework; | 33 | using NUnit.Framework; |
33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 34 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
35 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
34 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
35 | 37 | ||
36 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 38 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
@@ -47,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
47 | private CSharpCodeProvider m_CSCodeProvider; | 49 | private CSharpCodeProvider m_CSCodeProvider; |
48 | private CompilerParameters m_compilerParameters; | 50 | private CompilerParameters m_compilerParameters; |
49 | private CompilerResults m_compilerResults; | 51 | private CompilerResults m_compilerResults; |
52 | private ResolveEventHandler m_resolveEventHandler; | ||
50 | 53 | ||
51 | /// <summary> | 54 | /// <summary> |
52 | /// Creates a temporary directory where build artifacts are stored. | 55 | /// Creates a temporary directory where build artifacts are stored. |
@@ -66,9 +69,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
66 | m_CSCodeProvider = new CSharpCodeProvider(); | 69 | m_CSCodeProvider = new CSharpCodeProvider(); |
67 | m_compilerParameters = new CompilerParameters(); | 70 | m_compilerParameters = new CompilerParameters(); |
68 | 71 | ||
69 | string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "bin"); | 72 | string rootPath = System.AppDomain.CurrentDomain.BaseDirectory; |
73 | |||
74 | m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve); | ||
75 | |||
76 | System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler; | ||
77 | |||
70 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); | 78 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); |
71 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); | 79 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); |
80 | m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll")); | ||
72 | m_compilerParameters.GenerateExecutable = false; | 81 | m_compilerParameters.GenerateExecutable = false; |
73 | } | 82 | } |
74 | 83 | ||
@@ -79,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
79 | [TestFixtureTearDown] | 88 | [TestFixtureTearDown] |
80 | public void CleanUp() | 89 | public void CleanUp() |
81 | { | 90 | { |
91 | System.AppDomain.CurrentDomain.AssemblyResolve -= m_resolveEventHandler; | ||
92 | |||
82 | if (Directory.Exists(m_testDir)) | 93 | if (Directory.Exists(m_testDir)) |
83 | { | 94 | { |
84 | // Blow away the temporary directory with artifacts. | 95 | // Blow away the temporary directory with artifacts. |
@@ -90,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
90 | /// Test the C# compiler error message can be mapped to the correct | 101 | /// Test the C# compiler error message can be mapped to the correct |
91 | /// line/column in the LSL source when an undeclared variable is used. | 102 | /// line/column in the LSL source when an undeclared variable is used. |
92 | /// </summary> | 103 | /// </summary> |
93 | //[Test] | 104 | [Test] |
94 | public void TestUseUndeclaredVariable() | 105 | public void TestUseUndeclaredVariable() |
95 | { | 106 | { |
96 | TestHelpers.InMethod(); | 107 | TestHelpers.InMethod(); |
@@ -106,25 +117,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
106 | }"; | 117 | }"; |
107 | 118 | ||
108 | CSCodeGenerator cg = new CSCodeGenerator(); | 119 | CSCodeGenerator cg = new CSCodeGenerator(); |
109 | string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + | 120 | string output = cg.Convert(input); |
110 | "namespace SecondLife { " + | 121 | |
111 | "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + | 122 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); |
112 | "public Script() { } " + | 123 | // System.Console.WriteLine(output); |
113 | cg.Convert(input) + | 124 | |
114 | "} }\n"; | ||
115 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; | 125 | Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap; |
116 | 126 | ||
117 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 127 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
118 | 128 | // | |
119 | Assert.AreEqual(new KeyValuePair<int, int>(5, 21), | 129 | // foreach (KeyValuePair<int, int> key in positionMap.Keys) |
120 | positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); | 130 | // { |
131 | // KeyValuePair<int, int> val = positionMap[key]; | ||
132 | // | ||
133 | // System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value); | ||
134 | // } | ||
135 | // | ||
136 | // foreach (CompilerError compErr in m_compilerResults.Errors) | ||
137 | // { | ||
138 | // System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr); | ||
139 | // } | ||
140 | |||
141 | Assert.AreEqual( | ||
142 | new KeyValuePair<int, int>(5, 21), | ||
143 | positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]); | ||
121 | } | 144 | } |
122 | 145 | ||
123 | /// <summary> | 146 | /// <summary> |
124 | /// Test that a string can be cast to string and another string | 147 | /// Test that a string can be cast to string and another string |
125 | /// concatenated. | 148 | /// concatenated. |
126 | /// </summary> | 149 | /// </summary> |
127 | //[Test] | 150 | [Test] |
128 | public void TestCastAndConcatString() | 151 | public void TestCastAndConcatString() |
129 | { | 152 | { |
130 | TestHelpers.InMethod(); | 153 | TestHelpers.InMethod(); |
@@ -143,15 +166,21 @@ default | |||
143 | } | 166 | } |
144 | }"; | 167 | }"; |
145 | 168 | ||
169 | // System.Console.WriteLine(input); | ||
146 | CSCodeGenerator cg = new CSCodeGenerator(); | 170 | CSCodeGenerator cg = new CSCodeGenerator(); |
147 | string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + | 171 | string output = cg.Convert(input); |
148 | "namespace SecondLife { " + | 172 | |
149 | "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" + | 173 | output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null); |
150 | "public Script() { } " + | 174 | // System.Console.WriteLine(output); |
151 | cg.Convert(input) + | 175 | |
152 | "} }\n"; | ||
153 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); | 176 | m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output); |
154 | 177 | ||
178 | System.Console.WriteLine("ERRORS: {0}", m_compilerResults.Errors.Count); | ||
179 | foreach (CompilerError compErr in m_compilerResults.Errors) | ||
180 | { | ||
181 | System.Console.WriteLine("Error: {0}", compErr); | ||
182 | } | ||
183 | |||
155 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | 184 | Assert.AreEqual(0, m_compilerResults.Errors.Count); |
156 | } | 185 | } |
157 | } | 186 | } |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 9b86986..ab81dd6 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -30,6 +30,7 @@ using System.IO; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
34 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
35 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
@@ -69,6 +70,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
69 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); | 70 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); |
70 | bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false); | 71 | bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false); |
71 | 72 | ||
73 | string redirectURL = serverConfig.GetString("RedirectURL", string.Empty); | ||
74 | |||
72 | AllowedRemoteDeleteTypes allowedRemoteDeleteTypes; | 75 | AllowedRemoteDeleteTypes allowedRemoteDeleteTypes; |
73 | 76 | ||
74 | if (!allowDelete) | 77 | if (!allowDelete) |
@@ -83,9 +86,11 @@ namespace OpenSim.Server.Handlers.Asset | |||
83 | allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; | 86 | allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; |
84 | } | 87 | } |
85 | 88 | ||
86 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 89 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
87 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 90 | |
88 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes)); | 91 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth, redirectURL)); |
92 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); | ||
93 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth)); | ||
89 | server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); | 94 | server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); |
90 | 95 | ||
91 | MainConsole.Instance.Commands.AddCommand("Assets", false, | 96 | MainConsole.Instance.Commands.AddCommand("Assets", false, |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs index 941b97d..d85d471 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 44 | namespace OpenSim.Server.Handlers.Asset |
@@ -70,6 +71,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
70 | m_allowedTypes = allowedTypes; | 71 | m_allowedTypes = allowedTypes; |
71 | } | 72 | } |
72 | 73 | ||
74 | public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes, IServiceAuth auth) : | ||
75 | base("DELETE", "/assets", auth) | ||
76 | { | ||
77 | m_AssetService = service; | ||
78 | m_allowedTypes = allowedTypes; | ||
79 | } | ||
73 | protected override byte[] ProcessRequest(string path, Stream request, | 80 | protected override byte[] ProcessRequest(string path, Stream request, |
74 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 81 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
75 | { | 82 | { |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs index ed3b4af..91c5c54 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerGetHandler.cs | |||
@@ -38,20 +38,31 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 44 | namespace OpenSim.Server.Handlers.Asset |
44 | { | 45 | { |
45 | public class AssetServerGetHandler : BaseStreamHandler | 46 | public class AssetServerGetHandler : BaseStreamHandler |
46 | { | 47 | { |
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
49 | private IAssetService m_AssetService; | 50 | private IAssetService m_AssetService; |
51 | private string m_RedirectURL; | ||
50 | 52 | ||
51 | public AssetServerGetHandler(IAssetService service) : | 53 | public AssetServerGetHandler(IAssetService service) : |
52 | base("GET", "/assets") | 54 | base("GET", "/assets") |
53 | { | 55 | { |
56 | m_AssetService = service; | ||
57 | } | ||
58 | |||
59 | public AssetServerGetHandler(IAssetService service, IServiceAuth auth, string redirectURL) : | ||
60 | base("GET", "/assets", auth) | ||
61 | { | ||
54 | m_AssetService = service; | 62 | m_AssetService = service; |
63 | m_RedirectURL = redirectURL; | ||
64 | if (!m_RedirectURL.EndsWith("/")) | ||
65 | m_RedirectURL = m_RedirectURL.TrimEnd('/'); | ||
55 | } | 66 | } |
56 | 67 | ||
57 | protected override byte[] ProcessRequest(string path, Stream request, | 68 | protected override byte[] ProcessRequest(string path, Stream request, |
@@ -64,9 +75,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
64 | if (p.Length == 0) | 75 | if (p.Length == 0) |
65 | return result; | 76 | return result; |
66 | 77 | ||
78 | string id = string.Empty; | ||
67 | if (p.Length > 1) | 79 | if (p.Length > 1) |
68 | { | 80 | { |
69 | string id = p[0]; | 81 | id = p[0]; |
70 | string cmd = p[1]; | 82 | string cmd = p[1]; |
71 | 83 | ||
72 | if (cmd == "data") | 84 | if (cmd == "data") |
@@ -117,7 +129,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
117 | { | 129 | { |
118 | // Get the entire asset (metadata + data) | 130 | // Get the entire asset (metadata + data) |
119 | 131 | ||
120 | string id = p[0]; | 132 | id = p[0]; |
121 | AssetBase asset = m_AssetService.Get(id); | 133 | AssetBase asset = m_AssetService.Get(id); |
122 | 134 | ||
123 | if (asset != null) | 135 | if (asset != null) |
@@ -144,6 +156,16 @@ namespace OpenSim.Server.Handlers.Asset | |||
144 | result = new byte[0]; | 156 | result = new byte[0]; |
145 | } | 157 | } |
146 | 158 | ||
159 | if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id)) | ||
160 | { | ||
161 | httpResponse.StatusCode = (int)HttpStatusCode.Redirect; | ||
162 | string rurl = m_RedirectURL; | ||
163 | if (!path.StartsWith("/")) | ||
164 | rurl += "/"; | ||
165 | rurl += path; | ||
166 | httpResponse.AddHeader("Location", rurl); | ||
167 | m_log.DebugFormat("[ASSET GET HANDLER]: Asset not found, redirecting to {0} ({1})", rurl, httpResponse.StatusCode); | ||
168 | } | ||
147 | return result; | 169 | return result; |
148 | } | 170 | } |
149 | } | 171 | } |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs index a77e67d..1c706a7 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerPostHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.Asset | 44 | namespace OpenSim.Server.Handlers.Asset |
@@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
54 | m_AssetService = service; | 55 | m_AssetService = service; |
55 | } | 56 | } |
56 | 57 | ||
58 | public AssetServerPostHandler(IAssetService service, IServiceAuth auth) : | ||
59 | base("POST", "/assets", auth) | ||
60 | { | ||
61 | m_AssetService = service; | ||
62 | } | ||
63 | |||
57 | protected override byte[] ProcessRequest(string path, Stream request, | 64 | protected override byte[] ProcessRequest(string path, Stream request, |
58 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 65 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
59 | { | 66 | { |
diff --git a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs index 6d01f86..32901b3 100644 --- a/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs +++ b/OpenSim/Server/Handlers/Asset/AssetsExistHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenMetaverse; | 43 | using OpenMetaverse; |
43 | 44 | ||
@@ -55,6 +56,12 @@ namespace OpenSim.Server.Handlers.Asset | |||
55 | m_AssetService = service; | 56 | m_AssetService = service; |
56 | } | 57 | } |
57 | 58 | ||
59 | public AssetsExistHandler(IAssetService service, IServiceAuth auth) : | ||
60 | base("POST", "/get_assets_exist", auth) | ||
61 | { | ||
62 | m_AssetService = service; | ||
63 | } | ||
64 | |||
58 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 65 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
59 | { | 66 | { |
60 | XmlSerializer xs; | 67 | XmlSerializer xs; |
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs index 848a037..c9a8dce 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication | |||
58 | Object[] args = new Object[] { config }; | 59 | Object[] args = new Object[] { config }; |
59 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args); | 60 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args); |
60 | 61 | ||
61 | server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig)); | 62 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
63 | |||
64 | server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig, auth)); | ||
62 | } | 65 | } |
63 | } | 66 | } |
64 | } | 67 | } |
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs index 16e011a..5d65f67 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication | |||
55 | private bool m_AllowSetPassword = false; | 56 | private bool m_AllowSetPassword = false; |
56 | 57 | ||
57 | public AuthenticationServerPostHandler(IAuthenticationService service) : | 58 | public AuthenticationServerPostHandler(IAuthenticationService service) : |
58 | this(service, null) {} | 59 | this(service, null, null) {} |
59 | 60 | ||
60 | public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) : | 61 | public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) : |
61 | base("POST", "/auth") | 62 | base("POST", "/auth", auth) |
62 | { | 63 | { |
63 | m_AuthenticationService = service; | 64 | m_AuthenticationService = service; |
64 | 65 | ||
@@ -73,6 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication | |||
73 | protected override byte[] ProcessRequest(string path, Stream request, | 74 | protected override byte[] ProcessRequest(string path, Stream request, |
74 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 75 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
75 | { | 76 | { |
77 | // m_log.Error("[XXX]: Authenticating..."); | ||
76 | string[] p = SplitParams(path); | 78 | string[] p = SplitParams(path); |
77 | 79 | ||
78 | if (p.Length > 0) | 80 | if (p.Length > 0) |
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs index 9a57cd9..1831e84 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Avatar | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args); | 57 | m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs index d6bbb8f..59dbed4 100644 --- a/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Avatar/AvatarServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Avatar | |||
50 | 51 | ||
51 | private IAvatarService m_AvatarService; | 52 | private IAvatarService m_AvatarService; |
52 | 53 | ||
53 | public AvatarServerPostHandler(IAvatarService service) : | 54 | public AvatarServerPostHandler(IAvatarService service, IServiceAuth auth) : |
54 | base("POST", "/avatar") | 55 | base("POST", "/avatar", auth) |
55 | { | 56 | { |
56 | m_AvatarService = service; | 57 | m_AvatarService = service; |
57 | } | 58 | } |
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs index fb4b794..9e703f1 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesGetHandler.cs | |||
@@ -38,6 +38,7 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.BakedTextures | 44 | namespace OpenSim.Server.Handlers.BakedTextures |
@@ -50,14 +51,14 @@ namespace OpenSim.Server.Handlers.BakedTextures | |||
50 | private System.Text.UTF8Encoding utf8 = | 51 | private System.Text.UTF8Encoding utf8 = |
51 | new System.Text.UTF8Encoding(); | 52 | new System.Text.UTF8Encoding(); |
52 | 53 | ||
53 | public BakesServerGetHandler(IBakedTextureService service) : | 54 | public BakesServerGetHandler(IBakedTextureService service, IServiceAuth auth) : |
54 | base("GET", "/bakes") | 55 | base("GET", "/bakes", auth) |
55 | { | 56 | { |
56 | m_BakesService = service; | 57 | m_BakesService = service; |
57 | } | 58 | } |
58 | 59 | ||
59 | public override byte[] Handle(string path, Stream request, | 60 | protected override byte[] ProcessRequest( |
60 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 61 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
61 | { | 62 | { |
62 | string[] p = SplitParams(path); | 63 | string[] p = SplitParams(path); |
63 | 64 | ||
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs index 7bf7641..4c12967 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesHandler.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -59,8 +60,10 @@ namespace OpenSim.Server.Handlers.BakedTextures | |||
59 | m_BakesService = | 60 | m_BakesService = |
60 | ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args); | 61 | ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args); |
61 | 62 | ||
62 | server.AddStreamHandler(new BakesServerGetHandler(m_BakesService)); | 63 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
63 | server.AddStreamHandler(new BakesServerPostHandler(m_BakesService)); | 64 | |
65 | server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth)); | ||
66 | server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth)); | ||
64 | } | 67 | } |
65 | } | 68 | } |
66 | } | 69 | } |
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs index 69adb7f..1aacbc9 100644 --- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs +++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs | |||
@@ -38,27 +38,28 @@ using System.Xml.Serialization; | |||
38 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | 43 | ||
43 | namespace OpenSim.Server.Handlers.BakedTextures | 44 | namespace OpenSim.Server.Handlers.BakedTextures |
44 | { | 45 | { |
45 | public class BakesServerPostHandler : BaseStreamHandler | 46 | public class BakesServerPostHandler : BaseStreamHandler |
46 | { | 47 | { |
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 49 | ||
49 | private IBakedTextureService m_BakesService; | 50 | private IBakedTextureService m_BakesService; |
50 | 51 | ||
51 | private System.Text.UTF8Encoding utf8 = | 52 | private System.Text.UTF8Encoding utf8 = |
52 | new System.Text.UTF8Encoding(); | 53 | new System.Text.UTF8Encoding(); |
53 | 54 | ||
54 | public BakesServerPostHandler(IBakedTextureService service) : | 55 | public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : |
55 | base("POST", "/bakes") | 56 | base("POST", "/bakes", auth) |
56 | { | 57 | { |
57 | m_BakesService = service; | 58 | m_BakesService = service; |
58 | } | 59 | } |
59 | 60 | ||
60 | public override byte[] Handle(string path, Stream request, | 61 | protected override byte[] ProcessRequest( |
61 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 62 | string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
62 | { | 63 | { |
63 | string[] p = SplitParams(path); | 64 | string[] p = SplitParams(path); |
64 | 65 | ||
diff --git a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs index 5784bdf..b0e6c7d 100644 --- a/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs +++ b/OpenSim/Server/Handlers/Friends/FriendServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); | 57 | m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService, auth)); | ||
59 | } | 61 | } |
60 | } | 62 | } |
61 | } | 63 | } |
diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index ca0a24c..d442443 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 41 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
@@ -51,8 +52,8 @@ namespace OpenSim.Server.Handlers.Friends | |||
51 | 52 | ||
52 | private IFriendsService m_FriendsService; | 53 | private IFriendsService m_FriendsService; |
53 | 54 | ||
54 | public FriendsServerPostHandler(IFriendsService service) : | 55 | public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) : |
55 | base("POST", "/friends") | 56 | base("POST", "/friends", auth) |
56 | { | 57 | { |
57 | m_FriendsService = service; | 58 | m_FriendsService = service; |
58 | } | 59 | } |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index 14daf12..6eb6a79 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Grid | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | 57 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new GridServerPostHandler(m_GridService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new GridServerPostHandler(m_GridService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index 37ca5a4..dda4756 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | 44 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
@@ -55,8 +56,8 @@ namespace OpenSim.Server.Handlers.Grid | |||
55 | 56 | ||
56 | private IGridService m_GridService; | 57 | private IGridService m_GridService; |
57 | 58 | ||
58 | public GridServerPostHandler(IGridService service) : | 59 | public GridServerPostHandler(IGridService service, IServiceAuth auth) : |
59 | base("POST", "/grid") | 60 | base("POST", "/grid", auth) |
60 | { | 61 | { |
61 | m_GridService = service; | 62 | m_GridService = service; |
62 | } | 63 | } |
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs index 66f35e3..1e29378 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.ServiceAuth; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | 33 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); | 57 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; |
60 | |||
61 | server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 0b98e9a..006f6ab 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs | |||
@@ -39,6 +39,7 @@ using System.Collections.Generic; | |||
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.ServiceAuth; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
@@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.GridUser | |||
50 | 51 | ||
51 | private IGridUserService m_GridUserService; | 52 | private IGridUserService m_GridUserService; |
52 | 53 | ||
53 | public GridUserServerPostHandler(IGridUserService service) : | 54 | public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) : |
54 | base("POST", "/griduser") | 55 | base("POST", "/griduser", auth) |
55 | { | 56 | { |
56 | m_GridUserService = service; | 57 | m_GridUserService = service; |
57 | } | 58 | } |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index ce975a8..7283237 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Collections.Generic; | |||
33 | using System.IO; | 33 | using System.IO; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
@@ -71,7 +72,9 @@ namespace OpenSim.Server.Handlers.Asset | |||
71 | m_InventoryService = | 72 | m_InventoryService = |
72 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); | 73 | ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); |
73 | 74 | ||
74 | server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService)); | 75 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
76 | |||
77 | server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth)); | ||
75 | } | 78 | } |
76 | } | 79 | } |
77 | 80 | ||
@@ -81,8 +84,8 @@ namespace OpenSim.Server.Handlers.Asset | |||
81 | 84 | ||
82 | private IInventoryService m_InventoryService; | 85 | private IInventoryService m_InventoryService; |
83 | 86 | ||
84 | public XInventoryConnectorPostHandler(IInventoryService service) : | 87 | public XInventoryConnectorPostHandler(IInventoryService service, IServiceAuth auth) : |
85 | base("POST", "/xinventory") | 88 | base("POST", "/xinventory", auth) |
86 | { | 89 | { |
87 | m_InventoryService = service; | 90 | m_InventoryService = service; |
88 | } | 91 | } |
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 4d1729e..a896fdb 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Server.Handlers.Base; | 43 | using OpenSim.Server.Handlers.Base; |
43 | 44 | ||
@@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
79 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); | 80 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); |
80 | 81 | ||
81 | bool proxy = serverConfig.GetBoolean("HasProxy", false); | 82 | bool proxy = serverConfig.GetBoolean("HasProxy", false); |
82 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy)); | 83 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
84 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth)); | ||
83 | 85 | ||
84 | } | 86 | } |
85 | } | 87 | } |
@@ -91,8 +93,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
91 | private IGridService m_GridService; | 93 | private IGridService m_GridService; |
92 | bool m_Proxy; | 94 | bool m_Proxy; |
93 | 95 | ||
94 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : | 96 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) : |
95 | base("POST", "/map") | 97 | base("POST", "/map", auth) |
96 | { | 98 | { |
97 | m_MapService = service; | 99 | m_MapService = service; |
98 | m_GridService = grid; | 100 | m_GridService = grid; |
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs index 899cd8f..7a63c36 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerConnector.cs | |||
@@ -30,6 +30,7 @@ using Nini.Config; | |||
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
35 | namespace OpenSim.Server.Handlers.Presence | 36 | namespace OpenSim.Server.Handlers.Presence |
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Presence | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args); | 57 | m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index abb4b19..0b3b961 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Server.Base; | |||
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
43 | using OpenSim.Framework.ServiceAuth; | ||
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
45 | namespace OpenSim.Server.Handlers.Presence | 46 | namespace OpenSim.Server.Handlers.Presence |
@@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Presence | |||
50 | 51 | ||
51 | private IPresenceService m_PresenceService; | 52 | private IPresenceService m_PresenceService; |
52 | 53 | ||
53 | public PresenceServerPostHandler(IPresenceService service) : | 54 | public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) : |
54 | base("POST", "/presence") | 55 | base("POST", "/presence", auth) |
55 | { | 56 | { |
56 | m_PresenceService = service; | 57 | m_PresenceService = service; |
57 | } | 58 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 06392f7..7291931 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -132,6 +132,10 @@ namespace OpenSim.Server.Handlers.Simulation | |||
132 | // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); | 132 | // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); |
133 | OSDMap args = Utils.GetOSDMap((string)request["body"]); | 133 | OSDMap args = Utils.GetOSDMap((string)request["body"]); |
134 | 134 | ||
135 | bool viaTeleport = true; | ||
136 | if (args.ContainsKey("viaTeleport")) | ||
137 | viaTeleport = args["viaTeleport"].AsBoolean(); | ||
138 | |||
135 | Vector3 position = Vector3.Zero; | 139 | Vector3 position = Vector3.Zero; |
136 | if (args.ContainsKey("position")) | 140 | if (args.ContainsKey("position")) |
137 | position = Vector3.Parse(args["position"].AsString()); | 141 | position = Vector3.Parse(args["position"].AsString()); |
@@ -145,7 +149,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
145 | 149 | ||
146 | string reason; | 150 | string reason; |
147 | string version; | 151 | string version; |
148 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason); | 152 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); |
149 | 153 | ||
150 | responsedata["int_response_code"] = HttpStatusCode.OK; | 154 | responsedata["int_response_code"] = HttpStatusCode.OK; |
151 | 155 | ||
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs index 344b513..e95e3dc 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerConnector.cs | |||
@@ -30,6 +30,7 @@ using Nini.Config; | |||
30 | using OpenSim.Server.Base; | 30 | using OpenSim.Server.Base; |
31 | using OpenSim.Services.Interfaces; | 31 | using OpenSim.Services.Interfaces; |
32 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Framework.ServiceAuth; | ||
33 | using OpenSim.Server.Handlers.Base; | 34 | using OpenSim.Server.Handlers.Base; |
34 | 35 | ||
35 | namespace OpenSim.Server.Handlers.UserAccounts | 36 | namespace OpenSim.Server.Handlers.UserAccounts |
@@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.UserAccounts | |||
55 | Object[] args = new Object[] { config }; | 56 | Object[] args = new Object[] { config }; |
56 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args); | 57 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args); |
57 | 58 | ||
58 | server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig)); | 59 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
60 | |||
61 | server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig, auth)); | ||
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 24c9de6..c87e022 100644 --- a/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Server/Handlers/UserAccounts/UserAccountServerPostHandler.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces; | |||
41 | using OpenSim.Services.UserAccountService; | 41 | using OpenSim.Services.UserAccountService; |
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
44 | using OpenSim.Framework.ServiceAuth; | ||
44 | using OpenMetaverse; | 45 | using OpenMetaverse; |
45 | 46 | ||
46 | namespace OpenSim.Server.Handlers.UserAccounts | 47 | namespace OpenSim.Server.Handlers.UserAccounts |
@@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts | |||
54 | private bool m_AllowSetAccount = false; | 55 | private bool m_AllowSetAccount = false; |
55 | 56 | ||
56 | public UserAccountServerPostHandler(IUserAccountService service) | 57 | public UserAccountServerPostHandler(IUserAccountService service) |
57 | : this(service, null) {} | 58 | : this(service, null, null) {} |
58 | 59 | ||
59 | public UserAccountServerPostHandler(IUserAccountService service, IConfig config) : | 60 | public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) : |
60 | base("POST", "/accounts") | 61 | base("POST", "/accounts", auth) |
61 | { | 62 | { |
62 | m_UserAccountService = service; | 63 | m_UserAccountService = service; |
63 | 64 | ||
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index ee047e0..0996acb 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -39,7 +39,7 @@ using OpenMetaverse; | |||
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class AssetServicesConnector : IAssetService | 42 | public class AssetServicesConnector : BaseServiceConnector, IAssetService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -71,6 +71,7 @@ namespace OpenSim.Services.Connectors | |||
71 | } | 71 | } |
72 | 72 | ||
73 | public AssetServicesConnector(IConfigSource source) | 73 | public AssetServicesConnector(IConfigSource source) |
74 | : base(source, "AssetService") | ||
74 | { | 75 | { |
75 | Initialise(source); | 76 | Initialise(source); |
76 | } | 77 | } |
@@ -117,8 +118,16 @@ namespace OpenSim.Services.Connectors | |||
117 | 118 | ||
118 | if (asset == null) | 119 | if (asset == null) |
119 | { | 120 | { |
120 | asset = SynchronousRestObjectRequester. | 121 | // XXX: Commented out for now since this has either never been properly operational or not for some time |
121 | MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); | 122 | // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. |
123 | // Wasn't noticed before because timeout wasn't actually used. | ||
124 | // Not attempting concurrency setting for now as this omission was discovered in release candidate | ||
125 | // phase for OpenSimulator 0.8. Need to revisit afterwards. | ||
126 | // asset | ||
127 | // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( | ||
128 | // "GET", uri, 0, m_maxAssetRequestConcurrency); | ||
129 | |||
130 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth); | ||
122 | 131 | ||
123 | if (m_Cache != null) | 132 | if (m_Cache != null) |
124 | m_Cache.Cache(asset); | 133 | m_Cache.Cache(asset); |
@@ -148,8 +157,7 @@ namespace OpenSim.Services.Connectors | |||
148 | 157 | ||
149 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 158 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; |
150 | 159 | ||
151 | AssetMetadata asset = SynchronousRestObjectRequester. | 160 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); |
152 | MakeRequest<int, AssetMetadata>("GET", uri, 0); | ||
153 | return asset; | 161 | return asset; |
154 | } | 162 | } |
155 | 163 | ||
@@ -170,7 +178,7 @@ namespace OpenSim.Services.Connectors | |||
170 | 178 | ||
171 | rc.RequestMethod = "GET"; | 179 | rc.RequestMethod = "GET"; |
172 | 180 | ||
173 | Stream s = rc.Request(); | 181 | Stream s = rc.Request(m_Auth); |
174 | 182 | ||
175 | if (s == null) | 183 | if (s == null) |
176 | return null; | 184 | return null; |
@@ -231,7 +239,7 @@ namespace OpenSim.Services.Connectors | |||
231 | m_AssetHandlers.Remove(id); | 239 | m_AssetHandlers.Remove(id); |
232 | } | 240 | } |
233 | handlers.Invoke(a); | 241 | handlers.Invoke(a); |
234 | }, m_maxAssetRequestConcurrency); | 242 | }, m_maxAssetRequestConcurrency, m_Auth); |
235 | 243 | ||
236 | success = true; | 244 | success = true; |
237 | } | 245 | } |
@@ -261,7 +269,7 @@ namespace OpenSim.Services.Connectors | |||
261 | bool[] exist = null; | 269 | bool[] exist = null; |
262 | try | 270 | try |
263 | { | 271 | { |
264 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids); | 272 | exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth); |
265 | } | 273 | } |
266 | catch (Exception) | 274 | catch (Exception) |
267 | { | 275 | { |
@@ -290,8 +298,7 @@ namespace OpenSim.Services.Connectors | |||
290 | string newID; | 298 | string newID; |
291 | try | 299 | try |
292 | { | 300 | { |
293 | newID = SynchronousRestObjectRequester. | 301 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); |
294 | MakeRequest<AssetBase, string>("POST", uri, asset); | ||
295 | } | 302 | } |
296 | catch (Exception e) | 303 | catch (Exception e) |
297 | { | 304 | { |
@@ -337,8 +344,7 @@ namespace OpenSim.Services.Connectors | |||
337 | 344 | ||
338 | string uri = m_ServerURI + "/assets/" + id; | 345 | string uri = m_ServerURI + "/assets/" + id; |
339 | 346 | ||
340 | if (SynchronousRestObjectRequester. | 347 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) |
341 | MakeRequest<AssetBase, bool>("POST", uri, asset)) | ||
342 | { | 348 | { |
343 | if (m_Cache != null) | 349 | if (m_Cache != null) |
344 | m_Cache.Cache(asset); | 350 | m_Cache.Cache(asset); |
@@ -352,8 +358,7 @@ namespace OpenSim.Services.Connectors | |||
352 | { | 358 | { |
353 | string uri = m_ServerURI + "/assets/" + id; | 359 | string uri = m_ServerURI + "/assets/" + id; |
354 | 360 | ||
355 | if (SynchronousRestObjectRequester. | 361 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) |
356 | MakeRequest<int, bool>("DELETE", uri, 0)) | ||
357 | { | 362 | { |
358 | if (m_Cache != null) | 363 | if (m_Cache != null) |
359 | m_Cache.Expire(id); | 364 | m_Cache.Expire(id); |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index 2b77154..c8a4912 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
@@ -32,14 +32,14 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.ServiceAuth; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | 39 | ||
40 | namespace OpenSim.Services.Connectors | 40 | namespace OpenSim.Services.Connectors |
41 | { | 41 | { |
42 | public class AuthenticationServicesConnector : IAuthenticationService | 42 | public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService |
43 | { | 43 | { |
44 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
@@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors | |||
57 | } | 57 | } |
58 | 58 | ||
59 | public AuthenticationServicesConnector(IConfigSource source) | 59 | public AuthenticationServicesConnector(IConfigSource source) |
60 | : base(source, "AuthenticationService") | ||
60 | { | 61 | { |
61 | Initialise(source); | 62 | Initialise(source); |
62 | } | 63 | } |
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors | |||
79 | throw new Exception("Authentication connector init error"); | 80 | throw new Exception("Authentication connector init error"); |
80 | } | 81 | } |
81 | m_ServerURI = serviceURI; | 82 | m_ServerURI = serviceURI; |
83 | |||
84 | base.Initialise(source, "AuthenticationService"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public string Authenticate(UUID principalID, string password, int lifetime) | 87 | public string Authenticate(UUID principalID, string password, int lifetime) |
@@ -92,7 +95,7 @@ namespace OpenSim.Services.Connectors | |||
92 | 95 | ||
93 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 96 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
94 | m_ServerURI + "/auth/plain", | 97 | m_ServerURI + "/auth/plain", |
95 | ServerUtils.BuildQueryString(sendData)); | 98 | ServerUtils.BuildQueryString(sendData), m_Auth); |
96 | 99 | ||
97 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 100 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
98 | reply); | 101 | reply); |
@@ -105,6 +108,7 @@ namespace OpenSim.Services.Connectors | |||
105 | 108 | ||
106 | public bool Verify(UUID principalID, string token, int lifetime) | 109 | public bool Verify(UUID principalID, string token, int lifetime) |
107 | { | 110 | { |
111 | // m_log.Error("[XXX]: Verify"); | ||
108 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 112 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
109 | sendData["LIFETIME"] = lifetime.ToString(); | 113 | sendData["LIFETIME"] = lifetime.ToString(); |
110 | sendData["PRINCIPAL"] = principalID.ToString(); | 114 | sendData["PRINCIPAL"] = principalID.ToString(); |
@@ -114,7 +118,7 @@ namespace OpenSim.Services.Connectors | |||
114 | 118 | ||
115 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 119 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
116 | m_ServerURI + "/auth/plain", | 120 | m_ServerURI + "/auth/plain", |
117 | ServerUtils.BuildQueryString(sendData)); | 121 | ServerUtils.BuildQueryString(sendData), m_Auth); |
118 | 122 | ||
119 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 123 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
120 | reply); | 124 | reply); |
@@ -135,7 +139,7 @@ namespace OpenSim.Services.Connectors | |||
135 | 139 | ||
136 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 140 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
137 | m_ServerURI + "/auth/plain", | 141 | m_ServerURI + "/auth/plain", |
138 | ServerUtils.BuildQueryString(sendData)); | 142 | ServerUtils.BuildQueryString(sendData), m_Auth); |
139 | 143 | ||
140 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 144 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
141 | reply); | 145 | reply); |
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs index 35b7109..63730b3 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs | |||
@@ -105,7 +105,7 @@ namespace OpenSim.Services.Connectors | |||
105 | catch (Exception e) | 105 | catch (Exception e) |
106 | { | 106 | { |
107 | m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); | 107 | m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); |
108 | message = ""; | 108 | message = e.Message; |
109 | return m_ResponseOnFailure; | 109 | return m_ResponseOnFailure; |
110 | } | 110 | } |
111 | if (response == null) | 111 | if (response == null) |
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs index ddfca57..3f44efa 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs | |||
@@ -32,7 +32,7 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.ServiceAuth; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; | 38 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; |
@@ -41,7 +41,7 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
43 | { | 43 | { |
44 | public class AvatarServicesConnector : IAvatarService | 44 | public class AvatarServicesConnector : BaseServiceConnector, IAvatarService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors | |||
59 | } | 59 | } |
60 | 60 | ||
61 | public AvatarServicesConnector(IConfigSource source) | 61 | public AvatarServicesConnector(IConfigSource source) |
62 | : base(source, "AvatarService") | ||
62 | { | 63 | { |
63 | Initialise(source); | 64 | Initialise(source); |
64 | } | 65 | } |
@@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors | |||
81 | throw new Exception("Avatar connector init error"); | 82 | throw new Exception("Avatar connector init error"); |
82 | } | 83 | } |
83 | m_ServerURI = serviceURI; | 84 | m_ServerURI = serviceURI; |
85 | |||
86 | base.Initialise(source, "AvatarService"); | ||
84 | } | 87 | } |
85 | 88 | ||
86 | 89 | ||
@@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors | |||
114 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 117 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
115 | try | 118 | try |
116 | { | 119 | { |
117 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 120 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
118 | if (reply == null || (reply != null && reply == string.Empty)) | 121 | if (reply == null || (reply != null && reply == string.Empty)) |
119 | { | 122 | { |
120 | m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); | 123 | m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); |
@@ -162,7 +165,7 @@ namespace OpenSim.Services.Connectors | |||
162 | //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 165 | //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
163 | try | 166 | try |
164 | { | 167 | { |
165 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 168 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
168 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors | |||
207 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 210 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
208 | try | 211 | try |
209 | { | 212 | { |
210 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 213 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
211 | if (reply != string.Empty) | 214 | if (reply != string.Empty) |
212 | { | 215 | { |
213 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 216 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors | |||
250 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 253 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
251 | try | 254 | try |
252 | { | 255 | { |
253 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 256 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
254 | if (reply != string.Empty) | 257 | if (reply != string.Empty) |
255 | { | 258 | { |
256 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 259 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors | |||
293 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); | 296 | // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); |
294 | try | 297 | try |
295 | { | 298 | { |
296 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 299 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
297 | if (reply != string.Empty) | 300 | if (reply != string.Empty) |
298 | { | 301 | { |
299 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 302 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/Connectors/BaseServiceConnector.cs b/OpenSim/Services/Connectors/BaseServiceConnector.cs new file mode 100644 index 0000000..98cd489 --- /dev/null +++ b/OpenSim/Services/Connectors/BaseServiceConnector.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System; | ||
2 | using OpenSim.Framework; | ||
3 | using OpenSim.Framework.ServiceAuth; | ||
4 | |||
5 | using Nini.Config; | ||
6 | |||
7 | namespace OpenSim.Services.Connectors | ||
8 | { | ||
9 | public class BaseServiceConnector | ||
10 | { | ||
11 | protected IServiceAuth m_Auth; | ||
12 | |||
13 | public BaseServiceConnector() { } | ||
14 | |||
15 | public BaseServiceConnector(IConfigSource config, string section) | ||
16 | { | ||
17 | Initialise(config, section); | ||
18 | } | ||
19 | |||
20 | public void Initialise(IConfigSource config, string section) | ||
21 | { | ||
22 | string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None"); | ||
23 | |||
24 | switch (authType) | ||
25 | { | ||
26 | case "BasicHttpAuthentication": | ||
27 | m_Auth = new BasicHttpAuthentication(config, section); | ||
28 | break; | ||
29 | } | ||
30 | |||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index b1dd84e..74851a9 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | |||
@@ -32,6 +32,7 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.ServiceAuth; | ||
35 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 38 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors.Friends | 42 | namespace OpenSim.Services.Connectors.Friends |
42 | { | 43 | { |
43 | public class FriendsServicesConnector : IFriendsService | 44 | public class FriendsServicesConnector : BaseServiceConnector, IFriendsService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
80 | throw new Exception("Friends connector init error"); | 81 | throw new Exception("Friends connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | base.Initialise(source, "FriendsService"); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
@@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
112 | 114 | ||
113 | try | 115 | try |
114 | { | 116 | { |
115 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 117 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
116 | if (reply != string.Empty) | 118 | if (reply != string.Empty) |
117 | { | 119 | { |
118 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 120 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
168 | string uri = m_ServerURI + "/friends"; | 170 | string uri = m_ServerURI + "/friends"; |
169 | try | 171 | try |
170 | { | 172 | { |
171 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 173 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
172 | } | 174 | } |
173 | catch (Exception e) | 175 | catch (Exception e) |
174 | { | 176 | { |
@@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
223 | string uri = m_ServerURI + "/friends"; | 225 | string uri = m_ServerURI + "/friends"; |
224 | try | 226 | try |
225 | { | 227 | { |
226 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 228 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
227 | } | 229 | } |
228 | catch (Exception e) | 230 | catch (Exception e) |
229 | { | 231 | { |
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 0f5a613..7f86cff 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridServicesConnector : IGridService | 44 | public class GridServicesConnector : BaseServiceConnector, IGridService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("Grid connector init error"); | 81 | throw new Exception("Grid connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | |||
85 | base.Initialise(source, "GridService"); | ||
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
@@ -102,7 +105,7 @@ namespace OpenSim.Services.Connectors | |||
102 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); | 105 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); |
103 | try | 106 | try |
104 | { | 107 | { |
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
106 | if (reply != string.Empty) | 109 | if (reply != string.Empty) |
107 | { | 110 | { |
108 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 111 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -158,7 +161,7 @@ namespace OpenSim.Services.Connectors | |||
158 | try | 161 | try |
159 | { | 162 | { |
160 | string reply | 163 | string reply |
161 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 164 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
162 | 165 | ||
163 | if (reply != string.Empty) | 166 | if (reply != string.Empty) |
164 | { | 167 | { |
@@ -195,7 +198,7 @@ namespace OpenSim.Services.Connectors | |||
195 | 198 | ||
196 | try | 199 | try |
197 | { | 200 | { |
198 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 201 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
199 | } | 202 | } |
200 | catch (Exception e) | 203 | catch (Exception e) |
201 | { | 204 | { |
@@ -238,7 +241,7 @@ namespace OpenSim.Services.Connectors | |||
238 | string uri = m_ServerURI + "/grid"; | 241 | string uri = m_ServerURI + "/grid"; |
239 | try | 242 | try |
240 | { | 243 | { |
241 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
242 | } | 245 | } |
243 | catch (Exception e) | 246 | catch (Exception e) |
244 | { | 247 | { |
@@ -285,7 +288,7 @@ namespace OpenSim.Services.Connectors | |||
285 | { | 288 | { |
286 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 289 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
287 | uri, | 290 | uri, |
288 | ServerUtils.BuildQueryString(sendData)); | 291 | ServerUtils.BuildQueryString(sendData), m_Auth); |
289 | } | 292 | } |
290 | catch (Exception e) | 293 | catch (Exception e) |
291 | { | 294 | { |
@@ -330,7 +333,7 @@ namespace OpenSim.Services.Connectors | |||
330 | { | 333 | { |
331 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 334 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
332 | uri, | 335 | uri, |
333 | ServerUtils.BuildQueryString(sendData)); | 336 | ServerUtils.BuildQueryString(sendData), m_Auth); |
334 | } | 337 | } |
335 | catch (Exception e) | 338 | catch (Exception e) |
336 | { | 339 | { |
@@ -374,7 +377,7 @@ namespace OpenSim.Services.Connectors | |||
374 | { | 377 | { |
375 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 378 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
376 | uri, | 379 | uri, |
377 | ServerUtils.BuildQueryString(sendData)); | 380 | ServerUtils.BuildQueryString(sendData), m_Auth); |
378 | } | 381 | } |
379 | catch (Exception e) | 382 | catch (Exception e) |
380 | { | 383 | { |
@@ -428,7 +431,7 @@ namespace OpenSim.Services.Connectors | |||
428 | { | 431 | { |
429 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 432 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
430 | uri, | 433 | uri, |
431 | ServerUtils.BuildQueryString(sendData)); | 434 | ServerUtils.BuildQueryString(sendData), m_Auth); |
432 | 435 | ||
433 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 436 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
434 | } | 437 | } |
@@ -479,7 +482,7 @@ namespace OpenSim.Services.Connectors | |||
479 | { | 482 | { |
480 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 483 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
481 | uri, | 484 | uri, |
482 | ServerUtils.BuildQueryString(sendData)); | 485 | ServerUtils.BuildQueryString(sendData), m_Auth); |
483 | 486 | ||
484 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 487 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
485 | } | 488 | } |
@@ -530,7 +533,7 @@ namespace OpenSim.Services.Connectors | |||
530 | { | 533 | { |
531 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 534 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
532 | uri, | 535 | uri, |
533 | ServerUtils.BuildQueryString(sendData)); | 536 | ServerUtils.BuildQueryString(sendData), m_Auth); |
534 | 537 | ||
535 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 538 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
536 | } | 539 | } |
@@ -583,7 +586,7 @@ namespace OpenSim.Services.Connectors | |||
583 | { | 586 | { |
584 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 587 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
585 | uri, | 588 | uri, |
586 | ServerUtils.BuildQueryString(sendData)); | 589 | ServerUtils.BuildQueryString(sendData), m_Auth); |
587 | 590 | ||
588 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 591 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
589 | } | 592 | } |
@@ -634,7 +637,7 @@ namespace OpenSim.Services.Connectors | |||
634 | { | 637 | { |
635 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 638 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
636 | uri, | 639 | uri, |
637 | ServerUtils.BuildQueryString(sendData)); | 640 | ServerUtils.BuildQueryString(sendData), m_Auth); |
638 | 641 | ||
639 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 642 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
640 | } | 643 | } |
@@ -685,7 +688,7 @@ namespace OpenSim.Services.Connectors | |||
685 | { | 688 | { |
686 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 689 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
687 | uri, | 690 | uri, |
688 | ServerUtils.BuildQueryString(sendData)); | 691 | ServerUtils.BuildQueryString(sendData), m_Auth); |
689 | } | 692 | } |
690 | catch (Exception e) | 693 | catch (Exception e) |
691 | { | 694 | { |
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index 1a62d2f..ffdd94a 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridUserServicesConnector : IGridUserService | 44 | public class GridUserServicesConnector : BaseServiceConnector, IGridUserService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("GridUser connector init error"); | 81 | throw new Exception("GridUser connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | base.Initialise(source, "GridUserService"); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
@@ -162,7 +164,8 @@ namespace OpenSim.Services.Connectors | |||
162 | { | 164 | { |
163 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 165 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
164 | uri, | 166 | uri, |
165 | reqString); | 167 | reqString, |
168 | m_Auth); | ||
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
168 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -198,7 +201,8 @@ namespace OpenSim.Services.Connectors | |||
198 | { | 201 | { |
199 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 202 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
200 | uri, | 203 | uri, |
201 | reqString); | 204 | reqString, |
205 | m_Auth); | ||
202 | if (reply != string.Empty) | 206 | if (reply != string.Empty) |
203 | { | 207 | { |
204 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 208 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -243,7 +247,8 @@ namespace OpenSim.Services.Connectors | |||
243 | { | 247 | { |
244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 248 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
245 | uri, | 249 | uri, |
246 | reqString); | 250 | reqString, |
251 | m_Auth); | ||
247 | if (reply == null || (reply != null && reply == string.Empty)) | 252 | if (reply == null || (reply != null && reply == string.Empty)) |
248 | { | 253 | { |
249 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); | 254 | m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 85d105e..f86d2f1 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -40,7 +40,7 @@ using OpenMetaverse; | |||
40 | 40 | ||
41 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
42 | { | 42 | { |
43 | public class XInventoryServicesConnector : IInventoryService | 43 | public class XInventoryServicesConnector : BaseServiceConnector, IInventoryService |
44 | { | 44 | { |
45 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -60,6 +60,7 @@ namespace OpenSim.Services.Connectors | |||
60 | } | 60 | } |
61 | 61 | ||
62 | public XInventoryServicesConnector(IConfigSource source) | 62 | public XInventoryServicesConnector(IConfigSource source) |
63 | : base(source, "InventoryService") | ||
63 | { | 64 | { |
64 | Initialise(source); | 65 | Initialise(source); |
65 | } | 66 | } |
@@ -505,7 +506,7 @@ namespace OpenSim.Services.Connectors | |||
505 | lock (m_Lock) | 506 | lock (m_Lock) |
506 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 507 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
507 | m_ServerURI + "/xinventory", | 508 | m_ServerURI + "/xinventory", |
508 | ServerUtils.BuildQueryString(sendData)); | 509 | ServerUtils.BuildQueryString(sendData), m_Auth); |
509 | 510 | ||
510 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 511 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
511 | reply); | 512 | reply); |
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 725204d..677825e 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
@@ -36,6 +36,7 @@ using Nini.Config; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.ServiceAuth; | ||
39 | using OpenSim.Server.Base; | 40 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
41 | using OpenMetaverse; | 42 | using OpenMetaverse; |
@@ -43,7 +44,7 @@ using OpenMetaverse.StructuredData; | |||
43 | 44 | ||
44 | namespace OpenSim.Services.Connectors | 45 | namespace OpenSim.Services.Connectors |
45 | { | 46 | { |
46 | public class MapImageServicesConnector : IMapImageService | 47 | public class MapImageServicesConnector : BaseServiceConnector, IMapImageService |
47 | { | 48 | { |
48 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
49 | LogManager.GetLogger( | 50 | LogManager.GetLogger( |
@@ -84,6 +85,7 @@ namespace OpenSim.Services.Connectors | |||
84 | } | 85 | } |
85 | m_ServerURI = serviceURI; | 86 | m_ServerURI = serviceURI; |
86 | m_ServerURI = serviceURI.TrimEnd('/'); | 87 | m_ServerURI = serviceURI.TrimEnd('/'); |
88 | base.Initialise(source, "MapImageService"); | ||
87 | } | 89 | } |
88 | 90 | ||
89 | public bool RemoveMapTile(int x, int y, out string reason) | 91 | public bool RemoveMapTile(int x, int y, out string reason) |
@@ -101,7 +103,8 @@ namespace OpenSim.Services.Connectors | |||
101 | { | 103 | { |
102 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 104 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
103 | uri, | 105 | uri, |
104 | reqString); | 106 | reqString, |
107 | m_Auth); | ||
105 | if (reply != string.Empty) | 108 | if (reply != string.Empty) |
106 | { | 109 | { |
107 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -163,7 +166,8 @@ namespace OpenSim.Services.Connectors | |||
163 | { | 166 | { |
164 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 167 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
165 | uri, | 168 | uri, |
166 | reqString); | 169 | reqString, |
170 | m_Auth); | ||
167 | if (reply != string.Empty) | 171 | if (reply != string.Empty) |
168 | { | 172 | { |
169 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 173 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index f7d8c53..aade714 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class PresenceServicesConnector : IPresenceService | 44 | public class PresenceServicesConnector : BaseServiceConnector, IPresenceService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("Presence connector init error"); | 81 | throw new Exception("Presence connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | |||
85 | base.Initialise(source, "PresenceService"); | ||
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
@@ -104,7 +107,8 @@ namespace OpenSim.Services.Connectors | |||
104 | { | 107 | { |
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
106 | uri, | 109 | uri, |
107 | reqString); | 110 | reqString, |
111 | m_Auth); | ||
108 | if (reply != string.Empty) | 112 | if (reply != string.Empty) |
109 | { | 113 | { |
110 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -149,7 +153,8 @@ namespace OpenSim.Services.Connectors | |||
149 | { | 153 | { |
150 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 154 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
151 | uri, | 155 | uri, |
152 | reqString); | 156 | reqString, |
157 | m_Auth); | ||
153 | if (reply != string.Empty) | 158 | if (reply != string.Empty) |
154 | { | 159 | { |
155 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 160 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -193,7 +198,8 @@ namespace OpenSim.Services.Connectors | |||
193 | { | 198 | { |
194 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 199 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
195 | uri, | 200 | uri, |
196 | reqString); | 201 | reqString, |
202 | m_Auth); | ||
197 | if (reply != string.Empty) | 203 | if (reply != string.Empty) |
198 | { | 204 | { |
199 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 205 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -238,7 +244,8 @@ namespace OpenSim.Services.Connectors | |||
238 | { | 244 | { |
239 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 245 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
240 | uri, | 246 | uri, |
241 | reqString); | 247 | reqString, |
248 | m_Auth); | ||
242 | if (reply != string.Empty) | 249 | if (reply != string.Empty) |
243 | { | 250 | { |
244 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 251 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -283,7 +290,8 @@ namespace OpenSim.Services.Connectors | |||
283 | { | 290 | { |
284 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 291 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
285 | uri, | 292 | uri, |
286 | reqString); | 293 | reqString, |
294 | m_Auth); | ||
287 | if (reply == null || (reply != null && reply == string.Empty)) | 295 | if (reply == null || (reply != null && reply == string.Empty)) |
288 | { | 296 | { |
289 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); | 297 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); |
@@ -327,7 +335,8 @@ namespace OpenSim.Services.Connectors | |||
327 | { | 335 | { |
328 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 336 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
329 | uri, | 337 | uri, |
330 | reqString); | 338 | reqString, |
339 | m_Auth); | ||
331 | if (reply == null || (reply != null && reply == string.Empty)) | 340 | if (reply == null || (reply != null && reply == string.Empty)) |
332 | { | 341 | { |
333 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); | 342 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index d9fe5a0..099ba98 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -282,7 +282,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason) | 285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) |
286 | { | 286 | { |
287 | reason = "Failed to contact destination"; | 287 | reason = "Failed to contact destination"; |
288 | version = "Unknown"; | 288 | version = "Unknown"; |
@@ -296,6 +296,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
296 | string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; | 296 | string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; |
297 | 297 | ||
298 | OSDMap request = new OSDMap(); | 298 | OSDMap request = new OSDMap(); |
299 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); | ||
299 | request.Add("position", OSD.FromString(position.ToString())); | 300 | request.Add("position", OSD.FromString(position.ToString())); |
300 | if (agentHomeURI != null) | 301 | if (agentHomeURI != null) |
301 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); | 302 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 8110fe5..3f61d9a 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -33,13 +33,14 @@ using System.Reflection; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | 40 | ||
40 | namespace OpenSim.Services.Connectors | 41 | namespace OpenSim.Services.Connectors |
41 | { | 42 | { |
42 | public class UserAccountServicesConnector : IUserAccountService | 43 | public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService |
43 | { | 44 | { |
44 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors | |||
79 | throw new Exception("User account connector init error"); | 80 | throw new Exception("User account connector init error"); |
80 | } | 81 | } |
81 | m_ServerURI = serviceURI; | 82 | m_ServerURI = serviceURI; |
83 | |||
84 | base.Initialise(source, "UserAccountService"); | ||
82 | } | 85 | } |
83 | 86 | ||
84 | public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 87 | public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) |
@@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors | |||
144 | { | 147 | { |
145 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 148 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
146 | uri, | 149 | uri, |
147 | reqString); | 150 | reqString, |
151 | m_Auth); | ||
148 | if (reply == null || (reply != null && reply == string.Empty)) | 152 | if (reply == null || (reply != null && reply == string.Empty)) |
149 | { | 153 | { |
150 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); | 154 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); |
@@ -224,7 +228,8 @@ namespace OpenSim.Services.Connectors | |||
224 | { | 228 | { |
225 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 229 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
226 | uri, | 230 | uri, |
227 | reqString); | 231 | reqString, |
232 | m_Auth); | ||
228 | if (reply == null || (reply != null && reply == string.Empty)) | 233 | if (reply == null || (reply != null && reply == string.Empty)) |
229 | { | 234 | { |
230 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); | 235 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); |
@@ -260,7 +265,8 @@ namespace OpenSim.Services.Connectors | |||
260 | { | 265 | { |
261 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 266 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
262 | uri, | 267 | uri, |
263 | reqString); | 268 | reqString, |
269 | m_Auth); | ||
264 | if (reply != string.Empty) | 270 | if (reply != string.Empty) |
265 | { | 271 | { |
266 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 272 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c6d2ee3..09c7938 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -156,18 +156,18 @@ namespace OpenSim.Services.GridService | |||
156 | 156 | ||
157 | if (MainConsole.Instance != null) | 157 | if (MainConsole.Instance != null) |
158 | { | 158 | { |
159 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 159 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region", |
160 | "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", | 160 | "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", |
161 | "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand); | 161 | "Link a HyperGrid Region. Examples for <ServerURI>: http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand); |
162 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 162 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region", |
163 | "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", | 163 | "link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", |
164 | "Link a hypergrid region (deprecated)", RunCommand); | 164 | "Link a hypergrid region (deprecated)", RunCommand); |
165 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", | 165 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "unlink-region", |
166 | "unlink-region <local name>", | 166 | "unlink-region <local name>", |
167 | "Unlink a hypergrid region", RunCommand); | 167 | "Unlink a hypergrid region", RunCommand); |
168 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>]", | 168 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-mapping", "link-mapping [<x> <y>]", |
169 | "Set local coordinate to map HG regions to", RunCommand); | 169 | "Set local coordinate to map HG regions to", RunCommand); |
170 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks", | 170 | MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "show hyperlinks", "show hyperlinks", |
171 | "List the HG regions", HandleShow); | 171 | "List the HG regions", HandleShow); |
172 | } | 172 | } |
173 | } | 173 | } |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 3de2330..d158537 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Services.HypergridService | |||
122 | } | 122 | } |
123 | 123 | ||
124 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); | 124 | List<XInventoryFolder> tree = GetFolderTree(principalID, suitcase.folderID); |
125 | if (tree == null || (tree != null && tree.Count == 0)) | 125 | if (tree.Count == 0) |
126 | return null; | 126 | return null; |
127 | 127 | ||
128 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 128 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
@@ -164,8 +164,6 @@ namespace OpenSim.Services.HypergridService | |||
164 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); | 164 | m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); |
165 | return null; | 165 | return null; |
166 | } | 166 | } |
167 | |||
168 | m_Database.StoreFolder(suitcase); | ||
169 | 167 | ||
170 | CreateSystemFolders(principalID, suitcase.folderID); | 168 | CreateSystemFolders(principalID, suitcase.folderID); |
171 | } | 169 | } |
@@ -188,6 +186,10 @@ namespace OpenSim.Services.HypergridService | |||
188 | CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards"); | 186 | CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards"); |
189 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) | 187 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) |
190 | CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing"); | 188 | CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing"); |
189 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) | ||
190 | CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); | ||
191 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) | ||
192 | CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites"); | ||
191 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | 193 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) |
192 | CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures"); | 194 | CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures"); |
193 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) | 195 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) |
@@ -208,11 +210,6 @@ namespace OpenSim.Services.HypergridService | |||
208 | CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures"); | 210 | CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures"); |
209 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) | 211 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) |
210 | CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash"); | 212 | CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash"); |
211 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) | ||
212 | CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites"); | ||
213 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) | ||
214 | CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); | ||
215 | |||
216 | } | 213 | } |
217 | 214 | ||
218 | public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 215 | public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) |
@@ -249,7 +246,7 @@ namespace OpenSim.Services.HypergridService | |||
249 | 246 | ||
250 | if (!IsWithinSuitcaseTree(principalID, folderID)) | 247 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
251 | { | 248 | { |
252 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID); | 249 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID); |
253 | return new InventoryCollection(); | 250 | return new InventoryCollection(); |
254 | } | 251 | } |
255 | 252 | ||
@@ -269,7 +266,7 @@ namespace OpenSim.Services.HypergridService | |||
269 | // make sure the given folder exists under the suitcase tree of this user | 266 | // make sure the given folder exists under the suitcase tree of this user |
270 | if (!IsWithinSuitcaseTree(principalID, folderID)) | 267 | if (!IsWithinSuitcaseTree(principalID, folderID)) |
271 | { | 268 | { |
272 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} is not within Suitcase tree", folderID); | 269 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID); |
273 | return new List<InventoryItemBase>(); | 270 | return new List<InventoryItemBase>(); |
274 | } | 271 | } |
275 | 272 | ||
@@ -284,7 +281,7 @@ namespace OpenSim.Services.HypergridService | |||
284 | 281 | ||
285 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 282 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
286 | { | 283 | { |
287 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID); | 284 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); |
288 | return false; | 285 | return false; |
289 | } | 286 | } |
290 | 287 | ||
@@ -306,7 +303,7 @@ namespace OpenSim.Services.HypergridService | |||
306 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); | 303 | //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); |
307 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) | 304 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
308 | { | 305 | { |
309 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID); | 306 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", folder.Name, folder.ID, folder.Owner); |
310 | return false; | 307 | return false; |
311 | } | 308 | } |
312 | 309 | ||
@@ -318,13 +315,13 @@ namespace OpenSim.Services.HypergridService | |||
318 | { | 315 | { |
319 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) | 316 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) |
320 | { | 317 | { |
321 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID); | 318 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner); |
322 | return false; | 319 | return false; |
323 | } | 320 | } |
324 | 321 | ||
325 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) | 322 | if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) |
326 | { | 323 | { |
327 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ParentID); | 324 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); |
328 | return false; | 325 | return false; |
329 | } | 326 | } |
330 | 327 | ||
@@ -349,7 +346,7 @@ namespace OpenSim.Services.HypergridService | |||
349 | // make sure the given folder's parent folder exists under the suitcase tree of this user | 346 | // make sure the given folder's parent folder exists under the suitcase tree of this user |
350 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 347 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
351 | { | 348 | { |
352 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} is not within Suitcase tree", item.Folder); | 349 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); |
353 | return false; | 350 | return false; |
354 | } | 351 | } |
355 | 352 | ||
@@ -362,7 +359,7 @@ namespace OpenSim.Services.HypergridService | |||
362 | { | 359 | { |
363 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 360 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
364 | { | 361 | { |
365 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder); | 362 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); |
366 | return false; | 363 | return false; |
367 | } | 364 | } |
368 | 365 | ||
@@ -378,7 +375,7 @@ namespace OpenSim.Services.HypergridService | |||
378 | { | 375 | { |
379 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) | 376 | if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) |
380 | { | 377 | { |
381 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder); | 378 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); |
382 | return false; | 379 | return false; |
383 | } | 380 | } |
384 | } | 381 | } |
@@ -389,7 +386,7 @@ namespace OpenSim.Services.HypergridService | |||
389 | InventoryItemBase originalItem = base.GetItem(item); | 386 | InventoryItemBase originalItem = base.GetItem(item); |
390 | if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) | 387 | if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) |
391 | { | 388 | { |
392 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", originalItem.Folder); | 389 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); |
393 | return false; | 390 | return false; |
394 | } | 391 | } |
395 | } | 392 | } |
@@ -414,8 +411,8 @@ namespace OpenSim.Services.HypergridService | |||
414 | 411 | ||
415 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) | 412 | if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) |
416 | { | 413 | { |
417 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance", | 414 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetItem: item {0}/{1} (folder {2}) (user {3}) is not within Suitcase tree or Appearance", |
418 | it.Name, it.ID, it.Folder); | 415 | it.Name, it.ID, it.Folder, it.Owner); |
419 | return null; | 416 | return null; |
420 | } | 417 | } |
421 | 418 | ||
@@ -437,8 +434,8 @@ namespace OpenSim.Services.HypergridService | |||
437 | { | 434 | { |
438 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) | 435 | if (!IsWithinSuitcaseTree(f.Owner, f.ID)) |
439 | { | 436 | { |
440 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Folder {0}/{1} is not within Suitcase tree", | 437 | m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", |
441 | f.Name, f.ID); | 438 | f.Name, f.ID, f.Owner); |
442 | return null; | 439 | return null; |
443 | } | 440 | } |
444 | } | 441 | } |
@@ -537,13 +534,13 @@ namespace OpenSim.Services.HypergridService | |||
537 | 534 | ||
538 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) | 535 | private List<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder) |
539 | { | 536 | { |
540 | List<XInventoryFolder> t = null; | 537 | List<XInventoryFolder> t; |
541 | if (m_SuitcaseTrees.TryGetValue(principalID, out t)) | 538 | if (m_SuitcaseTrees.TryGetValue(principalID, out t)) |
542 | return t; | 539 | return t; |
543 | 540 | ||
544 | // Get the tree of the suitcase folder | 541 | // Get the tree of the suitcase folder |
545 | t = GetFolderTreeRecursive(folder); | 542 | t = GetFolderTreeRecursive(folder); |
546 | m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes | 543 | m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5 minutes |
547 | return t; | 544 | return t; |
548 | } | 545 | } |
549 | 546 | ||
@@ -554,8 +551,10 @@ namespace OpenSim.Services.HypergridService | |||
554 | new string[] { "parentFolderID" }, | 551 | new string[] { "parentFolderID" }, |
555 | new string[] { root.ToString() }); | 552 | new string[] { root.ToString() }); |
556 | 553 | ||
557 | if (folders == null || (folders != null && folders.Length == 0)) | 554 | if (folders == null || folders.Length == 0) |
555 | { | ||
558 | return tree; // empty tree | 556 | return tree; // empty tree |
557 | } | ||
559 | else | 558 | else |
560 | { | 559 | { |
561 | foreach (XInventoryFolder f in folders) | 560 | foreach (XInventoryFolder f in folders) |
@@ -588,17 +587,18 @@ namespace OpenSim.Services.HypergridService | |||
588 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); | 587 | List<XInventoryFolder> tree = new List<XInventoryFolder>(); |
589 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder | 588 | tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder |
590 | tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); | 589 | tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); |
590 | |||
591 | // Also add the Current Outfit folder to the list of available folders | 591 | // Also add the Current Outfit folder to the list of available folders |
592 | tree.Add(GetCurrentOutfitXFolder(principalID)); | 592 | XInventoryFolder folder = GetCurrentOutfitXFolder(principalID); |
593 | if (folder != null) | ||
594 | tree.Add(folder); | ||
593 | 595 | ||
594 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) | 596 | XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) |
595 | { | 597 | { |
596 | if (fl.folderID == folderID) return true; | 598 | return (fl.folderID == folderID); |
597 | else return false; | ||
598 | }); | 599 | }); |
599 | 600 | ||
600 | if (f == null) return false; | 601 | return (f != null); |
601 | else return true; | ||
602 | } | 602 | } |
603 | #endregion | 603 | #endregion |
604 | 604 | ||
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 375a35c..8b87ac0 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -83,11 +83,12 @@ namespace OpenSim.Services.Interfaces | |||
83 | /// <param name="destination">Desired destination</param> | 83 | /// <param name="destination">Desired destination</param> |
84 | /// <param name="agentID">The visitor's User ID</param> | 84 | /// <param name="agentID">The visitor's User ID</param> |
85 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | 85 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> |
86 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> | ||
86 | /// <param name="position">Position in the region</param> | 87 | /// <param name="position">Position in the region</param> |
87 | /// <param name="version"></param> | 88 | /// <param name="version"></param> |
88 | /// <param name="reason">[out] Optional error message</param> | 89 | /// <param name="reason">[out] Optional error message</param> |
89 | /// <returns>True: ok; False: not allowed</returns> | 90 | /// <returns>True: ok; False: not allowed</returns> |
90 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason); | 91 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason); |
91 | 92 | ||
92 | /// <summary> | 93 | /// <summary> |
93 | /// Message from receiving region to departing region, telling it got contacted by the client. | 94 | /// Message from receiving region to departing region, telling it got contacted by the client. |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7c16ca9..362ff8f 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -122,10 +122,18 @@ namespace OpenSim.Services.InventoryService | |||
122 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) | 122 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) |
123 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts"); | 123 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts"); |
124 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) | 124 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) |
125 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); | 125 | { |
126 | XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); | ||
127 | folder = CreateFolder(principalID, folder.folderID, (int)AssetType.CallingCard, "Friends"); | ||
128 | CreateFolder(principalID, folder.folderID, (int)AssetType.CallingCard, "All"); | ||
129 | } | ||
126 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) | 130 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) |
127 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); | 131 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); |
128 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | 132 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) |
133 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); | ||
134 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) | ||
135 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.FavoriteFolder, "Favorites"); | ||
136 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | ||
129 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); | 137 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); |
130 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) | 138 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) |
131 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks"); | 139 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks"); |
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 874ff62..342cd06 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -574,7 +574,11 @@ namespace OpenSim.Tests.Common | |||
574 | 574 | ||
575 | public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) | 575 | public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) |
576 | { | 576 | { |
577 | AgentCircuitData acd = GenerateAgentData(agentId); | 577 | return AddChildScenePresence(scene, GenerateAgentData(agentId)); |
578 | } | ||
579 | |||
580 | public static ScenePresence AddChildScenePresence(Scene scene, AgentCircuitData acd) | ||
581 | { | ||
578 | acd.child = true; | 582 | acd.child = true; |
579 | 583 | ||
580 | // XXX: ViaLogin may not be correct for child agents | 584 | // XXX: ViaLogin may not be correct for child agents |
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs index b3f8c36..5a257e9 100644 --- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs +++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | |||
@@ -324,7 +324,29 @@ namespace OpenSim.Tests.Common.Mock | |||
324 | 324 | ||
325 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID) | 325 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID) |
326 | { | 326 | { |
327 | return null; | 327 | XGroup group = GetXGroup(groupID, null); |
328 | |||
329 | if (group == null) | ||
330 | return null; | ||
331 | |||
332 | List<GroupNoticeData> notices = new List<GroupNoticeData>(); | ||
333 | |||
334 | foreach (XGroupNotice notice in group.notices.Values) | ||
335 | { | ||
336 | GroupNoticeData gnd = new GroupNoticeData() | ||
337 | { | ||
338 | NoticeID = notice.noticeID, | ||
339 | Timestamp = notice.timestamp, | ||
340 | FromName = notice.fromName, | ||
341 | Subject = notice.subject, | ||
342 | HasAttachment = notice.hasAttachment, | ||
343 | AssetType = (byte)notice.assetType | ||
344 | }; | ||
345 | |||
346 | notices.Add(gnd); | ||
347 | } | ||
348 | |||
349 | return notices; | ||
328 | } | 350 | } |
329 | 351 | ||
330 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) | 352 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index c2b0935..8eeaf99 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -62,14 +62,23 @@ namespace OpenSim.Tests.Common.Mock | |||
62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; | 62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; |
63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; | 63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; |
64 | public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; | 64 | public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; |
65 | |||
65 | public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate; | 66 | public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate; |
67 | |||
68 | public event OnReceivedChatMessageDelegate OnReceivedChatMessage; | ||
66 | public event Action<GridInstantMessage> OnReceivedInstantMessage; | 69 | public event Action<GridInstantMessage> OnReceivedInstantMessage; |
70 | |||
67 | public event Action<UUID> OnReceivedSendRebakeAvatarTextures; | 71 | public event Action<UUID> OnReceivedSendRebakeAvatarTextures; |
68 | 72 | ||
69 | public delegate void TestClientOnSendRegionTeleportDelegate( | 73 | public delegate void TestClientOnSendRegionTeleportDelegate( |
70 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 74 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
71 | uint locationID, uint flags, string capsURL); | 75 | uint locationID, uint flags, string capsURL); |
72 | 76 | ||
77 | public delegate void OnReceivedChatMessageDelegate( | ||
78 | string message, byte type, Vector3 fromPos, string fromName, | ||
79 | UUID fromAgentID, UUID ownerID, byte source, byte audible); | ||
80 | |||
81 | |||
73 | // disable warning: public events, part of the public API | 82 | // disable warning: public events, part of the public API |
74 | #pragma warning disable 67 | 83 | #pragma warning disable 67 |
75 | 84 | ||
@@ -467,6 +476,34 @@ namespace OpenSim.Tests.Common.Mock | |||
467 | } | 476 | } |
468 | 477 | ||
469 | /// <summary> | 478 | /// <summary> |
479 | /// Trigger chat coming from this connection. | ||
480 | /// </summary> | ||
481 | /// <param name="channel"></param> | ||
482 | /// <param name="type"></param> | ||
483 | /// <param name="message"></param> | ||
484 | public bool Chat(int channel, ChatTypeEnum type, string message) | ||
485 | { | ||
486 | ChatMessage handlerChatFromClient = OnChatFromClient; | ||
487 | |||
488 | if (handlerChatFromClient != null) | ||
489 | { | ||
490 | OSChatMessage args = new OSChatMessage(); | ||
491 | args.Channel = channel; | ||
492 | args.From = Name; | ||
493 | args.Message = message; | ||
494 | args.Type = type; | ||
495 | |||
496 | args.Scene = Scene; | ||
497 | args.Sender = this; | ||
498 | args.SenderUUID = AgentId; | ||
499 | |||
500 | handlerChatFromClient(this, args); | ||
501 | } | ||
502 | |||
503 | return true; | ||
504 | } | ||
505 | |||
506 | /// <summary> | ||
470 | /// Attempt a teleport to the given region. | 507 | /// Attempt a teleport to the given region. |
471 | /// </summary> | 508 | /// </summary> |
472 | /// <param name="regionHandle"></param> | 509 | /// <param name="regionHandle"></param> |
@@ -550,6 +587,9 @@ namespace OpenSim.Tests.Common.Mock | |||
550 | string message, byte type, Vector3 fromPos, string fromName, | 587 | string message, byte type, Vector3 fromPos, string fromName, |
551 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | 588 | UUID fromAgentID, UUID ownerID, byte source, byte audible) |
552 | { | 589 | { |
590 | // Console.WriteLine("mmm {0} {1} {2}", message, Name, AgentId); | ||
591 | if (OnReceivedChatMessage != null) | ||
592 | OnReceivedChatMessage(message, type, fromPos, fromName, fromAgentID, ownerID, source, audible); | ||
553 | } | 593 | } |
554 | 594 | ||
555 | public void SendInstantMessage(GridInstantMessage im) | 595 | public void SendInstantMessage(GridInstantMessage im) |
diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index 0b6ee9c..f1d3649 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs | |||
@@ -64,14 +64,13 @@ namespace OpenSim.Tools.Configger | |||
64 | /// <param name="configSettings"></param> | 64 | /// <param name="configSettings"></param> |
65 | /// <param name="networkInfo"></param> | 65 | /// <param name="networkInfo"></param> |
66 | /// <returns>A configuration that gets passed to modules</returns> | 66 | /// <returns>A configuration that gets passed to modules</returns> |
67 | public IConfigSource LoadConfigSettings() | 67 | public IConfigSource LoadConfigSettings(IConfig startupConfig) |
68 | { | 68 | { |
69 | bool iniFileExists = false; | 69 | bool iniFileExists = false; |
70 | 70 | ||
71 | List<string> sources = new List<string>(); | 71 | List<string> sources = new List<string>(); |
72 | 72 | ||
73 | string iniFileName = "OpenSim.ini"; | 73 | string iniFileName = startupConfig.GetString("inifile", Path.Combine(".", "OpenSim.ini")); |
74 | string iniFilePath = Path.Combine(".", iniFileName); | ||
75 | 74 | ||
76 | if (IsUri(iniFileName)) | 75 | if (IsUri(iniFileName)) |
77 | { | 76 | { |
@@ -80,10 +79,10 @@ namespace OpenSim.Tools.Configger | |||
80 | } | 79 | } |
81 | else | 80 | else |
82 | { | 81 | { |
83 | if (File.Exists(iniFilePath)) | 82 | if (File.Exists(iniFileName)) |
84 | { | 83 | { |
85 | if (!sources.Contains(iniFilePath)) | 84 | if (!sources.Contains(iniFileName)) |
86 | sources.Add(iniFilePath); | 85 | sources.Add(iniFileName); |
87 | } | 86 | } |
88 | } | 87 | } |
89 | 88 | ||
diff --git a/OpenSim/Tools/Configger/Main.cs b/OpenSim/Tools/Configger/Main.cs index 61a12e3..d7d918b 100644 --- a/OpenSim/Tools/Configger/Main.cs +++ b/OpenSim/Tools/Configger/Main.cs | |||
@@ -35,15 +35,16 @@ namespace OpenSim.Tools.Configger | |||
35 | public static int Main(string[] args) | 35 | public static int Main(string[] args) |
36 | { | 36 | { |
37 | ArgvConfigSource argvConfig = new ArgvConfigSource(args); | 37 | ArgvConfigSource argvConfig = new ArgvConfigSource(args); |
38 | |||
38 | argvConfig.AddSwitch("Startup", "format", "f"); | 39 | argvConfig.AddSwitch("Startup", "format", "f"); |
40 | argvConfig.AddSwitch("Startup", "inifile"); | ||
39 | 41 | ||
40 | IConfig startupConfig = argvConfig.Configs["Startup"]; | 42 | IConfig startupConfig = argvConfig.Configs["Startup"]; |
41 | 43 | ||
42 | string format = startupConfig.GetString("format", "ini"); | 44 | string format = startupConfig.GetString("format", "ini"); |
43 | 45 | ||
44 | ConfigurationLoader loader = new ConfigurationLoader(); | 46 | ConfigurationLoader loader = new ConfigurationLoader(); |
45 | 47 | IConfigSource s = loader.LoadConfigSettings(startupConfig); | |
46 | IConfigSource s = loader.LoadConfigSettings(); | ||
47 | 48 | ||
48 | if (format == "mysql") | 49 | if (format == "mysql") |
49 | { | 50 | { |