mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
cosmetics on groups
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user