mirror of
https://github.com/opensim/opensim.git
synced 2026-05-13 10:06:04 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7da2feedd | ||
|
|
88ef8a9dbe | ||
|
|
9db019b2cc | ||
|
|
f1b74cde60 | ||
|
|
d6fd012e65 | ||
|
|
64408c9395 | ||
|
|
5b2ca76fcb | ||
|
|
c6733b8c80 | ||
|
|
d068a68583 | ||
|
|
b713c3047e |
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
@@ -96,14 +97,15 @@ namespace OpenSim.Groups
|
||||
|
||||
public class GroupsDataUtils
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Sanitize(string s)
|
||||
{
|
||||
return s == null ? string.Empty : s;
|
||||
return s ?? string.Empty;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupRecord(ExtendedGroupRecord grec)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
Dictionary<string, object> dict = [];
|
||||
if (grec == null)
|
||||
return dict;
|
||||
|
||||
@@ -132,65 +134,66 @@ namespace OpenSim.Groups
|
||||
return null;
|
||||
|
||||
ExtendedGroupRecord grec = new ExtendedGroupRecord();
|
||||
if (dict.ContainsKey("AllowPublish") && dict["AllowPublish"] != null)
|
||||
grec.AllowPublish = bool.Parse(dict["AllowPublish"].ToString());
|
||||
object otmp;
|
||||
if (dict.TryGetValue("AllowPublish", out otmp) && otmp != null)
|
||||
grec.AllowPublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("Charter") && dict["Charter"] != null)
|
||||
grec.Charter = dict["Charter"].ToString();
|
||||
if (dict.TryGetValue("Charter", out otmp) && otmp != null)
|
||||
grec.Charter = otmp.ToString();
|
||||
else
|
||||
grec.Charter = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("FounderID") && dict["FounderID"] != null)
|
||||
if (dict.TryGetValue("FounderID", out otmp) && otmp != null)
|
||||
grec.FounderID = UUID.Parse(dict["FounderID"].ToString());
|
||||
|
||||
if (dict.ContainsKey("FounderUUI") && dict["FounderUUI"] != null)
|
||||
grec.FounderUUI = dict["FounderUUI"].ToString();
|
||||
if (dict.TryGetValue("FounderUUI", out otmp) && otmp != null)
|
||||
grec.FounderUUI = otmp.ToString();
|
||||
else
|
||||
grec.FounderUUI = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("GroupID") && dict["GroupID"] != null)
|
||||
grec.GroupID = UUID.Parse(dict["GroupID"].ToString());
|
||||
if (dict.TryGetValue("GroupID", out otmp) && otmp != null)
|
||||
grec.GroupID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupName") && dict["GroupName"] != null)
|
||||
grec.GroupName = dict["GroupName"].ToString();
|
||||
if (dict.TryGetValue("GroupName", out otmp) && otmp != null)
|
||||
grec.GroupName = otmp.ToString();
|
||||
else
|
||||
grec.GroupName = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("InsigniaID") && dict["InsigniaID"] != null)
|
||||
grec.GroupPicture = UUID.Parse(dict["InsigniaID"].ToString());
|
||||
if (dict.TryGetValue("InsigniaID", out otmp) && otmp != null)
|
||||
grec.GroupPicture = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MaturePublish") && dict["MaturePublish"] != null)
|
||||
grec.MaturePublish = bool.Parse(dict["MaturePublish"].ToString());
|
||||
if (dict.TryGetValue("MaturePublish", out otmp) && otmp != null)
|
||||
grec.MaturePublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MembershipFee") && dict["MembershipFee"] != null)
|
||||
grec.MembershipFee = Int32.Parse(dict["MembershipFee"].ToString());
|
||||
if (dict.TryGetValue("MembershipFee", out otmp) && otmp != null)
|
||||
grec.MembershipFee = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("OpenEnrollment") && dict["OpenEnrollment"] != null)
|
||||
grec.OpenEnrollment = bool.Parse(dict["OpenEnrollment"].ToString());
|
||||
if (dict.TryGetValue("OpenEnrollment", out otmp) && otmp != null)
|
||||
grec.OpenEnrollment = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("OwnerRoleID") && dict["OwnerRoleID"] != null)
|
||||
grec.OwnerRoleID = UUID.Parse(dict["OwnerRoleID"].ToString());
|
||||
if (dict.TryGetValue("OwnerRoleID", out otmp) && otmp != null)
|
||||
grec.OwnerRoleID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("ServiceLocation") && dict["ServiceLocation"] != null)
|
||||
grec.ServiceLocation = dict["ServiceLocation"].ToString();
|
||||
if (dict.TryGetValue("ServiceLocation", out otmp) && otmp != null)
|
||||
grec.ServiceLocation = otmp.ToString();
|
||||
else
|
||||
grec.ServiceLocation = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("ShownInList") && dict["ShownInList"] != null)
|
||||
grec.ShowInList = bool.Parse(dict["ShownInList"].ToString());
|
||||
if (dict.TryGetValue("ShownInList", out otmp) && otmp != null)
|
||||
grec.ShowInList = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MemberCount") && dict["MemberCount"] != null)
|
||||
grec.MemberCount = Int32.Parse(dict["MemberCount"].ToString());
|
||||
if (dict.TryGetValue("MemberCount", out otmp) && otmp != null)
|
||||
grec.MemberCount = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("RoleCount") && dict["RoleCount"] != null)
|
||||
grec.RoleCount = Int32.Parse(dict["RoleCount"].ToString());
|
||||
if (dict.TryGetValue("RoleCount", out otmp) && otmp != null)
|
||||
grec.RoleCount = int.Parse(otmp.ToString());
|
||||
|
||||
return grec;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupMembershipData(ExtendedGroupMembershipData membership)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
Dictionary<string, object> dict = [];
|
||||
if (membership == null)
|
||||
return dict;
|
||||
|
||||
@@ -222,68 +225,68 @@ namespace OpenSim.Groups
|
||||
return null;
|
||||
|
||||
ExtendedGroupMembershipData membership = new ExtendedGroupMembershipData();
|
||||
object otmp;
|
||||
if (dict.TryGetValue("AcceptNotices", out otmp) && otmp != null)
|
||||
membership.AcceptNotices = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("AcceptNotices") && dict["AcceptNotices"] != null)
|
||||
membership.AcceptNotices = bool.Parse(dict["AcceptNotices"].ToString());
|
||||
|
||||
if (dict.ContainsKey("AccessToken") && dict["AccessToken"] != null)
|
||||
membership.AccessToken = dict["AccessToken"].ToString();
|
||||
if (dict.TryGetValue("AccessToken", out otmp) && otmp != null)
|
||||
membership.AccessToken = otmp.ToString();
|
||||
else
|
||||
membership.AccessToken = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Active") && dict["Active"] != null)
|
||||
membership.Active = bool.Parse(dict["Active"].ToString());
|
||||
if (dict.TryGetValue("Active", out otmp) && otmp != null)
|
||||
membership.Active = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("ActiveRole") && dict["ActiveRole"] != null)
|
||||
membership.ActiveRole = UUID.Parse(dict["ActiveRole"].ToString());
|
||||
if (dict.TryGetValue("ActiveRole", out otmp) && otmp != null)
|
||||
membership.ActiveRole = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("AllowPublish") && dict["AllowPublish"] != null)
|
||||
membership.AllowPublish = bool.Parse(dict["AllowPublish"].ToString());
|
||||
if (dict.TryGetValue("AllowPublish", out otmp) && otmp != null)
|
||||
membership.AllowPublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("Charter") && dict["Charter"] != null)
|
||||
membership.Charter = dict["Charter"].ToString();
|
||||
if (dict.TryGetValue("Charter", out otmp) && otmp != null)
|
||||
membership.Charter = otmp.ToString();
|
||||
else
|
||||
membership.Charter = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Contribution") && dict["Contribution"] != null)
|
||||
membership.Contribution = Int32.Parse(dict["Contribution"].ToString());
|
||||
if (dict.TryGetValue("Contribution", out otmp) && otmp != null)
|
||||
membership.Contribution = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("FounderID") && dict["FounderID"] != null)
|
||||
membership.FounderID = UUID.Parse(dict["FounderID"].ToString());
|
||||
if (dict.TryGetValue("FounderID", out otmp) && otmp != null)
|
||||
membership.FounderID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupID") && dict["GroupID"] != null)
|
||||
membership.GroupID = UUID.Parse(dict["GroupID"].ToString());
|
||||
if (dict.TryGetValue("GroupID", out otmp) && otmp != null)
|
||||
membership.GroupID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupName") && dict["GroupName"] != null)
|
||||
membership.GroupName = dict["GroupName"].ToString();
|
||||
if (dict.TryGetValue("GroupName", out otmp) && otmp != null)
|
||||
membership.GroupName = otmp.ToString();
|
||||
else
|
||||
membership.GroupName = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("GroupPicture") && dict["GroupPicture"] != null)
|
||||
membership.GroupPicture = UUID.Parse(dict["GroupPicture"].ToString());
|
||||
if (dict.TryGetValue("GroupPicture", out otmp) && otmp != null)
|
||||
membership.GroupPicture = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupPowers") && dict["GroupPowers"] != null)
|
||||
membership.GroupPowers = UInt64.Parse(dict["GroupPowers"].ToString());
|
||||
if (dict.TryGetValue("GroupPowers", out otmp) && otmp != null)
|
||||
membership.GroupPowers = ulong.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupTitle") && dict["GroupTitle"] != null)
|
||||
membership.GroupTitle = dict["GroupTitle"].ToString();
|
||||
if (dict.TryGetValue("GroupTitle", out otmp) && otmp != null)
|
||||
membership.GroupTitle = otmp.ToString();
|
||||
else
|
||||
membership.GroupTitle = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("ListInProfile") && dict["ListInProfile"] != null)
|
||||
membership.ListInProfile = bool.Parse(dict["ListInProfile"].ToString());
|
||||
if (dict.TryGetValue("ListInProfile", out otmp) && otmp != null)
|
||||
membership.ListInProfile = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MaturePublish") && dict["MaturePublish"] != null)
|
||||
membership.MaturePublish = bool.Parse(dict["MaturePublish"].ToString());
|
||||
if (dict.TryGetValue("MaturePublish", out otmp) && otmp != null)
|
||||
membership.MaturePublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MembershipFee") && dict["MembershipFee"] != null)
|
||||
membership.MembershipFee = Int32.Parse(dict["MembershipFee"].ToString());
|
||||
if (dict.TryGetValue("MembershipFee", out otmp) && otmp != null)
|
||||
membership.MembershipFee = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("OpenEnrollment") && dict["OpenEnrollment"] != null)
|
||||
membership.OpenEnrollment = bool.Parse(dict["OpenEnrollment"].ToString());
|
||||
if (dict.TryGetValue("OpenEnrollment", out otmp) && otmp != null)
|
||||
membership.OpenEnrollment = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("ShowInList") && dict["ShowInList"] != null)
|
||||
membership.ShowInList = bool.Parse(dict["ShowInList"].ToString());
|
||||
if (dict.TryGetValue("ShowInList", out otmp) && otmp != null)
|
||||
membership.ShowInList = bool.Parse(otmp.ToString());
|
||||
|
||||
return membership;
|
||||
}
|
||||
@@ -312,38 +315,39 @@ namespace OpenSim.Groups
|
||||
if (dict == null)
|
||||
return member;
|
||||
|
||||
if (dict.ContainsKey("AcceptNotices") && dict["AcceptNotices"] != null)
|
||||
member.AcceptNotices = bool.Parse(dict["AcceptNotices"].ToString());
|
||||
object value;
|
||||
if (dict.TryGetValue("AcceptNotices", out value) && value != null)
|
||||
member.AcceptNotices = bool.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("AccessToken") && dict["AccessToken"] != null)
|
||||
member.AccessToken = Sanitize(dict["AccessToken"].ToString());
|
||||
if (dict.TryGetValue("AccessToken", out value) && value != null)
|
||||
member.AccessToken = value.ToString();
|
||||
else
|
||||
member.AccessToken = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("AgentID") && dict["AgentID"] != null)
|
||||
member.AgentID = Sanitize(dict["AgentID"].ToString());
|
||||
if (dict.TryGetValue("AgentID", out value) && value != null)
|
||||
member.AgentID = value.ToString();
|
||||
else
|
||||
member.AgentID = UUID.Zero.ToString();
|
||||
member.AgentID = UUID.ZeroString;
|
||||
|
||||
if (dict.ContainsKey("AgentPowers") && dict["AgentPowers"] != null)
|
||||
member.AgentPowers = UInt64.Parse(dict["AgentPowers"].ToString());
|
||||
if (dict.TryGetValue("AgentPowers", out value) && value != null)
|
||||
member.AgentPowers = ulong.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("Contribution") && dict["Contribution"] != null)
|
||||
member.Contribution = Int32.Parse(dict["Contribution"].ToString());
|
||||
if (dict.TryGetValue("Contribution", out value) && value != null)
|
||||
member.Contribution = int.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("IsOwner") && dict["IsOwner"] != null)
|
||||
member.IsOwner = bool.Parse(dict["IsOwner"].ToString());
|
||||
if (dict.TryGetValue("IsOwner", out value) && value != null)
|
||||
member.IsOwner = bool.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("ListInProfile") && dict["ListInProfile"] != null)
|
||||
member.ListInProfile = bool.Parse(dict["ListInProfile"].ToString());
|
||||
if (dict.TryGetValue("ListInProfile", out value) && value != null)
|
||||
member.ListInProfile = bool.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("OnlineStatus") && dict["OnlineStatus"] != null)
|
||||
member.OnlineStatus = Sanitize(dict["OnlineStatus"].ToString());
|
||||
if (dict.TryGetValue("OnlineStatus", out value) && value != null)
|
||||
member.OnlineStatus = value.ToString();
|
||||
else
|
||||
member.OnlineStatus = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Title") && dict["Title"] != null)
|
||||
member.Title = Sanitize(dict["Title"].ToString());
|
||||
if (dict.TryGetValue("Title", out value) && value != null)
|
||||
member.Title = value.ToString();
|
||||
else
|
||||
member.Title = string.Empty;
|
||||
|
||||
@@ -371,123 +375,116 @@ namespace OpenSim.Groups
|
||||
if (dict == null)
|
||||
return role;
|
||||
|
||||
if (dict.ContainsKey("Description") && dict["Description"] != null)
|
||||
role.Description = Sanitize(dict["Description"].ToString());
|
||||
object value;
|
||||
if (dict.TryGetValue("Description", out value) && value != null)
|
||||
role.Description = value.ToString();
|
||||
else
|
||||
role.Description = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Members") && dict["Members"] != null)
|
||||
role.Members = Int32.Parse(dict["Members"].ToString());
|
||||
if (dict.TryGetValue("Members", out value) && value != null)
|
||||
role.Members = int.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("Name") && dict["Name"] != null)
|
||||
role.Name = Sanitize(dict["Name"].ToString());
|
||||
if (dict.TryGetValue("Name", out value) && value != null)
|
||||
role.Name = value.ToString();
|
||||
else
|
||||
role.Name = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Powers") && dict["Powers"] != null)
|
||||
role.Powers = UInt64.Parse(dict["Powers"].ToString());
|
||||
if (dict.TryGetValue("Powers", out value) && value != null)
|
||||
role.Powers = ulong.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("Title") && dict["Title"] != null)
|
||||
role.Title = Sanitize(dict["Title"].ToString());
|
||||
if (dict.TryGetValue("Title", out value) && value != null)
|
||||
role.Title = value.ToString();
|
||||
else
|
||||
role.Title = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("RoleID") && dict["RoleID"] != null)
|
||||
role.RoleID = UUID.Parse(dict["RoleID"].ToString());
|
||||
if (dict.TryGetValue("RoleID", out value) && value != null)
|
||||
role.RoleID = UUID.Parse(value.ToString());
|
||||
|
||||
return role;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupRoleMembersData(ExtendedGroupRoleMembersData rmember)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["RoleID"] = rmember.RoleID.ToString();
|
||||
dict["MemberID"] = rmember.MemberID;
|
||||
return dict;
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
["RoleID"] = rmember.RoleID.ToString(),
|
||||
["MemberID"] = rmember.MemberID
|
||||
};
|
||||
}
|
||||
|
||||
public static ExtendedGroupRoleMembersData GroupRoleMembersData(Dictionary<string, object> dict)
|
||||
{
|
||||
ExtendedGroupRoleMembersData rmember = new ExtendedGroupRoleMembersData();
|
||||
|
||||
if (dict.ContainsKey("RoleID") && dict["RoleID"] != null)
|
||||
rmember.RoleID = new UUID(dict["RoleID"].ToString());
|
||||
object value;
|
||||
if (dict.TryGetValue("RoleID", out value) && value != null)
|
||||
rmember.RoleID = new UUID(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("MemberID") && dict["MemberID"] != null)
|
||||
rmember.MemberID = dict["MemberID"].ToString();
|
||||
if (dict.TryGetValue("MemberID", out value) && value != null)
|
||||
rmember.MemberID = value.ToString();
|
||||
|
||||
return rmember;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupInviteInfo(GroupInviteInfo invite)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["InviteID"] = invite.InviteID.ToString();
|
||||
dict["GroupID"] = invite.GroupID.ToString();
|
||||
dict["RoleID"] = invite.RoleID.ToString();
|
||||
dict["AgentID"] = invite.AgentID;
|
||||
|
||||
return dict;
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
["InviteID"] = invite.InviteID.ToString(),
|
||||
["GroupID"] = invite.GroupID.ToString(),
|
||||
["RoleID"] = invite.RoleID.ToString(),
|
||||
["AgentID"] = invite.AgentID
|
||||
};
|
||||
}
|
||||
|
||||
public static GroupInviteInfo GroupInviteInfo(Dictionary<string, object> dict)
|
||||
{
|
||||
if (dict == null)
|
||||
return null;
|
||||
|
||||
GroupInviteInfo invite = new GroupInviteInfo();
|
||||
|
||||
invite.InviteID = new UUID(dict["InviteID"].ToString());
|
||||
invite.GroupID = new UUID(dict["GroupID"].ToString());
|
||||
invite.RoleID = new UUID(dict["RoleID"].ToString());
|
||||
invite.AgentID = Sanitize(dict["AgentID"].ToString());
|
||||
|
||||
return invite;
|
||||
return dict == null ? null :
|
||||
new GroupInviteInfo
|
||||
{
|
||||
InviteID = new UUID(dict["InviteID"].ToString()),
|
||||
GroupID = new UUID(dict["GroupID"].ToString()),
|
||||
RoleID = new UUID(dict["RoleID"].ToString()),
|
||||
AgentID = Sanitize(dict["AgentID"].ToString())
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupNoticeData(ExtendedGroupNoticeData notice)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["NoticeID"] = notice.NoticeID.ToString();
|
||||
dict["Timestamp"] = notice.Timestamp.ToString();
|
||||
dict["FromName"] = Sanitize(notice.FromName);
|
||||
dict["Subject"] = Sanitize(notice.Subject);
|
||||
dict["HasAttachment"] = notice.HasAttachment.ToString();
|
||||
dict["AttachmentItemID"] = notice.AttachmentItemID.ToString();
|
||||
dict["AttachmentName"] = Sanitize(notice.AttachmentName);
|
||||
dict["AttachmentType"] = notice.AttachmentType.ToString();
|
||||
dict["AttachmentOwnerID"] = Sanitize(notice.AttachmentOwnerID);
|
||||
|
||||
return dict;
|
||||
return new Dictionary<string, object>
|
||||
{
|
||||
["NoticeID"] = notice.NoticeID.ToString(),
|
||||
["Timestamp"] = notice.Timestamp.ToString(),
|
||||
["FromName"] = Sanitize(notice.FromName),
|
||||
["Subject"] = Sanitize(notice.Subject),
|
||||
["HasAttachment"] = notice.HasAttachment.ToString(),
|
||||
["AttachmentItemID"] = notice.AttachmentItemID.ToString(),
|
||||
["AttachmentName"] = Sanitize(notice.AttachmentName),
|
||||
["AttachmentType"] = notice.AttachmentType.ToString(),
|
||||
["AttachmentOwnerID"] = Sanitize(notice.AttachmentOwnerID)
|
||||
};
|
||||
}
|
||||
|
||||
public static ExtendedGroupNoticeData GroupNoticeData(Dictionary<string, object> dict)
|
||||
{
|
||||
ExtendedGroupNoticeData notice = new ExtendedGroupNoticeData();
|
||||
|
||||
if (dict == null)
|
||||
return notice;
|
||||
|
||||
notice.NoticeID = new UUID(dict["NoticeID"].ToString());
|
||||
notice.Timestamp = UInt32.Parse(dict["Timestamp"].ToString());
|
||||
notice.FromName = Sanitize(dict["FromName"].ToString());
|
||||
notice.Subject = Sanitize(dict["Subject"].ToString());
|
||||
notice.HasAttachment = bool.Parse(dict["HasAttachment"].ToString());
|
||||
notice.AttachmentItemID = new UUID(dict["AttachmentItemID"].ToString());
|
||||
notice.AttachmentName = dict["AttachmentName"].ToString();
|
||||
notice.AttachmentType = byte.Parse(dict["AttachmentType"].ToString());
|
||||
notice.AttachmentOwnerID = dict["AttachmentOwnerID"].ToString();
|
||||
|
||||
return notice;
|
||||
}
|
||||
return dict == null ? new ExtendedGroupNoticeData() :
|
||||
new ExtendedGroupNoticeData()
|
||||
{
|
||||
NoticeID = new UUID(dict["NoticeID"].ToString()),
|
||||
Timestamp = uint.Parse(dict["Timestamp"].ToString()),
|
||||
FromName = Sanitize(dict["FromName"].ToString()),
|
||||
Subject = Sanitize(dict["Subject"].ToString()),
|
||||
HasAttachment = bool.Parse(dict["HasAttachment"].ToString()),
|
||||
AttachmentItemID = new UUID(dict["AttachmentItemID"].ToString()),
|
||||
AttachmentName = dict["AttachmentName"].ToString(),
|
||||
AttachmentType = byte.Parse(dict["AttachmentType"].ToString()),
|
||||
AttachmentOwnerID = dict["AttachmentOwnerID"].ToString()
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupNoticeInfo(GroupNoticeInfo notice)
|
||||
{
|
||||
Dictionary<string, object> dict = GroupNoticeData(notice.noticeData);
|
||||
|
||||
dict["GroupID"] = notice.GroupID.ToString();
|
||||
dict["Message"] = Sanitize(notice.Message);
|
||||
|
||||
@@ -496,25 +493,23 @@ namespace OpenSim.Groups
|
||||
|
||||
public static GroupNoticeInfo GroupNoticeInfo(Dictionary<string, object> dict)
|
||||
{
|
||||
GroupNoticeInfo notice = new GroupNoticeInfo();
|
||||
|
||||
notice.noticeData = GroupNoticeData(dict);
|
||||
notice.GroupID = new UUID(dict["GroupID"].ToString());
|
||||
notice.Message = Sanitize(dict["Message"].ToString());
|
||||
|
||||
return notice;
|
||||
return new GroupNoticeInfo
|
||||
{
|
||||
noticeData = GroupNoticeData(dict),
|
||||
GroupID = new UUID(dict["GroupID"].ToString()),
|
||||
Message = Sanitize(dict["Message"].ToString())
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> DirGroupsReplyData(DirGroupsReplyData g)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["GroupID"] = g.groupID;
|
||||
dict["Name"] = g.groupName;
|
||||
dict["NMembers"] = g.members;
|
||||
dict["SearchOrder"] = g.searchOrder;
|
||||
|
||||
return dict;
|
||||
return new Dictionary<string, object>
|
||||
{
|
||||
["GroupID"] = g.groupID,
|
||||
["Name"] = g.groupName,
|
||||
["NMembers"] = g.members,
|
||||
["SearchOrder"] = g.searchOrder
|
||||
};
|
||||
}
|
||||
|
||||
public static DirGroupsReplyData DirGroupsReplyData(Dictionary<string, object> dict)
|
||||
@@ -523,7 +518,7 @@ namespace OpenSim.Groups
|
||||
|
||||
g.groupID = new UUID(dict["GroupID"].ToString());
|
||||
g.groupName = dict["Name"].ToString();
|
||||
Int32.TryParse(dict["NMembers"].ToString(), out g.members);
|
||||
int.TryParse(dict["NMembers"].ToString(), out g.members);
|
||||
float.TryParse(dict["SearchOrder"].ToString(), out g.searchOrder);
|
||||
|
||||
return g;
|
||||
|
||||
@@ -128,11 +128,10 @@ namespace OpenSim.Groups
|
||||
Dictionary<string, object> request =
|
||||
ServerUtils.ParseQueryString(body);
|
||||
|
||||
if (!request.ContainsKey("METHOD"))
|
||||
if(!request.Remove("METHOD", out object omethod))
|
||||
return FailureResult();
|
||||
|
||||
string method = request["METHOD"].ToString();
|
||||
request.Remove("METHOD");
|
||||
string method = omethod.ToString();
|
||||
|
||||
m_log.DebugFormat("[Groups.RobustHGConnector]: {0}", method);
|
||||
switch (method)
|
||||
|
||||
@@ -246,6 +246,7 @@ namespace OpenSim.Framework
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double lerp(double a, double b, double c)
|
||||
{
|
||||
return (b * a) + (c * (1 - a));
|
||||
@@ -424,6 +425,7 @@ namespace OpenSim.Framework
|
||||
// legacy, do not use
|
||||
public static Random RandomClass
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return Random.Shared;}
|
||||
}
|
||||
|
||||
@@ -2230,9 +2232,9 @@ namespace OpenSim.Framework
|
||||
/// <returns></returns>
|
||||
public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections, object val)
|
||||
{
|
||||
foreach (string section in sections.AsSpan())
|
||||
for (int i = 0 ; i < sections.Length; i++)
|
||||
{
|
||||
IConfig cnf = config.Configs[section];
|
||||
IConfig cnf = config.Configs[sections[i]];
|
||||
if (cnf == null)
|
||||
continue;
|
||||
|
||||
@@ -2250,6 +2252,119 @@ namespace OpenSim.Framework
|
||||
return (T)val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a configuration variable by looking into
|
||||
/// multiple sections in order. Returns as soon one is found, ignoring other sections
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If no value is found then the given default value is returned
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">Type of the variable</typeparam>
|
||||
/// <param name="config">The configuration object</param>
|
||||
/// <param name="varname">The configuration variable</param>
|
||||
/// <param name="sections">Ordered sequence of sections to look at</param>
|
||||
/// <param name="val">Default value</param>
|
||||
/// <returns></returns>
|
||||
public static T GetFirstConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections, object val)
|
||||
{
|
||||
for (int i = 0 ; i < sections.Length; i++)
|
||||
{
|
||||
IConfig cnf = config.Configs[sections[i]];
|
||||
if (cnf == null)
|
||||
continue;
|
||||
|
||||
string text = cnf.Get(varname);
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (typeof(T) == typeof(string))
|
||||
return Unsafe.As<string, T>(ref text);
|
||||
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
bool b = bool.Parse(text);
|
||||
return Unsafe.As<bool, T>(ref b);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(int))
|
||||
{
|
||||
int ti = int.Parse(text);
|
||||
return Unsafe.As<int, T>(ref ti);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(float))
|
||||
{
|
||||
float f = float.Parse(text);
|
||||
return Unsafe.As<float, T>(ref f);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(double))
|
||||
{
|
||||
double d = double.Parse(text);
|
||||
return Unsafe.As<double, T>(ref d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return val == null ? default : (T) val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a configuration variable by looking into
|
||||
/// multiple sections in order. Returns as soon one is found, ignoring other sections
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If no value is found then the default value of T is returned
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">Type of the variable</typeparam>
|
||||
/// <param name="config">The configuration object</param>
|
||||
/// <param name="varname">The configuration variable</param>
|
||||
/// <param name="sections">Ordered sequence of sections to look at</param>
|
||||
/// <returns></returns>
|
||||
|
||||
public static T GetFirstConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections)
|
||||
{
|
||||
for (int i = 0 ; i < sections.Length; i++)
|
||||
{
|
||||
IConfig cnf = config.Configs[sections[i]];
|
||||
if (cnf == null)
|
||||
continue;
|
||||
|
||||
string text = cnf.Get(varname);
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (typeof(T) == typeof(string))
|
||||
return Unsafe.As<string, T>(ref text);
|
||||
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
bool b = bool.Parse(text);
|
||||
return Unsafe.As<bool, T>(ref b);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(int))
|
||||
{
|
||||
int ti = int.Parse(text);
|
||||
return Unsafe.As<int, T>(ref ti);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(float))
|
||||
{
|
||||
float f = float.Parse(text);
|
||||
return Unsafe.As<float, T>(ref f);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(double))
|
||||
{
|
||||
double d = double.Parse(text);
|
||||
return Unsafe.As<double, T>(ref d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
||||
public static void MergeEnvironmentToConfig(IConfigSource ConfigSource)
|
||||
{
|
||||
IConfig enVars = ConfigSource.Configs["Environment"];
|
||||
|
||||
@@ -100,16 +100,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
IConfigSource config = m_Scene.Config;
|
||||
if (config is not null)
|
||||
{
|
||||
IConfig sconfig = config.Configs["Startup"];
|
||||
if (sconfig is not null)
|
||||
ConfigOptions.levelUpload = sconfig.GetInt("LevelUpload", 0);
|
||||
|
||||
if (ConfigOptions.levelUpload == 0)
|
||||
{
|
||||
IConfig pconfig = config.Configs["Permissions"];
|
||||
if (pconfig is not null)
|
||||
ConfigOptions.levelUpload = pconfig.GetInt("LevelUpload", 0);
|
||||
}
|
||||
ConfigOptions.levelUpload = Util.GetFirstConfigVarFromSections<int>(config,"LevelUpload",["Permissions", "Startup"], 0);
|
||||
|
||||
IConfig appearanceConfig = config.Configs["Appearance"];
|
||||
if (appearanceConfig is not null)
|
||||
|
||||
@@ -305,11 +305,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
lock(dropedResponses)
|
||||
{
|
||||
if(dropedResponses.Contains(requestID))
|
||||
{
|
||||
dropedResponses.Remove(requestID);
|
||||
if(dropedResponses.Remove(requestID))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,9 +318,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
lock(dropedResponses)
|
||||
{
|
||||
if(dropedResponses.Contains(requestID))
|
||||
if(dropedResponses.Remove(requestID))
|
||||
{
|
||||
dropedResponses.Remove(requestID);
|
||||
ProcessedRequestsCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using log4net;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
@@ -114,29 +115,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public Packet GetPacket(PacketType type)
|
||||
{
|
||||
PacketsRequested++;
|
||||
|
||||
Packet packet;
|
||||
|
||||
if (!RecyclePackets)
|
||||
return Packet.BuildPacket(type);
|
||||
|
||||
Packet packet;
|
||||
lock (pool)
|
||||
{
|
||||
if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0)
|
||||
if (!pool.TryGetValue(type, out Stack<Packet> typePacketsStack) || typePacketsStack == null || typePacketsStack.Count == 0)
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type);
|
||||
|
||||
// Creating a new packet if we cannot reuse an old package
|
||||
//m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type);
|
||||
packet = Packet.BuildPacket(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type);
|
||||
//m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type);
|
||||
|
||||
// Recycle old packages
|
||||
PacketsReused++;
|
||||
|
||||
packet = pool[type].Pop();
|
||||
packet = typePacketsStack.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +195,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (!RecyclePackets)
|
||||
return;
|
||||
|
||||
bool trypool = false;
|
||||
PacketType type = packet.Type;
|
||||
|
||||
switch (type)
|
||||
@@ -207,83 +202,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
case PacketType.ObjectUpdate:
|
||||
ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
|
||||
oup.ObjectData = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.ImprovedTerseObjectUpdate:
|
||||
ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
|
||||
itoup.ObjectData = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.PacketAck:
|
||||
PacketAckPacket ackup = (PacketAckPacket)packet;
|
||||
ackup.Packets = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.AgentUpdate:
|
||||
trypool = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(!trypool)
|
||||
return;
|
||||
|
||||
lock (pool)
|
||||
{
|
||||
if (!pool.ContainsKey(type))
|
||||
ref Stack<Packet> spkt = ref CollectionsMarshal.GetValueRefOrAddDefault(pool, type, out bool exists);
|
||||
if (exists && spkt.Count < 50)
|
||||
{
|
||||
pool[type] = new Stack<Packet>();
|
||||
spkt.Push(packet);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pool[type]).Count < 50)
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type);
|
||||
pool[type].Push(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T GetDataBlock<T>() where T: new()
|
||||
{
|
||||
lock (DataBlocks)
|
||||
{
|
||||
BlocksRequested++;
|
||||
|
||||
Stack<Object> s;
|
||||
|
||||
if (DataBlocks.TryGetValue(typeof(T), out s))
|
||||
{
|
||||
if (s.Count > 0)
|
||||
{
|
||||
BlocksReused++;
|
||||
return (T)s.Pop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataBlocks[typeof(T)] = new Stack<Object>();
|
||||
}
|
||||
|
||||
return new T();
|
||||
}
|
||||
}
|
||||
|
||||
public void ReturnDataBlock<T>(T block) where T: new()
|
||||
{
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
lock (DataBlocks)
|
||||
{
|
||||
if (!DataBlocks.ContainsKey(typeof(T)))
|
||||
DataBlocks[typeof(T)] = new Stack<Object>();
|
||||
|
||||
if (DataBlocks[typeof(T)].Count < 50)
|
||||
DataBlocks[typeof(T)].Push(block);
|
||||
spkt = new Stack<Packet>();
|
||||
spkt.Push(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Mono.Addins;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
@@ -51,18 +52,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
/// <summary>
|
||||
/// Each agent has its own singleton collection of transactions
|
||||
/// </summary>
|
||||
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
|
||||
new Dictionary<UUID, AgentAssetTransactions>();
|
||||
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions = [];
|
||||
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig sconfig = source.Configs["Startup"];
|
||||
if (sconfig != null)
|
||||
{
|
||||
m_levelUpload = sconfig.GetInt("LevelUpload", 0);
|
||||
}
|
||||
if(source != null)
|
||||
m_levelUpload = Util.GetFirstConfigVarFromSections<int>(source,"LevelUpload",["Permissions", "Startup"], 0);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
@@ -113,16 +110,11 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
lock (AgentTransactions)
|
||||
{
|
||||
if (!AgentTransactions.ContainsKey(userID))
|
||||
{
|
||||
AgentAssetTransactions transactions =
|
||||
new AgentAssetTransactions(userID, m_Scene,
|
||||
m_dumpAssetsToFile);
|
||||
ref AgentAssetTransactions value = ref CollectionsMarshal.GetValueRefOrAddDefault(AgentTransactions, userID, out bool exists);
|
||||
if (!exists)
|
||||
value = new AgentAssetTransactions(userID, m_Scene, m_dumpAssetsToFile);
|
||||
|
||||
AgentTransactions.Add(userID, transactions);
|
||||
}
|
||||
|
||||
return AgentTransactions[userID];
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,8 +209,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
// "[ASSET TRANSACTION MODULE]: Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
|
||||
// item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
|
||||
|
||||
AgentAssetTransactions transactions =
|
||||
GetUserTransactions(remoteClient.AgentId);
|
||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||
|
||||
transactions.RequestUpdateTaskInventoryItem(remoteClient, part,
|
||||
transactionID, item);
|
||||
@@ -247,9 +238,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
(AssetType)type == AssetType.Animation) &&
|
||||
tempFile == false)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
Scene scene = (Scene)remoteClient.Scene;
|
||||
scene.TryGetScenePresence(remoteClient.AgentId, out avatar);
|
||||
scene.TryGetScenePresence(remoteClient.AgentId, out ScenePresence avatar);
|
||||
|
||||
// check user level
|
||||
if (avatar != null)
|
||||
|
||||
@@ -994,7 +994,8 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
try
|
||||
{
|
||||
// If the file is already cached, don't cache it, just touch it so access time is updated
|
||||
if (!replace && File.Exists(filename))
|
||||
bool fileExists = File.Exists(filename);
|
||||
if (!replace && fileExists)
|
||||
{
|
||||
if (m_updateFileTimeOnCacheHit)
|
||||
UpdateFileLastAccessTime(filename);
|
||||
@@ -1031,7 +1032,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
|
||||
try
|
||||
{
|
||||
if(replace)
|
||||
if(fileExists)
|
||||
File.Delete(filename);
|
||||
File.Move(tempname, filename);
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
|
||||
// Create a new asset for user
|
||||
AssetBase asset = new AssetBase(
|
||||
UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture,
|
||||
UUID.Random(), "DynamicImage" + Random.Shared.Next(1, 10000), (sbyte)AssetType.Texture,
|
||||
part.OwnerID.ToString());
|
||||
asset.Data = assetData;
|
||||
asset.Description = string.Format("URL image : {0}", Url);
|
||||
|
||||
@@ -253,7 +253,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
m_hasGroupChanged = value;
|
||||
|
||||
//m_log.DebugFormat(
|
||||
// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
@@ -147,15 +148,14 @@ namespace OpenSim.Region.DataSnapshot
|
||||
#region Response storage
|
||||
public XmlNode GetScene(Scene scene, XmlDocument factory)
|
||||
{
|
||||
m_log.Debug("[DATASNAPSHOT]: Data requested for scene " + scene.RegionInfo.RegionName);
|
||||
m_log.Debug("[DATASNAPSHOT]: Data requested for scene " + scene.Name);
|
||||
|
||||
if (!m_scenes.ContainsKey(scene)) {
|
||||
m_scenes.Add(scene, true); //stale by default
|
||||
}
|
||||
ref bool sceneStale = ref CollectionsMarshal.GetValueRefOrAddDefault(m_scenes, scene, out bool exists);
|
||||
sceneStale |= !exists;
|
||||
|
||||
XmlNode regionElement = null;
|
||||
|
||||
if (!m_scenes[scene])
|
||||
if (!sceneStale)
|
||||
{
|
||||
m_log.Debug("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache.");
|
||||
//get snapshot from cache
|
||||
@@ -212,7 +212,7 @@ namespace OpenSim.Region.DataSnapshot
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
|
||||
}
|
||||
|
||||
m_scenes[scene] = false;
|
||||
sceneStale = false;
|
||||
|
||||
m_log.Debug("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName);
|
||||
}
|
||||
@@ -258,7 +258,6 @@ namespace OpenSim.Region.DataSnapshot
|
||||
//attr.Value = scene.LandManager.landList.Count.ToString();
|
||||
//docElement.Attributes.Append(attr);
|
||||
|
||||
|
||||
XmlNode infoblock = basedoc.CreateNode(XmlNodeType.Element, "info", "");
|
||||
|
||||
XmlNode infopiece = basedoc.CreateNode(XmlNodeType.Element, "uuid", "");
|
||||
|
||||
@@ -2942,7 +2942,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
if(obj is OTOpndBinOp)
|
||||
sb.Append(')');
|
||||
sb.Append('.');
|
||||
sb.Append(field.Name);
|
||||
sb.Append(this.field.Name);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
@@ -3548,9 +3548,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
{
|
||||
get
|
||||
{
|
||||
if(field.DeclaringType == typeof(ScriptBaseClass))
|
||||
return field.Name;
|
||||
return field.DeclaringType.Name + "." + field.Name;
|
||||
if(this.field.DeclaringType == typeof(ScriptBaseClass))
|
||||
return this.field.Name;
|
||||
return this.field.DeclaringType.Name + "." + this.field.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,9 +450,11 @@ namespace OpenSim.Services.LLLoginService
|
||||
//
|
||||
// Authenticate this user
|
||||
//
|
||||
if (!passwd.StartsWith("$1$"))
|
||||
passwd = "$1$" + Util.Md5Hash(passwd);
|
||||
passwd = passwd.Remove(0, 3); //remove $1$
|
||||
if (passwd.StartsWith("$1$"))
|
||||
passwd = passwd[3..];
|
||||
else
|
||||
passwd = Util.Md5Hash(passwd);
|
||||
|
||||
string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out UUID realID);
|
||||
UUID secureSession = UUID.Zero;
|
||||
if (string.IsNullOrWhiteSpace(token) || !UUID.TryParse(token, out secureSession))
|
||||
|
||||
Reference in New Issue
Block a user