Merge branch 'master' into 0.8-post-fixes
commit
3f703ae1cb
|
@ -127,12 +127,14 @@ what it is today.
|
|||
* maimedleech
|
||||
* Mana Janus
|
||||
* MarcelEdward
|
||||
* Matt Lehmann
|
||||
* Mic Bowman
|
||||
* Michelle Argus
|
||||
* Michael Cortez (The Flotsam Project, http://osflotsam.org/)
|
||||
* Micheil Merlin
|
||||
* Mike Osias (IBM)
|
||||
* Mike Pitman (IBM)
|
||||
* mikemig
|
||||
* mikkopa/_someone - RealXtend
|
||||
* Misterblue
|
||||
* Mircea Kitsune
|
||||
|
|
|
@ -56,8 +56,8 @@ namespace OpenSim.Groups
|
|||
private IGroupsServicesConnector m_groupData = null;
|
||||
|
||||
// Config Options
|
||||
private bool m_groupMessagingEnabled = false;
|
||||
private bool m_debugEnabled = true;
|
||||
private bool m_groupMessagingEnabled;
|
||||
private bool m_debugEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, module only tries to send group IMs to online users by querying cached presence information.
|
||||
|
@ -120,7 +120,7 @@ namespace OpenSim.Groups
|
|||
return;
|
||||
}
|
||||
|
||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
||||
m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled);
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[Groups.Messaging]: GroupsMessagingModule enabled with MessageOnlineOnly = {0}, DebugEnabled = {1}",
|
||||
|
@ -140,6 +140,14 @@ namespace OpenSim.Groups
|
|||
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||
scene.EventManager.OnClientLogin += OnClientLogin;
|
||||
|
||||
scene.AddCommand(
|
||||
"Debug",
|
||||
this,
|
||||
"debug groups messaging verbose",
|
||||
"debug groups messaging verbose <true|false>",
|
||||
"This setting turns on very verbose groups messaging debugging",
|
||||
HandleDebugGroupsMessagingVerbose);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -227,6 +235,26 @@ namespace OpenSim.Groups
|
|||
|
||||
#endregion
|
||||
|
||||
private void HandleDebugGroupsMessagingVerbose(object modules, string[] args)
|
||||
{
|
||||
if (args.Length < 5)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
|
||||
return;
|
||||
}
|
||||
|
||||
bool verbose = false;
|
||||
if (!bool.TryParse(args[4], out verbose))
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
|
||||
return;
|
||||
}
|
||||
|
||||
m_debugEnabled = verbose;
|
||||
|
||||
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not really needed, but does confirm that the group exists.
|
||||
/// </summary>
|
||||
|
@ -255,6 +283,8 @@ namespace OpenSim.Groups
|
|||
public void SendMessageToGroup(
|
||||
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
|
||||
{
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
UUID fromAgentID = new UUID(im.fromAgentID);
|
||||
|
||||
// Unlike current XmlRpcGroups, Groups V2 can accept UUID.Zero when a perms check for the requesting agent
|
||||
|
@ -287,8 +317,6 @@ namespace OpenSim.Groups
|
|||
// "[Groups.Messaging]: SendMessageToGroup called for group {0} with {1} visible members, {2} online",
|
||||
// groupID, groupMembersCount, groupMembers.Count());
|
||||
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
im.imSessionID = groupID.Guid;
|
||||
im.fromGroup = true;
|
||||
IClientAPI thisClient = GetActiveClient(fromAgentID);
|
||||
|
|
|
@ -32,10 +32,12 @@ using System.Reflection;
|
|||
using System.Text;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
|
@ -44,17 +46,33 @@ namespace OpenSim.Groups
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ServerURI;
|
||||
private string m_SecretKey;
|
||||
private IServiceAuth m_Auth;
|
||||
private object m_Lock = new object();
|
||||
|
||||
public GroupsServiceRemoteConnector(string url, string secret)
|
||||
public GroupsServiceRemoteConnector(IConfigSource config)
|
||||
{
|
||||
IConfig groupsConfig = config.Configs["Groups"];
|
||||
string url = groupsConfig.GetString("GroupsServerURI", string.Empty);
|
||||
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
|
||||
|
||||
m_ServerURI = url;
|
||||
if (!m_ServerURI.EndsWith("/"))
|
||||
m_ServerURI += "/";
|
||||
|
||||
m_SecretKey = secret;
|
||||
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, secret key {1}", m_ServerURI, m_SecretKey);
|
||||
/// This is from BaseServiceConnector
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Groups" }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
m_Auth = new BasicHttpAuthentication(config, "Groups");
|
||||
break;
|
||||
}
|
||||
///
|
||||
|
||||
m_log.DebugFormat("[Groups.RemoteConnector]: Groups server at {0}, authentication {1}",
|
||||
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
|
||||
}
|
||||
|
||||
public ExtendedGroupRecord CreateGroup(string RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment,
|
||||
|
@ -656,14 +674,13 @@ namespace OpenSim.Groups
|
|||
private Dictionary<string, object> MakeRequest(string method, Dictionary<string, object> sendData)
|
||||
{
|
||||
sendData["METHOD"] = method;
|
||||
if (m_SecretKey != string.Empty)
|
||||
sendData["KEY"] = m_SecretKey;
|
||||
|
||||
string reply = string.Empty;
|
||||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "groups",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData),
|
||||
m_Auth);
|
||||
|
||||
if (reply == string.Empty)
|
||||
return null;
|
||||
|
|
|
@ -72,13 +72,7 @@ namespace OpenSim.Groups
|
|||
|
||||
private void Init(IConfigSource config)
|
||||
{
|
||||
IConfig groupsConfig = config.Configs["Groups"];
|
||||
string url = groupsConfig.GetString("GroupsServerURI", string.Empty);
|
||||
if (!Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
throw new Exception(string.Format("[Groups.RemoteConnector]: Malformed groups server URL {0}. Fix it or disable the Groups feature.", url));
|
||||
|
||||
string secret = groupsConfig.GetString("SecretKey", string.Empty);
|
||||
m_GroupsService = new GroupsServiceRemoteConnector(url, secret);
|
||||
m_GroupsService = new GroupsServiceRemoteConnector(config);
|
||||
m_Scenes = new List<Scene>();
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
@ -64,12 +65,14 @@ namespace OpenSim.Groups
|
|||
key = groupsConfig.GetString("SecretKey", string.Empty);
|
||||
m_log.DebugFormat("[Groups.RobustConnector]: Starting with secret key {0}", key);
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName);
|
||||
// else
|
||||
// m_log.DebugFormat("[Groups.RobustConnector]: Unable to find {0} section in configuration", m_ConfigName);
|
||||
|
||||
m_GroupsService = new GroupsService(config);
|
||||
|
||||
server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, key));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new GroupsServicePostHandler(m_GroupsService, auth));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,13 +81,11 @@ namespace OpenSim.Groups
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private GroupsService m_GroupsService;
|
||||
private string m_SecretKey = String.Empty;
|
||||
|
||||
public GroupsServicePostHandler(GroupsService service, string key) :
|
||||
base("POST", "/groups")
|
||||
public GroupsServicePostHandler(GroupsService service, IServiceAuth auth) :
|
||||
base("POST", "/groups", auth)
|
||||
{
|
||||
m_GroupsService = service;
|
||||
m_SecretKey = key;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
|
@ -108,20 +109,6 @@ namespace OpenSim.Groups
|
|||
string method = request["METHOD"].ToString();
|
||||
request.Remove("METHOD");
|
||||
|
||||
if (!String.IsNullOrEmpty(m_SecretKey)) // Verification required
|
||||
{
|
||||
// Sender didn't send key
|
||||
if (!request.ContainsKey("KEY") || (request["KEY"] == null))
|
||||
return FailureResult("This service requires a secret key");
|
||||
|
||||
// Sender sent wrong key
|
||||
if (!m_SecretKey.Equals(request["KEY"]))
|
||||
return FailureResult("Provided key does not match existing one");
|
||||
|
||||
// OK, key matches. Remove it.
|
||||
request.Remove("KEY");
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[Groups.Handler]: {0}", method);
|
||||
switch (method)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.OfflineIM
|
|||
if (serviceLocation == string.Empty)
|
||||
m_OfflineIMService = new OfflineIMService(config);
|
||||
else
|
||||
m_OfflineIMService = new OfflineIMServiceRemoteConnector(serviceLocation);
|
||||
m_OfflineIMService = new OfflineIMServiceRemoteConnector(config);
|
||||
|
||||
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
|
||||
m_log.DebugFormat("[OfflineIM.V2]: Offline messages enabled by {0}", Name);
|
||||
|
@ -226,10 +226,6 @@ namespace OpenSim.OfflineIM
|
|||
return;
|
||||
}
|
||||
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
string reason = string.Empty;
|
||||
bool success = m_OfflineIMService.StoreMessage(im, out reason);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.Reflection;
|
|||
using System.Text;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
|
@ -46,6 +47,7 @@ namespace OpenSim.OfflineIM
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_ServerURI = string.Empty;
|
||||
private IServiceAuth m_Auth;
|
||||
private object m_Lock = new object();
|
||||
|
||||
public OfflineIMServiceRemoteConnector(string url)
|
||||
|
@ -65,6 +67,18 @@ namespace OpenSim.OfflineIM
|
|||
|
||||
m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty);
|
||||
|
||||
/// This is from BaseServiceConnector
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Messaging" }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
m_Auth = new BasicHttpAuthentication(config, "Messaging");
|
||||
break;
|
||||
}
|
||||
///
|
||||
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
|
||||
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
|
||||
}
|
||||
|
||||
#region IOfflineIMService
|
||||
|
@ -143,7 +157,8 @@ namespace OpenSim.OfflineIM
|
|||
lock (m_Lock)
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/offlineim",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData),
|
||||
m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
@ -59,7 +60,9 @@ namespace OpenSim.OfflineIM
|
|||
|
||||
m_OfflineIMService = new OfflineIMService(config);
|
||||
|
||||
server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new OfflineIMServicePostHandler(m_OfflineIMService, auth));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,8 +72,8 @@ namespace OpenSim.OfflineIM
|
|||
|
||||
private IOfflineIMService m_OfflineIMService;
|
||||
|
||||
public OfflineIMServicePostHandler(IOfflineIMService service) :
|
||||
base("POST", "/offlineim")
|
||||
public OfflineIMServicePostHandler(IOfflineIMService service, IServiceAuth auth) :
|
||||
base("POST", "/offlineim", auth)
|
||||
{
|
||||
m_OfflineIMService = service;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace OpenSim.OfflineIM
|
|||
using (MemoryStream mstream = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
settings.Encoding = Util.UTF8NoBomEncoding;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(mstream, settings))
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ namespace OpenSim.OfflineIM
|
|||
writer.Flush();
|
||||
}
|
||||
|
||||
imXml = Util.UTF8.GetString(mstream.ToArray());
|
||||
imXml = Util.UTF8NoBomEncoding.GetString(mstream.ToArray());
|
||||
}
|
||||
|
||||
OfflineIMData data = new OfflineIMData();
|
||||
|
|
|
@ -56,12 +56,15 @@ namespace OpenSim.Capabilities.Handlers
|
|||
public const string DefaultFormat = "x-j2c";
|
||||
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
private string m_RedirectURL = null;
|
||||
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description)
|
||||
public GetTextureHandler(string path, IAssetService assService, string name, string description, string redirectURL)
|
||||
: base("GET", path, name, description)
|
||||
{
|
||||
m_assetService = assService;
|
||||
m_RedirectURL = redirectURL;
|
||||
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
|
||||
m_RedirectURL += "/";
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
|
@ -134,7 +137,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
if (format != DefaultFormat)
|
||||
fullID = fullID + "-" + format;
|
||||
|
||||
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
||||
if (!String.IsNullOrEmpty(m_RedirectURL))
|
||||
{
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
@ -150,8 +153,9 @@ namespace OpenSim.Capabilities.Handlers
|
|||
}
|
||||
else
|
||||
{
|
||||
string textureUrl = REDIRECT_URL + textureID.ToString();
|
||||
string textureUrl = m_RedirectURL + "?texture_id="+ textureID.ToString();
|
||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||
httpResponse.StatusCode = (int)OSHttpStatusCode.RedirectMovedPermanently;
|
||||
httpResponse.RedirectLocation = textureUrl;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,10 @@ namespace OpenSim.Capabilities.Handlers
|
|||
if (m_AssetService == null)
|
||||
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
|
||||
|
||||
string rurl = serverConfig.GetString("GetTextureRedirectURL");
|
||||
;
|
||||
server.AddStreamHandler(
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null));
|
||||
new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null, rurl));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests
|
|||
// Overkill - we only really need the asset service, not a whole scene.
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null);
|
||||
GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null, null);
|
||||
TestOSHttpRequest req = new TestOSHttpRequest();
|
||||
TestOSHttpResponse resp = new TestOSHttpResponse();
|
||||
req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012");
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Data.MySQL
|
|||
if (string.IsNullOrEmpty(pattern))
|
||||
pattern = "1";
|
||||
else
|
||||
pattern = string.Format("Name LIKE '%{0}%'", pattern);
|
||||
pattern = string.Format("Name LIKE '%{0}%'", MySqlHelper.EscapeString(pattern));
|
||||
|
||||
return m_Groups.Get(string.Format("ShowInList=1 AND ({0}) ORDER BY Name LIMIT 100", pattern));
|
||||
}
|
||||
|
|
|
@ -300,7 +300,6 @@ namespace OpenSim.Data.PGSQL
|
|||
m_Realm, where);
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
|
||||
//m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where);
|
||||
|
||||
conn.Open();
|
||||
|
@ -308,6 +307,25 @@ namespace OpenSim.Data.PGSQL
|
|||
}
|
||||
}
|
||||
|
||||
public virtual T[] Get(string where, NpgsqlParameter parameter)
|
||||
{
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_ConnectionString))
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand())
|
||||
{
|
||||
|
||||
string query = String.Format("SELECT * FROM {0} WHERE {1}",
|
||||
m_Realm, where);
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = query;
|
||||
//m_log.WarnFormat("[PGSQLGenericTable]: SELECT {0} WHERE {1}", m_Realm, where);
|
||||
|
||||
cmd.Parameters.Add(parameter);
|
||||
|
||||
conn.Open();
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Store(T row)
|
||||
{
|
||||
List<string> constraintFields = GetConstraints();
|
||||
|
|
|
@ -83,11 +83,15 @@ namespace OpenSim.Data.PGSQL
|
|||
public GroupData[] RetrieveGroups(string pattern)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pattern)) // True for where clause
|
||||
{
|
||||
pattern = " true ORDER BY lower(\"Name\") LIMIT 100";
|
||||
return m_Groups.Get(pattern);
|
||||
}
|
||||
else
|
||||
pattern = string.Format(" lower(\"Name\") LIKE lower('%{0}%') ORDER BY lower(\"Name\") LIMIT 100", pattern);
|
||||
|
||||
return m_Groups.Get(pattern);
|
||||
{
|
||||
pattern = " lower(\"Name\") LIKE lower('%:pattern%') ORDER BY lower(\"Name\") LIMIT 100";
|
||||
return m_Groups.Get(pattern, new NpgsqlParameter("pattern", pattern));
|
||||
}
|
||||
}
|
||||
|
||||
public bool DeleteGroup(UUID groupID)
|
||||
|
|
|
@ -321,6 +321,8 @@ namespace OpenSim.Framework
|
|||
Mac = args["mac"].AsString();
|
||||
if (args["id0"] != null)
|
||||
Id0 = args["id0"].AsString();
|
||||
if (args["teleport_flags"] != null)
|
||||
teleportFlags = args["teleport_flags"].AsUInteger();
|
||||
|
||||
if (args["start_pos"] != null)
|
||||
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
|
||||
|
|
|
@ -35,6 +35,8 @@ using System.Threading;
|
|||
using System.Web;
|
||||
using log4net;
|
||||
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -297,7 +299,7 @@ namespace OpenSim.Framework.Communications
|
|||
/// <summary>
|
||||
/// Perform a synchronous request
|
||||
/// </summary>
|
||||
public Stream Request()
|
||||
public Stream Request(IServiceAuth auth)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
|
@ -307,6 +309,8 @@ namespace OpenSim.Framework.Communications
|
|||
_request.Timeout = 200000;
|
||||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
try
|
||||
|
@ -358,7 +362,7 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
}
|
||||
|
||||
public Stream Request(Stream src)
|
||||
public Stream Request(Stream src, IServiceAuth auth)
|
||||
{
|
||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||
_request.KeepAlive = false;
|
||||
|
@ -367,6 +371,8 @@ namespace OpenSim.Framework.Communications
|
|||
_request.Method = RequestMethod;
|
||||
_asyncException = null;
|
||||
_request.ContentLength = src.Length;
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(_request.Headers);
|
||||
|
||||
m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength);
|
||||
m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
|
||||
|
@ -384,7 +390,22 @@ namespace OpenSim.Framework.Communications
|
|||
length = src.Read(buf, 0, 1024);
|
||||
}
|
||||
|
||||
_response = (HttpWebResponse) _request.GetResponse();
|
||||
try
|
||||
{
|
||||
_response = (HttpWebResponse)_request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}",
|
||||
RequestMethod, _request.RequestUri, e.Status, e.Message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[REST]: Request {0} {1} failed with exception {2} {3}",
|
||||
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
|
||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||
|
||||
|
@ -423,7 +444,7 @@ namespace OpenSim.Framework.Communications
|
|||
try
|
||||
{
|
||||
// Perform the operation; if sucessful set the result
|
||||
Stream s = Request();
|
||||
Stream s = Request(null);
|
||||
ar.SetAsCompleted(s, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -46,6 +46,11 @@ namespace OpenSim.Framework.Console
|
|||
// private readonly object m_syncRoot = new object();
|
||||
private const string LOGLEVEL_NONE = "(none)";
|
||||
|
||||
// Used to extract categories for colourization.
|
||||
private Regex m_categoryRegex
|
||||
= new Regex(
|
||||
@"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)", RegexOptions.Singleline | RegexOptions.Compiled);
|
||||
|
||||
private int m_cursorYPosition = -1;
|
||||
private int m_cursorXPosition = 0;
|
||||
private StringBuilder m_commandLine = new StringBuilder();
|
||||
|
@ -281,10 +286,7 @@ namespace OpenSim.Framework.Console
|
|||
|
||||
if (level != LOGLEVEL_NONE)
|
||||
{
|
||||
string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)";
|
||||
|
||||
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||
MatchCollection matches = RE.Matches(text);
|
||||
MatchCollection matches = m_categoryRegex.Matches(text);
|
||||
|
||||
if (matches.Count == 1)
|
||||
{
|
||||
|
|
|
@ -213,8 +213,13 @@ namespace OpenSim.Framework.Serialization.External
|
|||
xtw.WriteElementString("ClaimDate", Convert.ToString(landData.ClaimDate));
|
||||
xtw.WriteElementString("ClaimPrice", Convert.ToString(landData.ClaimPrice));
|
||||
xtw.WriteElementString("GlobalID", landData.GlobalID.ToString());
|
||||
xtw.WriteElementString("GroupID", landData.GroupID.ToString());
|
||||
xtw.WriteElementString("IsGroupOwned", Convert.ToString(landData.IsGroupOwned));
|
||||
|
||||
UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : landData.GroupID;
|
||||
xtw.WriteElementString("GroupID", groupID.ToString());
|
||||
|
||||
bool isGroupOwned = options.ContainsKey("wipe-owners") ? false : landData.IsGroupOwned;
|
||||
xtw.WriteElementString("IsGroupOwned", Convert.ToString(isGroupOwned));
|
||||
|
||||
xtw.WriteElementString("Bitmap", Convert.ToBase64String(landData.Bitmap));
|
||||
xtw.WriteElementString("Description", landData.Description);
|
||||
xtw.WriteElementString("Flags", Convert.ToString((uint)landData.Flags));
|
||||
|
@ -227,13 +232,8 @@ namespace OpenSim.Framework.Serialization.External
|
|||
xtw.WriteElementString("MediaURL", landData.MediaURL);
|
||||
xtw.WriteElementString("MusicURL", landData.MusicURL);
|
||||
|
||||
UUID ownerIdToWrite;
|
||||
if (options != null && options.ContainsKey("wipe-owners"))
|
||||
ownerIdToWrite = UUID.Zero;
|
||||
else
|
||||
ownerIdToWrite = landData.OwnerID;
|
||||
|
||||
xtw.WriteElementString("OwnerID", ownerIdToWrite.ToString());
|
||||
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : landData.OwnerID;
|
||||
xtw.WriteElementString("OwnerID", ownerID.ToString());
|
||||
|
||||
xtw.WriteStartElement("ParcelAccessList");
|
||||
foreach (LandAccessEntry pal in landData.ParcelAccessList)
|
||||
|
|
|
@ -121,7 +121,8 @@ namespace OpenSim.Framework.Serialization.Tests
|
|||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, null));
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
LandData ld = LandDataSerializer.Deserialize(LandDataSerializer.Serialize(this.land, options));
|
||||
Assert.That(ld, Is.Not.Null, "Deserialize(string) returned null");
|
||||
// Assert.That(ld.AABBMax, Is.EqualTo(land.AABBMax));
|
||||
// Assert.That(ld.AABBMin, Is.EqualTo(land.AABBMin));
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
@ -37,15 +39,30 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// </remarks>
|
||||
public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler
|
||||
{
|
||||
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) {}
|
||||
protected IServiceAuth m_Auth;
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path) : this(httpMethod, path, null, null) { }
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path, string name, string description)
|
||||
: base(httpMethod, path, name, description) {}
|
||||
|
||||
protected BaseStreamHandler(string httpMethod, string path, IServiceAuth auth)
|
||||
: base(httpMethod, path, null, null)
|
||||
{
|
||||
m_Auth = auth;
|
||||
}
|
||||
|
||||
public virtual byte[] Handle(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
RequestsReceived++;
|
||||
if (m_Auth != null && !m_Auth.Authenticate(httpRequest.Headers, httpResponse.AddHeader))
|
||||
{
|
||||
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Unauthorized;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
byte[] result = ProcessRequest(path, request, httpRequest, httpResponse);
|
||||
|
||||
|
|
|
@ -90,14 +90,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e);
|
||||
m_log.Debug(string.Format("JsonRpc request '{0}' to {1} failed", method, uri), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!response.ContainsKey("_Result"))
|
||||
{
|
||||
m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
|
||||
method, OSDParser.SerializeJsonString(response));
|
||||
m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}",
|
||||
method, uri, OSDParser.SerializeJsonString(response));
|
||||
return false;
|
||||
}
|
||||
response = (OSDMap)response["_Result"];
|
||||
|
@ -107,15 +107,15 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
if (response.ContainsKey("error"))
|
||||
{
|
||||
data = response["error"];
|
||||
m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}",
|
||||
method, OSDParser.SerializeJsonString(data));
|
||||
m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}",
|
||||
method, uri, OSDParser.SerializeJsonString(data));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!response.ContainsKey("result"))
|
||||
{
|
||||
m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
|
||||
method, OSDParser.SerializeJsonString(response));
|
||||
m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}",
|
||||
method, uri, OSDParser.SerializeJsonString(response));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -161,14 +161,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e);
|
||||
m_log.Debug(string.Format("JsonRpc request '{0}' to {1} failed", method, uri), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!response.ContainsKey("_Result"))
|
||||
{
|
||||
m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
|
||||
method, OSDParser.SerializeJsonString(response));
|
||||
m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an invalid response: {2}",
|
||||
method, uri, OSDParser.SerializeJsonString(response));
|
||||
return false;
|
||||
}
|
||||
response = (OSDMap)response["_Result"];
|
||||
|
@ -176,8 +176,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
if (response.ContainsKey("error"))
|
||||
{
|
||||
data = response["error"];
|
||||
m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}",
|
||||
method, OSDParser.SerializeJsonString(data));
|
||||
m_log.DebugFormat("JsonRpc request '{0}' to {1} returned an error: {2}",
|
||||
method, uri, OSDParser.SerializeJsonString(data));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
|
||||
using Nini.Config;
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.ServiceAuth
|
||||
{
|
||||
public class BasicHttpAuthentication : IServiceAuth
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_Username, m_Password;
|
||||
private string m_CredentialsB64;
|
||||
|
||||
private string remove_me;
|
||||
|
||||
public string Credentials
|
||||
{
|
||||
get { return m_CredentialsB64; }
|
||||
}
|
||||
|
||||
public BasicHttpAuthentication(IConfigSource config, string section)
|
||||
{
|
||||
remove_me = section;
|
||||
m_Username = Util.GetConfigVarFromSections<string>(config, "HttpAuthUsername", new string[] { "Network", section }, string.Empty);
|
||||
m_Password = Util.GetConfigVarFromSections<string>(config, "HttpAuthPassword", new string[] { "Network", section }, string.Empty);
|
||||
string str = m_Username + ":" + m_Password;
|
||||
byte[] encData_byte = Util.UTF8.GetBytes(str);
|
||||
|
||||
m_CredentialsB64 = Convert.ToBase64String(encData_byte);
|
||||
m_log.DebugFormat("[HTTP BASIC AUTH]: {0} {1} [{2}]", m_Username, m_Password, section);
|
||||
}
|
||||
|
||||
public void AddAuthorization(NameValueCollection headers)
|
||||
{
|
||||
//m_log.DebugFormat("[HTTP BASIC AUTH]: Adding authorization for {0}", remove_me);
|
||||
headers["Authorization"] = "Basic " + m_CredentialsB64;
|
||||
}
|
||||
|
||||
public bool Authenticate(string data)
|
||||
{
|
||||
string recovered = Util.Base64ToString(data);
|
||||
if (!String.IsNullOrEmpty(recovered))
|
||||
{
|
||||
string[] parts = recovered.Split(new char[] { ':' });
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
return m_Username.Equals(parts[0]) && m_Password.Equals(parts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Authenticate(NameValueCollection requestHeaders, AddHeaderDelegate d)
|
||||
{
|
||||
//m_log.DebugFormat("[HTTP BASIC AUTH]: Authenticate in {0}", remove_me);
|
||||
if (requestHeaders != null)
|
||||
{
|
||||
string value = requestHeaders.Get("Authorization");
|
||||
if (value != null)
|
||||
{
|
||||
value = value.Trim();
|
||||
if (value.StartsWith("Basic "))
|
||||
{
|
||||
value = value.Replace("Basic ", string.Empty);
|
||||
if (Authenticate(value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
d("WWW-Authenticate", "Basic realm = \"Asset Server\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace OpenSim.Framework.ServiceAuth
|
||||
{
|
||||
public delegate void AddHeaderDelegate(string key, string value);
|
||||
|
||||
public interface IServiceAuth
|
||||
{
|
||||
bool Authenticate(string data);
|
||||
bool Authenticate(NameValueCollection headers, AddHeaderDelegate d);
|
||||
void AddAuthorization(NameValueCollection headers);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Framework.ServiceAuth
|
||||
{
|
||||
public class ServiceAuth
|
||||
{
|
||||
public static IServiceAuth Create(IConfigSource config, string section)
|
||||
{
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
return new BasicHttpAuthentication(config, section);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,8 @@ using Nwc.XmlRpc;
|
|||
using OpenMetaverse.StructuredData;
|
||||
using XMLResponseHelper = OpenSim.Framework.SynchronousRestObjectRequester.XMLResponseHelper;
|
||||
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -772,6 +774,13 @@ namespace OpenSim.Framework
|
|||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action,
|
||||
int maxConnections)
|
||||
{
|
||||
MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, maxConnections, null);
|
||||
}
|
||||
|
||||
public static void MakeRequest<TRequest, TResponse>(string verb,
|
||||
string requestUrl, TRequest obj, Action<TResponse> action,
|
||||
int maxConnections, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
|
||||
|
@ -786,6 +795,10 @@ namespace OpenSim.Framework
|
|||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
HttpWebRequest ht = (HttpWebRequest)request;
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(ht.Headers);
|
||||
|
||||
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
|
||||
ht.ServicePoint.ConnectionLimit = maxConnections;
|
||||
|
||||
|
@ -969,7 +982,7 @@ namespace OpenSim.Framework
|
|||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs)
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
|
||||
|
@ -984,6 +997,10 @@ namespace OpenSim.Framework
|
|||
request.Method = verb;
|
||||
if (timeoutsecs > 0)
|
||||
request.Timeout = timeoutsecs * 1000;
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(request.Headers);
|
||||
|
||||
string respstring = String.Empty;
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
|
@ -1068,10 +1085,20 @@ namespace OpenSim.Framework
|
|||
return respstring;
|
||||
}
|
||||
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, int timeoutsecs)
|
||||
{
|
||||
return MakeRequest(verb, requestUrl, obj, timeoutsecs, null);
|
||||
}
|
||||
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
return MakeRequest(verb, requestUrl, obj, -1);
|
||||
}
|
||||
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj, IServiceAuth auth)
|
||||
{
|
||||
return MakeRequest(verb, requestUrl, obj, -1, auth);
|
||||
}
|
||||
}
|
||||
|
||||
public class SynchronousRestObjectRequester
|
||||
|
@ -1085,22 +1112,75 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"> </param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns>
|
||||
/// The response. If there was an internal exception, then the default(TResponse) is returned.
|
||||
/// </returns>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
|
||||
}
|
||||
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, IServiceAuth auth)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0, auth);
|
||||
}
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="pTimeout">
|
||||
/// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds)
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The response. If there was an internal exception or the request timed out,
|
||||
/// then the default(TResponse) is returned.
|
||||
/// </returns>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0);
|
||||
}
|
||||
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, IServiceAuth auth)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0, auth);
|
||||
}
|
||||
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="pTimeout">
|
||||
/// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds)
|
||||
/// </param>
|
||||
/// <param name="maxConnections"></param>
|
||||
/// <returns>
|
||||
/// The response. If there was an internal exception or the request timed out,
|
||||
/// then the default(TResponse) is returned.
|
||||
/// </returns>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections)
|
||||
{
|
||||
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, maxConnections, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="pTimeout">
|
||||
/// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds)
|
||||
/// </param>
|
||||
/// <param name="maxConnections"></param>
|
||||
/// <returns>
|
||||
/// The response. If there was an internal exception or the request timed out,
|
||||
/// then the default(TResponse) is returned.
|
||||
/// </returns>
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections, IServiceAuth auth)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
|
||||
|
@ -1116,6 +1196,13 @@ namespace OpenSim.Framework
|
|||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
HttpWebRequest ht = (HttpWebRequest)request;
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(ht.Headers);
|
||||
|
||||
if (pTimeout != 0)
|
||||
ht.Timeout = pTimeout;
|
||||
|
||||
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)
|
||||
ht.ServicePoint.ConnectionLimit = maxConnections;
|
||||
|
||||
|
@ -1191,8 +1278,18 @@ namespace OpenSim.Framework
|
|||
{
|
||||
using (HttpWebResponse hwr = (HttpWebResponse)e.Response)
|
||||
{
|
||||
if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
|
||||
return deserial;
|
||||
if (hwr != null)
|
||||
{
|
||||
if (hwr.StatusCode == HttpStatusCode.NotFound)
|
||||
return deserial;
|
||||
if (hwr.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
m_log.Error(string.Format(
|
||||
"[SynchronousRestObjectRequester]: Web request {0} requires authentication ",
|
||||
requestUrl));
|
||||
return deserial;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_log.Error(string.Format(
|
||||
"[SynchronousRestObjectRequester]: WebException for {0} {1} {2} ",
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
private bool m_Enabled = false;
|
||||
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
private string m_RedirectURL = null;
|
||||
|
||||
private string m_URL;
|
||||
|
||||
|
@ -78,7 +78,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_URL = config.GetString("Cap_GetTexture", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
{
|
||||
m_Enabled = true;
|
||||
m_RedirectURL = config.GetString("GetTextureRedirectURL");
|
||||
}
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
|
@ -132,14 +135,14 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler(
|
||||
"GetTexture",
|
||||
new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString()));
|
||||
new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString(), m_RedirectURL));
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
|
||||
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
|
||||
if (handler != null)
|
||||
handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture",m_URL);
|
||||
handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture", m_URL);
|
||||
else
|
||||
caps.RegisterHandler("GetTexture", m_URL);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests
|
|||
|
||||
// A sanity check that the response has the expected number of descendents for a default inventory
|
||||
// TODO: Need a more thorough check.
|
||||
Assert.That((int)folderOsd["descendents"], Is.EqualTo(14));
|
||||
Assert.That((int)folderOsd["descendents"], Is.EqualTo(16));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8949,7 +8949,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
||||
{
|
||||
string assetServer = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
||||
return ((Scene)Scene).AssetService.Get(assetServer + "/" + id);
|
||||
if (!string.IsNullOrEmpty(assetServer))
|
||||
return ((Scene)Scene).AssetService.Get(assetServer + "/" + id);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -12658,16 +12659,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
if (asset == null)
|
||||
{
|
||||
req.AssetInf = null;
|
||||
req.AssetRequestSource = source;
|
||||
req.IsTextureRequest = false;
|
||||
req.NumPackets = 0;
|
||||
req.Params = transferRequest.TransferInfo.Params;
|
||||
req.RequestAssetID = requestID;
|
||||
req.TransferRequestID = transferRequest.TransferInfo.TransferID;
|
||||
// Try the user's asset server
|
||||
IInventoryAccessModule inventoryAccessModule = Scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
|
||||
string assetServerURL = string.Empty;
|
||||
if (inventoryAccessModule.IsForeignUser(AgentId, out assetServerURL) && !string.IsNullOrEmpty(assetServerURL))
|
||||
{
|
||||
if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
|
||||
assetServerURL = assetServerURL + "/";
|
||||
|
||||
//m_log.DebugFormat("[LLCLIENTVIEW]: asset {0} not found in local storage. Trying user's storage.", assetServerURL + id);
|
||||
asset = m_scene.AssetService.Get(assetServerURL + id);
|
||||
}
|
||||
|
||||
if (asset == null)
|
||||
{
|
||||
req.AssetInf = null;
|
||||
req.AssetRequestSource = source;
|
||||
req.IsTextureRequest = false;
|
||||
req.NumPackets = 0;
|
||||
req.Params = transferRequest.TransferInfo.Params;
|
||||
req.RequestAssetID = requestID;
|
||||
req.TransferRequestID = transferRequest.TransferInfo.TransferID;
|
||||
|
||||
SendAssetNotFound(req);
|
||||
return;
|
||||
}
|
||||
|
||||
SendAssetNotFound(req);
|
||||
return;
|
||||
}
|
||||
|
||||
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|
||||
|
|
|
@ -774,15 +774,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml),
|
||||
sp.UUID);
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
|
||||
m_scene.InventoryService.UpdateItem(item);
|
||||
invAccess.UpdateInventoryItemAsset(sp.UUID, item, asset);
|
||||
|
||||
// If the name of the object has been changed whilst attached then we want to update the inventory
|
||||
// item in the viewer.
|
||||
|
|
|
@ -37,6 +37,7 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -54,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
private string m_URL = String.Empty;
|
||||
private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
|
||||
|
||||
|
||||
private static IServiceAuth m_Auth;
|
||||
|
||||
public void Initialise(IConfigSource configSource)
|
||||
{
|
||||
|
@ -63,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
return;
|
||||
|
||||
m_URL = config.GetString("URL", String.Empty);
|
||||
m_Auth = ServiceAuth.Create(configSource, "XBakes");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
|
@ -110,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
|
||||
try
|
||||
{
|
||||
Stream s = rc.Request();
|
||||
Stream s = rc.Request(m_Auth);
|
||||
XmlTextReader sr = new XmlTextReader(s);
|
||||
|
||||
sr.ReadStartElement("BakedAppearance");
|
||||
|
@ -183,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
|||
Util.FireAndForget(
|
||||
delegate
|
||||
{
|
||||
rc.Request(reqStream);
|
||||
rc.Request(reqStream, m_Auth);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
/*
|
||||
* 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 log4net.Config;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.CoreModules.Avatar.Chat;
|
||||
using OpenSim.Region.CoreModules.Framework;
|
||||
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ChatModuleTests : OpenSimTestCase
|
||||
{
|
||||
[TestFixtureSetUp]
|
||||
public void FixtureInit()
|
||||
{
|
||||
// Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
|
||||
// We must do this here so that child agent positions are updated in a predictable manner.
|
||||
Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
|
||||
// threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
|
||||
// tests really shouldn't).
|
||||
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
|
||||
}
|
||||
|
||||
private void SetupNeighbourRegions(TestScene sceneA, TestScene sceneB)
|
||||
{
|
||||
// XXX: HTTP server is not (and should not be) necessary for this test, though it's absence makes the
|
||||
// CapabilitiesModule complain when it can't set up HTTP endpoints.
|
||||
// BaseHttpServer httpServer = new BaseHttpServer(99999);
|
||||
// MainServer.AddHttpServer(httpServer);
|
||||
// MainServer.Instance = httpServer;
|
||||
|
||||
// We need entity transfer modules so that when sp2 logs into the east region, the region calls
|
||||
// EntityTransferModuleto set up a child agent on the west region.
|
||||
// XXX: However, this is not an entity transfer so is misleading.
|
||||
EntityTransferModule etmA = new EntityTransferModule();
|
||||
EntityTransferModule etmB = new EntityTransferModule();
|
||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Chat");
|
||||
IConfig modulesConfig = config.AddConfig("Modules");
|
||||
modulesConfig.Set("EntityTransferModule", etmA.Name);
|
||||
modulesConfig.Set("SimulationServices", lscm.Name);
|
||||
|
||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
|
||||
SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, new ChatModule());
|
||||
SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB, new ChatModule());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests chat between neighbour regions on the east-west axis
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Really, this is a combination of a child agent position update test and a chat range test. These need
|
||||
/// to be separated later on.
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestInterRegionChatDistanceEastWest()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID sp1Uuid = TestHelpers.ParseTail(0x11);
|
||||
UUID sp2Uuid = TestHelpers.ParseTail(0x12);
|
||||
|
||||
Vector3 sp1Position = new Vector3(6, 128, 20);
|
||||
Vector3 sp2Position = new Vector3(250, 128, 20);
|
||||
|
||||
SceneHelpers sh = new SceneHelpers();
|
||||
TestScene sceneWest = sh.SetupScene("sceneWest", TestHelpers.ParseTail(0x1), 1000, 1000);
|
||||
TestScene sceneEast = sh.SetupScene("sceneEast", TestHelpers.ParseTail(0x2), 1001, 1000);
|
||||
|
||||
SetupNeighbourRegions(sceneWest, sceneEast);
|
||||
|
||||
ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneEast, sp1Uuid);
|
||||
TestClient sp1Client = (TestClient)sp1.ControllingClient;
|
||||
|
||||
// If we don't set agents to flying, test will go wrong as they instantly fall to z = 0.
|
||||
// TODO: May need to create special complete no-op test physics module rather than basic physics, since
|
||||
// physics is irrelevant to this test.
|
||||
sp1.Flying = true;
|
||||
|
||||
// When sp1 logs in to sceneEast, it sets up a child agent in sceneWest and informs the sp2 client to
|
||||
// make the connection. For this test, will simplify this chain by making the connection directly.
|
||||
ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneWest, sp1Uuid);
|
||||
TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient;
|
||||
|
||||
sp1.AbsolutePosition = sp1Position;
|
||||
|
||||
ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneWest, sp2Uuid);
|
||||
TestClient sp2Client = (TestClient)sp2.ControllingClient;
|
||||
sp2.Flying = true;
|
||||
|
||||
ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneEast, sp2Uuid);
|
||||
TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient;
|
||||
|
||||
sp2.AbsolutePosition = sp2Position;
|
||||
|
||||
// We must update the scenes in order to make the root new root agents trigger position updates in their
|
||||
// children.
|
||||
sceneWest.Update(1);
|
||||
sceneEast.Update(1);
|
||||
|
||||
// Check child positions are correct.
|
||||
Assert.AreEqual(
|
||||
new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z),
|
||||
sp1ChildClient.SceneAgent.AbsolutePosition);
|
||||
|
||||
Assert.AreEqual(
|
||||
new Vector3(sp2Position.X - sceneWest.RegionInfo.RegionSizeX, sp2Position.Y, sp2Position.Z),
|
||||
sp2ChildClient.SceneAgent.AbsolutePosition);
|
||||
|
||||
string receivedSp1ChatMessage = "";
|
||||
string receivedSp2ChatMessage = "";
|
||||
|
||||
sp1ChildClient.OnReceivedChatMessage
|
||||
+= (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message;
|
||||
sp2ChildClient.OnReceivedChatMessage
|
||||
+= (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message;
|
||||
|
||||
TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage);
|
||||
TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage);
|
||||
|
||||
sp1Position = new Vector3(30, 128, 20);
|
||||
sp1.AbsolutePosition = sp1Position;
|
||||
sceneEast.Update(1);
|
||||
|
||||
// Check child position is correct.
|
||||
Assert.AreEqual(
|
||||
new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z),
|
||||
sp1ChildClient.SceneAgent.AbsolutePosition);
|
||||
|
||||
TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage);
|
||||
TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests chat between neighbour regions on the north-south axis
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Really, this is a combination of a child agent position update test and a chat range test. These need
|
||||
/// to be separated later on.
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestInterRegionChatDistanceNorthSouth()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID sp1Uuid = TestHelpers.ParseTail(0x11);
|
||||
UUID sp2Uuid = TestHelpers.ParseTail(0x12);
|
||||
|
||||
Vector3 sp1Position = new Vector3(128, 250, 20);
|
||||
Vector3 sp2Position = new Vector3(128, 6, 20);
|
||||
|
||||
SceneHelpers sh = new SceneHelpers();
|
||||
TestScene sceneNorth = sh.SetupScene("sceneNorth", TestHelpers.ParseTail(0x1), 1000, 1000);
|
||||
TestScene sceneSouth = sh.SetupScene("sceneSouth", TestHelpers.ParseTail(0x2), 1000, 1001);
|
||||
|
||||
SetupNeighbourRegions(sceneNorth, sceneSouth);
|
||||
|
||||
ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneNorth, sp1Uuid);
|
||||
TestClient sp1Client = (TestClient)sp1.ControllingClient;
|
||||
|
||||
// If we don't set agents to flying, test will go wrong as they instantly fall to z = 0.
|
||||
// TODO: May need to create special complete no-op test physics module rather than basic physics, since
|
||||
// physics is irrelevant to this test.
|
||||
sp1.Flying = true;
|
||||
|
||||
// When sp1 logs in to sceneEast, it sets up a child agent in sceneNorth and informs the sp2 client to
|
||||
// make the connection. For this test, will simplify this chain by making the connection directly.
|
||||
ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneSouth, sp1Uuid);
|
||||
TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient;
|
||||
|
||||
sp1.AbsolutePosition = sp1Position;
|
||||
|
||||
ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneSouth, sp2Uuid);
|
||||
TestClient sp2Client = (TestClient)sp2.ControllingClient;
|
||||
sp2.Flying = true;
|
||||
|
||||
ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneNorth, sp2Uuid);
|
||||
TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient;
|
||||
|
||||
sp2.AbsolutePosition = sp2Position;
|
||||
|
||||
// We must update the scenes in order to make the root new root agents trigger position updates in their
|
||||
// children.
|
||||
sceneNorth.Update(1);
|
||||
sceneSouth.Update(1);
|
||||
|
||||
// Check child positions are correct.
|
||||
Assert.AreEqual(
|
||||
new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z),
|
||||
sp1ChildClient.SceneAgent.AbsolutePosition);
|
||||
|
||||
Assert.AreEqual(
|
||||
new Vector3(sp2Position.X, sp2Position.Y + sceneSouth.RegionInfo.RegionSizeY, sp2Position.Z),
|
||||
sp2ChildClient.SceneAgent.AbsolutePosition);
|
||||
|
||||
string receivedSp1ChatMessage = "";
|
||||
string receivedSp2ChatMessage = "";
|
||||
|
||||
sp1ChildClient.OnReceivedChatMessage
|
||||
+= (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message;
|
||||
sp2ChildClient.OnReceivedChatMessage
|
||||
+= (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message;
|
||||
|
||||
TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage);
|
||||
TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage);
|
||||
|
||||
sp1Position = new Vector3(30, 128, 20);
|
||||
sp1.AbsolutePosition = sp1Position;
|
||||
sceneNorth.Update(1);
|
||||
|
||||
// Check child position is correct.
|
||||
Assert.AreEqual(
|
||||
new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z),
|
||||
sp1ChildClient.SceneAgent.AbsolutePosition);
|
||||
|
||||
TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage);
|
||||
TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage);
|
||||
}
|
||||
|
||||
private void TestUserInRange(TestClient speakClient, string testMessage, ref string receivedMessage)
|
||||
{
|
||||
receivedMessage = "";
|
||||
|
||||
speakClient.Chat(0, ChatTypeEnum.Say, testMessage);
|
||||
|
||||
Assert.AreEqual(testMessage, receivedMessage);
|
||||
}
|
||||
|
||||
private void TestUserOutOfRange(TestClient speakClient, string testMessage, ref string receivedMessage)
|
||||
{
|
||||
receivedMessage = "";
|
||||
|
||||
speakClient.Chat(0, ChatTypeEnum.Say, testMessage);
|
||||
|
||||
Assert.AreNotEqual(testMessage, receivedMessage);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -210,7 +210,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
|
||||
|
||||
if (!success && !foreigner)
|
||||
HandleUndeliveredMessage(im, result);
|
||||
HandleUndeliverableMessage(im, result);
|
||||
else
|
||||
result(success);
|
||||
});
|
||||
|
@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
return successful;
|
||||
}
|
||||
|
||||
protected void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
{
|
||||
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
SendGridInstantMessageViaXMLRPC(im, result);
|
||||
}
|
||||
|
||||
private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
|
||||
{
|
||||
UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
|
||||
|
||||
|
@ -428,7 +428,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
/// <summary>
|
||||
/// delegate for sending a grid instant message asynchronously
|
||||
/// </summary>
|
||||
public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID);
|
||||
public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result);
|
||||
|
||||
protected virtual void GridInstantMessageCompleted(IAsyncResult iar)
|
||||
{
|
||||
|
@ -442,138 +442,87 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
{
|
||||
GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync;
|
||||
|
||||
d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d);
|
||||
d.BeginInvoke(im, result, GridInstantMessageCompleted, d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recursive SendGridInstantMessage over XMLRPC method.
|
||||
/// This is called from within a dedicated thread.
|
||||
/// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from
|
||||
/// itself, prevRegionHandle will be the last region handle that we tried to send.
|
||||
/// If the handles are the same, we look up the user's location using the grid.
|
||||
/// If the handles are still the same, we end. The send failed.
|
||||
/// Internal SendGridInstantMessage over XMLRPC method.
|
||||
/// </summary>
|
||||
/// <param name="prevRegionHandle">
|
||||
/// Pass in 0 the first time this method is called. It will be called recursively with the last
|
||||
/// regionhandle tried
|
||||
/// </param>
|
||||
protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID)
|
||||
/// <remarks>
|
||||
/// This is called from within a dedicated thread.
|
||||
/// </remarks>
|
||||
private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result)
|
||||
{
|
||||
UUID toAgentID = new UUID(im.toAgentID);
|
||||
|
||||
PresenceInfo upd = null;
|
||||
|
||||
bool lookupAgent = false;
|
||||
UUID regionID;
|
||||
bool needToLookupAgent;
|
||||
|
||||
lock (m_UserRegionMap)
|
||||
needToLookupAgent = !m_UserRegionMap.TryGetValue(toAgentID, out regionID);
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (m_UserRegionMap.ContainsKey(toAgentID))
|
||||
if (needToLookupAgent)
|
||||
{
|
||||
upd = new PresenceInfo();
|
||||
upd.RegionID = m_UserRegionMap[toAgentID];
|
||||
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
|
||||
|
||||
// We need to compare the current regionhandle with the previous region handle
|
||||
// or the recursive loop will never end because it will never try to lookup the agent again
|
||||
if (prevRegionID == upd.RegionID)
|
||||
UUID foundRegionID = UUID.Zero;
|
||||
|
||||
if (presences != null)
|
||||
{
|
||||
lookupAgent = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lookupAgent = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Are we needing to look-up an agent?
|
||||
if (lookupAgent)
|
||||
{
|
||||
// Non-cached user agent lookup.
|
||||
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
|
||||
if (presences != null && presences.Length > 0)
|
||||
{
|
||||
foreach (PresenceInfo p in presences)
|
||||
{
|
||||
if (p.RegionID != UUID.Zero)
|
||||
foreach (PresenceInfo p in presences)
|
||||
{
|
||||
upd = p;
|
||||
break;
|
||||
if (p.RegionID != UUID.Zero)
|
||||
{
|
||||
foundRegionID = p.RegionID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If not found or the found region is the same as the last lookup, then message is undeliverable
|
||||
if (foundRegionID == UUID.Zero || foundRegionID == regionID)
|
||||
break;
|
||||
else
|
||||
regionID = foundRegionID;
|
||||
}
|
||||
|
||||
if (upd != null)
|
||||
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, regionID);
|
||||
if (reginfo == null)
|
||||
{
|
||||
// check if we've tried this before..
|
||||
// This is one way to end the recursive loop
|
||||
//
|
||||
if (upd.RegionID == prevRegionID)
|
||||
{
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliveredMessage(im, result);
|
||||
return;
|
||||
}
|
||||
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", regionID);
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
// Try to send the message to the agent via the retrieved region.
|
||||
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
|
||||
msgdata["region_handle"] = 0;
|
||||
bool imresult = doIMSending(reginfo, msgdata);
|
||||
|
||||
// If the message delivery was successful, then cache the entry.
|
||||
if (imresult)
|
||||
{
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliveredMessage(im, result);
|
||||
lock (m_UserRegionMap)
|
||||
{
|
||||
m_UserRegionMap[toAgentID] = regionID;
|
||||
}
|
||||
result(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we reach this point in the first iteration of the while, then we may have unsuccessfully tried
|
||||
// to use a locally cached region ID. All subsequent attempts need to lookup agent details from
|
||||
// the presence service.
|
||||
needToLookupAgent = true;
|
||||
}
|
||||
|
||||
if (upd != null)
|
||||
{
|
||||
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID,
|
||||
upd.RegionID);
|
||||
if (reginfo != null)
|
||||
{
|
||||
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
|
||||
// Not actually used anymore, left in for compatibility
|
||||
// Remove at next interface change
|
||||
//
|
||||
msgdata["region_handle"] = 0;
|
||||
bool imresult = doIMSending(reginfo, msgdata);
|
||||
if (imresult)
|
||||
{
|
||||
// IM delivery successful, so store the Agent's location in our local cache.
|
||||
lock (m_UserRegionMap)
|
||||
{
|
||||
if (m_UserRegionMap.ContainsKey(toAgentID))
|
||||
{
|
||||
m_UserRegionMap[toAgentID] = upd.RegionID;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_UserRegionMap.Add(toAgentID, upd.RegionID);
|
||||
}
|
||||
}
|
||||
result(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// try again, but lookup user this time.
|
||||
// Warning, this must call the Async version
|
||||
// of this method or we'll be making thousands of threads
|
||||
// The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
|
||||
// The version that spawns the thread is SendGridInstantMessageViaXMLRPC
|
||||
// If we reached this point then the message was not deliverable. Remove the bad cache entry and
|
||||
// signal the delivery failure.
|
||||
lock (m_UserRegionMap)
|
||||
m_UserRegionMap.Remove(toAgentID);
|
||||
|
||||
// This is recursive!!!!!
|
||||
SendGridInstantMessageViaXMLRPCAsync(im, result,
|
||||
upd.RegionID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
|
||||
HandleUndeliveredMessage(im, result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleUndeliveredMessage(im, result);
|
||||
}
|
||||
// m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
|
||||
HandleUndeliverableMessage(im, result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -584,7 +533,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
/// <returns>Bool if the message was successfully delivered at the other side.</returns>
|
||||
protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata)
|
||||
{
|
||||
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(xmlrpcdata);
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);
|
||||
|
|
|
@ -226,12 +226,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
return;
|
||||
}
|
||||
|
||||
Scene scene = FindScene(new UUID(im.fromAgentID));
|
||||
if (scene == null)
|
||||
scene = m_SceneList[0];
|
||||
|
||||
bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
|
||||
"POST", m_RestURL+"/SaveMessage/", im);
|
||||
"POST", m_RestURL+"/SaveMessage/", im, 10000);
|
||||
|
||||
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
|
||||
{
|
||||
|
|
|
@ -484,6 +484,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error updating classified", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,6 +511,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error classified delete", false);
|
||||
return;
|
||||
}
|
||||
|
||||
parameters = (OSDMap)Params;
|
||||
|
@ -612,6 +614,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error selecting pick", false);
|
||||
return;
|
||||
}
|
||||
pick = (UserProfilePick) Pick;
|
||||
|
||||
|
@ -714,6 +717,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error updating pick", false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString());
|
||||
|
@ -740,6 +744,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error picks delete", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion Picks
|
||||
|
@ -807,6 +812,8 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
object Note = note;
|
||||
if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString()))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error updating note", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -916,6 +923,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error updating interests", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1044,6 +1052,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error updating properties", false);
|
||||
return;
|
||||
}
|
||||
|
||||
RequestAvatarProperties(remoteClient, newProfile.ID);
|
||||
|
|
|
@ -761,12 +761,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
string reason;
|
||||
string version;
|
||||
if (!Scene.SimulationService.QueryAccess(
|
||||
finalDestination, sp.ControllingClient.AgentId, homeURI, position, out version, out reason))
|
||||
finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, out version, out reason))
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed(reason);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}",
|
||||
"[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because: {3}",
|
||||
sp.Name, sp.Scene.Name, finalDestination.RegionName, reason);
|
||||
|
||||
return;
|
||||
|
@ -1510,7 +1510,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
// Check to see if we have access to the target region.
|
||||
if (neighbourRegion != null
|
||||
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, newpos, out version, out failureReason))
|
||||
&& !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, out version, out failureReason))
|
||||
{
|
||||
// remember banned
|
||||
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
||||
|
|
|
@ -64,6 +64,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
private bool m_bypassPermissions = true;
|
||||
|
||||
// This simple check makes it possible to support grids in which all the simulators
|
||||
// share all central services of the Robust server EXCEPT assets. In other words,
|
||||
// grids where the simulators' assets are kept in one DB and the users' inventory assets
|
||||
// are kept on another. When users rez items from inventory or take objects from world,
|
||||
// an HG-like asset copy takes place between the 2 servers, the world asset server and
|
||||
// the user's asset server.
|
||||
private bool m_CheckSeparateAssets = false;
|
||||
private string m_LocalAssetsURL = string.Empty;
|
||||
|
||||
// private bool m_Initialized = false;
|
||||
|
||||
#region INonSharedRegionModule
|
||||
|
@ -99,6 +108,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
|
||||
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
|
||||
m_CheckSeparateAssets = thisModuleConfig.GetBoolean("CheckSeparateAssets", false);
|
||||
m_LocalAssetsURL = thisModuleConfig.GetString("RegionHGAssetServerURI", string.Empty);
|
||||
m_LocalAssetsURL = m_LocalAssetsURL.Trim(new char[] { '/' });
|
||||
|
||||
}
|
||||
else
|
||||
m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
|
||||
|
@ -240,6 +253,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return newAssetID;
|
||||
}
|
||||
|
||||
///
|
||||
/// UpdateInventoryItemAsset
|
||||
///
|
||||
public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
|
||||
{
|
||||
if (base.UpdateInventoryItemAsset(ownerID, item, asset))
|
||||
{
|
||||
UploadInventoryItem(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Used in DeleteToInventory
|
||||
///
|
||||
|
@ -284,50 +311,98 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
|
||||
RezSelected, RemoveItem, fromTaskID, attachment);
|
||||
|
||||
if (sog == null)
|
||||
remoteClient.SendAgentAlertMessage("Unable to rez: problem accessing inventory or locating assets", false);
|
||||
|
||||
return sog;
|
||||
|
||||
}
|
||||
|
||||
public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
||||
{
|
||||
string userAssetServer = string.Empty;
|
||||
if (IsForeignUser(sender, out userAssetServer) && userAssetServer != string.Empty)
|
||||
m_assMapper.Get(item.AssetID, sender, userAssetServer);
|
||||
string senderAssetServer = string.Empty;
|
||||
string receiverAssetServer = string.Empty;
|
||||
bool isForeignSender, isForeignReceiver;
|
||||
isForeignSender = IsForeignUser(sender, out senderAssetServer);
|
||||
isForeignReceiver = IsForeignUser(receiver, out receiverAssetServer);
|
||||
|
||||
if (IsForeignUser(receiver, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
|
||||
m_assMapper.Post(item.AssetID, receiver, userAssetServer);
|
||||
// They're both local. Nothing to do.
|
||||
if (!isForeignSender && !isForeignReceiver)
|
||||
return;
|
||||
|
||||
// At least one of them is foreign.
|
||||
// If both users have the same asset server, no need to transfer the asset
|
||||
if (senderAssetServer.Equals(receiverAssetServer))
|
||||
{
|
||||
m_log.DebugFormat("[HGScene]: Asset transfer between foreign users, but they have the same server. No transfer.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isForeignSender && senderAssetServer != string.Empty)
|
||||
m_assMapper.Get(item.AssetID, sender, senderAssetServer);
|
||||
|
||||
if (isForeignReceiver && receiverAssetServer != string.Empty && m_OutboundPermission)
|
||||
m_assMapper.Post(item.AssetID, receiver, receiverAssetServer);
|
||||
}
|
||||
|
||||
public override bool IsForeignUser(UUID userID, out string assetServerURL)
|
||||
{
|
||||
assetServerURL = string.Empty;
|
||||
|
||||
if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID))
|
||||
{ // foreign
|
||||
ScenePresence sp = null;
|
||||
if (m_Scene.TryGetScenePresence(userID, out sp))
|
||||
if (UserManagementModule != null)
|
||||
{
|
||||
if (!m_CheckSeparateAssets)
|
||||
{
|
||||
AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||
if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
||||
{
|
||||
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' });
|
||||
if (!UserManagementModule.IsLocalGridUser(userID))
|
||||
{ // foreign
|
||||
ScenePresence sp = null;
|
||||
if (m_Scene.TryGetScenePresence(userID, out sp))
|
||||
{
|
||||
AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||
if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
||||
{
|
||||
assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI");
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI");
|
||||
assetServerURL = assetServerURL.Trim(new char[] { '/' });
|
||||
if (IsLocalInventoryAssetsUser(userID, out assetServerURL))
|
||||
{
|
||||
m_log.DebugFormat("[HGScene]: user {0} has local assets {1}", userID, assetServerURL);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[HGScene]: user {0} has foreign assets {1}", userID, assetServerURL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsLocalInventoryAssetsUser(UUID uuid, out string assetsURL)
|
||||
{
|
||||
assetsURL = UserManagementModule.GetUserServerURL(uuid, "AssetServerURI");
|
||||
if (assetsURL == string.Empty)
|
||||
{
|
||||
AgentCircuitData agent = m_Scene.AuthenticateHandler.GetAgentCircuitData(uuid);
|
||||
if (agent != null)
|
||||
{
|
||||
assetsURL = agent.ServiceURLs["AssetServerURI"].ToString();
|
||||
assetsURL = assetsURL.Trim(new char[] { '/' });
|
||||
}
|
||||
}
|
||||
return m_LocalAssetsURL.Equals(assetsURL);
|
||||
}
|
||||
|
||||
|
||||
protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
|
||||
{
|
||||
InventoryItemBase item = base.GetItem(agentID, itemID);
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
m_Scene.AssetService.Store(asset);
|
||||
m_Scene.CreateNewInventoryItem(
|
||||
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
|
||||
name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
|
||||
name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -293,6 +293,30 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return UUID.Zero;
|
||||
}
|
||||
|
||||
public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
|
||||
{
|
||||
if (item != null && item.Owner == ownerID && asset != null)
|
||||
{
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
|
||||
m_Scene.AssetService.Store(asset);
|
||||
m_Scene.InventoryService.UpdateItem(item);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY ACCESS MODULE]: Given invalid item for inventory update: {0}",
|
||||
(item == null || asset == null? "null item or asset" : "wrong owner"));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual List<InventoryItemBase> CopyToInventory(
|
||||
DeRezAction action, UUID folderID,
|
||||
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment)
|
||||
|
@ -532,6 +556,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||
{
|
||||
// Changing ownership, so apply the "Next Owner" permissions to all of the
|
||||
// inventory item's permissions.
|
||||
|
||||
uint perms = effectivePerms;
|
||||
PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
|
||||
|
||||
|
@ -546,6 +573,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
}
|
||||
else
|
||||
{
|
||||
// Not changing ownership.
|
||||
// In this case we apply the permissions in the object's items ONLY to the inventory
|
||||
// item's "Next Owner" permissions, but NOT to its "Current", "Base", etc. permissions.
|
||||
// E.g., if the object contains a No-Transfer item then the item's "Next Owner"
|
||||
// permissions are also No-Transfer.
|
||||
PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref allObjectsNextOwnerPerms);
|
||||
|
||||
item.BasePermissions = effectivePerms;
|
||||
item.CurrentPermissions = effectivePerms;
|
||||
item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms;
|
||||
|
@ -773,12 +807,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
m_log.WarnFormat(
|
||||
"[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()",
|
||||
assetID, item.Name, item.ID, remoteClient.Name);
|
||||
remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0} for item {1}.", assetID, item.Name), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()",
|
||||
assetID, remoteClient.Name);
|
||||
remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0}.", assetID), false);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -89,35 +89,43 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
public bool IsAuthorizedForRegion(
|
||||
string user, string firstName, string lastName, string regionID, out string message)
|
||||
{
|
||||
message = "authorized";
|
||||
|
||||
// This should not happen
|
||||
if (m_Scene.RegionInfo.RegionID.ToString() != regionID)
|
||||
{
|
||||
m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}",
|
||||
m_Scene.RegionInfo.RegionID, regionID);
|
||||
return true;
|
||||
message = string.Format("Region {0} received request to authorize for region {1}", m_Scene.RegionInfo.RegionID, regionID);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_accessValue == AccessFlags.None)
|
||||
{
|
||||
message = "Authorized";
|
||||
return true;
|
||||
}
|
||||
|
||||
UUID userID = new UUID(user);
|
||||
bool authorized = true;
|
||||
if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners)
|
||||
|
||||
if ((m_accessValue & AccessFlags.DisallowForeigners) != 0)
|
||||
{
|
||||
authorized = m_UserManagement.IsLocalGridUser(userID);
|
||||
if (!authorized)
|
||||
message = "no foreigner users allowed in this region";
|
||||
}
|
||||
if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents)
|
||||
{
|
||||
authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID);
|
||||
if (!authorized)
|
||||
message = "only Admins and Managers allowed in this region";
|
||||
if (!m_UserManagement.IsLocalGridUser(userID))
|
||||
{
|
||||
message = "No foreign users allowed in this region";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return authorized;
|
||||
if ((m_accessValue & AccessFlags.DisallowResidents) != 0)
|
||||
{
|
||||
if (!(m_Scene.Permissions.IsGod(userID) || m_Scene.Permissions.IsAdministrator(userID)))
|
||||
{
|
||||
message = "Only Admins and Managers allowed in this region";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
message = "Authorized";
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
|
|||
public void OnMakeRootAgent(ScenePresence sp)
|
||||
{
|
||||
// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
|
||||
m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID);
|
||||
if (sp.PresenceType != PresenceType.Npc)
|
||||
m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void OnNewClient(IClientAPI client)
|
||||
|
|
|
@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = ServiceVersion;
|
||||
|
@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||
|
||||
return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, position, out reason);
|
||||
return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason);
|
||||
}
|
||||
|
||||
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return m_remoteConnector.UpdateAgent(destination, cAgentData);
|
||||
}
|
||||
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, Vector3 position, out string version, out string reason)
|
||||
public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason)
|
||||
{
|
||||
reason = "Communications failure";
|
||||
version = "Unknown";
|
||||
|
@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
return false;
|
||||
|
||||
// Try local first
|
||||
if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason))
|
||||
if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason))
|
||||
return true;
|
||||
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(destination.RegionID))
|
||||
return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason);
|
||||
return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -585,7 +585,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
|||
ld.GlobalID = landID;
|
||||
|
||||
string ldPath = ArchiveConstants.CreateOarLandDataPath(ld);
|
||||
tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null));
|
||||
Dictionary<string, object> options = new Dictionary<string, object>();
|
||||
tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, options));
|
||||
tar.Close();
|
||||
|
||||
oarStream = new MemoryStream(oarStream.ToArray());
|
||||
|
|
|
@ -1106,13 +1106,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
|
||||
TerrainUploader = null;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[CLIENT]: Terrain upload from {0} to {1} complete.", remoteClient.Name, Scene.Name);
|
||||
remoteClient.SendAlertMessage("Terrain Upload Complete. Loading....");
|
||||
|
||||
ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>();
|
||||
|
||||
if (terr != null)
|
||||
{
|
||||
m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
|
||||
|
||||
try
|
||||
{
|
||||
MemoryStream terrainStream = new MemoryStream(terrainData);
|
||||
|
@ -1161,7 +1162,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
{
|
||||
if (TerrainUploader == null)
|
||||
{
|
||||
m_log.DebugFormat("Starting to receive uploaded terrain");
|
||||
m_log.DebugFormat(
|
||||
"[TERRAIN]: Started receiving terrain upload for region {0} from {1}",
|
||||
Scene.Name, remote_client.Name);
|
||||
|
||||
TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName);
|
||||
remote_client.OnXferReceive += TerrainUploader.XferReceive;
|
||||
remote_client.OnAbortXfer += AbortTerrainXferHandler;
|
||||
|
@ -1182,7 +1186,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
|
||||
if (terr != null)
|
||||
{
|
||||
m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
|
||||
// m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
|
||||
if (File.Exists(Util.dataDir() + "/terrain.raw"))
|
||||
{
|
||||
File.Delete(Util.dataDir() + "/terrain.raw");
|
||||
|
@ -1194,8 +1198,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
input.Read(bdata, 0, (int)input.Length);
|
||||
remote_client.SendAlertMessage("Terrain file written, starting download...");
|
||||
Scene.XferManager.AddNewFile("terrain.raw", bdata);
|
||||
// Tell client about it
|
||||
m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name);
|
||||
|
||||
m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name);
|
||||
|
||||
remote_client.SendInitiateDownload("terrain.raw", clientFileName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
List<Scene> m_scenes = new List<Scene>();
|
||||
List<UUID> m_Clients;
|
||||
|
||||
IWorldMapModule m_WorldMap;
|
||||
IWorldMapModule WorldMap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_WorldMap == null)
|
||||
m_WorldMap = m_scene.RequestModuleInterface<IWorldMapModule>();
|
||||
return m_WorldMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
@ -64,6 +76,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
m_scenes.Add(scene);
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
m_Clients = new List<UUID>();
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
@ -129,7 +142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
|
||||
{
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
MapBlockData data;
|
||||
if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
|
||||
{
|
||||
// final block, closing the search result
|
||||
|
@ -143,50 +155,50 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
}
|
||||
|
||||
|
||||
//m_log.DebugFormat("MAP NAME=({0})", mapName);
|
||||
|
||||
// Hack to get around the fact that ll V3 now drops the port from the
|
||||
// map name. See https://jira.secondlife.com/browse/VWR-28570
|
||||
//
|
||||
// Caller, use this magic form instead:
|
||||
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
|
||||
// or url encode if possible.
|
||||
// the hacks we do with this viewer...
|
||||
//
|
||||
string mapNameOrig = mapName;
|
||||
if (mapName.Contains("|"))
|
||||
mapName = mapName.Replace('|', ':');
|
||||
if (mapName.Contains("+"))
|
||||
mapName = mapName.Replace('+', ' ');
|
||||
if (mapName.Contains("!"))
|
||||
mapName = mapName.Replace('!', '/');
|
||||
|
||||
// try to fetch from GridServer
|
||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
||||
|
||||
string mapNameOrig = mapName;
|
||||
if (regionInfos.Count == 0)
|
||||
{
|
||||
// Hack to get around the fact that ll V3 now drops the port from the
|
||||
// map name. See https://jira.secondlife.com/browse/VWR-28570
|
||||
//
|
||||
// Caller, use this magic form instead:
|
||||
// secondlife://http|!!mygrid.com|8002|Region+Name/128/128
|
||||
// or url encode if possible.
|
||||
// the hacks we do with this viewer...
|
||||
//
|
||||
if (mapName.Contains("|"))
|
||||
mapName = mapName.Replace('|', ':');
|
||||
if (mapName.Contains("+"))
|
||||
mapName = mapName.Replace('+', ' ');
|
||||
if (mapName.Contains("!"))
|
||||
mapName = mapName.Replace('!', '/');
|
||||
|
||||
if (mapName != mapNameOrig)
|
||||
regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
|
||||
|
||||
if (regionInfos.Count > 0)
|
||||
{
|
||||
foreach (GridRegion info in regionInfos)
|
||||
{
|
||||
data = new MapBlockData();
|
||||
data.Agents = 0;
|
||||
data.Access = info.Access;
|
||||
if (flags == 2) // V2 sends this
|
||||
data.MapImageId = UUID.Zero;
|
||||
if ((flags & 2) == 2) // V2 sends this
|
||||
{
|
||||
List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags);
|
||||
// ugh! V2-3 is very sensitive about the result being
|
||||
// exactly the same as the requested name
|
||||
if (regionInfos.Count == 1 && (mapName != mapNameOrig))
|
||||
datas.ForEach(d => d.Name = mapNameOrig);
|
||||
|
||||
blocks.AddRange(datas);
|
||||
}
|
||||
else
|
||||
data.MapImageId = info.TerrainImage;
|
||||
// ugh! V2-3 is very sensitive about the result being
|
||||
// exactly the same as the requested name
|
||||
if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+"))
|
||||
data.Name = mapNameOrig;
|
||||
else
|
||||
data.Name = info.RegionName;
|
||||
data.RegionFlags = 0; // TODO not used?
|
||||
data.WaterHeight = 0; // not used
|
||||
data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX);
|
||||
data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY);
|
||||
blocks.Add(data);
|
||||
{
|
||||
MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1064,7 +1064,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
}
|
||||
|
||||
// Fill a passed MapBlockData from a GridRegion
|
||||
protected MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag)
|
||||
public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
return block;
|
||||
}
|
||||
|
||||
protected List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
|
||||
public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
|
||||
{
|
||||
List<MapBlockData> blocks = new List<MapBlockData>();
|
||||
MapBlockData block = new MapBlockData();
|
||||
|
|
|
@ -381,7 +381,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
cli.RequestMethod = "GET";
|
||||
try
|
||||
{
|
||||
reply = cli.Request();
|
||||
reply = cli.Request(null);
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
{
|
||||
UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data);
|
||||
|
||||
bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset);
|
||||
|
||||
/// <summary>
|
||||
/// Copy objects to a user's inventory.
|
||||
/// </summary>
|
||||
|
|
|
@ -36,6 +36,26 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
{
|
||||
event UndeliveredMessage OnUndeliveredMessage;
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to send an instant message to a given destination.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the message cannot be delivered for any reason, this will be signalled on the OnUndeliveredMessage
|
||||
/// event. result(false) will also be called if the message cannot be delievered unless the type is
|
||||
/// InstantMessageDialog.MessageFromAgent. For successful message delivery, result(true) is called.
|
||||
/// </remarks>
|
||||
/// <param name="im"></param>
|
||||
/// <param name="result"></param>
|
||||
void SendInstantMessage(GridInstantMessage im, MessageResultNotification result);
|
||||
|
||||
/// <summary>
|
||||
/// Appropriately handle a known undeliverable message without attempting a send.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Essentially, this invokes the OnUndeliveredMessage event.
|
||||
/// </remarks>
|
||||
/// <param name="im"></param>
|
||||
/// <param name="result"></param>
|
||||
void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
* (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.Collections.Generic;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
|
@ -33,5 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// Generate a map tile for the scene. a terrain texture for this scene
|
||||
/// </summary>
|
||||
void GenerateMaptile();
|
||||
List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag);
|
||||
MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,11 +127,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public bool AddInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
return AddInventoryItem(item, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the given inventory item to a user's inventory.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public bool AddInventoryItem(InventoryItemBase item)
|
||||
public bool AddInventoryItem(InventoryItemBase item, bool trigger)
|
||||
{
|
||||
if (item.Folder != UUID.Zero && InventoryService.AddItem(item))
|
||||
{
|
||||
|
@ -140,7 +145,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
userlevel = 1;
|
||||
}
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
|
||||
if (trigger)
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -179,7 +185,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
userlevel = 1;
|
||||
}
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
|
||||
if (trigger)
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
|
||||
|
||||
if (originalFolder != UUID.Zero)
|
||||
{
|
||||
|
@ -764,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
invAccess.TransferInventoryAssets(itemCopy, senderId, recipient);
|
||||
AddInventoryItem(itemCopy);
|
||||
AddInventoryItem(itemCopy, false);
|
||||
|
||||
if (!Permissions.BypassPermissions())
|
||||
{
|
||||
|
@ -872,50 +879,33 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
AssetBase asset = AssetService.Get(item.AssetID.ToString());
|
||||
if (newName == String.Empty)
|
||||
newName = item.Name;
|
||||
|
||||
if (asset != null)
|
||||
if (remoteClient.AgentId == oldAgentID
|
||||
|| (LibraryService != null
|
||||
&& LibraryService.LibraryRootFolder != null
|
||||
&& oldAgentID == LibraryService.LibraryRootFolder.Owner))
|
||||
{
|
||||
if (newName != String.Empty)
|
||||
{
|
||||
asset.Name = newName;
|
||||
}
|
||||
else
|
||||
{
|
||||
newName = item.Name;
|
||||
}
|
||||
|
||||
if (remoteClient.AgentId == oldAgentID
|
||||
|| (LibraryService != null
|
||||
&& LibraryService.LibraryRootFolder != null
|
||||
&& oldAgentID == LibraryService.LibraryRootFolder.Owner))
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID,
|
||||
newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType,
|
||||
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
|
||||
}
|
||||
else
|
||||
{
|
||||
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
|
||||
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
|
||||
&& (m_permissions.BypassPermissions()
|
||||
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
|
||||
asset, (sbyte) item.InvType,
|
||||
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
|
||||
}
|
||||
}
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID,
|
||||
newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
|
||||
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
|
||||
item.Name, item.AssetID);
|
||||
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
|
||||
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
|
||||
&& (m_permissions.BypassPermissions()
|
||||
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
|
||||
item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType,
|
||||
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
|
||||
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -966,11 +956,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void CreateNewInventoryItem(
|
||||
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
|
||||
string name, string description, uint flags, uint callbackID,
|
||||
AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
|
||||
UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate)
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate);
|
||||
remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType,
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0,
|
||||
creationDate, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -994,19 +985,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="creationDate">Unix timestamp at which this item was created.</param>
|
||||
private void CreateNewInventoryItem(
|
||||
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
|
||||
string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
|
||||
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
|
||||
string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
|
||||
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
|
||||
bool assetUpload)
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.CreatorId = creatorID;
|
||||
item.CreatorData = creatorData;
|
||||
item.ID = UUID.Random();
|
||||
item.AssetID = asset.FullID;
|
||||
item.AssetID = assetID;
|
||||
item.Name = name;
|
||||
item.Description = description;
|
||||
item.Flags = flags;
|
||||
item.AssetType = asset.Type;
|
||||
item.AssetType = assetType;
|
||||
item.InvType = invType;
|
||||
item.Folder = folderID;
|
||||
item.CurrentPermissions = currentMask;
|
||||
|
@ -1016,7 +1008,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.BasePermissions = baseMask;
|
||||
item.CreationDate = creationDate;
|
||||
|
||||
if (AddInventoryItem(item))
|
||||
if (AddInventoryItem(item, assetUpload))
|
||||
{
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
}
|
||||
|
@ -1079,17 +1071,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// return;
|
||||
// }
|
||||
|
||||
AssetBase asset = new AssetBase();
|
||||
asset.FullID = olditemID;
|
||||
asset.Type = type;
|
||||
asset.Name = name;
|
||||
asset.Description = description;
|
||||
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
|
||||
name, description, 0, callbackID, asset, invType,
|
||||
name, description, 0, callbackID, olditemID, type, invType,
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All,
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch());
|
||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch(),
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3751,6 +3751,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
|
||||
}
|
||||
|
||||
// Final permissions check; this time we don't allow changing the position
|
||||
if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
|
||||
{
|
||||
m_authenticateHandler.RemoveCircuit(acd.circuitcode);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3760,6 +3767,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
|
||||
{
|
||||
acd.startpos = land.LandData.UserLocation;
|
||||
|
||||
// Final permissions check; this time we don't allow changing the position
|
||||
if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
|
||||
{
|
||||
m_authenticateHandler.RemoveCircuit(acd.circuitcode);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3767,6 +3781,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool IsPositionAllowed(UUID agentID, Vector3 pos, ref string reason)
|
||||
{
|
||||
ILandObject land = LandChannel.GetLandObject(pos);
|
||||
if (land == null)
|
||||
return true;
|
||||
|
||||
if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID))
|
||||
{
|
||||
reason = "You are banned from the region.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
|
||||
{
|
||||
if (posX < 0)
|
||||
|
@ -3865,7 +3894,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!AuthorizationService.IsAuthorizedForRegion(
|
||||
agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}",
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
|
||||
|
||||
return false;
|
||||
|
@ -4133,7 +4162,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>true if we handled it.</returns>
|
||||
public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData)
|
||||
{
|
||||
//m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}",
|
||||
// cAgentData.AgentID, Name, cAgentData.Position);
|
||||
|
||||
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
|
||||
if (childAgentUpdate != null)
|
||||
{
|
||||
|
@ -5150,7 +5182,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
|
||||
if (nearestPoint != null)
|
||||
{
|
||||
Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
|
||||
m_log.Debug("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
|
||||
return nearestPoint.Value;
|
||||
}
|
||||
|
||||
|
@ -5160,7 +5192,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
|
||||
if (nearestPoint != null)
|
||||
{
|
||||
Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString());
|
||||
m_log.Debug("They had a zero velocity, sending them to: " + nearestPoint.ToString());
|
||||
return nearestPoint.Value;
|
||||
}
|
||||
|
||||
|
@ -5169,7 +5201,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
// Ultimate backup if we have no idea where they are and
|
||||
// the last allowed position was in another parcel
|
||||
Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
|
||||
m_log.Debug("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
|
||||
return avatar.lastKnownAllowedPosition;
|
||||
}
|
||||
|
||||
|
@ -5179,7 +5211,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//Go to the edge, this happens in teleporting to a region with no available parcels
|
||||
Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
|
||||
|
||||
//Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
|
||||
//m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
|
||||
|
||||
return nearestRegionEdgePoint;
|
||||
}
|
||||
|
@ -5463,9 +5495,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name='position'></param>
|
||||
/// <param name='reason'></param>
|
||||
/// <returns></returns>
|
||||
public bool QueryAccess(UUID agentID, string agentHomeURI, Vector3 position, out string reason)
|
||||
public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
|
||||
{
|
||||
reason = "You are banned from the region";
|
||||
reason = string.Empty;
|
||||
|
||||
if (Permissions.IsGod(agentID))
|
||||
{
|
||||
|
@ -5525,10 +5557,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message);
|
||||
reason = "Error authorizing agent: " + e.Message;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (position == Vector3.Zero) // Teleport
|
||||
if (viaTeleport)
|
||||
{
|
||||
if (!RegionInfo.EstateSettings.AllowDirectTeleport)
|
||||
{
|
||||
|
@ -5568,6 +5601,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
|
||||
reason = "You are banned from the region on all parcels";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -5575,13 +5609,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
|
||||
if (land == null)
|
||||
{
|
||||
reason = "No parcel found";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool banned = land.IsBannedFromLand(agentID);
|
||||
bool restricted = land.IsRestrictedFromLand(agentID);
|
||||
|
||||
if (banned || restricted)
|
||||
{
|
||||
if (banned)
|
||||
reason = "You are banned from the parcel";
|
||||
else
|
||||
reason = "The parcel is restricted";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
reason = String.Empty;
|
||||
|
|
|
@ -751,7 +751,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Vector3 bbox;
|
||||
float offsetHeight;
|
||||
|
||||
bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
|
||||
m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
|
||||
|
||||
for (int i = 0; i < objlist.Count; i++)
|
||||
{
|
||||
|
|
|
@ -208,7 +208,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// private int m_lastColCount = -1; //KF: Look for Collision chnages
|
||||
// private int m_updateCount = 0; //KF: Update Anims for a while
|
||||
// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
|
||||
private List<uint> m_lastColliders = new List<uint>();
|
||||
|
||||
private TeleportFlags m_teleportFlags;
|
||||
public TeleportFlags TeleportFlags
|
||||
|
@ -271,8 +270,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//private int m_moveToPositionStateStatus;
|
||||
//*****************************************************
|
||||
|
||||
private object m_collisionEventLock = new Object();
|
||||
|
||||
private int m_movementAnimationUpdateCounter = 0;
|
||||
|
||||
public Vector3 PrevSitOffset { get; set; }
|
||||
|
@ -1328,6 +1325,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
|
||||
|
||||
// Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating
|
||||
// from the source simulator has completed on a V2 teleport.
|
||||
lock (m_originRegionIDAccessLock)
|
||||
m_originRegionID = UUID.Zero;
|
||||
|
||||
// Reset these so that teleporting in and walking out isn't seen
|
||||
// as teleporting back
|
||||
TeleportFlags = TeleportFlags.Default;
|
||||
|
@ -2752,7 +2754,34 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
part.AddSittingAvatar(this);
|
||||
|
||||
cameraAtOffset = part.GetCameraAtOffset();
|
||||
|
||||
if (!part.IsRoot && cameraAtOffset == Vector3.Zero)
|
||||
cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
|
||||
|
||||
bool cameraEyeOffsetFromRootForChild = false;
|
||||
cameraEyeOffset = part.GetCameraEyeOffset();
|
||||
|
||||
if (!part.IsRoot && cameraEyeOffset == Vector3.Zero)
|
||||
{
|
||||
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
|
||||
cameraEyeOffsetFromRootForChild = true;
|
||||
}
|
||||
|
||||
if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero)
|
||||
{
|
||||
if (!part.IsRoot)
|
||||
{
|
||||
cameraEyeOffset = cameraEyeOffset * part.RotationOffset;
|
||||
cameraAtOffset += part.OffsetPosition;
|
||||
}
|
||||
|
||||
cameraEyeOffset += part.OffsetPosition;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}",
|
||||
// cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name);
|
||||
|
||||
forceMouselook = part.GetForceMouselook();
|
||||
|
||||
// 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
|
|||
if (!IsChildAgent)
|
||||
return;
|
||||
|
||||
//m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}",
|
||||
// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position);
|
||||
|
||||
// Find the distance (in meters) between the two regions
|
||||
uint shiftx = Util.RegionToWorldLoc(rRegionX - tRegionX);
|
||||
uint shifty = Util.RegionToWorldLoc(rRegionY - tRegionY);
|
||||
// XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the
|
||||
// uint
|
||||
int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize);
|
||||
int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize);
|
||||
|
||||
Vector3 offset = new Vector3(shiftx, shifty, 0f);
|
||||
|
||||
|
@ -3876,9 +3910,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private void CopyFrom(AgentData cAgent)
|
||||
{
|
||||
lock (m_originRegionIDAccessLock)
|
||||
m_originRegionID = cAgent.RegionID;
|
||||
|
||||
m_callbackURI = cAgent.CallbackURI;
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
|
||||
|
@ -3951,6 +3982,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (Scene.AttachmentsModule != null)
|
||||
Scene.AttachmentsModule.CopyAttachments(cAgent, this);
|
||||
|
||||
// This must occur after attachments are copied, as it releases the CompleteMovement() calling thread
|
||||
// originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart
|
||||
// script attachments can outrace this thread.
|
||||
lock (m_originRegionIDAccessLock)
|
||||
m_originRegionID = cAgent.RegionID;
|
||||
}
|
||||
|
||||
public bool CopyAgent(out IAgentData agent)
|
||||
|
|
|
@ -1343,7 +1343,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
|
||||
writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
|
||||
writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
|
||||
WriteUUID(writer, "GroupID", sop.GroupID, options);
|
||||
|
||||
UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.GroupID;
|
||||
WriteUUID(writer, "GroupID", groupID, options);
|
||||
|
||||
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
|
||||
WriteUUID(writer, "OwnerID", ownerID, options);
|
||||
|
@ -1469,7 +1471,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
writer.WriteElementString("Description", item.Description);
|
||||
writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
|
||||
writer.WriteElementString("Flags", item.Flags.ToString());
|
||||
WriteUUID(writer, "GroupID", item.GroupID, options);
|
||||
|
||||
UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.GroupID;
|
||||
WriteUUID(writer, "GroupID", groupID, options);
|
||||
|
||||
writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
|
||||
writer.WriteElementString("InvType", item.InvType.ToString());
|
||||
WriteUUID(writer, "ItemID", item.ItemID, options);
|
||||
|
@ -1490,7 +1495,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
|
||||
writer.WriteElementString("PermsMask", item.PermsMask.ToString());
|
||||
writer.WriteElementString("Type", item.Type.ToString());
|
||||
writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower());
|
||||
|
||||
bool ownerChanged = options.ContainsKey("wipe-owners") ? false : item.OwnerChanged;
|
||||
writer.WriteElementString("OwnerChanged", ownerChanged.ToString().ToLower());
|
||||
|
||||
writer.WriteEndElement(); // TaskInventoryItem
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
public static class OpenSimTerrainCompressor
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
#pragma warning disable 414
|
||||
private static string LogHeader = "[TERRAIN COMPRESSOR]";
|
||||
|
|
|
@ -55,8 +55,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
private IGroupsServicesConnector m_groupData = null;
|
||||
|
||||
// Config Options
|
||||
private bool m_groupMessagingEnabled = false;
|
||||
private bool m_debugEnabled = true;
|
||||
private bool m_groupMessagingEnabled;
|
||||
private bool m_debugEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
|||
if (m_messageOnlineAgentsOnly)
|
||||
m_usersOnlineCache = new ExpiringCache<UUID, PresenceInfo[]>();
|
||||
|
||||
m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true);
|
||||
m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled);
|
||||
}
|
||||
|
||||
m_log.InfoFormat(
|
||||
|
@ -127,6 +127,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
return;
|
||||
|
||||
scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
|
||||
|
||||
scene.AddCommand(
|
||||
"Debug",
|
||||
this,
|
||||
"debug groups messaging verbose",
|
||||
"debug groups messaging verbose <true|false>",
|
||||
"This setting turns on very verbose groups messaging debugging",
|
||||
HandleDebugGroupsMessagingVerbose);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
@ -218,6 +226,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
#endregion
|
||||
|
||||
private void HandleDebugGroupsMessagingVerbose(object modules, string[] args)
|
||||
{
|
||||
if (args.Length < 5)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
|
||||
return;
|
||||
}
|
||||
|
||||
bool verbose = false;
|
||||
if (!bool.TryParse(args[4], out verbose))
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
|
||||
return;
|
||||
}
|
||||
|
||||
m_debugEnabled = verbose;
|
||||
|
||||
MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not really needed, but does confirm that the group exists.
|
||||
/// </summary>
|
||||
|
@ -246,8 +274,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
public void SendMessageToGroup(
|
||||
GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
|
||||
{
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID);
|
||||
int groupMembersCount = groupMembers.Count;
|
||||
HashSet<string> attemptDeliveryUuidSet = null;
|
||||
|
||||
if (m_messageOnlineAgentsOnly)
|
||||
{
|
||||
|
@ -263,10 +294,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
|
||||
}
|
||||
|
||||
HashSet<string> onlineAgentsUuidSet = new HashSet<string>();
|
||||
Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID));
|
||||
attemptDeliveryUuidSet
|
||||
= new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID));
|
||||
|
||||
groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
|
||||
//Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID));
|
||||
|
||||
//groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
|
||||
|
||||
// if (m_debugEnabled)
|
||||
// m_log.DebugFormat(
|
||||
|
@ -275,14 +308,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
}
|
||||
else
|
||||
{
|
||||
attemptDeliveryUuidSet
|
||||
= new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()));
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members",
|
||||
groupID, groupMembers.Count);
|
||||
}
|
||||
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
foreach (GroupMembersData member in groupMembers)
|
||||
{
|
||||
if (sendCondition != null)
|
||||
|
@ -309,7 +343,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
// Copy Message
|
||||
GridInstantMessage msg = new GridInstantMessage();
|
||||
msg.imSessionID = groupID.Guid;
|
||||
msg.imSessionID = im.imSessionID;
|
||||
msg.fromAgentName = im.fromAgentName;
|
||||
msg.message = im.message;
|
||||
msg.dialog = im.dialog;
|
||||
|
@ -325,26 +359,51 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
msg.toAgentID = member.AgentID.Guid;
|
||||
|
||||
IClientAPI client = GetActiveClient(member.AgentID);
|
||||
if (client == null)
|
||||
if (attemptDeliveryUuidSet.Contains(member.AgentID.ToString()))
|
||||
{
|
||||
// If they're not local, forward across the grid
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID);
|
||||
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
|
||||
IClientAPI client = GetActiveClient(member.AgentID);
|
||||
if (client == null)
|
||||
{
|
||||
int startTick = Environment.TickCount;
|
||||
|
||||
// If they're not local, forward across the grid
|
||||
m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: Delivering to {0} via grid took {1} ms",
|
||||
member.AgentID, Environment.TickCount - startTick);
|
||||
}
|
||||
else
|
||||
{
|
||||
int startTick = Environment.TickCount;
|
||||
|
||||
ProcessMessageFromGroupSession(msg, client);
|
||||
|
||||
// Deliver locally, directly
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: Delivering to {0} locally took {1} ms",
|
||||
member.AgentID, Environment.TickCount - startTick);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Deliver locally, directly
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name);
|
||||
ProcessMessageFromGroupSession(msg, client);
|
||||
int startTick = Environment.TickCount;
|
||||
|
||||
m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { });
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: Handling undeliverable message for {0} took {1} ms",
|
||||
member.AgentID, Environment.TickCount - startTick);
|
||||
}
|
||||
}
|
||||
|
||||
// Temporary for assessing how long it still takes to send messages to large online groups.
|
||||
if (m_messageOnlineAgentsOnly)
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms",
|
||||
groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick);
|
||||
"[GROUPS-MESSAGING]: Total SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3} ms",
|
||||
groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick);
|
||||
}
|
||||
|
||||
#region SimGridEventHandlers
|
||||
|
@ -407,7 +466,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}",
|
||||
msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog);
|
||||
|
||||
UUID AgentID = new UUID(msg.fromAgentID);
|
||||
UUID GroupID = new UUID(msg.imSessionID);
|
||||
|
@ -431,8 +493,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
// Add them to the session for now, and Invite them
|
||||
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||
|
||||
UUID toAgentID = new UUID(msg.toAgentID);
|
||||
|
||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
|
||||
if (groupInfo != null)
|
||||
{
|
||||
|
@ -577,15 +637,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
// Don't log any normal IMs (privacy!)
|
||||
if (m_debugEnabled && im.dialog != (byte)InstantMessageDialog.MessageFromAgent)
|
||||
{
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False");
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", (InstantMessageDialog)im.dialog);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID);
|
||||
m_log.WarnFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket"));
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False");
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", (InstantMessageDialog)im.dialog);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID);
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,7 +656,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
/// </summary>
|
||||
private IClientAPI GetActiveClient(UUID agentID)
|
||||
{
|
||||
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
|
||||
|
||||
IClientAPI child = null;
|
||||
|
||||
|
@ -608,12 +669,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
{
|
||||
if (!sp.IsChildAgent)
|
||||
{
|
||||
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name);
|
||||
|
||||
return sp.ControllingClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name);
|
||||
|
||||
child = sp.ControllingClient;
|
||||
}
|
||||
}
|
||||
|
@ -622,12 +687,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
// If we didn't find a root, then just return whichever child we found, or null if none
|
||||
if (child == null)
|
||||
{
|
||||
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name);
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||
{
|
||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS]: {0} called for {1}, message type {2}",
|
||||
System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog);
|
||||
|
||||
// Group invitations
|
||||
if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
|
||||
|
@ -551,6 +554,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
UUID noticeID = new UUID(im.imSessionID);
|
||||
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId);
|
||||
|
||||
GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID);
|
||||
if (notice != null)
|
||||
{
|
||||
|
@ -572,6 +578,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_debugEnabled)
|
||||
m_log.DebugFormat(
|
||||
"[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
|
||||
noticeID, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
// Interop, received special 210 code for ejecting a group member
|
||||
|
|
|
@ -132,6 +132,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
|
|||
MessageTransferModule mtm = new MessageTransferModule();
|
||||
GroupsModule gm = new GroupsModule();
|
||||
GroupsMessagingModule gmm = new GroupsMessagingModule();
|
||||
MockGroupsServicesConnector mgsc = new MockGroupsServicesConnector();
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
|
||||
|
@ -149,6 +150,83 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
|
|||
config.Set("MessagingEnabled", true);
|
||||
}
|
||||
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, mgsc, mtm, gm, gmm);
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
string subjectText = "newman";
|
||||
string messageText = "Hello";
|
||||
string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText);
|
||||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
TestClient tc = (TestClient)sp.ControllingClient;
|
||||
|
||||
UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true);
|
||||
gm.JoinGroupRequest(tc, groupID);
|
||||
|
||||
// Create a second user who doesn't want to receive notices
|
||||
ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
|
||||
TestClient tc2 = (TestClient)sp2.ControllingClient;
|
||||
gm.JoinGroupRequest(tc2, groupID);
|
||||
gm.SetGroupAcceptNotices(tc2, groupID, false, true);
|
||||
|
||||
List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>();
|
||||
tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
|
||||
|
||||
List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>();
|
||||
tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
|
||||
|
||||
GridInstantMessage noticeIm = new GridInstantMessage();
|
||||
noticeIm.fromAgentID = userId.Guid;
|
||||
noticeIm.toAgentID = groupID.Guid;
|
||||
noticeIm.message = combinedSubjectMessage;
|
||||
noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
|
||||
|
||||
tc.HandleImprovedInstantMessage(noticeIm);
|
||||
|
||||
Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
|
||||
Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
|
||||
|
||||
List<GroupNoticeData> notices = mgsc.GetGroupNotices(UUID.Zero, groupID);
|
||||
Assert.AreEqual(1, notices.Count);
|
||||
|
||||
// OpenSimulator (possibly also SL) transport the notice ID as the session ID!
|
||||
Assert.AreEqual(notices[0].NoticeID.Guid, spReceivedMessages[0].imSessionID);
|
||||
|
||||
Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run test with the MessageOnlineUsersOnly flag set.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSendGroupNoticeOnlineOnly()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
|
||||
MessageTransferModule mtm = new MessageTransferModule();
|
||||
GroupsModule gm = new GroupsModule();
|
||||
GroupsMessagingModule gmm = new GroupsMessagingModule();
|
||||
|
||||
IConfigSource configSource = new IniConfigSource();
|
||||
|
||||
{
|
||||
IConfig config = configSource.AddConfig("Messaging");
|
||||
config.Set("MessageTransferModule", mtm.Name);
|
||||
}
|
||||
|
||||
{
|
||||
IConfig config = configSource.AddConfig("Groups");
|
||||
config.Set("Enabled", true);
|
||||
config.Set("Module", gm.Name);
|
||||
config.Set("DebugEnabled", true);
|
||||
config.Set("MessagingModule", gmm.Name);
|
||||
config.Set("MessagingEnabled", true);
|
||||
config.Set("MessageOnlineUsersOnly", true);
|
||||
}
|
||||
|
||||
SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm);
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
|
|
|
@ -105,8 +105,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
|
|||
m_scene.LoginLock = true;
|
||||
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
|
||||
|
||||
// Warn level because the region cannot be used while logins are disabled
|
||||
m_log.WarnFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
|
||||
// This should always show up to the user but should not trigger warn/errors as these messages are
|
||||
// expected and are not simulator problems. Ideally, there would be a status level in log4net but
|
||||
// failing that, we will print out to console instead.
|
||||
MainConsole.Instance.OutputFormat("Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
|
||||
|
||||
if (m_uri != string.Empty)
|
||||
{
|
||||
|
|
|
@ -147,6 +147,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
|||
terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X];
|
||||
|
||||
float height = terrainHeight + actor.Size.Z;
|
||||
// Console.WriteLine("height {0}, actorPosition {1}", height, actorPosition);
|
||||
|
||||
if (actor.Flying)
|
||||
{
|
||||
|
|
|
@ -399,8 +399,8 @@ public class BSActorAvatarMove : BSActor
|
|||
m_controllingPrim.ForcePosition = m_controllingPrim.RawPosition + displacement;
|
||||
}
|
||||
}
|
||||
m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs.ComputeStairCorrection,disp={1},force={2}",
|
||||
m_controllingPrim.LocalID, displacement, ret);
|
||||
m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs.ComputeStairCorrection,stepUp={1},isp={2},force={3}",
|
||||
m_controllingPrim.LocalID, stepUp, displacement, ret);
|
||||
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -598,9 +598,9 @@ public static class BSParam
|
|||
new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
|
||||
1.0f ),
|
||||
new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
|
||||
1.0f ),
|
||||
2.0f ),
|
||||
new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
|
||||
2 ),
|
||||
1 ),
|
||||
|
||||
new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
|
||||
1000.0f,
|
||||
|
|
|
@ -639,15 +639,18 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
{
|
||||
if (collidersCount > 0)
|
||||
{
|
||||
for (int ii = 0; ii < collidersCount; ii++)
|
||||
lock (PhysObjects)
|
||||
{
|
||||
uint cA = m_collisionArray[ii].aID;
|
||||
uint cB = m_collisionArray[ii].bID;
|
||||
Vector3 point = m_collisionArray[ii].point;
|
||||
Vector3 normal = m_collisionArray[ii].normal;
|
||||
float penetration = m_collisionArray[ii].penetration;
|
||||
SendCollision(cA, cB, point, normal, penetration);
|
||||
SendCollision(cB, cA, point, -normal, penetration);
|
||||
for (int ii = 0; ii < collidersCount; ii++)
|
||||
{
|
||||
uint cA = m_collisionArray[ii].aID;
|
||||
uint cB = m_collisionArray[ii].bID;
|
||||
Vector3 point = m_collisionArray[ii].point;
|
||||
Vector3 normal = m_collisionArray[ii].normal;
|
||||
float penetration = m_collisionArray[ii].penetration;
|
||||
SendCollision(cA, cB, point, normal, penetration);
|
||||
SendCollision(cB, cA, point, -normal, penetration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -658,14 +661,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
{
|
||||
if (updatedEntityCount > 0)
|
||||
{
|
||||
for (int ii = 0; ii < updatedEntityCount; ii++)
|
||||
lock (PhysObjects)
|
||||
{
|
||||
EntityProperties entprop = m_updateArray[ii];
|
||||
BSPhysObject pobj;
|
||||
if (PhysObjects.TryGetValue(entprop.ID, out pobj))
|
||||
for (int ii = 0; ii < updatedEntityCount; ii++)
|
||||
{
|
||||
if (pobj.IsInitialized)
|
||||
pobj.UpdateProperties(entprop);
|
||||
EntityProperties entprop = m_updateArray[ii];
|
||||
BSPhysObject pobj;
|
||||
if (PhysObjects.TryGetValue(entprop.ID, out pobj))
|
||||
{
|
||||
if (pobj.IsInitialized)
|
||||
pobj.UpdateProperties(entprop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6846,12 +6846,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.SetCameraEyeOffset(offset);
|
||||
|
||||
if (m_host.ParentGroup.RootPart.GetCameraEyeOffset() == Vector3.Zero)
|
||||
m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset);
|
||||
}
|
||||
|
||||
public void llSetCameraAtOffset(LSL_Vector offset)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.SetCameraAtOffset(offset);
|
||||
|
||||
if (m_host.ParentGroup.RootPart.GetCameraAtOffset() == Vector3.Zero)
|
||||
m_host.ParentGroup.RootPart.SetCameraAtOffset(offset);
|
||||
}
|
||||
|
||||
public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
m_braceCount++;
|
||||
|
||||
// line number
|
||||
m_CSharpLine += 3;
|
||||
m_CSharpLine += 9;
|
||||
|
||||
// here's the payload
|
||||
retstr += GenerateLine();
|
||||
|
|
|
@ -444,7 +444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
|||
// return compileScript;
|
||||
// }
|
||||
|
||||
private static string CreateCSCompilerScript(
|
||||
public static string CreateCSCompilerScript(
|
||||
string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters)
|
||||
{
|
||||
compileScript = string.Format(
|
||||
|
@ -472,7 +472,7 @@ namespace SecondLife
|
|||
return compileScript;
|
||||
}
|
||||
|
||||
private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName)
|
||||
public static string CreateVBCompilerScript(string compileScript, string className, string baseClassName)
|
||||
{
|
||||
compileScript = String.Empty +
|
||||
"Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
|
||||
|
|
|
@ -25,12 +25,14 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CSharp;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
||||
|
@ -47,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
private CSharpCodeProvider m_CSCodeProvider;
|
||||
private CompilerParameters m_compilerParameters;
|
||||
private CompilerResults m_compilerResults;
|
||||
private ResolveEventHandler m_resolveEventHandler;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a temporary directory where build artifacts are stored.
|
||||
|
@ -66,9 +69,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
m_CSCodeProvider = new CSharpCodeProvider();
|
||||
m_compilerParameters = new CompilerParameters();
|
||||
|
||||
string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "bin");
|
||||
string rootPath = System.AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
||||
m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve);
|
||||
|
||||
System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler;
|
||||
|
||||
m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
|
||||
m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
|
||||
m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll"));
|
||||
m_compilerParameters.GenerateExecutable = false;
|
||||
}
|
||||
|
||||
|
@ -79,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
[TestFixtureTearDown]
|
||||
public void CleanUp()
|
||||
{
|
||||
System.AppDomain.CurrentDomain.AssemblyResolve -= m_resolveEventHandler;
|
||||
|
||||
if (Directory.Exists(m_testDir))
|
||||
{
|
||||
// Blow away the temporary directory with artifacts.
|
||||
|
@ -90,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
/// Test the C# compiler error message can be mapped to the correct
|
||||
/// line/column in the LSL source when an undeclared variable is used.
|
||||
/// </summary>
|
||||
//[Test]
|
||||
[Test]
|
||||
public void TestUseUndeclaredVariable()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
@ -106,25 +117,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
|
|||
}";
|
||||
|
||||
CSCodeGenerator cg = new CSCodeGenerator();
|
||||
string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" +
|
||||
"namespace SecondLife { " +
|
||||
"public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" +
|
||||
"public Script() { } " +
|
||||
cg.Convert(input) +
|
||||
"} }\n";
|
||||
string output = cg.Convert(input);
|
||||
|
||||
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
|
||||
// System.Console.WriteLine(output);
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
|
||||
|
||||
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||
//
|
||||
// foreach (KeyValuePair<int, int> key in positionMap.Keys)
|
||||
// {
|
||||
// KeyValuePair<int, int> val = positionMap[key];
|
||||
//
|
||||
// System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
|
||||
// }
|
||||
//
|
||||
// foreach (CompilerError compErr in m_compilerResults.Errors)
|
||||
// {
|
||||
// System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
|
||||
// }
|
||||
|
||||
Assert.AreEqual(new KeyValuePair<int, int>(5, 21),
|
||||
positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
|
||||
Assert.AreEqual(
|
||||
new KeyValuePair<int, int>(5, 21),
|
||||
positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that a string can be cast to string and another string
|
||||
/// concatenated.
|
||||
/// </summary>
|
||||
//[Test]
|
||||
[Test]
|
||||
public void TestCastAndConcatString()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
@ -143,15 +166,21 @@ default
|
|||
}
|
||||
}";
|
||||
|
||||
// System.Console.WriteLine(input);
|
||||
CSCodeGenerator cg = new CSCodeGenerator();
|
||||
string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" +
|
||||
"namespace SecondLife { " +
|
||||
"public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" +
|
||||
"public Script() { } " +
|
||||
cg.Convert(input) +
|
||||
"} }\n";
|
||||
string output = cg.Convert(input);
|
||||
|
||||
output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
|
||||
// System.Console.WriteLine(output);
|
||||
|
||||
m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
|
||||
|
||||
System.Console.WriteLine("ERRORS: {0}", m_compilerResults.Errors.Count);
|
||||
foreach (CompilerError compErr in m_compilerResults.Errors)
|
||||
{
|
||||
System.Console.WriteLine("Error: {0}", compErr);
|
||||
}
|
||||
|
||||
Assert.AreEqual(0, m_compilerResults.Errors.Count);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.IO;
|
|||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
@ -69,6 +70,8 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
|
||||
bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false);
|
||||
|
||||
string redirectURL = serverConfig.GetString("RedirectURL", string.Empty);
|
||||
|
||||
AllowedRemoteDeleteTypes allowedRemoteDeleteTypes;
|
||||
|
||||
if (!allowDelete)
|
||||
|
@ -83,9 +86,11 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile;
|
||||
}
|
||||
|
||||
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
|
||||
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
|
||||
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth, redirectURL));
|
||||
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth));
|
||||
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth));
|
||||
server.AddStreamHandler(new AssetsExistHandler(m_AssetService));
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("Assets", false,
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Asset
|
||||
|
@ -70,6 +71,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_allowedTypes = allowedTypes;
|
||||
}
|
||||
|
||||
public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes, IServiceAuth auth) :
|
||||
base("DELETE", "/assets", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
m_allowedTypes = allowedTypes;
|
||||
}
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
|
|
|
@ -38,15 +38,17 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Asset
|
||||
{
|
||||
public class AssetServerGetHandler : BaseStreamHandler
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IAssetService m_AssetService;
|
||||
private string m_RedirectURL;
|
||||
|
||||
public AssetServerGetHandler(IAssetService service) :
|
||||
base("GET", "/assets")
|
||||
|
@ -54,6 +56,15 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_AssetService = service;
|
||||
}
|
||||
|
||||
public AssetServerGetHandler(IAssetService service, IServiceAuth auth, string redirectURL) :
|
||||
base("GET", "/assets", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
m_RedirectURL = redirectURL;
|
||||
if (!m_RedirectURL.EndsWith("/"))
|
||||
m_RedirectURL = m_RedirectURL.TrimEnd('/');
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
|
@ -64,9 +75,10 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
if (p.Length == 0)
|
||||
return result;
|
||||
|
||||
string id = string.Empty;
|
||||
if (p.Length > 1)
|
||||
{
|
||||
string id = p[0];
|
||||
id = p[0];
|
||||
string cmd = p[1];
|
||||
|
||||
if (cmd == "data")
|
||||
|
@ -117,7 +129,7 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
{
|
||||
// Get the entire asset (metadata + data)
|
||||
|
||||
string id = p[0];
|
||||
id = p[0];
|
||||
AssetBase asset = m_AssetService.Get(id);
|
||||
|
||||
if (asset != null)
|
||||
|
@ -144,6 +156,16 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
result = new byte[0];
|
||||
}
|
||||
|
||||
if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id))
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Redirect;
|
||||
string rurl = m_RedirectURL;
|
||||
if (!path.StartsWith("/"))
|
||||
rurl += "/";
|
||||
rurl += path;
|
||||
httpResponse.AddHeader("Location", rurl);
|
||||
m_log.DebugFormat("[ASSET GET HANDLER]: Asset not found, redirecting to {0} ({1})", rurl, httpResponse.StatusCode);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Asset
|
||||
|
@ -54,6 +55,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_AssetService = service;
|
||||
}
|
||||
|
||||
public AssetServerPostHandler(IAssetService service, IServiceAuth auth) :
|
||||
base("POST", "/assets", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -55,6 +56,12 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_AssetService = service;
|
||||
}
|
||||
|
||||
public AssetsExistHandler(IAssetService service, IServiceAuth auth) :
|
||||
base("POST", "/get_assets_exist", auth)
|
||||
{
|
||||
m_AssetService = service;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
XmlSerializer xs;
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
|
||||
|
@ -58,7 +59,9 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
Object[] args = new Object[] { config };
|
||||
m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authenticationService, args);
|
||||
|
||||
server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new AuthenticationServerPostHandler(m_AuthenticationService, serverConfig, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ 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;
|
||||
|
||||
|
@ -55,10 +56,10 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
private bool m_AllowSetPassword = false;
|
||||
|
||||
public AuthenticationServerPostHandler(IAuthenticationService service) :
|
||||
this(service, null) {}
|
||||
this(service, null, null) {}
|
||||
|
||||
public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config) :
|
||||
base("POST", "/auth")
|
||||
public AuthenticationServerPostHandler(IAuthenticationService service, IConfig config, IServiceAuth auth) :
|
||||
base("POST", "/auth", auth)
|
||||
{
|
||||
m_AuthenticationService = service;
|
||||
|
||||
|
@ -73,6 +74,7 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.Error("[XXX]: Authenticating...");
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
if (p.Length > 0)
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Avatar
|
|||
Object[] args = new Object[] { config };
|
||||
m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
|
||||
|
||||
server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new AvatarServerPostHandler(m_AvatarService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ 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;
|
||||
|
||||
|
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Avatar
|
|||
|
||||
private IAvatarService m_AvatarService;
|
||||
|
||||
public AvatarServerPostHandler(IAvatarService service) :
|
||||
base("POST", "/avatar")
|
||||
public AvatarServerPostHandler(IAvatarService service, IServiceAuth auth) :
|
||||
base("POST", "/avatar", auth)
|
||||
{
|
||||
m_AvatarService = service;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.BakedTextures
|
||||
|
@ -50,14 +51,14 @@ namespace OpenSim.Server.Handlers.BakedTextures
|
|||
private System.Text.UTF8Encoding utf8 =
|
||||
new System.Text.UTF8Encoding();
|
||||
|
||||
public BakesServerGetHandler(IBakedTextureService service) :
|
||||
base("GET", "/bakes")
|
||||
public BakesServerGetHandler(IBakedTextureService service, IServiceAuth auth) :
|
||||
base("GET", "/bakes", auth)
|
||||
{
|
||||
m_BakesService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override byte[] ProcessRequest(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
|
||||
|
@ -59,8 +60,10 @@ namespace OpenSim.Server.Handlers.BakedTextures
|
|||
m_BakesService =
|
||||
ServerUtils.LoadPlugin<IBakedTextureService>(assetService, args);
|
||||
|
||||
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService));
|
||||
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new BakesServerGetHandler(m_BakesService, auth));
|
||||
server.AddStreamHandler(new BakesServerPostHandler(m_BakesService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,27 +38,28 @@ using System.Xml.Serialization;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Server.Handlers.BakedTextures
|
||||
{
|
||||
public class BakesServerPostHandler : BaseStreamHandler
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IBakedTextureService m_BakesService;
|
||||
|
||||
private System.Text.UTF8Encoding utf8 =
|
||||
new System.Text.UTF8Encoding();
|
||||
|
||||
public BakesServerPostHandler(IBakedTextureService service) :
|
||||
base("POST", "/bakes")
|
||||
public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) :
|
||||
base("POST", "/bakes", auth)
|
||||
{
|
||||
m_BakesService = service;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override byte[] ProcessRequest(
|
||||
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
|
||||
|
@ -55,7 +56,8 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
Object[] args = new Object[] { config };
|
||||
m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args);
|
||||
|
||||
server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
server.AddStreamHandler(new FriendsServerPostHandler(m_FriendsService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -51,8 +52,8 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
|
||||
private IFriendsService m_FriendsService;
|
||||
|
||||
public FriendsServerPostHandler(IFriendsService service) :
|
||||
base("POST", "/friends")
|
||||
public FriendsServerPostHandler(IFriendsService service, IServiceAuth auth) :
|
||||
base("POST", "/friends", auth)
|
||||
{
|
||||
m_FriendsService = service;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
Object[] args = new Object[] { config };
|
||||
m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
|
||||
|
||||
server.AddStreamHandler(new GridServerPostHandler(m_GridService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new GridServerPostHandler(m_GridService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
|
@ -55,8 +56,8 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
|
||||
private IGridService m_GridService;
|
||||
|
||||
public GridServerPostHandler(IGridService service) :
|
||||
base("POST", "/grid")
|
||||
public GridServerPostHandler(IGridService service, IServiceAuth auth) :
|
||||
base("POST", "/grid", auth)
|
||||
{
|
||||
m_GridService = service;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ 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;
|
||||
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.GridUser
|
|||
Object[] args = new Object[] { config };
|
||||
m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(service, args);
|
||||
|
||||
server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); ;
|
||||
|
||||
server.AddStreamHandler(new GridUserServerPostHandler(m_GridUserService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ 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;
|
||||
|
||||
|
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.GridUser
|
|||
|
||||
private IGridUserService m_GridUserService;
|
||||
|
||||
public GridUserServerPostHandler(IGridUserService service) :
|
||||
base("POST", "/griduser")
|
||||
public GridUserServerPostHandler(IGridUserService service, IServiceAuth auth) :
|
||||
base("POST", "/griduser", auth)
|
||||
{
|
||||
m_GridUserService = service;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
@ -71,7 +72,9 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
m_InventoryService =
|
||||
ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args);
|
||||
|
||||
server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService, auth));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,8 +84,8 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
|
||||
private IInventoryService m_InventoryService;
|
||||
|
||||
public XInventoryConnectorPostHandler(IInventoryService service) :
|
||||
base("POST", "/xinventory")
|
||||
public XInventoryConnectorPostHandler(IInventoryService service, IServiceAuth auth) :
|
||||
base("POST", "/xinventory", auth)
|
||||
{
|
||||
m_InventoryService = service;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ using OpenMetaverse;
|
|||
using OpenSim.Framework;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
|
@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
|
||||
|
||||
bool proxy = serverConfig.GetBoolean("HasProxy", false);
|
||||
server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -91,8 +93,8 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
private IGridService m_GridService;
|
||||
bool m_Proxy;
|
||||
|
||||
public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) :
|
||||
base("POST", "/map")
|
||||
public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) :
|
||||
base("POST", "/map", auth)
|
||||
{
|
||||
m_MapService = service;
|
||||
m_GridService = grid;
|
||||
|
|
|
@ -30,6 +30,7 @@ using Nini.Config;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Presence
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
Object[] args = new Object[] { config };
|
||||
m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args);
|
||||
|
||||
server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ using OpenSim.Server.Base;
|
|||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Presence
|
||||
|
@ -50,8 +51,8 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
|
||||
private IPresenceService m_PresenceService;
|
||||
|
||||
public PresenceServerPostHandler(IPresenceService service) :
|
||||
base("POST", "/presence")
|
||||
public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) :
|
||||
base("POST", "/presence", auth)
|
||||
{
|
||||
m_PresenceService = service;
|
||||
}
|
||||
|
|
|
@ -132,6 +132,10 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
// m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
|
||||
OSDMap args = Utils.GetOSDMap((string)request["body"]);
|
||||
|
||||
bool viaTeleport = true;
|
||||
if (args.ContainsKey("viaTeleport"))
|
||||
viaTeleport = args["viaTeleport"].AsBoolean();
|
||||
|
||||
Vector3 position = Vector3.Zero;
|
||||
if (args.ContainsKey("position"))
|
||||
position = Vector3.Parse(args["position"].AsString());
|
||||
|
@ -145,7 +149,7 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
|
||||
string reason;
|
||||
string version;
|
||||
bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, position, out version, out reason);
|
||||
bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason);
|
||||
|
||||
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ using Nini.Config;
|
|||
using OpenSim.Server.Base;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
|
||||
namespace OpenSim.Server.Handlers.UserAccounts
|
||||
|
@ -55,7 +56,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
|||
Object[] args = new Object[] { config };
|
||||
m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(service, args);
|
||||
|
||||
server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig));
|
||||
IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
|
||||
|
||||
server.AddStreamHandler(new UserAccountServerPostHandler(m_UserAccountService, serverConfig, auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces;
|
|||
using OpenSim.Services.UserAccountService;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Server.Handlers.UserAccounts
|
||||
|
@ -54,10 +55,10 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
|||
private bool m_AllowSetAccount = false;
|
||||
|
||||
public UserAccountServerPostHandler(IUserAccountService service)
|
||||
: this(service, null) {}
|
||||
: this(service, null, null) {}
|
||||
|
||||
public UserAccountServerPostHandler(IUserAccountService service, IConfig config) :
|
||||
base("POST", "/accounts")
|
||||
public UserAccountServerPostHandler(IUserAccountService service, IConfig config, IServiceAuth auth) :
|
||||
base("POST", "/accounts", auth)
|
||||
{
|
||||
m_UserAccountService = service;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class AssetServicesConnector : IAssetService
|
||||
public class AssetServicesConnector : BaseServiceConnector, IAssetService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -71,6 +71,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public AssetServicesConnector(IConfigSource source)
|
||||
: base(source, "AssetService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -117,8 +118,16 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
if (asset == null)
|
||||
{
|
||||
asset = SynchronousRestObjectRequester.
|
||||
MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency);
|
||||
// XXX: Commented out for now since this has either never been properly operational or not for some time
|
||||
// as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option.
|
||||
// Wasn't noticed before because timeout wasn't actually used.
|
||||
// Not attempting concurrency setting for now as this omission was discovered in release candidate
|
||||
// phase for OpenSimulator 0.8. Need to revisit afterwards.
|
||||
// asset
|
||||
// = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>(
|
||||
// "GET", uri, 0, m_maxAssetRequestConcurrency);
|
||||
|
||||
asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth);
|
||||
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
|
@ -148,8 +157,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string uri = m_ServerURI + "/assets/" + id + "/metadata";
|
||||
|
||||
AssetMetadata asset = SynchronousRestObjectRequester.
|
||||
MakeRequest<int, AssetMetadata>("GET", uri, 0);
|
||||
AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth);
|
||||
return asset;
|
||||
}
|
||||
|
||||
|
@ -170,7 +178,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
rc.RequestMethod = "GET";
|
||||
|
||||
Stream s = rc.Request();
|
||||
Stream s = rc.Request(m_Auth);
|
||||
|
||||
if (s == null)
|
||||
return null;
|
||||
|
@ -231,7 +239,7 @@ namespace OpenSim.Services.Connectors
|
|||
m_AssetHandlers.Remove(id);
|
||||
}
|
||||
handlers.Invoke(a);
|
||||
}, m_maxAssetRequestConcurrency);
|
||||
}, m_maxAssetRequestConcurrency, m_Auth);
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
@ -261,7 +269,7 @@ namespace OpenSim.Services.Connectors
|
|||
bool[] exist = null;
|
||||
try
|
||||
{
|
||||
exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids);
|
||||
exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -290,8 +298,7 @@ namespace OpenSim.Services.Connectors
|
|||
string newID;
|
||||
try
|
||||
{
|
||||
newID = SynchronousRestObjectRequester.
|
||||
MakeRequest<AssetBase, string>("POST", uri, asset);
|
||||
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -337,8 +344,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string uri = m_ServerURI + "/assets/" + id;
|
||||
|
||||
if (SynchronousRestObjectRequester.
|
||||
MakeRequest<AssetBase, bool>("POST", uri, asset))
|
||||
if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth))
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
|
@ -352,8 +358,7 @@ namespace OpenSim.Services.Connectors
|
|||
{
|
||||
string uri = m_ServerURI + "/assets/" + id;
|
||||
|
||||
if (SynchronousRestObjectRequester.
|
||||
MakeRequest<int, bool>("DELETE", uri, 0))
|
||||
if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth))
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Expire(id);
|
||||
|
|
|
@ -32,14 +32,14 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class AuthenticationServicesConnector : IAuthenticationService
|
||||
public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public AuthenticationServicesConnector(IConfigSource source)
|
||||
: base(source, "AuthenticationService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("Authentication connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "AuthenticationService");
|
||||
}
|
||||
|
||||
public string Authenticate(UUID principalID, string password, int lifetime)
|
||||
|
@ -92,7 +95,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/auth/plain",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
@ -105,6 +108,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
public bool Verify(UUID principalID, string token, int lifetime)
|
||||
{
|
||||
// m_log.Error("[XXX]: Verify");
|
||||
Dictionary<string, object> sendData = new Dictionary<string, object>();
|
||||
sendData["LIFETIME"] = lifetime.ToString();
|
||||
sendData["PRINCIPAL"] = principalID.ToString();
|
||||
|
@ -114,7 +118,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/auth/plain",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
@ -135,7 +139,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST",
|
||||
m_ServerURI + "/auth/plain",
|
||||
ServerUtils.BuildQueryString(sendData));
|
||||
ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
|
||||
reply);
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace OpenSim.Services.Connectors
|
|||
catch (Exception e)
|
||||
{
|
||||
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);
|
||||
message = "";
|
||||
message = e.Message;
|
||||
return m_ResponseOnFailure;
|
||||
}
|
||||
if (response == null)
|
||||
|
|
|
@ -32,7 +32,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
|
||||
|
@ -41,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class AvatarServicesConnector : IAvatarService
|
||||
public class AvatarServicesConnector : BaseServiceConnector, IAvatarService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors
|
|||
}
|
||||
|
||||
public AvatarServicesConnector(IConfigSource source)
|
||||
: base(source, "AvatarService")
|
||||
{
|
||||
Initialise(source);
|
||||
}
|
||||
|
@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors
|
|||
throw new Exception("Avatar connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
|
||||
base.Initialise(source, "AvatarService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply == null || (reply != null && reply == string.Empty))
|
||||
{
|
||||
m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply");
|
||||
|
@ -162,7 +165,7 @@ namespace OpenSim.Services.Connectors
|
|||
//m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors
|
|||
// m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Services.Connectors
|
||||
{
|
||||
public class BaseServiceConnector
|
||||
{
|
||||
protected IServiceAuth m_Auth;
|
||||
|
||||
public BaseServiceConnector() { }
|
||||
|
||||
public BaseServiceConnector(IConfigSource config, string section)
|
||||
{
|
||||
Initialise(config, section);
|
||||
}
|
||||
|
||||
public void Initialise(IConfigSource config, string section)
|
||||
{
|
||||
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");
|
||||
|
||||
switch (authType)
|
||||
{
|
||||
case "BasicHttpAuthentication":
|
||||
m_Auth = new BasicHttpAuthentication(config, section);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ using System.IO;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
|
||||
|
@ -40,7 +41,7 @@ using OpenMetaverse;
|
|||
|
||||
namespace OpenSim.Services.Connectors.Friends
|
||||
{
|
||||
public class FriendsServicesConnector : IFriendsService
|
||||
public class FriendsServicesConnector : BaseServiceConnector, IFriendsService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
|
@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
throw new Exception("Friends connector init error");
|
||||
}
|
||||
m_ServerURI = serviceURI;
|
||||
base.Initialise(source, "FriendsService");
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
|
||||
try
|
||||
{
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString);
|
||||
string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
|
||||
if (reply != string.Empty)
|
||||
{
|
||||
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
|
||||
|
@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
string uri = m_ServerURI + "/friends";
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends
|
|||
string uri = m_ServerURI + "/friends";
|
||||
try
|
||||
{
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData));
|
||||
reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue