cosmetics

This commit is contained in:
UbitUmarov
2026-03-15 18:22:50 +00:00
parent 0120e62250
commit da5f1b3f7e
18 changed files with 71 additions and 82 deletions

View File

@@ -623,8 +623,7 @@ namespace OpenSim.Groups
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
List<GroupChatListAgentUpdateData> updates = [new GroupChatListAgentUpdateData(AgentID)];
eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates);
}
}
@@ -663,8 +662,7 @@ namespace OpenSim.Groups
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
if (queue != null)
{
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
List<GroupChatListAgentUpdateData> updates = [new GroupChatListAgentUpdateData(AgentID)];
queue.ChatterBoxSessionAgentListUpdates(GroupID, remoteClient.AgentId, updates);
}
}
@@ -673,8 +671,8 @@ namespace OpenSim.Groups
// Send a message from locally connected client to a group
if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
{
UUID GroupID = new UUID(im.imSessionID);
UUID AgentID = new UUID(im.fromAgentID);
UUID GroupID = new(im.imSessionID);
UUID AgentID = new(im.fromAgentID);
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());

View File

@@ -142,20 +142,25 @@ namespace OpenSim.Groups
}
// Create the group
GroupData data = new GroupData();
data.GroupID = UUID.Random();
data.Data = new Dictionary<string, string>();
data.Data["Name"] = name;
data.Data["Charter"] = charter;
data.Data["InsigniaID"] = insigniaID.ToString();
data.Data["FounderID"] = founderID.ToString();
data.Data["MembershipFee"] = membershipFee.ToString();
data.Data["OpenEnrollment"] = openEnrollment ? "1" : "0";
data.Data["ShowInList"] = showInList ? "1" : "0";
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
UUID ownerRoleID = UUID.Random();
data.Data["OwnerRoleID"] = ownerRoleID.ToString();
string founderIDstr = founderID.ToString();
GroupData data = new()
{
GroupID = UUID.Random(),
Data = new Dictionary<string, string>
{
["Name"] = name,
["Charter"] = charter,
["InsigniaID"] = insigniaID.ToString(),
["FounderID"] = founderIDstr,
["MembershipFee"] = membershipFee.ToString(),
["OpenEnrollment"] = openEnrollment ? "1" : "0",
["ShowInList"] = showInList ? "1" : "0",
["AllowPublish"] = allowPublish ? "1" : "0",
["MaturePublish"] = maturePublish ? "1" : "0",
["OwnerRoleID"] = ownerRoleID.ToString()
}
};
if (!m_Database.StoreGroup(data))
return UUID.Zero;
@@ -171,8 +176,8 @@ namespace OpenSim.Groups
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, ownerRoleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
// Add founder to group
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, ownerRoleID);
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, officersRoleID);
_AddAgentToGroup(RequestingAgentID, founderIDstr, data.GroupID, ownerRoleID);
_AddAgentToGroup(RequestingAgentID, founderIDstr, data.GroupID, officersRoleID);
return data.GroupID;
}
@@ -186,7 +191,7 @@ namespace OpenSim.Groups
// Check perms
if (!HasPower(RequestingAgentID, groupID, GroupPowers.ChangeActions))
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at updating group {1} denied because of lack of permission", RequestingAgentID, groupID);
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at updating group {groupID} denied because of lack of permission");
return;
}
@@ -219,7 +224,7 @@ namespace OpenSim.Groups
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
{
List<DirGroupsReplyData> groups = new List<DirGroupsReplyData>();
List<DirGroupsReplyData> groups = [];
GroupData[] data = m_Database.RetrieveGroups(search);
@@ -228,7 +233,7 @@ namespace OpenSim.Groups
foreach (GroupData d in data)
{
// Don't list group proxies
if (d.Data.ContainsKey("Location") && d.Data["Location"] != string.Empty)
if (d.Data.TryGetValue("Location", out string loc) && loc != string.Empty)
continue;
int nmembers = m_Database.MemberCount(d.GroupID);
@@ -257,7 +262,7 @@ namespace OpenSim.Groups
public List<ExtendedGroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
{
List<ExtendedGroupMembersData> members = new List<ExtendedGroupMembersData>();
List<ExtendedGroupMembersData> members = [];
GroupData group = m_Database.RetrieveGroup(GroupID);
if (group == null)

View File

@@ -155,7 +155,7 @@ namespace osWebRtcVoice
// getHashCode() is not deterministic across sessions.
public static int CalcRoomNumber(string pRegionId, string pChannelType, int pParcelLocalID, string pChannelID)
{
var hasher = new BHasherMdjb2();
BHasherMdjb2 hasher = new();
// If there is a channel specified it must be group
switch (pChannelType)
{
@@ -174,7 +174,7 @@ namespace osWebRtcVoice
default:
throw new Exception("Unknown channel type: " + pChannelType);
}
var hashed = hasher.Finish();
BHash hashed = hasher.Finish();
// The "Abs()" is because Janus room number must be a positive integer
// And note that this is the BHash.GetHashCode() and not Object.getHashCode().
int roomNumber = Math.Abs(hashed.GetHashCode());

View File

@@ -193,7 +193,7 @@ namespace osWebRtcVoice
public static JanusMessageResp FromJson(string pJson)
{
var newBody = OSDParser.DeserializeJson(pJson) as OSDMap;
OSDMap newBody = OSDParser.DeserializeJson(pJson) as OSDMap;
return new JanusMessageResp(newBody);
}

View File

@@ -105,7 +105,7 @@ namespace osWebRtcVoice
JanusMessageResp resp = await SendToJanus(new CreateSessionReq());
if (resp is not null && resp.isSuccess)
{
var sessionResp = new CreateSessionResp(resp);
CreateSessionResp sessionResp = new(resp);
SessionId = sessionResp.returnedId;
IsConnected = true;
SessionUri = _JanusServerURI + "/" + SessionId;
@@ -702,7 +702,7 @@ namespace osWebRtcVoice
break;
case "GETERROR":
// Special error response from the GET
var errorResp = new ErrorResp(resp);
ErrorResp errorResp = new(resp);
switch (errorResp.errorCode)
{
case 404:

View File

@@ -720,7 +720,7 @@ namespace osWebRtcVoice
roomid, room["description"], room["num_participants"],
room["sampling_rate"], room["spatial_audio"], room["record"]);
var participantResp = ab.SendAudioBridgeMsg(new AudioBridgeListParticipantsReq(roomid)).Result;
AudioBridgeResp participantResp = ab.SendAudioBridgeMsg(new AudioBridgeListParticipantsReq(roomid)).Result;
if (participantResp is not null && participantResp.AudioBridgeReturnCode == "participants")
{

View File

@@ -82,7 +82,7 @@ namespace osWebRtcVoice
{
lock (ViewerSessions)
{
var sessions = ViewerSessions.Where(v => v.Value.VoiceServiceSessionId == pVSSessionId);
IEnumerable<KeyValuePair<string,IVoiceViewerSession>> sessions = ViewerSessions.Where(v => v.Value.VoiceServiceSessionId == pVSSessionId);
if (sessions.Count() > 0)
{
pViewerSession = sessions.First().Value;

View File

@@ -101,7 +101,7 @@ namespace osWebRtcVoice
{ "userID", pUserID.ToString() },
{ "scene", pSceneID.ToString() }
};
var resp = JsonRpcRequest("provision_voice_account_request", m_serverURI, req);
OSDMap resp = JsonRpcRequest("provision_voice_account_request", m_serverURI, req);
// Kludge to sync the viewer session number in our IVoiceViewerSession with the one from the WebRTC service.
if (resp.TryGetString("viewer_session", out string otherViewerSessionId))