mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 10:45:40 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c6ac378a | ||
|
|
821408215f |
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
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