Merge branch 'master' into httptests

httptests
UbitUmarov 2018-01-05 22:37:42 +00:00
commit 875ca104b8
46 changed files with 936 additions and 178 deletions

View File

@ -93,6 +93,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
xmlSource.Length); xmlSource.Length);
XmlDocument xmlDoc = new XmlDocument(); XmlDocument xmlDoc = new XmlDocument();
xmlDoc.XmlResolver = null;
xmlDoc.LoadXml(xmlSource); xmlDoc.LoadXml(xmlSource);
if (xmlDoc.FirstChild.Name == "Nini") if (xmlDoc.FirstChild.Name == "Nini")
{ {

View File

@ -3138,6 +3138,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (File.Exists(defaultAppearanceFileName)) if (File.Exists(defaultAppearanceFileName))
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
string name = "*unknown*"; string name = "*unknown*";
string email = "anon@anon"; string email = "anon@anon";
uint regionXLocation = 1000; uint regionXLocation = 1000;

View File

@ -83,6 +83,9 @@ namespace OpenSim.Framework.Capabilities
{ {
using (XmlTextReader reader = new XmlTextReader(st)) using (XmlTextReader reader = new XmlTextReader(st))
{ {
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
reader.Read(); reader.Read();
SkipWS(reader); SkipWS(reader);

View File

@ -110,6 +110,7 @@ namespace OpenSim.ConsoleClient
public static void LoginReply(string requestUrl, string requestData, string replyData) public static void LoginReply(string requestUrl, string requestData, string replyData)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(replyData); doc.LoadXml(replyData);
@ -169,6 +170,7 @@ namespace OpenSim.ConsoleClient
public static void ReadResponses(string requestUrl, string requestData, string replyData) public static void ReadResponses(string requestUrl, string requestData, string replyData)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(replyData); doc.LoadXml(replyData);

View File

@ -187,16 +187,18 @@ namespace OpenSim.Framework
if (text == String.Empty) if (text == String.Empty)
return null; return null;
UTF8Encoding enc = new UTF8Encoding();
MemoryStream ms = new MemoryStream(enc.GetBytes(text));
XmlTextReader xreader = new XmlTextReader(ms);
PhysicsInertiaData v = new PhysicsInertiaData();
bool error; bool error;
PhysicsInertiaData v;
UTF8Encoding enc = new UTF8Encoding();
using(MemoryStream ms = new MemoryStream(enc.GetBytes(text)))
using(XmlTextReader xreader = new XmlTextReader(ms))
{
xreader.DtdProcessing = DtdProcessing.Prohibit;
xreader.XmlResolver = null;
v.FromXml2(xreader, out error); v = new PhysicsInertiaData();
v.FromXml2(xreader, out error);
xreader.Close(); }
if (error) if (error)
return null; return null;

View File

@ -1595,6 +1595,9 @@ namespace OpenSim.Framework
{ {
using (XmlTextReader xtr = new XmlTextReader(sr)) using (XmlTextReader xtr = new XmlTextReader(sr))
{ {
xtr.DtdProcessing = DtdProcessing.Prohibit;
xtr.XmlResolver = null;
xtr.MoveToContent(); xtr.MoveToContent();
string type = xtr.GetAttribute("type"); string type = xtr.GetAttribute("type");

View File

@ -156,6 +156,7 @@ namespace OpenSim.Framework.Serialization.External
return xml; return xml;
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(xml); doc.LoadXml(xml);
XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
@ -220,7 +221,7 @@ namespace OpenSim.Framework.Serialization.External
using (StringWriter sw = new StringWriter()) using (StringWriter sw = new StringWriter())
using (XmlTextWriter writer = new XmlTextWriter(sw)) using (XmlTextWriter writer = new XmlTextWriter(sw))
using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null }))
{ {
TransformXml(reader, writer, sceneName, homeURL, userService, scopeID); TransformXml(reader, writer, sceneName, homeURL, userService, scopeID);

View File

@ -178,6 +178,8 @@ namespace OpenSim.Framework.Serialization.External
using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData)))
{ {
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
reader.ReadStartElement("LandData"); reader.ReadStartElement("LandData");
ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader); ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader);

View File

@ -63,6 +63,8 @@ namespace OpenSim.Framework.Serialization.External
StringReader sr = new StringReader(serializedSettings); StringReader sr = new StringReader(serializedSettings);
XmlTextReader xtr = new XmlTextReader(sr); XmlTextReader xtr = new XmlTextReader(sr);
xtr.DtdProcessing = DtdProcessing.Prohibit;
xtr.XmlResolver = null;
xtr.ReadStartElement("RegionSettings"); xtr.ReadStartElement("RegionSettings");

View File

@ -202,6 +202,9 @@ namespace OpenSim.Framework.Serialization.External
using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization))) using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization)))
{ {
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
reader.ReadStartElement("InventoryItem"); reader.ReadStartElement("InventoryItem");
ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>( ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>(

View File

@ -54,6 +54,9 @@ namespace OpenSim.Framework.Servers.HttpServer
TRequest deserial; TRequest deserial;
using (XmlTextReader xmlReader = new XmlTextReader(request)) using (XmlTextReader xmlReader = new XmlTextReader(request))
{ {
xmlReader.DtdProcessing = DtdProcessing.Prohibit;
xmlReader.XmlResolver = null;
XmlSerializer deserializer = new XmlSerializer(typeof (TRequest)); XmlSerializer deserializer = new XmlSerializer(typeof (TRequest));
deserial = (TRequest) deserializer.Deserialize(xmlReader); deserial = (TRequest) deserializer.Deserialize(xmlReader);
} }

View File

@ -210,6 +210,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
try try
{ {
xmlReader.DtdProcessing = DtdProcessing.Prohibit;
xmlReader.XmlResolver = null;
XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject<TRequest>)); XmlSerializer deserializer = new XmlSerializer(typeof(RestSessionObject<TRequest>));
deserial = (RestSessionObject<TRequest>)deserializer.Deserialize(xmlReader); deserial = (RestSessionObject<TRequest>)deserializer.Deserialize(xmlReader);
} }
@ -269,6 +271,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{ {
try try
{ {
xmlReader.DtdProcessing = DtdProcessing.Prohibit;
xmlReader.XmlResolver = null;
XmlSerializer deserializer = new XmlSerializer(typeof(TRequest)); XmlSerializer deserializer = new XmlSerializer(typeof(TRequest));
deserial = (TRequest)deserializer.Deserialize(xmlReader); deserial = (TRequest)deserializer.Deserialize(xmlReader);
} }

View File

@ -671,6 +671,7 @@ namespace OpenSim.Framework
public static string GetFormattedXml(string rawXml) public static string GetFormattedXml(string rawXml)
{ {
XmlDocument xd = new XmlDocument(); XmlDocument xd = new XmlDocument();
xd.XmlResolver=null;
xd.LoadXml(rawXml); xd.LoadXml(rawXml);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@ -306,6 +306,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name); m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name);
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
string stateData = String.Empty; string stateData = String.Empty;
IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>(); IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>();
@ -372,6 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (itemData.TryGetValue(attach.ItemID, out xmlData)) if (itemData.TryGetValue(attach.ItemID, out xmlData))
{ {
d = new XmlDocument(); d = new XmlDocument();
d.XmlResolver=null;
d.LoadXml(xmlData); d.LoadXml(xmlData);
m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID); m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID);
} }

View File

@ -124,6 +124,8 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
{ {
using(XmlTextReader sr = new XmlTextReader(s)) using(XmlTextReader sr = new XmlTextReader(s))
{ {
sr.DtdProcessing = DtdProcessing.Prohibit;
sr.XmlResolver = null;
sr.ReadStartElement("BakedAppearance"); sr.ReadStartElement("BakedAppearance");
while(sr.LocalName == "BakedTexture") while(sr.LocalName == "BakedTexture")
{ {

View File

@ -93,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
Assert.AreEqual(foreignUrl, ncAssetGet.CreatorID); Assert.AreEqual(foreignUrl, ncAssetGet.CreatorID);
string xmlData = Utils.BytesToString(ncAssetGet.Data); string xmlData = Utils.BytesToString(ncAssetGet.Data);
XmlDocument ncAssetGetXmlDoc = new XmlDocument(); XmlDocument ncAssetGetXmlDoc = new XmlDocument();
ncAssetGetXmlDoc.XmlResolver=null;
ncAssetGetXmlDoc.LoadXml(xmlData); ncAssetGetXmlDoc.LoadXml(xmlData);
// Console.WriteLine(ncAssetGetXmlDoc.OuterXml); // Console.WriteLine(ncAssetGetXmlDoc.OuterXml);

View File

@ -38,7 +38,7 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MuteList
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalMuteListServicesConnector")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalMuteListServicesConnector")]
public class LocalMuteListServicesConnector : ISharedRegionModule, IMuteListService public class LocalMuteListServicesConnector : ISharedRegionModule, IMuteListService
@ -66,7 +66,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig moduleConfig = source.Configs["Modules"]; // only active for core mute lists module
IConfig moduleConfig = source.Configs["Messaging"];
if (moduleConfig == null)
return;
if (moduleConfig.GetString("MuteListModule", "None") != "MuteListModuleTst")
return;
moduleConfig = source.Configs["Modules"];
if (moduleConfig == null) if (moduleConfig == null)
return; return;
@ -99,7 +107,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
catch catch
{ {
m_log.Error("[MuteList LOCALCONNECTOR]: Failed to load mute service"); m_log.Error("[MuteList LOCALCONNECTOR]: Failed to load mute service");
return; return;
} }
if (m_service == null) if (m_service == null)

View File

@ -0,0 +1,143 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors;
using OpenMetaverse;
using log4net;
using Mono.Addins;
using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MuteList
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteMuteListServicesConnector")]
public class RemoteMuteListServicesConnector : ISharedRegionModule, IMuteListService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region ISharedRegionModule
private bool m_Enabled = false;
private IMuteListService m_remoteConnector;
public Type ReplaceableInterface
{
get { return null; }
}
public string Name
{
get { return "RemoteMuteListServicesConnector"; }
}
public void Initialise(IConfigSource source)
{
// only active for core mute lists module
IConfig moduleConfig = source.Configs["Messaging"];
if (moduleConfig == null)
return;
if (moduleConfig.GetString("MuteListModule", "None") != "MuteListModuleTst")
return;
moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("MuteListService", "");
if (name == Name)
{
m_remoteConnector = new MuteListServicesConnector(source);
m_Enabled = true;
}
}
}
public void PostInitialise()
{
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
scene.RegisterModuleInterface<IMuteListService>(this);
m_log.InfoFormat("[MUTELIST CONNECTOR]: Enabled for region {0}", scene.RegionInfo.RegionName);
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
}
public void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
}
#endregion
#region IMuteListService
public Byte[] MuteListRequest(UUID agentID, uint crc)
{
if (!m_Enabled)
return null;
return m_remoteConnector.MuteListRequest(agentID, crc);
}
public bool UpdateMute(MuteData mute)
{
if (!m_Enabled)
return false;
return m_remoteConnector.UpdateMute(mute);
}
public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
{
if (!m_Enabled)
return false;
return m_remoteConnector.RemoveMute(agentID, muteID, muteName);
}
#endregion IMuteListService
}
}

View File

@ -1130,6 +1130,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
xtr.DtdProcessing = DtdProcessing.Prohibit;
xtr.XmlResolver = null;
// Loaded metadata will be empty if no information exists in the archive // Loaded metadata will be empty if no information exists in the archive
dearchivedScenes.LoadedCreationDateTime = 0; dearchivedScenes.LoadedCreationDateTime = 0;

View File

@ -93,6 +93,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
StringReader sr = new StringReader(xml); StringReader sr = new StringReader(xml);
XmlTextReader reader = new XmlTextReader(sr); XmlTextReader reader = new XmlTextReader(sr);
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
reader.ReadStartElement("assets"); reader.ReadStartElement("assets");
reader.Read(); reader.Read();

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
MemoryStream stream = new MemoryStream(); MemoryStream stream = new MemoryStream();
XmlTextWriter formatter = new XmlTextWriter(stream, Encoding.UTF8); XmlTextWriter formatter = new XmlTextWriter(stream, Encoding.UTF8);
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(xmlstream); doc.LoadXml(xmlstream);
formatter.Formatting = Formatting.Indented; formatter.Formatting = Formatting.Indented;
doc.WriteContentTo(formatter); doc.WriteContentTo(formatter);

View File

@ -58,7 +58,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
using (XmlTextReader reader = new XmlTextReader(path)) using (XmlTextReader reader = new XmlTextReader(path))
{ {
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
doc.Load(reader); doc.Load(reader);
// if (doc.DocumentElement != null) // if (doc.DocumentElement != null)
// { // {

View File

@ -593,6 +593,8 @@ namespace OpenSim.Region.Framework.Scenes
UTF8Encoding enc = new UTF8Encoding(); UTF8Encoding enc = new UTF8Encoding();
MemoryStream ms = new MemoryStream(enc.GetBytes(text)); MemoryStream ms = new MemoryStream(enc.GetBytes(text));
XmlTextReader xreader = new XmlTextReader(ms); XmlTextReader xreader = new XmlTextReader(ms);
xreader.DtdProcessing = DtdProcessing.Prohibit;
xreader.XmlResolver = null;
SOPVehicle v = new SOPVehicle(); SOPVehicle v = new SOPVehicle();
bool error; bool error;

View File

@ -2389,7 +2389,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
{ {
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null }))
{ {
reader.Read(); reader.Read();
bool isSingleObject = reader.Name != "CoalescedObject"; bool isSingleObject = reader.Name != "CoalescedObject";
@ -2420,6 +2420,7 @@ namespace OpenSim.Region.Framework.Scenes
else else
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(xmlData); doc.LoadXml(xmlData);
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
XmlElement coll = (XmlElement)e; XmlElement coll = (XmlElement)e;

View File

@ -505,6 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (KeyValuePair<UUID, string> state in states) foreach (KeyValuePair<UUID, string> state in states)
{ {
XmlDocument sdoc = new XmlDocument(); XmlDocument sdoc = new XmlDocument();
sdoc.XmlResolver=null;
sdoc.LoadXml(state.Value); sdoc.LoadXml(state.Value);
XmlNodeList rootL = sdoc.GetElementsByTagName("State"); XmlNodeList rootL = sdoc.GetElementsByTagName("State");
XmlNode rootNode = rootL[0]; XmlNode rootNode = rootL[0];
@ -540,6 +541,7 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
try try
{ {
doc.LoadXml(objXMLData); doc.LoadXml(objXMLData);

View File

@ -1994,6 +1994,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SaveScriptedState(XmlTextWriter writer, bool oldIDs) public void SaveScriptedState(XmlTextWriter writer, bool oldIDs)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
Dictionary<UUID,string> states = new Dictionary<UUID,string>(); Dictionary<UUID,string> states = new Dictionary<UUID,string>();
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
@ -2782,7 +2783,7 @@ namespace OpenSim.Region.Framework.Scenes
return RootPart.Torque; return RootPart.Torque;
} }
// This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object // This is used by llMoveToTarget() in an attached object
public void MoveToTarget(Vector3 target, float tau) public void MoveToTarget(Vector3 target, float tau)
{ {
if (IsAttachment) if (IsAttachment)
@ -2790,7 +2791,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
if (avatar != null) if (avatar != null)
avatar.MoveToTarget(target, false, false); avatar.MoveToTarget(target, false, false, tau);
} }
else else
{ {

View File

@ -455,7 +455,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID)) if (m_part.ParentGroup.m_savedScriptState.ContainsKey(stateID))
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]);
////////// CRUFT WARNING /////////////////////////////////// ////////// CRUFT WARNING ///////////////////////////////////

View File

@ -101,7 +101,8 @@ namespace OpenSim.Region.Framework.Scenes
public bool IsGod { get; set; } public bool IsGod { get; set; }
private PresenceType m_presenceType; private PresenceType m_presenceType;
public PresenceType PresenceType { public PresenceType PresenceType
{
get {return m_presenceType;} get {return m_presenceType;}
private set private set
{ {
@ -368,8 +369,28 @@ namespace OpenSim.Region.Framework.Scenes
private Quaternion m_headrotation = Quaternion.Identity; private Quaternion m_headrotation = Quaternion.Identity;
//PauPaw:Proper PID Controler for autopilot************ //PauPaw:Proper PID Controler for autopilot************
public bool MovingToTarget { get; private set; }
public Vector3 MoveToPositionTarget { get; private set; } private bool m_movingToTarget;
public bool MovingToTarget
{
get {return m_movingToTarget;}
private set {m_movingToTarget = value; }
}
private Vector3 m_moveToPositionTarget;
public Vector3 MoveToPositionTarget
{
get {return m_moveToPositionTarget;}
private set {m_moveToPositionTarget = value; }
}
private float m_moveToSpeed;
public float MoveToSpeed
{
get {return m_moveToSpeed;}
private set {m_moveToSpeed = value; }
}
private double m_delayedStop = -1.0; private double m_delayedStop = -1.0;
/// <summary> /// <summary>
@ -1160,7 +1181,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.OnStopAnim += HandleStopAnim; ControllingClient.OnStopAnim += HandleStopAnim;
ControllingClient.OnChangeAnim += avnHandleChangeAnim; ControllingClient.OnChangeAnim += avnHandleChangeAnim;
ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
ControllingClient.OnAutoPilotGo += MoveToTarget; ControllingClient.OnAutoPilotGo += MoveToTargetHandle;
ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles;
// ControllingClient.OnAgentFOV += HandleAgentFOV; // ControllingClient.OnAgentFOV += HandleAgentFOV;
@ -1180,7 +1201,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.OnStopAnim -= HandleStopAnim; ControllingClient.OnStopAnim -= HandleStopAnim;
ControllingClient.OnChangeAnim -= avnHandleChangeAnim; ControllingClient.OnChangeAnim -= avnHandleChangeAnim;
ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls;
ControllingClient.OnAutoPilotGo -= MoveToTarget; ControllingClient.OnAutoPilotGo -= MoveToTargetHandle;
ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles;
// ControllingClient.OnAgentFOV += HandleAgentFOV; // ControllingClient.OnAgentFOV += HandleAgentFOV;
} }
@ -2587,11 +2608,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
bool update_movementflag = false; bool update_movementflag = false;
bool mvToTarget = MovingToTarget; bool mvToTarget = m_movingToTarget;
if (agentData.UseClientAgentPosition) if (agentData.UseClientAgentPosition)
{ {
MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f; m_movingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f;
MoveToPositionTarget = agentData.ClientAgentPosition; m_moveToPositionTarget = agentData.ClientAgentPosition;
m_moveToSpeed = -1f;
} }
int i = 0; int i = 0;
@ -2686,7 +2708,7 @@ namespace OpenSim.Region.Framework.Scenes
update_movementflag = true; update_movementflag = true;
} }
if (MovingToTarget) if (m_movingToTarget)
{ {
// If the user has pressed a key then we want to cancel any move to target. // If the user has pressed a key then we want to cancel any move to target.
if (DCFlagKeyPressed) if (DCFlagKeyPressed)
@ -2787,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
if(MovingToTarget || if(m_movingToTarget ||
(Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying && (Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying &&
Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface) Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface)
) )
@ -2878,7 +2900,7 @@ namespace OpenSim.Region.Framework.Scenes
bool updated = false; bool updated = false;
Vector3 LocalVectorToTarget3D = MoveToPositionTarget - AbsolutePosition; Vector3 LocalVectorToTarget3D = m_moveToPositionTarget - AbsolutePosition;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}", // "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
@ -2891,9 +2913,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
Vector3 hdist = LocalVectorToTarget3D; distanceToTarget = (float)Math.Sqrt(LocalVectorToTarget3D.X * LocalVectorToTarget3D.X +
hdist.Z = 0; LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y);
distanceToTarget = hdist.Length();
} }
// m_log.DebugFormat( // m_log.DebugFormat(
@ -2905,128 +2926,126 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// We are close enough to the target // We are close enough to the target
Velocity = Vector3.Zero; Velocity = Vector3.Zero;
AbsolutePosition = MoveToPositionTarget; AbsolutePosition = m_moveToPositionTarget;
if (Flying) if (Flying)
{ {
if (LandAtTarget) if (LandAtTarget)
Flying = false; Flying = false;
// A horrible hack to stop the avatar dead in its tracks rather than having them overshoot // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot
// the target if flying. // the target if flying.
// We really need to be more subtle (slow the avatar as it approaches the target) or at // We really need to be more subtle (slow the avatar as it approaches the target) or at
// least be able to set collision status once, rather than 5 times to give it enough // least be able to set collision status once, rather than 5 times to give it enough
// weighting so that that PhysicsActor thinks it really is colliding. // weighting so that that PhysicsActor thinks it really is colliding.
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
IsColliding = true; IsColliding = true;
} }
ResetMoveToTarget(); ResetMoveToTarget();
return false; return false;
} }
else
if(m_moveToSpeed > 0 && distanceToTarget <= m_moveToSpeed * Scene.FrameTime)
m_moveToSpeed = distanceToTarget / Scene.FrameTime;
try
{ {
try // move avatar in 3D towards target, in avatar coordinate frame.
// This movement vector gets added to the velocity through AddNewMovement().
// Theoretically we might need a more complex PID approach here if other
// unknown forces are acting on the avatar and we need to adaptively respond
// to such forces, but the following simple approach seems to works fine.
float angle = 0.5f * (float)Math.Atan2(LocalVectorToTarget3D.Y, LocalVectorToTarget3D.X);
Quaternion rot = new Quaternion(0,0, (float)Math.Sin(angle),(float)Math.Cos(angle));
Rotation = rot;
LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(rot); // change to avatar coords
LocalVectorToTarget3D.Normalize();
// update avatar movement flags. the avatar coordinate system is as follows:
//
// +X (forward)
//
// ^
// |
// |
// |
// |
// (left) +Y <--------o--------> -Y
// avatar
// |
// |
// |
// |
// v
// -X
//
// based on the above avatar coordinate system, classify the movement into
// one of left/right/back/forward.
const uint noMovFlagsMask = (uint)(~(Dir_ControlFlags.DIR_CONTROL_FLAG_BACK |
Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD | Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT |
Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT | Dir_ControlFlags.DIR_CONTROL_FLAG_UP |
Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN));
MovementFlag &= noMovFlagsMask;
uint tmpAgentControlFlags = (uint)m_AgentControlFlags;
tmpAgentControlFlags &= noMovFlagsMask;
if (LocalVectorToTarget3D.X < 0) //MoveBack
{ {
// move avatar in 3D at one meter/second towards target, in avatar coordinate frame. MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
// This movement vector gets added to the velocity through AddNewMovement(). tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
// Theoretically we might need a more complex PID approach here if other updated = true;
// unknown forces are acting on the avatar and we need to adaptively respond }
// to such forces, but the following simple approach seems to works fine. else if (LocalVectorToTarget3D.X > 0) //Move Forward
{
LocalVectorToTarget3D = LocalVectorToTarget3D * Quaternion.Inverse(Rotation); // change to avatar coords MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
LocalVectorToTarget3D.Normalize(); updated = true;
}
// update avatar movement flags. the avatar coordinate system is as follows:
//
// +X (forward)
//
// ^
// |
// |
// |
// |
// (left) +Y <--------o--------> -Y
// avatar
// |
// |
// |
// |
// v
// -X
//
// based on the above avatar coordinate system, classify the movement into
// one of left/right/back/forward.
const uint noMovFlagsMask = (uint)(~(Dir_ControlFlags.DIR_CONTROL_FLAG_BACK |
Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD | Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT |
Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT | Dir_ControlFlags.DIR_CONTROL_FLAG_UP |
Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN));
MovementFlag &= noMovFlagsMask;
uint tmpAgentControlFlags = (uint)m_AgentControlFlags;
tmpAgentControlFlags &= noMovFlagsMask;
if (LocalVectorToTarget3D.X < 0) //MoveBack
{
MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
updated = true;
}
else if (LocalVectorToTarget3D.X > 0) //Move Forward
{
MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
updated = true;
}
if (LocalVectorToTarget3D.Y > 0) //MoveLeft
{
MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
updated = true;
}
else if (LocalVectorToTarget3D.Y < 0) //MoveRight
{
MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
updated = true;
}
if (LocalVectorToTarget3D.Z > 0) //Up
{
// Don't set these flags for up or down - doing so will make the avatar crouch or
// keep trying to jump even if walking along level ground
//MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
//AgentControlFlags
//AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
updated = true;
}
else if (LocalVectorToTarget3D.Z < 0) //Down
{
//MovementFlag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
//AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
updated = true;
}
if (LocalVectorToTarget3D.Y > 0) //MoveLeft
{
MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
updated = true;
}
else if (LocalVectorToTarget3D.Y < 0) //MoveRight
{
MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
updated = true;
}
if (LocalVectorToTarget3D.Z > 0) //Up
updated = true;
else if (LocalVectorToTarget3D.Z < 0) //Down
updated = true;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}", // "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}",
// LocalVectorToTarget3D, agent_control_v3, Name); // LocalVectorToTarget3D, agent_control_v3, Name);
m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags; m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags;
if(updated)
agent_control_v3 += LocalVectorToTarget3D; agent_control_v3 += LocalVectorToTarget3D;
} }
catch (Exception e) catch (Exception e)
{ {
//Avoid system crash, can be slower but... //Avoid system crash, can be slower but...
m_log.DebugFormat("Crash! {0}", e.ToString()); m_log.DebugFormat("Crash! {0}", e.ToString());
}
} }
return updated; return updated;
// AddNewMovement(agent_control_v3); // AddNewMovement(agent_control_v3);
} }
public void MoveToTargetHandle(Vector3 pos, bool noFly, bool landAtTarget)
{
MoveToTarget(pos, noFly, landAtTarget);
}
/// <summary> /// <summary>
/// Move to the given target over time. /// Move to the given target over time.
/// </summary> /// </summary>
@ -3039,8 +3058,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="landAtTarget"> /// <param name="landAtTarget">
/// If true and the avatar starts flying during the move then land at the target. /// If true and the avatar starts flying during the move then land at the target.
/// </param> /// </param>
public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget, float tau = -1f)
{ {
m_delayedStop = -1; m_delayedStop = -1;
if (SitGround) if (SitGround)
@ -3073,30 +3092,36 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
terrainHeight += Appearance.AvatarHeight; // so 1.5 * AvatarHeight above ground at target
bool shouldfly = Flying; bool shouldfly = Flying;
if (noFly) if (noFly)
shouldfly = false; shouldfly = false;
else if (pos.Z > terrainHeight || Flying) else if (pos.Z > terrainHeight || Flying)
shouldfly = true; shouldfly = true;
LandAtTarget = landAtTarget;
MovingToTarget = true;
MoveToPositionTarget = pos;
Flying = shouldfly;
// Rotate presence around the z-axis to point in same direction as movement.
// Ignore z component of vector
Vector3 localVectorToTarget3D = pos - AbsolutePosition; Vector3 localVectorToTarget3D = pos - AbsolutePosition;
// m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y); // m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y);
m_movingToTarget = true;
LandAtTarget = landAtTarget;
m_moveToPositionTarget = pos;
if(tau > 0)
{
if(tau < Scene.FrameTime)
tau = Scene.FrameTime;
m_moveToSpeed = localVectorToTarget3D.Length() / tau;
if(m_moveToSpeed < 0.5f) //to tune
m_moveToSpeed = 0.5f;
else if(m_moveToSpeed > 50f)
m_moveToSpeed = 50f;
// Calculate the yaw. SetAlwaysRun = false;
Vector3 angle = new Vector3(0, 0, (float)(Math.Atan2(localVectorToTarget3D.Y, localVectorToTarget3D.X))); }
else
m_moveToSpeed = 4.096f * m_speedModifier;
// m_log.DebugFormat("[SCENE PRESENCE]: Angle is {0}", angle); Flying = shouldfly;
Rotation = Quaternion.CreateFromEulers(angle);
// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation);
Vector3 control = Vector3.Zero; Vector3 control = Vector3.Zero;
if(HandleMoveToTargetUpdate(1f, ref control)) if(HandleMoveToTargetUpdate(1f, ref control))
@ -3110,7 +3135,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); // m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
MovingToTarget = false; m_movingToTarget = false;
m_moveToSpeed = -1f;
// MoveToPositionTarget = Vector3.Zero; // MoveToPositionTarget = Vector3.Zero;
// lock(m_forceToApplyLock) // lock(m_forceToApplyLock)
// m_forceToApplyValid = false; // cancel possible last action // m_forceToApplyValid = false; // cancel possible last action
@ -3294,7 +3320,7 @@ namespace OpenSim.Region.Framework.Scenes
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
} }
if (MovingToTarget) if (m_movingToTarget)
ResetMoveToTarget(); ResetMoveToTarget();
Velocity = Vector3.Zero; Velocity = Vector3.Zero;
@ -3436,7 +3462,7 @@ namespace OpenSim.Region.Framework.Scenes
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
if (MovingToTarget) if (m_movingToTarget)
ResetMoveToTarget(); ResetMoveToTarget();
Velocity = Vector3.Zero; Velocity = Vector3.Zero;
@ -3716,8 +3742,12 @@ namespace OpenSim.Region.Framework.Scenes
if ((vec.Z == 0f) && !Flying) if ((vec.Z == 0f) && !Flying)
direc.Z = 0f; // Prevent camera WASD up. direc.Z = 0f; // Prevent camera WASD up.
bool notmvtrgt = !m_movingToTarget || m_moveToSpeed <= 0;
// odd rescalings // odd rescalings
direc *= 0.032f * 128f * SpeedModifier * thisAddSpeedModifier; if(notmvtrgt)
direc *= 4.096f * SpeedModifier * thisAddSpeedModifier;
else
direc *= m_moveToSpeed;
// m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name);
@ -3735,12 +3765,12 @@ namespace OpenSim.Region.Framework.Scenes
// landing situation, prevent avatar moving or it may fail to land // landing situation, prevent avatar moving or it may fail to land
// animator will handle this condition and do the land // animator will handle this condition and do the land
direc = Vector3.Zero; direc = Vector3.Zero;
else else if(notmvtrgt)
direc *= 4.0f; direc *= 4.0f;
} }
else if (IsColliding) else if (IsColliding)
{ {
if (direc.Z > 2.0f) // reinforce jumps if (direc.Z > 2.0f && notmvtrgt) // reinforce jumps
{ {
direc.Z *= 2.6f; direc.Z *= 2.6f;
} }
@ -3780,7 +3810,7 @@ namespace OpenSim.Region.Framework.Scenes
if (IsInTransit || IsLoggingIn) if (IsInTransit || IsLoggingIn)
return; return;
if(MovingToTarget) if(m_movingToTarget)
{ {
m_delayedStop = -1; m_delayedStop = -1;
Vector3 control = Vector3.Zero; Vector3 control = Vector3.Zero;

View File

@ -133,6 +133,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{ {
using (XmlTextReader reader = new XmlTextReader(sr)) using (XmlTextReader reader = new XmlTextReader(sr))
{ {
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
reader.MoveToContent(); // skip possible xml declaration reader.MoveToContent(); // skip possible xml declaration
if (reader.Name != "CoalescedObject") if (reader.Name != "CoalescedObject")
@ -147,6 +150,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
} }
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(xml); doc.LoadXml(xml);
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
if (e == null) if (e == null)

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData); String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData);
using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null)) using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null))
{ {
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Prohibit, XmlResolver = null }))
{ {
try try
{ {
@ -255,6 +255,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
try try
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
doc.LoadXml(xmlData); doc.LoadXml(xmlData);
XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart");
@ -266,18 +267,29 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
return null; return null;
} }
StringReader sr = new StringReader(parts[0].OuterXml); SceneObjectGroup sceneObject;
XmlTextReader reader = new XmlTextReader(sr); using(StringReader sr = new StringReader(parts[0].OuterXml))
SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); {
reader.Close(); using(XmlTextReader reader = new XmlTextReader(sr))
sr.Close(); {
reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
}
}
// Then deal with the rest // Then deal with the rest
SceneObjectPart part;
for (int i = 1; i < parts.Count; i++) for (int i = 1; i < parts.Count; i++)
{ {
sr = new StringReader(parts[i].OuterXml); using(StringReader sr = new StringReader(parts[i].OuterXml))
reader = new XmlTextReader(sr); {
SceneObjectPart part = SceneObjectPart.FromXml(reader); using(XmlTextReader reader = new XmlTextReader(sr))
{
part = SceneObjectPart.FromXml(reader);
}
}
int originalLinkNum = part.LinkNum; int originalLinkNum = part.LinkNum;
@ -288,8 +300,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (originalLinkNum != 0) if (originalLinkNum != 0)
part.LinkNum = originalLinkNum; part.LinkNum = originalLinkNum;
reader.Close();
sr.Close();
} }
XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion"); XmlNodeList keymotion = doc.GetElementsByTagName("KeyframeMotion");

View File

@ -49,14 +49,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
XmlNode rootNode; XmlNode rootNode;
if (fileName.StartsWith("http:") || File.Exists(fileName)) if (fileName.StartsWith("http:") || File.Exists(fileName))
{ {
XmlTextReader reader = new XmlTextReader(fileName); using(XmlTextReader reader = new XmlTextReader(fileName))
reader.WhitespaceHandling = WhitespaceHandling.None; {
doc.Load(reader); reader.WhitespaceHandling = WhitespaceHandling.None;
reader.Close(); reader.DtdProcessing = DtdProcessing.Prohibit;
reader.XmlResolver = null;
doc.Load(reader);
}
rootNode = doc.FirstChild; rootNode = doc.FirstChild;
foreach (XmlNode aPrimNode in rootNode.ChildNodes) foreach (XmlNode aPrimNode in rootNode.ChildNodes)
{ {

View File

@ -196,13 +196,15 @@ namespace OpenSim.Region.Framework.Scenes
// ITerrainChannel.LoadFromXmlString() // ITerrainChannel.LoadFromXmlString()
public void LoadFromXmlString(string data) public void LoadFromXmlString(string data)
{ {
StringReader sr = new StringReader(data); using(StringReader sr = new StringReader(data))
XmlTextReader reader = new XmlTextReader(sr); {
reader.Read(); using(XmlTextReader reader = new XmlTextReader(sr))
{
ReadXml(reader); reader.DtdProcessing = DtdProcessing.Prohibit;
reader.Close(); reader.XmlResolver = null;
sr.Close(); ReadXml(reader);
}
}
} }
// ITerrainChannel.Merge // ITerrainChannel.Merge

View File

@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X)); Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X));
m_scene.Update(10); m_scene.Update(50);
double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos);
Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move"); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move");
@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y));
Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
m_scene.Update(10); m_scene.Update(50);
distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos);
Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move"); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move");

View File

@ -1125,6 +1125,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
return null; return null;
doc = new XmlDocument(); doc = new XmlDocument();
doc.XmlResolver = null;
// Let's serialize all calls to Vivox. Most of these are driven by // Let's serialize all calls to Vivox. Most of these are driven by
// the clients (CAPs), when the user arrives at the region. We don't // the clients (CAPs), when the user arrives at the region. We don't
@ -1146,7 +1147,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse())
using (Stream s = rsp.GetResponseStream()) using (Stream s = rsp.GetResponseStream())
using (XmlTextReader rdr = new XmlTextReader(s)) using (XmlTextReader rdr = new XmlTextReader(s))
doc.Load(rdr); {
rdr.DtdProcessing = DtdProcessing.Prohibit;
rdr.XmlResolver = null;
doc.Load(rdr);
}
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -207,6 +207,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public static void Deserialize(string xml, ScriptInstance instance) public static void Deserialize(string xml, ScriptInstance instance)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
Dictionary<string, object> vars = instance.GetVars(); Dictionary<string, object> vars = instance.GetVars();

View File

@ -2098,6 +2098,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string xml = instance.GetXMLState(); string xml = instance.GetXMLState();
XmlDocument sdoc = new XmlDocument(); XmlDocument sdoc = new XmlDocument();
sdoc.XmlResolver=null;
bool loadedState = true; bool loadedState = true;
try try
{ {
@ -2253,6 +2254,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false; return false;
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver=null;
try try
{ {

View File

@ -513,7 +513,7 @@ namespace OpenSim.Server.Base
Dictionary<string, object> ret = new Dictionary<string, object>(); Dictionary<string, object> ret = new Dictionary<string, object>();
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
try try
{ {
doc.LoadXml(data); doc.LoadXml(data);

View File

@ -56,7 +56,7 @@ namespace OpenSim.Server.Handlers.GridUser
Object[] args = new Object[] { config }; Object[] args = new Object[] { config };
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args); m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args);
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ; IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth)); server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth));
} }

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
namespace OpenSim.Server.Handlers.GridUser
{
public class MuteListServiceConnector : ServiceConnector
{
private IMuteListService m_MuteListService;
private string m_ConfigName = "MuteListService";
public MuteListServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
string service = serverConfig.GetString("LocalServiceModule", String.Empty);
if (service == String.Empty)
throw new Exception("LocalServiceModule not present in MuteListService config file MuteListService section");
Object[] args = new Object[] { config };
m_MuteListService = ServerUtils.LoadPlugin<IMuteListService>(service, args);
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
server.AddStreamHandler(new MuteListServerPostHandler(m_MuteListService, auth));
}
}
}

View File

@ -0,0 +1,240 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using Nini.Config;
using log4net;
using System;
using System.Reflection;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse;
namespace OpenSim.Server.Handlers.GridUser
{
public class MuteListServerPostHandler : BaseStreamHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IMuteListService m_service;
public MuteListServerPostHandler(IMuteListService service, IServiceAuth auth) :
base("POST", "/mutelist", auth)
{
m_service = service;
}
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);
string method = string.Empty;
try
{
Dictionary<string, object> request =
ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
return FailureResult();
method = request["METHOD"].ToString();
switch (method)
{
case "get":
return getmutes(request);
case "update":
return updatemute(request);
case "delete":
return deletemute(request);
}
m_log.DebugFormat("[MUTELIST HANDLER]: unknown method request: {0}", method);
}
catch (Exception e)
{
m_log.DebugFormat("[MUTELIST HANDLER]: Exception in method {0}: {1}", method, e);
}
return FailureResult();
}
byte[] getmutes(Dictionary<string, object> request)
{
if(!request.ContainsKey("agentid") || !request.ContainsKey("mutecrc"))
return FailureResult();
UUID agentID;
if(!UUID.TryParse(request["agentid"].ToString(), out agentID))
return FailureResult();
uint mutecrc;
if(!UInt32.TryParse(request["mutecrc"].ToString(), out mutecrc))
return FailureResult();
byte[] data = m_service.MuteListRequest(agentID, mutecrc);
Dictionary<string, object> result = new Dictionary<string, object>();
result["result"] = Convert.ToBase64String(data);
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString);
return Util.UTF8NoBomEncoding.GetBytes(xmlString);
}
byte[] updatemute(Dictionary<string, object> request)
{
if(!request.ContainsKey("agentid") || !request.ContainsKey("muteid"))
return FailureResult();
MuteData mute = new MuteData();
if( !UUID.TryParse(request["agentid"].ToString(), out mute.AgentID))
return FailureResult();
if(!UUID.TryParse(request["muteid"].ToString(), out mute.MuteID))
return FailureResult();
if(request.ContainsKey("mutename"))
{
mute.MuteName = request["mutename"].ToString();
}
else
mute.MuteName = String.Empty;
if(request.ContainsKey("mutetype"))
{
if(!Int32.TryParse(request["mutetype"].ToString(), out mute.MuteType))
return FailureResult();
}
else
mute.MuteType = 0;
if(request.ContainsKey("muteflags"))
{
if(!Int32.TryParse(request["muteflags"].ToString(), out mute.MuteFlags))
return FailureResult();
}
else
mute.MuteFlags = 0;
if(request.ContainsKey("mutestamp"))
{
if(!Int32.TryParse(request["mutestamp"].ToString(), out mute.Stamp))
return FailureResult();
}
else
mute.Stamp = Util.UnixTimeSinceEpoch();
return m_service.UpdateMute(mute) ? SuccessResult() : FailureResult();
}
byte[] deletemute(Dictionary<string, object> request)
{
if(!request.ContainsKey("agentid") || !request.ContainsKey("muteid"))
return FailureResult();
UUID agentID;
if( !UUID.TryParse(request["agentid"].ToString(), out agentID))
return FailureResult();
UUID muteID;
if(!UUID.TryParse(request["muteid"].ToString(), out muteID))
return FailureResult();
string muteName;
if(request.ContainsKey("mutename"))
{
muteName = request["mutename"].ToString();
}
else
muteName = String.Empty;
return m_service.RemoveMute(agentID, muteID, muteName) ? SuccessResult() : FailureResult();
}
private byte[] SuccessResult()
{
XmlDocument doc = new XmlDocument();
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
"", "");
doc.AppendChild(xmlnode);
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
"");
doc.AppendChild(rootElement);
XmlElement result = doc.CreateElement("", "result", "");
result.AppendChild(doc.CreateTextNode("Success"));
rootElement.AppendChild(result);
return Util.DocToBytes(doc);
}
private byte[] FailureResult()
{
XmlDocument doc = new XmlDocument();
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
"", "");
doc.AppendChild(xmlnode);
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
"");
doc.AppendChild(rootElement);
XmlElement result = doc.CreateElement("", "result", "");
result.AppendChild(doc.CreateTextNode("Failure"));
rootElement.AppendChild(result);
return Util.DocToBytes(doc);
}
}
}

View File

@ -0,0 +1,183 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using log4net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base;
using OpenMetaverse;
namespace OpenSim.Services.Connectors
{
public class MuteListServicesConnector : BaseServiceConnector, IMuteListService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_ServerURI = String.Empty;
public MuteListServicesConnector()
{
}
public MuteListServicesConnector(string serverURI)
{
m_ServerURI = serverURI.TrimEnd('/') + "/mutelist";
}
public MuteListServicesConnector(IConfigSource source)
{
Initialise(source);
}
public virtual void Initialise(IConfigSource source)
{
IConfig gridConfig = source.Configs["MuteListService"];
if (gridConfig == null)
{
m_log.Error("[MUTELIST CONNECTOR]: MuteListService missing from configuration");
throw new Exception("MuteList connector init error");
}
string serviceURI = gridConfig.GetString("MuteListServerURI",
String.Empty);
if (serviceURI == String.Empty)
{
m_log.Error("[GRID USER CONNECTOR]: No Server URI named in section GridUserService");
throw new Exception("GridUser connector init error");
}
m_ServerURI = serviceURI + "/mutelist";;
base.Initialise(source, "MuteListService");
}
#region IMuteListService
public Byte[] MuteListRequest(UUID agentID, uint crc)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "get";
sendData["agentid"] = agentID.ToString();
sendData["mutecrc"] = crc.ToString();
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI,
ServerUtils.BuildQueryString(sendData), m_Auth);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("result"))
{
string datastr = replyData["result"].ToString();
if(String.IsNullOrWhiteSpace(datastr))
return null;
return Convert.FromBase64String(datastr);
}
else
m_log.DebugFormat("[MUTELIST CONNECTOR]: get reply data does not contain result field");
}
else
m_log.DebugFormat("[MUTELIST CONNECTOR]: get received empty reply");
}
catch (Exception e)
{
m_log.DebugFormat("[MUTELIST CONNECTOR]: Exception when contacting server at {0}: {1}", m_ServerURI, e.Message);
}
return null;
}
public bool UpdateMute(MuteData mute)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "update";
sendData["agentid"] = mute.AgentID.ToString();
sendData["muteid"] = mute.MuteID.ToString();
if(mute.MuteType != 0)
sendData["mutetype"] = mute.MuteType.ToString();
if(mute.MuteFlags != 0)
sendData["muteflags"] = mute.MuteFlags.ToString();
sendData["mutestamp"] = mute.Stamp.ToString();
if(!String.IsNullOrEmpty(mute.MuteName))
sendData["mutename"] = mute.MuteName;
return doSimplePost(ServerUtils.BuildQueryString(sendData), "update");
}
public bool RemoveMute(UUID agentID, UUID muteID, string muteName)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "delete";
sendData["agentid"] = agentID.ToString();
sendData["muteid"] = muteID.ToString();
if(!String.IsNullOrEmpty(muteName))
sendData["mutename"] = muteName;
return doSimplePost(ServerUtils.BuildQueryString(sendData), "remove");
}
#endregion IMuteListService
private bool doSimplePost(string reqString, string meth)
{
try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString, m_Auth);
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.ContainsKey("result"))
{
if (replyData["result"].ToString().ToLower() == "success")
return true;
else
return false;
}
else
m_log.DebugFormat("[MUTELIST CONNECTOR]: {0} reply data does not contain result field", meth);
}
else
m_log.DebugFormat("[MUTELIST CONNECTOR]: {0} received empty reply", meth);
}
catch (Exception e)
{
m_log.DebugFormat("[MUTELIST CONNECTOR]: Exception when contacting server at {0}: {1}", m_ServerURI, e.Message);
}
return false;
}
}
}

View File

@ -110,6 +110,8 @@
;; Uncomment if you want to have centralized estate data ;; Uncomment if you want to have centralized estate data
; EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector" ; EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector"
MuteListConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:MuteListServiceConnector"
;; Additions for Hypergrid ;; Additions for Hypergrid
GatekeeperServiceInConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector" GatekeeperServiceInConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector"
@ -815,3 +817,6 @@
LocalServiceModule = "OpenSim.Server.Handlers.dll:XBakes" LocalServiceModule = "OpenSim.Server.Handlers.dll:XBakes"
;; This directory must be writable by the user ROBUST runs as. It will be created automatically. ;; This directory must be writable by the user ROBUST runs as. It will be created automatically.
BaseDirectory = "./bakes" BaseDirectory = "./bakes"
[MuteListService]
LocalServiceModule = "OpenSim.Services.MuteListService.dll:MuteListService"

View File

@ -101,6 +101,8 @@
;; Uncomment if you want to have centralized estate data ;; Uncomment if you want to have centralized estate data
; EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector" ; EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector"
MuteListConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:MuteListServiceConnector"
; * This is common for all services, it's the network setup for the entire ; * This is common for all services, it's the network setup for the entire
; * server instance, if none is specified above ; * server instance, if none is specified above
; * ; *
@ -569,3 +571,6 @@
LocalServiceModule = "OpenSim.Server.Handlers.dll:XBakes" LocalServiceModule = "OpenSim.Server.Handlers.dll:XBakes"
;; This directory must be writable by the user ROBUST runs as. It will be created automatically. ;; This directory must be writable by the user ROBUST runs as. It will be created automatically.
BaseDirectory = "./bakes" BaseDirectory = "./bakes"
[MuteListService]
LocalServiceModule = "OpenSim.Services.MuteListService.dll:MuteListService"

View File

@ -25,7 +25,8 @@
LandServices = "RemoteLandServicesConnector" LandServices = "RemoteLandServicesConnector"
MapImageService = "MapImageServiceModule" MapImageService = "MapImageServiceModule"
SearchModule = "BasicSearchModule" SearchModule = "BasicSearchModule"
MuteListService = "RemoteMuteListServicesConnector"
LandServiceInConnector = true LandServiceInConnector = true
NeighbourServiceInConnector = true NeighbourServiceInConnector = true
SimulationServiceInConnector = true SimulationServiceInConnector = true

View File

@ -244,3 +244,6 @@
;; Capability assigned by the grid administrator for the simulator ;; Capability assigned by the grid administrator for the simulator
;; SimulatorCapability = "00000000-0000-0000-0000-000000000000" ;; SimulatorCapability = "00000000-0000-0000-0000-000000000000"
[MuteListService]
MuteListServerURI = "${Const|BaseURL}:${Const|PrivatePort}"

View File

@ -30,7 +30,8 @@
MapImageService = "MapImageServiceModule" MapImageService = "MapImageServiceModule"
UserManagementModule = "HGUserManagementModule" UserManagementModule = "HGUserManagementModule"
SearchModule = "BasicSearchModule" SearchModule = "BasicSearchModule"
MuteListService = "RemoteMuteListServicesConnector"
LandServiceInConnector = true LandServiceInConnector = true
NeighbourServiceInConnector = true NeighbourServiceInConnector = true
SimulationServiceInConnector = true SimulationServiceInConnector = true