mirror of
https://github.com/opensim/opensim.git
synced 2026-06-20 20:47:33 +08:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d829644650 | ||
|
|
effb5784c1 | ||
|
|
7130e30483 | ||
|
|
ecdcaca032 | ||
|
|
2720a1db36 | ||
|
|
60a32d28e4 | ||
|
|
8a95a4dfe0 | ||
|
|
282db7dd1e | ||
|
|
dae81f7bf5 | ||
|
|
29889f481a | ||
|
|
2494f23538 | ||
|
|
cf8778f50f | ||
|
|
a61b946563 | ||
|
|
93ebb36904 | ||
|
|
6a679f7cfa | ||
|
|
9c2cc2d1af | ||
|
|
ad1d137c2e | ||
|
|
9afd9e9e74 | ||
|
|
c2569335b6 | ||
|
|
94e887b9f7 | ||
|
|
72c6ac378a | ||
|
|
821408215f | ||
|
|
d88947e07a | ||
|
|
dfb3aed36a | ||
|
|
fc75ae0011 | ||
|
|
82842f26cc | ||
|
|
e306a1c1de | ||
|
|
a4b5986271 | ||
|
|
dfd03c01ff | ||
|
|
3c1ecad319 |
@@ -71,12 +71,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oresult))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
string result = oresult.ToString();
|
||||
if (!result.Equals("true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
reason = result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,13 +113,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<ExtendedGroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID, string token)
|
||||
@@ -134,12 +135,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return members;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return members;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return members;
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupMembersData m = GroupsDataUtils.GroupMembersData((Dictionary<string, object>)v);
|
||||
members.Add(m);
|
||||
@@ -161,12 +163,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return roles;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return roles;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return roles;
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
|
||||
roles.Add(m);
|
||||
@@ -188,13 +191,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return rmembers;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return rmembers;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return rmembers;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupRoleMembersData m = GroupsDataUtils.GroupRoleMembersData((Dictionary<string, object>)v);
|
||||
rmembers.Add(m);
|
||||
@@ -227,13 +230,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object value))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return value.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool VerifyNotice(UUID noticeID, UUID groupID)
|
||||
@@ -246,13 +246,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object value))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return value.ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -42,6 +42,7 @@ using OpenMetaverse;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
@@ -680,14 +681,11 @@ namespace OpenSim.Groups
|
||||
{
|
||||
lock (m_NetworkConnectors)
|
||||
{
|
||||
if (m_NetworkConnectors.ContainsKey(url))
|
||||
return m_NetworkConnectors[url];
|
||||
|
||||
GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
|
||||
m_NetworkConnectors[url] = c;
|
||||
ref GroupsServiceHGConnector connector = ref CollectionsMarshal.GetValueRefOrAddDefault(m_NetworkConnectors,url, out bool exists);
|
||||
if(!exists)
|
||||
connector = new GroupsServiceHGConnector(url);
|
||||
return connector;
|
||||
}
|
||||
|
||||
return m_NetworkConnectors[url];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -168,24 +168,24 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID")
|
||||
|| !request.ContainsKey("AgentID")
|
||||
|| !request.ContainsKey("AccessToken") || !request.ContainsKey("Location"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AgentID", out object oAgentID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken) ||
|
||||
!request.TryGetValue("Location", out object oLocation))
|
||||
NullResult(result, "Bad network data");
|
||||
|
||||
else
|
||||
{
|
||||
string RequestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string agentID = request["AgentID"].ToString();
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string accessToken = request["AccessToken"].ToString();
|
||||
string location = request["Location"].ToString();
|
||||
string RequestingAgentID = oRequestingAgentID.ToString();
|
||||
string agentID = oAgentID.ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string accessToken = oAccessToken.ToString();
|
||||
string location = oLocation.ToString();
|
||||
string name = string.Empty;
|
||||
if (request.ContainsKey("Name"))
|
||||
name = request["Name"].ToString();
|
||||
if (request.TryGetValue("Name", out object oName))
|
||||
name = oName.ToString();
|
||||
|
||||
string reason = string.Empty;
|
||||
bool success = m_GroupsService.CreateGroupProxy(RequestingAgentID, agentID, accessToken, groupID, location, name, out reason);
|
||||
bool success = m_GroupsService.CreateGroupProxy(RequestingAgentID, agentID, accessToken, groupID, location, name, out string reason);
|
||||
result["REASON"] = reason;
|
||||
result["RESULT"] = success.ToString();
|
||||
}
|
||||
@@ -255,16 +255,18 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken))
|
||||
NullResult(result, "Bad network data");
|
||||
else
|
||||
{
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string requestingAgentID = oRequestingAgentID.ToString();
|
||||
string token = oAccessToken.ToString();
|
||||
|
||||
List<ExtendedGroupMembersData> members = m_GroupsService.GetGroupMembers(requestingAgentID, groupID, token);
|
||||
if (members == null || (members != null && members.Count == 0))
|
||||
if (members == null || members.Count == 0)
|
||||
{
|
||||
NullResult(result, "No members");
|
||||
}
|
||||
@@ -291,16 +293,18 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken))
|
||||
NullResult(result, "Bad network data");
|
||||
else
|
||||
{
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string requestingAgentID = oRequestingAgentID.ToString();
|
||||
string token = oAccessToken.ToString();
|
||||
|
||||
List<GroupRolesData> roles = m_GroupsService.GetGroupRoles(requestingAgentID, groupID, token);
|
||||
if (roles == null || (roles != null && roles.Count == 0))
|
||||
if (roles == null || roles.Count == 0)
|
||||
{
|
||||
NullResult(result, "No members");
|
||||
}
|
||||
@@ -325,16 +329,18 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken))
|
||||
NullResult(result, "Bad network data");
|
||||
else
|
||||
{
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string requestingAgentID = oRequestingAgentID.ToString();
|
||||
string token = oAccessToken.ToString();
|
||||
|
||||
List<ExtendedGroupRoleMembersData> rmembers = m_GroupsService.GetGroupRoleMembers(requestingAgentID, groupID, token);
|
||||
if (rmembers == null || (rmembers != null && rmembers.Count == 0))
|
||||
if (rmembers == null || rmembers.Count == 0)
|
||||
{
|
||||
NullResult(result, "No members");
|
||||
}
|
||||
@@ -359,31 +365,35 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("NoticeID") ||
|
||||
!request.ContainsKey("FromName") || !request.ContainsKey("Subject") || !request.ContainsKey("Message") ||
|
||||
!request.ContainsKey("HasAttachment"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("NoticeID", out object oNoticeID) ||
|
||||
!request.TryGetValue("FromName", out object oFromName) ||
|
||||
!request.TryGetValue("Subject", out object oSubject) ||
|
||||
!request.TryGetValue("Message", out object oMessage) ||
|
||||
!request.TryGetValue("HasAttachment", out object oHasAttachment))
|
||||
NullResult(result, "Bad network data");
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
bool hasAtt = bool.Parse(request["HasAttachment"].ToString());
|
||||
bool hasAtt = bool.Parse(oHasAttachment.ToString());
|
||||
byte attType = 0;
|
||||
string attName = string.Empty;
|
||||
string attOwner = string.Empty;
|
||||
UUID attItem = UUID.Zero;
|
||||
if (request.ContainsKey("AttachmentType"))
|
||||
attType = byte.Parse(request["AttachmentType"].ToString());
|
||||
if (request.ContainsKey("AttachmentName"))
|
||||
attName = request["AttachmentType"].ToString();
|
||||
if (request.ContainsKey("AttachmentItemID"))
|
||||
attItem = new UUID(request["AttachmentItemID"].ToString());
|
||||
if (request.ContainsKey("AttachmentOwnerID"))
|
||||
attOwner = request["AttachmentOwnerID"].ToString();
|
||||
if (request.TryGetValue("AttachmentType", out object oAttachmentType))
|
||||
attType = byte.Parse(oAttachmentType.ToString());
|
||||
|
||||
bool success = m_GroupsService.AddNotice(request["RequestingAgentID"].ToString(), new UUID(request["GroupID"].ToString()),
|
||||
new UUID(request["NoticeID"].ToString()), request["FromName"].ToString(), request["Subject"].ToString(),
|
||||
request["Message"].ToString(), hasAtt, attType, attName, attItem, attOwner);
|
||||
if (request.TryGetValue("AttachmentName", out object oAttachmentName))
|
||||
attName = oAttachmentName.ToString();
|
||||
if (request.TryGetValue("AttachmentItemID", out object oAttachmentItemID))
|
||||
attItem = new UUID(oAttachmentItemID.ToString());
|
||||
if (request.TryGetValue("AttachmentOwnerID", out object oAttachmentOwnerID))
|
||||
attOwner = oAttachmentOwnerID.ToString();
|
||||
|
||||
bool success = m_GroupsService.AddNotice(oRequestingAgentID.ToString(), new UUID(oGroupID.ToString()),
|
||||
new UUID(oNoticeID.ToString()), oFromName.ToString(), oSubject.ToString(),
|
||||
oMessage.ToString(), hasAtt, attType, attName, attItem, attOwner);
|
||||
|
||||
result["RESULT"] = success.ToString();
|
||||
}
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
@@ -99,13 +99,16 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
return null;
|
||||
}
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
|
||||
}
|
||||
|
||||
@@ -126,10 +129,13 @@ namespace OpenSim.Groups
|
||||
sendData["OP"] = "UPDATE";
|
||||
Dictionary<string, object> ret = MakeRequest("PUTGROUP", sendData);
|
||||
|
||||
if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL")))
|
||||
if (ret == null || !ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
|
||||
@@ -147,10 +153,13 @@ namespace OpenSim.Groups
|
||||
|
||||
Dictionary<string, object> ret = MakeRequest("GETGROUP", sendData);
|
||||
|
||||
if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL")))
|
||||
if (ret == null || !ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string query)
|
||||
@@ -168,13 +177,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return hits;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT) || oRESULT.ToString() == "NULL")
|
||||
return hits;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
return hits;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary<string, object>)v);
|
||||
hits.Add(m);
|
||||
@@ -198,16 +204,16 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
return null;
|
||||
}
|
||||
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)oRESULT);
|
||||
|
||||
}
|
||||
|
||||
@@ -232,13 +238,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<GroupMembershipData> GetMemberships(string RequestingAgentID, string AgentID)
|
||||
@@ -254,13 +260,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return memberships;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return memberships;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
return memberships;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupMembershipData m = GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)v);
|
||||
memberships.Add(m);
|
||||
@@ -282,13 +288,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return members;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return members;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
return members;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupMembersData m = GroupsDataUtils.GroupMembersData((Dictionary<string, object>)v);
|
||||
members.Add(m);
|
||||
@@ -315,10 +321,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
if (!oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
return false;
|
||||
@@ -343,13 +349,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return !oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
|
||||
@@ -373,13 +376,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return roles;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return roles;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return roles;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
|
||||
roles.Add(m);
|
||||
@@ -400,13 +403,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return rmembers;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return rmembers;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return rmembers;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupRoleMembersData m = GroupsDataUtils.GroupRoleMembersData((Dictionary<string, object>)v);
|
||||
rmembers.Add(m);
|
||||
@@ -429,13 +432,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool RemoveAgentFromGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
|
||||
@@ -452,13 +452,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
@@ -474,13 +471,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return roles;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return roles;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return roles;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
|
||||
roles.Add(m);
|
||||
@@ -502,13 +499,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public void SetAgentActiveGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
|
||||
@@ -549,13 +546,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true") // it may return "NULL"
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
|
||||
@@ -570,13 +564,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupInviteInfo((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupInviteInfo((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public void RemoveAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
|
||||
@@ -613,13 +607,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
|
||||
@@ -633,13 +624,14 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupNoticeInfo((Dictionary<string, object>)ret["RESULT"]);
|
||||
|
||||
return GroupsDataUtils.GroupNoticeInfo((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID)
|
||||
@@ -654,13 +646,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return notices;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return notices;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return notices;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupNoticeData m = GroupsDataUtils.GroupNoticeData((Dictionary<string, object>)v);
|
||||
notices.Add(m);
|
||||
|
||||
@@ -274,33 +274,31 @@ namespace OpenSim.Groups
|
||||
UUID ownerRoleID = new UUID(group.Data["OwnerRoleID"]);
|
||||
|
||||
RoleData[] roles = m_Database.RetrieveRoles(GroupID);
|
||||
if (roles == null)
|
||||
// something wrong with this group
|
||||
if (roles == null || roles.Length == 0)
|
||||
return members;
|
||||
List<RoleData> rolesList = new List<RoleData>(roles);
|
||||
|
||||
List<RoleData> rolesList = new List<RoleData>(roles);
|
||||
// Let's find the "real" ownerRoleID
|
||||
RoleData ownerRole = rolesList.Find(r => r.Data["Powers"] == ((long)OwnerPowers).ToString());
|
||||
string OwnerPowersstr = ((long)OwnerPowers).ToString();
|
||||
RoleData ownerRole = rolesList.Find(r => OwnerPowersstr.Equals(r.Data["Powers"]));
|
||||
if (ownerRole != null)
|
||||
ownerRoleID = ownerRole.RoleID;
|
||||
|
||||
// Check visibility?
|
||||
// When we don't want to check visibility, we pass it "all" as the requestingAgentID
|
||||
bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
|
||||
bool checkVisibility = !RequestingAgentID.Equals(UUID.ZeroString);
|
||||
|
||||
if (checkVisibility)
|
||||
{
|
||||
// Is the requester a member of the group?
|
||||
bool isInGroup = false;
|
||||
if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
|
||||
isInGroup = true;
|
||||
bool isInGroup = m_Database.RetrieveMember(GroupID, RequestingAgentID) != null;
|
||||
|
||||
if (!isInGroup) // reduce the roles to the visible ones
|
||||
rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0);
|
||||
}
|
||||
|
||||
MembershipData[] datas = m_Database.RetrieveMembers(GroupID);
|
||||
if (datas == null || (datas != null && datas.Length == 0))
|
||||
if (datas == null || datas.Length == 0)
|
||||
return members;
|
||||
|
||||
// OK, we have everything we need
|
||||
@@ -323,27 +321,27 @@ namespace OpenSim.Groups
|
||||
}
|
||||
|
||||
m.AgentID = d.PrincipalID;
|
||||
m.AcceptNotices = d.Data["AcceptNotices"] == "1" ? true : false;
|
||||
m.AcceptNotices = d.Data["AcceptNotices"] == "1";
|
||||
m.Contribution = Int32.Parse(d.Data["Contribution"]);
|
||||
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
|
||||
m.ListInProfile = d.Data["ListInProfile"] == "1";
|
||||
|
||||
GridUserData gud = m_GridUserService.Get(d.PrincipalID);
|
||||
if (gud != null)
|
||||
{
|
||||
if (bool.Parse(gud.Data["Online"]))
|
||||
{
|
||||
m.OnlineStatus = @"Online";
|
||||
m.OnlineStatus = "Online";
|
||||
}
|
||||
else
|
||||
{
|
||||
int unixtime = int.Parse(gud.Data["Login"]);
|
||||
// The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
|
||||
m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
|
||||
m.OnlineStatus = (unixtime == 0) ? "unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
// Is this person an owner of the group?
|
||||
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
|
||||
m.IsOwner = rolemembershipsList.Find(r => r.RoleID.Equals(ownerRoleID)) != null;
|
||||
|
||||
members.Add(m);
|
||||
}
|
||||
@@ -353,17 +351,16 @@ namespace OpenSim.Groups
|
||||
|
||||
public bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
// check that the requesting agent has permissions to add role
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.CreateRole))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at creating role in group {1} denied because of lack of permission", RequestingAgentID, groupID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at creating role in group {groupID} denied because of lack of permission");
|
||||
reason = "Insufficient permission to create role";
|
||||
return false;
|
||||
}
|
||||
|
||||
reason = string.Empty;
|
||||
return _AddOrUpdateGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers, true);
|
||||
|
||||
}
|
||||
|
||||
public bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers)
|
||||
@@ -371,7 +368,7 @@ namespace OpenSim.Groups
|
||||
// check perms
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.ChangeActions))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at changing role in group {1} denied because of lack of permission", RequestingAgentID, groupID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at changing role in group {groupID} denied because of lack of permission");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -380,30 +377,30 @@ namespace OpenSim.Groups
|
||||
|
||||
public void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
|
||||
{
|
||||
// check perms
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.DeleteRole))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at deleting role from group {1} denied because of lack of permission", RequestingAgentID, groupID);
|
||||
return;
|
||||
}
|
||||
|
||||
// Can't delete Everyone and Owners roles
|
||||
if (roleID.IsZero())
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: Attempt at deleting Everyone role from group {0} denied", groupID);
|
||||
m_log.Debug($"[Groups]: Attempt at deleting Everyone role from group {groupID} denied");
|
||||
return;
|
||||
}
|
||||
|
||||
// check perms
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.DeleteRole))
|
||||
{
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at deleting role from group {groupID} denied because of lack of permission");
|
||||
return;
|
||||
}
|
||||
|
||||
GroupData group = m_Database.RetrieveGroup(groupID);
|
||||
if (group == null)
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: Attempt at deleting role from non-existing group {0}", groupID);
|
||||
m_log.Debug($"[Groups]: Attempt at deleting role from non-existing group {groupID}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (roleID == new UUID(group.Data["OwnerRoleID"]))
|
||||
if (roleID.ToString().Equals(group.Data["OwnerRoleID"]))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: Attempt at deleting Owners role from group {0} denied", groupID);
|
||||
m_log.Debug($"[Groups]: Attempt at deleting Owners role from group {groupID} denied");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -421,9 +418,7 @@ namespace OpenSim.Groups
|
||||
// TODO: check perms
|
||||
|
||||
// Is the requester a member of the group?
|
||||
bool isInGroup = false;
|
||||
if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
|
||||
isInGroup = true;
|
||||
bool isInGroup = m_Database.RetrieveMember(GroupID, RequestingAgentID) != null;
|
||||
|
||||
return _GetGroupRoleMembers(GroupID, isInGroup);
|
||||
}
|
||||
@@ -500,15 +495,19 @@ namespace OpenSim.Groups
|
||||
|
||||
public bool AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
|
||||
{
|
||||
//if (!m_Database.CheckOwnerRole(RequestingAgentID, GroupID, RoleID))
|
||||
// return;
|
||||
|
||||
// check permissions
|
||||
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
||||
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
|
||||
bool limited = false;
|
||||
bool unlimited = IsOwner(RequestingAgentID, GroupID);
|
||||
if(!unlimited)
|
||||
{
|
||||
ulong upowers =(ulong)GetAgentGroupPowers(RequestingAgentID, GroupID);
|
||||
limited = (upowers & (ulong)GroupPowers.AssignMemberLimited) != 0;
|
||||
unlimited = (upowers & (ulong)GroupPowers.AssignMember) != 0;
|
||||
}
|
||||
|
||||
if (!limited && !unlimited)
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at assigning {AgentID} to role {RoleID} denied because of lack of permission");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -519,7 +518,7 @@ namespace OpenSim.Groups
|
||||
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
|
||||
if (rolemembership == null)
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at assigning {AgentID} to role {RoleID} denied because of limited permission");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -588,11 +587,11 @@ namespace OpenSim.Groups
|
||||
|
||||
public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
{
|
||||
List<GroupRolesData> roles = new List<GroupRolesData>();
|
||||
List<GroupRolesData> roles = [];
|
||||
// TODO: check permissions
|
||||
|
||||
RoleMembershipData[] data = m_Database.RetrieveMemberRoles(GroupID, AgentID);
|
||||
if (data == null || (data != null && data.Length ==0))
|
||||
if (data == null || data.Length ==0)
|
||||
return roles;
|
||||
|
||||
foreach (RoleMembershipData d in data)
|
||||
@@ -601,11 +600,13 @@ namespace OpenSim.Groups
|
||||
if (rdata == null) // hippos
|
||||
continue;
|
||||
|
||||
GroupRolesData r = new GroupRolesData();
|
||||
r.Name = rdata.Data["Name"];
|
||||
r.Powers = UInt64.Parse(rdata.Data["Powers"]);
|
||||
r.RoleID = rdata.RoleID;
|
||||
r.Title = rdata.Data["Title"];
|
||||
GroupRolesData r = new GroupRolesData
|
||||
{
|
||||
Name = rdata.Data["Name"],
|
||||
Powers = UInt64.Parse(rdata.Data["Powers"]),
|
||||
RoleID = rdata.RoleID,
|
||||
Title = rdata.Data["Title"]
|
||||
};
|
||||
|
||||
roles.Add(r);
|
||||
}
|
||||
@@ -1053,19 +1054,20 @@ namespace OpenSim.Groups
|
||||
notice.AttachmentOwnerID = data.Data["AttachmentOwnerID"].ToString();
|
||||
}
|
||||
|
||||
|
||||
return notice;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region permissions
|
||||
private bool HasPower(string agentID, UUID groupID, GroupPowers power)
|
||||
|
||||
public GroupPowers GetAgentGroupPowers(string agentID, UUID groupID)
|
||||
{
|
||||
RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
|
||||
if (rmembership is null || rmembership.Length == 0)
|
||||
return false;
|
||||
return 0;
|
||||
|
||||
ulong powers = 0;
|
||||
foreach (RoleMembershipData rdata in rmembership)
|
||||
{
|
||||
if(rdata is null)
|
||||
@@ -1080,7 +1082,36 @@ namespace OpenSim.Groups
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((UInt64.Parse(role.Data["Powers"]) & (ulong)power) != 0)
|
||||
if (role.Data.TryGetValue("Powers", out string psrt) &&
|
||||
ulong.TryParse(psrt, out ulong ut))
|
||||
powers |= ut;
|
||||
}
|
||||
return (GroupPowers)powers;
|
||||
}
|
||||
|
||||
private bool HasPower(string agentID, UUID groupID, GroupPowers power)
|
||||
{
|
||||
RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
|
||||
if (rmembership is null || rmembership.Length == 0)
|
||||
return false;
|
||||
|
||||
ulong upower = (ulong)power;
|
||||
foreach (RoleMembershipData rdata in rmembership)
|
||||
{
|
||||
if(rdata is null)
|
||||
{
|
||||
m_log.Warn($"[GROUPSERVICE] null membership data entry in group {groupID} for agent {agentID}");
|
||||
continue;
|
||||
}
|
||||
RoleData role = m_Database.RetrieveRole(groupID, rdata.RoleID);
|
||||
if (role is null)
|
||||
{
|
||||
m_log.Warn($"[GROUPSERVICE] role with id {rdata.RoleID} is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (role.Data.TryGetValue("Powers", out string psrt) &&
|
||||
ulong.TryParse(psrt, out ulong ut) && (ut & upower) != 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -417,7 +417,7 @@ namespace osWebRtcVoice
|
||||
m_log.Warn($"{LogHeader}[ProvisionVoice]: Request detail: {map}");
|
||||
|
||||
response.RawBuffer = llsdUndefAnswerBytes;
|
||||
response.StatusCode = (int)HttpStatusCode.OK;
|
||||
response.StatusCode = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace OpenSim.Data.MySQL
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
return [];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
|
||||
@@ -401,7 +401,7 @@ namespace OpenSim.Data.MySQL
|
||||
public bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
return [];
|
||||
|
||||
HashSet<UUID> exists = new HashSet<UUID>();
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace OpenSim.Data.PGSQL
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
return [];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
|
||||
@@ -352,12 +352,12 @@ namespace OpenSim.Data.PGSQL
|
||||
|
||||
//Insert after
|
||||
cmd.CommandText = "insert into estateban (\"EstateID\", \"bannedUUID\",\"bannedIp\", \"bannedIpHostMask\", \"bannedNameMask\", \"banningUUID\",\"banTime\" ) values ( :EstateID, :bannedUUID, '','','', :banningUUID, :banTime )";
|
||||
cmd.Parameters.AddWithValue("bannedUUID", Guid.Empty);
|
||||
foreach (EstateBan b in es.EstateBans)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
cmd.Parameters["EstateID"].Value = b.EstateID;
|
||||
cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid;
|
||||
cmd.Parameters["banningUUID"].Value = b.BanningUserID.Guid;
|
||||
cmd.Parameters["bannedUUID"].Value = _Database.CreateParameter("bannedUUID", b.BannedUserID).Value;
|
||||
cmd.Parameters["banningUUID"].Value = _Database.CreateParameter("banningUUID", b.BanningUserID).Value;
|
||||
cmd.Parameters["banTime"].Value = b.BanTime;
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -378,10 +378,10 @@ namespace OpenSim.Data.PGSQL
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.CommandText = string.Format("insert into {0} (\"EstateID\", uuid) values ( :EstateID, :uuid )", table);
|
||||
cmd.Parameters.AddWithValue("uuid", Guid.Empty);
|
||||
foreach (UUID uuid in data)
|
||||
{
|
||||
cmd.Parameters["uuid"].Value = uuid.Guid; //.ToString(); //TODO check if this works
|
||||
cmd.Parameters.Clear();
|
||||
cmd.Parameters.Add(_Database.CreateParameter("uuid", uuid));
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,10 +134,13 @@ namespace OpenSim.Data.PGSQL
|
||||
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null &&
|
||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
if (row["ColumnName"] == null)
|
||||
continue;
|
||||
|
||||
string col = row["ColumnName"].ToString();
|
||||
|
||||
if (!m_Fields.ContainsKey(col))
|
||||
m_ColumnNames.Add(col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace OpenSim.Data.PGSQL
|
||||
{
|
||||
// cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm);
|
||||
|
||||
cmd.CommandText = "select * from inventoryitems where avatarID = :uuid and assetType = :type and flags = 1";
|
||||
cmd.CommandText = "select * from inventoryitems where \"avatarID\" = :uuid and \"assetType\" = :type and \"flags\" = 1";
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("uuid", principalID));
|
||||
cmd.Parameters.Add(m_database.CreateParameter("type", (int)AssetType.Gesture));
|
||||
|
||||
@@ -147,7 +147,8 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
|
||||
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
|
||||
if (AssetsExist(new[] { asset.FullID })[0])
|
||||
bool[] assetsExist = AssetsExist([ asset.FullID ]);
|
||||
if (assetsExist.Length > 0 && assetsExist[0])
|
||||
{
|
||||
//LogAssetLoad(asset);
|
||||
|
||||
@@ -218,7 +219,7 @@ namespace OpenSim.Data.SQLite
|
||||
public override bool[] AssetsExist(UUID[] uuids)
|
||||
{
|
||||
if (uuids.Length == 0)
|
||||
return new bool[0];
|
||||
return [];
|
||||
|
||||
HashSet<UUID> exist = new HashSet<UUID>();
|
||||
|
||||
|
||||
@@ -916,18 +916,17 @@ namespace OpenSim.Framework
|
||||
{
|
||||
// Wearables
|
||||
OSD tmpOSD8;
|
||||
OSDArray wears8 = null;
|
||||
int wears8Count = 0;
|
||||
|
||||
if (data.TryGetValue("wrbls8", out tmpOSD8) && (tmpOSD8 is OSDArray))
|
||||
if (data.TryGetValue("wrbls8", out tmpOSD8) && (tmpOSD8 is OSDArray wears8))
|
||||
{
|
||||
wears8 = (OSDArray)tmpOSD8;
|
||||
wears8Count = wears8.Count;
|
||||
}
|
||||
else
|
||||
wears8 = null;
|
||||
|
||||
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray wears))
|
||||
{
|
||||
OSDArray wears = (OSDArray)tmpOSD;
|
||||
if(wears.Count + wears8Count > 0)
|
||||
{
|
||||
m_wearables = new AvatarWearable[wears.Count + wears8Count];
|
||||
@@ -948,9 +947,8 @@ namespace OpenSim.Framework
|
||||
Primitive.TextureEntry te = new Primitive.TextureEntry(teb, 0, teb.Length);
|
||||
m_texture = te;
|
||||
}
|
||||
else if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
else if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray textures))
|
||||
{
|
||||
OSDArray textures = (OSDArray)tmpOSD;
|
||||
for (int i = 0; i < textures.Count && i < TEXTURE_COUNT_PV7; ++i)
|
||||
{
|
||||
tmpOSD = textures[i];
|
||||
@@ -959,26 +957,12 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray bakedOSDArray))
|
||||
{
|
||||
OSDArray bakedOSDArray = (OSDArray)tmpOSD;
|
||||
m_cacheitems = WearableCacheItem.GetDefaultCacheItem();
|
||||
|
||||
bakedOSDArray = (OSDArray)tmpOSD;
|
||||
foreach (OSDMap item in bakedOSDArray)
|
||||
foreach (OSD oitem in bakedOSDArray)
|
||||
{
|
||||
int idx = item["textureindex"].AsInteger();
|
||||
if (idx < 0 || idx >= m_cacheitems.Length)
|
||||
continue;
|
||||
m_cacheitems[idx].CacheId = item["cacheid"].AsUUID();
|
||||
m_cacheitems[idx].TextureID = item["textureid"].AsUUID();
|
||||
m_cacheitems[idx].TextureAsset = null;
|
||||
}
|
||||
|
||||
if (data.TryGetValue("bc8", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
{
|
||||
bakedOSDArray = (OSDArray)tmpOSD;
|
||||
foreach (OSDMap item in bakedOSDArray)
|
||||
if(oitem is OSDMap item)
|
||||
{
|
||||
int idx = item["textureindex"].AsInteger();
|
||||
if (idx < 0 || idx >= m_cacheitems.Length)
|
||||
@@ -988,6 +972,22 @@ namespace OpenSim.Framework
|
||||
m_cacheitems[idx].TextureAsset = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.TryGetValue("bc8", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
{
|
||||
foreach (OSD oitem in bakedOSDArray)
|
||||
{
|
||||
if(oitem is OSDMap item)
|
||||
{
|
||||
int idx = item["textureindex"].AsInteger();
|
||||
if (idx < 0 || idx >= m_cacheitems.Length)
|
||||
continue;
|
||||
m_cacheitems[idx].CacheId = item["cacheid"].AsUUID();
|
||||
m_cacheitems[idx].TextureID = item["textureid"].AsUUID();
|
||||
m_cacheitems[idx].TextureAsset = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Visual Parameters
|
||||
@@ -1002,9 +1002,8 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
// Attachments
|
||||
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
|
||||
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray attachs)
|
||||
{
|
||||
OSDArray attachs = (OSDArray)tmpOSD;
|
||||
for (int i = 0; i < attachs.Count; i++)
|
||||
{
|
||||
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
|
||||
|
||||
@@ -28,6 +28,7 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using Timer = System.Threading.Timer ;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
@@ -168,6 +169,28 @@ namespace OpenSim.Framework
|
||||
finally { m_rwLock.ExitWriteLock(); }
|
||||
}
|
||||
|
||||
public bool AddOrUpdate(Tkey1 key, int expireMS)
|
||||
{
|
||||
int now;
|
||||
if (expireMS > 0)
|
||||
{
|
||||
expireMS = (expireMS > m_expire) ? expireMS : m_expire;
|
||||
now = (int)(Util.GetTimeStampMS() - m_startTS) + expireMS;
|
||||
}
|
||||
else
|
||||
now = int.MinValue;
|
||||
|
||||
m_rwLock.EnterWriteLock();
|
||||
try
|
||||
{
|
||||
ref int entry = ref CollectionsMarshal.GetValueRefOrAddDefault(m_dictionary, key, out bool exists);
|
||||
entry = now;
|
||||
CheckTimer();
|
||||
return exists;
|
||||
}
|
||||
finally { m_rwLock.ExitWriteLock(); }
|
||||
}
|
||||
|
||||
public bool Remove(Tkey1 key)
|
||||
{
|
||||
m_rwLock.EnterWriteLock();
|
||||
|
||||
@@ -81,8 +81,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public Lazy(Func<T> valueFactory, LazyThreadSafetyMode mode)
|
||||
{
|
||||
if (valueFactory == null)
|
||||
throw new ArgumentNullException("valueFactory");
|
||||
ArgumentNullException.ThrowIfNull(valueFactory);
|
||||
this.factory = valueFactory;
|
||||
if (mode != LazyThreadSafetyMode.None)
|
||||
monitor = new object();
|
||||
|
||||
@@ -212,6 +212,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
set { m_certificateValidationCallback = value; }
|
||||
}
|
||||
private static readonly char[] LineSeparators = ['\n','\r'];
|
||||
|
||||
private void load_cert(string CPath, string CPass)
|
||||
{
|
||||
@@ -223,13 +224,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
AsnEncodedData asndata = new AsnEncodedData(ext.Oid, ext.RawData);
|
||||
string datastr = asndata.Format(true);
|
||||
string[] lines = datastr.Split(new char[] {'\n','\r'});
|
||||
string[] lines = datastr.Split(LineSeparators);
|
||||
foreach(string s in lines)
|
||||
{
|
||||
if(String.IsNullOrEmpty(s))
|
||||
if(string.IsNullOrEmpty(s))
|
||||
continue;
|
||||
string[] parts = s.Split(new char[] {'='});
|
||||
if(String.IsNullOrEmpty(parts[0]))
|
||||
string[] parts = s.Split('=');
|
||||
if(string.IsNullOrEmpty(parts[0]))
|
||||
continue;
|
||||
string entryName = parts[0].Replace(" ","");
|
||||
if(entryName == "DNSName")
|
||||
@@ -1015,8 +1016,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (innerStream != null)
|
||||
innerStream.Dispose();
|
||||
innerStream?.Dispose();
|
||||
inputStream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OSHttpServer
|
||||
public RequestCookie(string id, string content)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id");
|
||||
if (content == null) throw new ArgumentNullException("content");
|
||||
ArgumentNullException.ThrowIfNull(content);
|
||||
|
||||
_name = id;
|
||||
_value = content;
|
||||
|
||||
@@ -79,8 +79,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
XmlWriterSettings settings = new()
|
||||
{
|
||||
Encoding = Encoding.UTF8
|
||||
};
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
@@ -134,8 +136,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
XmlWriterSettings settings = new() { Encoding = Encoding.UTF8 };
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
@@ -169,8 +170,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
|
||||
|
||||
deserial = (TResponse)deserializer.Deserialize(stream);
|
||||
if (stream != null)
|
||||
stream.Close();
|
||||
stream?.Close();
|
||||
|
||||
if (deserial != null && ResponseCallback != null)
|
||||
{
|
||||
|
||||
@@ -1009,8 +1009,7 @@ namespace OpenSim.Framework
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl);
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(request.Headers);
|
||||
auth?.AddAuthorization(request.Headers);
|
||||
|
||||
request.AllowWriteStreamBuffering = false;
|
||||
|
||||
|
||||
@@ -4438,8 +4438,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
data[pos++] = 0;
|
||||
// AppearanceHover vector 3
|
||||
data[pos++] = 1;
|
||||
Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
//Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
//Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
Utils.Int64ZeroToBytes(data, pos); pos += 8;
|
||||
Utils.FloatToBytesSafepos(hover, data, pos); pos += 4;
|
||||
|
||||
buf.DataLength = pos;
|
||||
@@ -6738,26 +6739,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#endregion
|
||||
|
||||
#region Helper Methods
|
||||
private static void ClampVectorForUint(ref Vector3 v, float max)
|
||||
{
|
||||
float a, b;
|
||||
|
||||
a = MathF.Abs(v.X);
|
||||
b = MathF.Abs(v.Y);
|
||||
if (b > a)
|
||||
a = b;
|
||||
b = MathF.Abs(v.Z);
|
||||
if (b > a)
|
||||
a = b;
|
||||
|
||||
if (a > max)
|
||||
{
|
||||
a = max / a;
|
||||
v.X *= a;
|
||||
v.Y *= a;
|
||||
v.Z *= a;
|
||||
}
|
||||
}
|
||||
|
||||
protected static void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos, bool includeTexture)
|
||||
{
|
||||
@@ -6834,7 +6815,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
data[pos++] = 1;
|
||||
|
||||
//m_log.DebugFormat("CollisionPlane: {0}",collisionPlane);
|
||||
if (collisionPlane == Vector4.Zero)
|
||||
if (collisionPlane.IsZero())
|
||||
Vector4.UnitW.ToBytes(data, pos);
|
||||
else
|
||||
collisionPlane.ToBytes(data, pos);
|
||||
@@ -6846,33 +6827,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Position
|
||||
position.ToBytes(data, pos);
|
||||
pos += 12;
|
||||
position.ToBytes(data, pos); pos += 12;
|
||||
|
||||
// Velocity
|
||||
ClampVectorForUint(ref velocity, 128f);
|
||||
Utils.FloatToUInt16Bytes(velocity.X, 128.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(velocity.Y, 128.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(velocity.Z, 128.0f, data, pos); pos += 2;
|
||||
velocity.ClampedToShortsBytes(128f,data,pos); pos += 6;
|
||||
|
||||
// Acceleration
|
||||
ClampVectorForUint(ref acceleration, 64f);
|
||||
Utils.FloatToUInt16Bytes(acceleration.X, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(acceleration.Y, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(acceleration.Z, 64.0f, data, pos); pos += 2;
|
||||
acceleration.ClampedToShortsBytes(64f, data, pos); pos += 6;
|
||||
|
||||
// Rotation
|
||||
|
||||
Utils.FloatToUInt16Bytes(rotation.X, 1.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(rotation.Y, 1.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(rotation.Z, 1.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(rotation.W, 1.0f, data, pos); pos += 2;
|
||||
rotation.ToShortsBytes(data, pos); pos += 8;
|
||||
|
||||
// Angular Velocity
|
||||
ClampVectorForUint(ref angularVelocity, 64f);
|
||||
Utils.FloatToUInt16Bytes(angularVelocity.X, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(angularVelocity.Y, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(angularVelocity.Z, 64.0f, data, pos); pos += 2;
|
||||
angularVelocity.ClampedToShortsBytes(64f, data, pos); pos += 6;
|
||||
|
||||
// texture entry block size
|
||||
if (te is null)
|
||||
|
||||
@@ -1535,10 +1535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error($"Packet statistics gathering failed: {ex.Message}");
|
||||
if (PacketLog.Log != null)
|
||||
{
|
||||
PacketLog.Log.Close();
|
||||
}
|
||||
PacketLog?.Log?.Close();
|
||||
PacketLog = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,8 +226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
m_parent?.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -246,8 +245,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (Parent != null)
|
||||
Parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
Parent?.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -351,8 +349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_dripRate = Math.Clamp(value, m_minimumFlow, MaxDripRate);
|
||||
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, m_dripRate);
|
||||
m_parent?.RegisterRequest(this, m_dripRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,8 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_dripRate = m_maxDripRate * .5f;
|
||||
else
|
||||
m_dripRate = m_maxDripRate;
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, m_dripRate);
|
||||
m_parent?.RegisterRequest(this, m_dripRate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -392,7 +388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public void AcknowledgePackets(Int32 count)
|
||||
{
|
||||
if (m_enabled)
|
||||
AdjustedDripRate = AdjustedDripRate + count;
|
||||
AdjustedDripRate += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,6 +1008,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
/// <param name="saveAllScripted"></param>
|
||||
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, string scriptedState)
|
||||
{
|
||||
if (sp.IsNPC)
|
||||
return;
|
||||
|
||||
if (m_invAccessModule is null)
|
||||
return;
|
||||
|
||||
if(!grp.HasGroupChanged)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
@@ -1020,20 +1026,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
|
||||
grp.HasGroupChanged = false;
|
||||
|
||||
if (m_invAccessModule is null)
|
||||
return;
|
||||
|
||||
if (grp.FromItemID.IsZero())
|
||||
{
|
||||
// We can't save temp attachments
|
||||
return;
|
||||
}
|
||||
|
||||
if (sp.IsNPC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.Debug($"[ATTACHMENTS MODULE]: Updating asset for attachment {grp.UUID}, attachpoint {grp.AttachmentPoint}");
|
||||
|
||||
InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID);
|
||||
@@ -1153,6 +1151,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
so.IsSelected = false; // fudge....
|
||||
|
||||
so.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
|
||||
so.HasGroupChanged = false;
|
||||
}
|
||||
|
||||
// In case it is later dropped again, don't let
|
||||
|
||||
@@ -67,6 +67,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
|
||||
private object m_setAppearanceLock = new object();
|
||||
|
||||
// add throttle
|
||||
private const int REBAKE_THROTTLE_SECONDS = 30;
|
||||
readonly ExpiringKey<string> m_rebakeThrottle = new(500 * REBAKE_THROTTLE_SECONDS);
|
||||
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
@@ -451,10 +455,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
|
||||
sp.Appearance.WearableCacheItems = wearableCache;
|
||||
|
||||
// throttle rebake requests
|
||||
if (missing.Count > 0)
|
||||
{
|
||||
string spuuidstr = sp.UUID.ToString();
|
||||
foreach (UUID id in missing)
|
||||
{
|
||||
string key = spuuidstr + id.ToString();
|
||||
|
||||
if(m_rebakeThrottle.AddOrUpdate(key, 1000 * REBAKE_THROTTLE_SECONDS))
|
||||
continue;
|
||||
|
||||
m_log.Debug($"[AVFACTORY]: Missing baked texture {id} for {sp.Name}, requesting rebake");
|
||||
|
||||
sp.ControllingClient.SendRebakeAvatarTextures(id);
|
||||
}
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
|
||||
@@ -115,28 +115,39 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
}
|
||||
|
||||
// This is it! Let's ask the other world
|
||||
if (words[0].Contains("."))
|
||||
if (words[0].Contains('.'))
|
||||
{
|
||||
string[] names = words[0].Split(Util.SplitDotArray);
|
||||
if (names.Length >= 2)
|
||||
{
|
||||
string uriStr = "http://" + words[1];
|
||||
ReadOnlySpan<char> words1lower = words[1].ToLower();
|
||||
string uriStr = string.Concat("http://", words1lower);
|
||||
|
||||
// Let's check that the last name is a valid address
|
||||
try
|
||||
if(!Uri.TryCreate(uriStr, UriKind.Absolute, out _))
|
||||
{
|
||||
new Uri(uriStr);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
|
||||
m_log.Debug($"[USER MANAGEMENT MODULE]: Malformed address {words1lower}");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID userID = UUID.Zero;
|
||||
uriStr = uriStr.ToLower();
|
||||
if(!WebUtil.GlobalExpiringBadURLs.ContainsKey(uriStr))
|
||||
{
|
||||
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
|
||||
UserAgentServiceConnector uasConn = new(uriStr);
|
||||
|
||||
// If fail to connect with http... try with https...
|
||||
if (uasConn is null)
|
||||
{
|
||||
string SSLuriStr = string.Concat("https://", words1lower); // words[1] already validated
|
||||
uasConn = new UserAgentServiceConnector(SSLuriStr);
|
||||
if (uasConn is null)
|
||||
{
|
||||
m_log.Debug($"[USER MANAGEMENT MODULE]: UserAgentServiceConnector failed to connect to {words1lower}");
|
||||
return;
|
||||
}
|
||||
uriStr = SSLuriStr;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
userID = uasConn.GetUUID(names[0], names[1]);
|
||||
@@ -147,18 +158,20 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
}
|
||||
}
|
||||
|
||||
if (!userID.Equals(UUID.Zero))
|
||||
if (userID.IsNotZero())
|
||||
{
|
||||
UserData ud = new UserData();
|
||||
ud.Id = userID;
|
||||
ud.FirstName = words[0];
|
||||
ud.LastName = "@" + words[1];
|
||||
UserData ud = new()
|
||||
{
|
||||
Id = userID,
|
||||
FirstName = words[0],
|
||||
LastName = "@" + words[1]
|
||||
};
|
||||
users.Add(ud);
|
||||
AddUser(userID, names[0], names[1], uriStr);
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
|
||||
m_log.Debug($"[USER MANAGEMENT MODULE]: User {words[0]}@{words[1]} found");
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
|
||||
m_log.Debug($"[USER MANAGEMENT MODULE]: User {words[0]}@{words[1]} not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,8 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
|
||||
public string Store(AssetBase asset)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
m_Cache?.Cache(asset);
|
||||
|
||||
if (asset.Local)
|
||||
{
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
return m_localConnector.AssetsExist(ids);
|
||||
else if (m_HGConnector != null)
|
||||
return m_HGConnector.AssetsExist(ids);
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
|
||||
public string Store(AssetBase asset)
|
||||
@@ -524,12 +524,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
return null;
|
||||
|
||||
id = StoreForeign(asset);
|
||||
if (m_Cache != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(id) && !id.Equals(UUID.ZeroString))
|
||||
m_Cache.Cache(asset);
|
||||
if (!string.IsNullOrEmpty(id) && !id.Equals(UUID.ZeroString))
|
||||
{
|
||||
m_Cache?.Cache(asset);
|
||||
return id;
|
||||
}
|
||||
return id;
|
||||
else
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (m_Cache != null)
|
||||
@@ -541,10 +542,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
|
||||
id = StoreLocal(asset);
|
||||
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return string.Empty;
|
||||
|
||||
return id;
|
||||
return string.IsNullOrEmpty(id) || id.Equals(UUID.ZeroString) ? string.Empty : id;
|
||||
}
|
||||
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
@@ -2117,7 +2117,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
// if you do a "About Landmark" on a landmark a second time, the viewer sends the
|
||||
// region_handle it got earlier via RegionHandleRequest
|
||||
ulong regionHandle = Util.BytesToUInt64Big((byte[])tmp);
|
||||
ulong regionHandle = tmp.AsULong();
|
||||
if(regionHandle == myHandle)
|
||||
{
|
||||
ILandObject l = GetLandObjectClippedXY(x, y);
|
||||
|
||||
@@ -105,11 +105,9 @@ namespace OpenSim.Region.CoreModules
|
||||
}
|
||||
|
||||
// Check for desired plugin
|
||||
if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
|
||||
if (m_availableWindPlugins.TryGetValue(m_dWindPluginName, out m_activeWindPlugin))
|
||||
{
|
||||
m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
|
||||
|
||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
|
||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
|
||||
|
||||
if (m_windConfig != null)
|
||||
{
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
||||
assetStrings[k], existChecks[k] ? "yes" : "no");
|
||||
|
||||
sb.Append(cdt.ToString());
|
||||
sb.Append("\n");
|
||||
sb.Append('\n');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -123,8 +123,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if(m_odeScene != null)
|
||||
m_odeScene.RegionLoaded();
|
||||
m_odeScene?.RegionLoaded();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -75,8 +75,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
private bool doConvexPrims = true;
|
||||
private bool doConvexSculpts = true;
|
||||
|
||||
private readonly Dictionary<AMeshKey, Mesh> m_uniqueMeshes = new();
|
||||
private readonly Dictionary<AMeshKey, Mesh> m_uniqueReleasedMeshes = new ();
|
||||
private readonly Dictionary<AMeshKey, Mesh> m_uniqueMeshes = [];
|
||||
private readonly Dictionary<AMeshKey, Mesh> m_uniqueReleasedMeshes = [];
|
||||
|
||||
#region INonSharedRegionModule
|
||||
public string Name
|
||||
@@ -173,7 +173,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
/// <param name="size">Size of entire object</param>
|
||||
/// <param name="coords"></param>
|
||||
/// <param name="faces"></param>
|
||||
private unsafe void AddSubMesh(OSDMap subMeshData, List<Vector3> coords, List<Face> faces)
|
||||
private unsafe void AddSubMesh(OSDMap subMeshData, List<Vector3> coords, List<Face> faces)
|
||||
{
|
||||
// Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap));
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
int faceIndexOffset = coords.Count;
|
||||
|
||||
fixed (byte* ptrstart = posBytes)
|
||||
{
|
||||
{
|
||||
byte* end = ptrstart + posBytes.Length;
|
||||
byte* ptr = ptrstart;
|
||||
while (ptr < end)
|
||||
@@ -1331,8 +1331,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(stream != null)
|
||||
stream.Dispose();
|
||||
stream?.Dispose();
|
||||
}
|
||||
|
||||
if (!ok && File.Exists(filename))
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
maximumRange = CmdManager.m_ScriptEngine.Config.GetFloat("SensorMaxRange", 96.0f);
|
||||
maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16);
|
||||
maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 32);
|
||||
m_npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||
private const int SCRIPTED = 8;
|
||||
|
||||
private readonly float maximumRange = 96.0f;
|
||||
private readonly int maximumToReturn = 16;
|
||||
private readonly int maximumToReturn = 32;
|
||||
|
||||
//
|
||||
// Sensed entity
|
||||
|
||||
@@ -43,6 +43,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Server.Handlers.Hypergrid
|
||||
{
|
||||
@@ -80,13 +81,13 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> request =
|
||||
ServerUtils.ParseQueryString(body);
|
||||
Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
|
||||
|
||||
if (!request.ContainsKey("METHOD"))
|
||||
object tmpObj;
|
||||
if (!request.TryGetValue("METHOD", out tmpObj))
|
||||
return FailureResult();
|
||||
|
||||
string method = request["METHOD"].ToString();
|
||||
string method = tmpObj.ToString();
|
||||
|
||||
switch (method)
|
||||
{
|
||||
@@ -140,19 +141,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
if (!VerifyServiceKey(request))
|
||||
return FailureResult();
|
||||
|
||||
UUID principalID = UUID.Zero;
|
||||
if (request.ContainsKey("PRINCIPALID"))
|
||||
UUID.TryParse(request["PRINCIPALID"].ToString(), out principalID);
|
||||
else
|
||||
object tmpObj;
|
||||
if (!request.TryGetValue("PRINCIPALID", out tmpObj) || !UUID.TryParse(tmpObj.ToString(), out UUID principalID))
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS HANDLER]: no principalID in request to get friend perms");
|
||||
return FailureResult();
|
||||
}
|
||||
|
||||
UUID friendID = UUID.Zero;
|
||||
if (request.ContainsKey("FRIENDID"))
|
||||
UUID.TryParse(request["FRIENDID"].ToString(), out friendID);
|
||||
else
|
||||
if (!request.TryGetValue("FRIENDID", out tmpObj) || !UUID.TryParse(tmpObj.ToString(), out UUID friendID))
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS HANDLER]: no friendID in request to get friend perms");
|
||||
return FailureResult();
|
||||
@@ -181,14 +177,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
byte[] DeleteFriendship(Dictionary<string, object> request)
|
||||
{
|
||||
FriendInfo friend = new FriendInfo(request);
|
||||
string secret = string.Empty;
|
||||
if (request.ContainsKey("SECRET"))
|
||||
secret = request["SECRET"].ToString();
|
||||
if (request.TryGetValue("SECRET", out object tmpObj) || tmpObj is null)
|
||||
return BoolResult(false);
|
||||
|
||||
string secret = tmpObj.ToString();
|
||||
if (secret.Length == 0)
|
||||
return BoolResult(false);
|
||||
|
||||
FriendInfo friend = new FriendInfo(request);
|
||||
bool success = m_TheService.DeleteFriendship(friend, secret);
|
||||
|
||||
return BoolResult(success);
|
||||
@@ -196,27 +192,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
byte[] FriendshipOffered(Dictionary<string, object> request)
|
||||
{
|
||||
UUID fromID = UUID.Zero;
|
||||
UUID toID = UUID.Zero;
|
||||
string message = string.Empty;
|
||||
string name = string.Empty;
|
||||
|
||||
if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID"))
|
||||
if (!request.TryGetValue("FromID", out object FromIDobj) || !UUID.TryParse(FromIDobj.ToString(), out UUID fromID))
|
||||
return BoolResult(false);
|
||||
if (!request.TryGetValue("ToID", out object ToIDobj) || !UUID.TryParse(ToIDobj.ToString(), out UUID toID))
|
||||
return BoolResult(false);
|
||||
|
||||
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
|
||||
return BoolResult(false);
|
||||
|
||||
message = request["Message"].ToString();
|
||||
|
||||
if (!UUID.TryParse(request["FromID"].ToString(), out fromID))
|
||||
return BoolResult(false);
|
||||
|
||||
if (request.ContainsKey("FromName"))
|
||||
name = request["FromName"].ToString();
|
||||
string name = request.TryGetValue("FromName", out object FromNameobj) ? FromNameobj.ToString() : string.Empty;
|
||||
string message = request.TryGetValue("Message", out object Messageobj) ? Messageobj.ToString() : string.Empty;
|
||||
|
||||
bool success = m_TheService.FriendshipOffered(fromID, name, toID, message);
|
||||
|
||||
return BoolResult(success);
|
||||
}
|
||||
|
||||
@@ -234,9 +218,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
byte[] StatusNotification(Dictionary<string, object> request)
|
||||
{
|
||||
object tmpObj;
|
||||
UUID principalID = UUID.Zero;
|
||||
if (request.ContainsKey("userID"))
|
||||
UUID.TryParse(request["userID"].ToString(), out principalID);
|
||||
if (request.TryGetValue("userID", out tmpObj))
|
||||
UUID.TryParse(tmpObj.ToString(), out principalID);
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify");
|
||||
@@ -244,8 +229,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
}
|
||||
|
||||
bool online = true;
|
||||
if (request.ContainsKey("online"))
|
||||
Boolean.TryParse(request["online"].ToString(), out online);
|
||||
if (request.TryGetValue("online", out tmpObj))
|
||||
bool.TryParse(tmpObj.ToString(), out online);
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify");
|
||||
@@ -266,7 +251,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
List<UUID> onlineFriends = m_TheService.StatusNotification(friends, principalID, online);
|
||||
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0)))
|
||||
if (onlineFriends == null || onlineFriends.Count == 0)
|
||||
result["RESULT"] = "NULL";
|
||||
else
|
||||
{
|
||||
@@ -290,20 +275,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
private bool VerifyServiceKey(Dictionary<string, object> request)
|
||||
{
|
||||
if (!request.ContainsKey("KEY") || !request.ContainsKey("SESSIONID"))
|
||||
if (!request.TryGetValue("KEY", out object KEYobj) || KEYobj is not string serviceKey || serviceKey.Length == 0 ||
|
||||
!request.TryGetValue("SESSIONID", out object SESSIONIDobj) || SESSIONIDobj is not string sessionStr)
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS HANDLER]: ignoring request without Key or SessionID");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request["KEY"] == null || request["SESSIONID"] == null)
|
||||
return false;
|
||||
|
||||
string serviceKey = request["KEY"].ToString();
|
||||
string sessionStr = request["SESSIONID"].ToString();
|
||||
|
||||
UUID sessionID;
|
||||
if (!UUID.TryParse(sessionStr, out sessionID) || serviceKey.Length == 0)
|
||||
if (!UUID.TryParse(sessionStr, out UUID sessionID))
|
||||
return false;
|
||||
|
||||
if (!m_UserAgentService.VerifyAgent(sessionID, serviceKey))
|
||||
@@ -325,8 +304,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||
"");
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse", "");
|
||||
|
||||
doc.AppendChild(rootElement);
|
||||
|
||||
@@ -342,8 +320,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||
"", "");
|
||||
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
@@ -380,8 +357,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||
"");
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse", "");
|
||||
|
||||
doc.AppendChild(rootElement);
|
||||
|
||||
@@ -407,8 +383,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
|
||||
|
||||
doc.AppendChild(xmlnode);
|
||||
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
|
||||
"");
|
||||
XmlElement rootElement = doc.CreateElement("", "ServerResponse", "");
|
||||
|
||||
doc.AppendChild(rootElement);
|
||||
|
||||
|
||||
@@ -61,8 +61,7 @@ namespace OpenSim.Services.AssetService
|
||||
if (assetConfig == null)
|
||||
throw new Exception("No " + m_ConfigName + " configuration");
|
||||
|
||||
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
|
||||
String.Empty);
|
||||
string loaderArgs = assetConfig.GetString("AssetLoaderArgs", string.Empty);
|
||||
|
||||
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
|
||||
|
||||
@@ -92,11 +91,8 @@ namespace OpenSim.Services.AssetService
|
||||
|
||||
public virtual AssetBase Get(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
|
||||
if (!UUID.TryParse(id, out UUID assetID))
|
||||
{
|
||||
m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested asset id {0}", id);
|
||||
return null;
|
||||
@@ -172,15 +168,13 @@ namespace OpenSim.Services.AssetService
|
||||
|
||||
public virtual string Store(AssetBase asset)
|
||||
{
|
||||
bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0];
|
||||
if (!exists)
|
||||
bool[] assetsexist = m_Database.AssetsExist([ asset.FullID ] );
|
||||
if (assetsexist.Length == 0 || !assetsexist[0])
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
|
||||
if (!m_Database.StoreAsset(asset))
|
||||
{
|
||||
return UUID.Zero.ToString();
|
||||
}
|
||||
return UUID.Zero.ToString();
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
||||
@@ -187,9 +187,8 @@ namespace OpenSim.Services.AssetService
|
||||
|
||||
public virtual string Store(AssetBase asset)
|
||||
{
|
||||
bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0];
|
||||
if (!exists)
|
||||
{
|
||||
bool[] assetsexist = m_Database.AssetsExist([ asset.FullID ] );
|
||||
if (assetsexist.Length == 0 || !assetsexist[0]) {
|
||||
// m_log.DebugFormat(
|
||||
// "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
|
||||
m_Database.StoreAsset(asset);
|
||||
|
||||
@@ -359,7 +359,7 @@ namespace OpenSim.Services.Connectors
|
||||
string newID;
|
||||
try
|
||||
{
|
||||
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, 10000, m_Auth);
|
||||
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, 30000, m_Auth);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenSim.Services.HypergridService
|
||||
if (configName != String.Empty)
|
||||
m_ConfigName = configName;
|
||||
|
||||
Object[] args = new Object[] { config };
|
||||
Object[] args = [ config ];
|
||||
|
||||
IConfig serverConfig = config.Configs[m_ConfigName];
|
||||
if (serverConfig == null)
|
||||
@@ -309,29 +309,39 @@ namespace OpenSim.Services.HypergridService
|
||||
// But now we need to confirm that the requester is who he says he is
|
||||
// before we act on the friendship request.
|
||||
|
||||
if (!fromName.Contains("@"))
|
||||
if (!fromName.Contains('@'))
|
||||
return;
|
||||
|
||||
string[] parts = fromName.Split(new char[] {'@'});
|
||||
if (parts.Length != 2)
|
||||
return;
|
||||
|
||||
string uriStr = "http://" + parts[1];
|
||||
try
|
||||
{
|
||||
new Uri(uriStr);
|
||||
}
|
||||
catch (UriFormatException)
|
||||
string uriStr = "http://" + parts[1].ToLower();
|
||||
string SSLuriStr = "https://" + parts[1].ToLower();
|
||||
if(!Uri.TryCreate(uriStr, UriKind.Absolute, out _))
|
||||
{
|
||||
m_log.DebugFormat("[HGFRIENDS SERVICE]: Malformed address {0}", parts[1].ToLower());
|
||||
return;
|
||||
}
|
||||
|
||||
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
|
||||
UserAgentServiceConnector uasConn = new(uriStr);
|
||||
// If fail to connect with http... try with https...
|
||||
if (uasConn is null)
|
||||
{
|
||||
uasConn = new UserAgentServiceConnector(SSLuriStr);
|
||||
if (uasConn is null)
|
||||
{
|
||||
m_log.DebugFormat("[HGFRIENDS SERVICE]: UserAgentServiceConnector failed to connect to {0}", parts[1].ToLower());
|
||||
return;
|
||||
}
|
||||
uriStr = SSLuriStr;
|
||||
}
|
||||
|
||||
Dictionary<string, object> servers = uasConn.GetServerURLs(fromID);
|
||||
if (!servers.ContainsKey("FriendsServerURI"))
|
||||
if (!servers.TryGetValue("FriendsServerURI", out object friendsServerURI))
|
||||
return;
|
||||
|
||||
HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(servers["FriendsServerURI"].ToString());
|
||||
HGFriendsServicesConnector friendsConn = new(friendsServerURI.ToString());
|
||||
if (!friendsConn.ValidateFriendshipOffered(fromID, toID))
|
||||
{
|
||||
m_log.WarnFormat("[HGFRIENDS SERVICE]: Friendship request from {0} to {1} is invalid. Impersonations?", fromID, toID);
|
||||
|
||||
BIN
bin/CSJ2K.dll
BIN
bin/CSJ2K.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user