mirror of
https://github.com/opensim/opensim.git
synced 2026-05-13 01:46:07 +08:00
cosmetics
This commit is contained in:
@@ -290,10 +290,6 @@ namespace osWebRtcVoice
|
||||
{
|
||||
get
|
||||
{
|
||||
// The JSON response gives a long number (not a string)
|
||||
// and the ODMap conversion interprets it as a long (OSDLong).
|
||||
// If one just does a "ToString()" on the OSD object, you
|
||||
// get an interpretation of the binary value.
|
||||
return dataSection.TryGetValue("id", out OSD oid) ? oid.AsLong().ToString() : string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace osWebRtcVoice
|
||||
public string PluginId { get; private set; }
|
||||
public string PluginUri { get ; private set ; }
|
||||
|
||||
public bool IsConnected => !String.IsNullOrEmpty(PluginId);
|
||||
public bool IsConnected => !string.IsNullOrEmpty(PluginId);
|
||||
|
||||
// Wrapper around the session connection to Janus-gateway
|
||||
public JanusPlugin(JanusSession pSession, string pPluginName)
|
||||
|
||||
@@ -260,6 +260,8 @@ namespace osWebRtcVoice
|
||||
// IWebRtcVoiceService.ProvisionVoiceAccountRequest
|
||||
public OSDMap ProvisionVoiceAccountRequest(IVoiceViewerSession pSession, OSDMap pRequest, UUID pUserID, UUID pSceneID)
|
||||
{
|
||||
// the bad refers to use of .Result
|
||||
// that should not be used and may deadlock, due to poor ms design of all this specially async/await crap
|
||||
return ProvisionVoiceAccountRequestBAD(pSession, pRequest, pUserID, pSceneID).Result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2761,32 +2761,22 @@ namespace OpenSim.Framework
|
||||
|
||||
public static byte ConvertMaturityToAccessLevel(uint maturity)
|
||||
{
|
||||
byte retVal = 0;
|
||||
switch (maturity)
|
||||
return maturity switch
|
||||
{
|
||||
case 0: //PG
|
||||
retVal = 13;
|
||||
break;
|
||||
case 1: //Mature
|
||||
retVal = 21;
|
||||
break;
|
||||
case 2: // Adult
|
||||
retVal = 42;
|
||||
break;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
||||
//0 => 13, //PG
|
||||
1 => 21, //Mature
|
||||
2 => 42, // Adult
|
||||
_ => 13 // PG
|
||||
};
|
||||
}
|
||||
|
||||
public static uint ConvertAccessLevelToMaturity(byte maturity)
|
||||
{
|
||||
if (maturity <= 13)
|
||||
return 0;
|
||||
else if (maturity <= 21)
|
||||
if (maturity <= 21)
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
return 2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -571,8 +571,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (k.Rotation.HasValue)
|
||||
{
|
||||
if (direction == -1)
|
||||
k.Rotation = Quaternion.Conjugate((Quaternion)k.Rotation);
|
||||
k.Rotation = rot * k.Rotation;
|
||||
k.Rotation = Quaternion.Conjugate(k.Rotation.Value);
|
||||
k.Rotation = rot * k.Rotation.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3105,9 +3105,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
*/
|
||||
UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user);
|
||||
if (uac is null)
|
||||
return 0;
|
||||
return uac.UserFlags;
|
||||
return uac is null ? 0 : uac.UserFlags;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
|
||||
using OpenSim.Framework;
|
||||
@@ -92,7 +93,7 @@ namespace OpenSim.Services.Interfaces
|
||||
public int UserFlags;
|
||||
public string UserTitle;
|
||||
public string UserCountry;
|
||||
public Boolean LocalToGrid = true;
|
||||
public bool LocalToGrid = true;
|
||||
|
||||
public Dictionary<string, object> ServiceURLs;
|
||||
|
||||
@@ -105,40 +106,39 @@ namespace OpenSim.Services.Interfaces
|
||||
|
||||
public UserAccount(Dictionary<string, object> kvp)
|
||||
{
|
||||
if (kvp.ContainsKey("FirstName"))
|
||||
FirstName = kvp["FirstName"].ToString();
|
||||
if (kvp.ContainsKey("LastName"))
|
||||
LastName = kvp["LastName"].ToString();
|
||||
if (kvp.ContainsKey("Email"))
|
||||
Email = kvp["Email"].ToString();
|
||||
if (kvp.ContainsKey("PrincipalID"))
|
||||
UUID.TryParse(kvp["PrincipalID"].ToString(), out PrincipalID);
|
||||
if (kvp.ContainsKey("ScopeID"))
|
||||
UUID.TryParse(kvp["ScopeID"].ToString(), out ScopeID);
|
||||
if (kvp.ContainsKey("UserLevel"))
|
||||
UserLevel = Convert.ToInt32(kvp["UserLevel"].ToString());
|
||||
if (kvp.ContainsKey("UserFlags"))
|
||||
UserFlags = Convert.ToInt32(kvp["UserFlags"].ToString());
|
||||
if (kvp.ContainsKey("UserTitle"))
|
||||
UserTitle = kvp["UserTitle"].ToString();
|
||||
if (kvp.ContainsKey("UserCountry"))
|
||||
UserCountry = kvp["UserCountry"].ToString();
|
||||
if (kvp.ContainsKey("LocalToGrid"))
|
||||
Boolean.TryParse(kvp["LocalToGrid"].ToString(), out LocalToGrid);
|
||||
object otmp;
|
||||
if (kvp.TryGetValue("FirstName", out otmp))
|
||||
FirstName = otmp.ToString();
|
||||
if (kvp.TryGetValue("LastName", out otmp))
|
||||
LastName = otmp.ToString();
|
||||
if (kvp.TryGetValue("Email", out otmp))
|
||||
Email = otmp.ToString();
|
||||
if (kvp.TryGetValue("PrincipalID", out otmp))
|
||||
_ = UUID.TryParse(otmp.ToString(), out PrincipalID);
|
||||
if (kvp.TryGetValue("ScopeID", out otmp))
|
||||
UUID.TryParse(otmp.ToString(), out ScopeID);
|
||||
if (kvp.TryGetValue("UserLevel", out otmp))
|
||||
UserLevel = Convert.ToInt32(otmp.ToString());
|
||||
if (kvp.TryGetValue("UserFlags", out otmp))
|
||||
UserFlags = Convert.ToInt32(otmp.ToString());
|
||||
if (kvp.TryGetValue("UserTitle", out otmp))
|
||||
UserTitle = otmp.ToString();
|
||||
if (kvp.TryGetValue("UserCountry", out otmp))
|
||||
UserCountry = otmp.ToString();
|
||||
if (kvp.TryGetValue("LocalToGrid", out otmp))
|
||||
_ = bool.TryParse(otmp.ToString(), out LocalToGrid);
|
||||
|
||||
if (kvp.ContainsKey("Created"))
|
||||
Created = Convert.ToInt32(kvp["Created"].ToString());
|
||||
if (kvp.ContainsKey("ServiceURLs") && kvp["ServiceURLs"] != null)
|
||||
if (kvp.TryGetValue("Created", out otmp))
|
||||
Created = Convert.ToInt32(otmp.ToString());
|
||||
if (kvp.TryGetValue("ServiceURLs", out otmp) && otmp is string str)
|
||||
{
|
||||
ServiceURLs = new Dictionary<string, object>();
|
||||
string str = kvp["ServiceURLs"].ToString();
|
||||
if (str != string.Empty)
|
||||
if (str.Length > 0)
|
||||
{
|
||||
string[] parts = str.Split(new char[] { ';' });
|
||||
// Dictionary<string, object> dic = new Dictionary<string, object>();
|
||||
string[] parts = str.Split(';');
|
||||
foreach (string s in parts)
|
||||
{
|
||||
string[] parts2 = s.Split(new char[] { '*' });
|
||||
string[] parts2 = s.Split('*');
|
||||
if (parts2.Length == 2)
|
||||
ServiceURLs[parts2[0]] = parts2[1];
|
||||
}
|
||||
@@ -148,25 +148,35 @@ namespace OpenSim.Services.Interfaces
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs()
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
result["FirstName"] = FirstName;
|
||||
result["LastName"] = LastName;
|
||||
result["Email"] = Email;
|
||||
result["PrincipalID"] = PrincipalID.ToString();
|
||||
result["ScopeID"] = ScopeID.ToString();
|
||||
result["Created"] = Created.ToString();
|
||||
result["UserLevel"] = UserLevel.ToString();
|
||||
result["UserFlags"] = UserFlags.ToString();
|
||||
result["UserTitle"] = UserTitle;
|
||||
result["UserCountry"] = UserCountry;
|
||||
result["LocalToGrid"] = LocalToGrid.ToString();
|
||||
|
||||
string str = string.Empty;
|
||||
foreach (KeyValuePair<string, object> kvp in ServiceURLs)
|
||||
Dictionary<string, object> result = new()
|
||||
{
|
||||
str += kvp.Key + "*" + (kvp.Value == null ? "" : kvp.Value) + ";";
|
||||
["FirstName"] = FirstName,
|
||||
["LastName"] = LastName,
|
||||
["Email"] = Email,
|
||||
["PrincipalID"] = PrincipalID.ToString(),
|
||||
["ScopeID"] = ScopeID.ToString(),
|
||||
["Created"] = Created.ToString(),
|
||||
["UserLevel"] = UserLevel.ToString(),
|
||||
["UserFlags"] = UserFlags.ToString(),
|
||||
["UserTitle"] = UserTitle,
|
||||
["UserCountry"] = UserCountry,
|
||||
["LocalToGrid"] = LocalToGrid.ToString()
|
||||
};
|
||||
|
||||
if(ServiceURLs.Count == 0)
|
||||
result["ServiceURLs"] = string.Empty;
|
||||
else
|
||||
{
|
||||
StringBuilder sb = osStringBuilderCache.Acquire();
|
||||
foreach (KeyValuePair<string, object> kvp in ServiceURLs)
|
||||
{
|
||||
sb.Append(kvp.Key);
|
||||
sb.Append('*');
|
||||
sb.Append(kvp.Value ?? "");
|
||||
sb.Append(';');
|
||||
}
|
||||
result["ServiceURLs"] = osStringBuilderCache.GetStringAndRelease(sb);
|
||||
}
|
||||
result["ServiceURLs"] = str;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace OpenSim.Services.LLLoginService
|
||||
+ ","
|
||||
+ "r" + userProfile.homelookat.Z.ToString()
|
||||
+ "]}";
|
||||
lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
|
||||
lookAt = "[r1,r0,r0]";
|
||||
RegionX = (uint) 255232;
|
||||
RegionY = (uint) 254976;
|
||||
|
||||
|
||||
@@ -1050,30 +1050,31 @@ namespace OpenSim.Services.LLLoginService
|
||||
// Old style: get the service keys from the DB
|
||||
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
|
||||
{
|
||||
if (kvp.Value is not null)
|
||||
if (kvp.Value is string svalue)
|
||||
{
|
||||
aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
|
||||
|
||||
if (!aCircuit.ServiceURLs[kvp.Key].ToString().EndsWith("/"))
|
||||
aCircuit.ServiceURLs[kvp.Key] = aCircuit.ServiceURLs[kvp.Key] + "/";
|
||||
if (svalue.EndsWith('/'))
|
||||
aCircuit.ServiceURLs[kvp.Key] = kvp.Value;
|
||||
else
|
||||
aCircuit.ServiceURLs[kvp.Key] = svalue + '/';
|
||||
}
|
||||
}
|
||||
|
||||
// New style: service keys start with SRV_; override the previous
|
||||
// New style: service keys start with SRV_; override the previous
|
||||
string[] keys = m_LoginServerConfig.GetKeys();
|
||||
|
||||
if (keys.Length > 0)
|
||||
{
|
||||
bool newUrls = false;
|
||||
IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_"));
|
||||
foreach (string serviceKey in serviceKeys)
|
||||
foreach (string serviceKey in keys)
|
||||
{
|
||||
string keyName = serviceKey.Replace("SRV_", "");
|
||||
if(!serviceKey.StartsWith("SRV_"))
|
||||
continue;
|
||||
string keyName = serviceKey[4..];
|
||||
string keyValue = m_LoginServerConfig.GetString(serviceKey, string.Empty);
|
||||
if (!keyValue.EndsWith("/"))
|
||||
keyValue += "/";
|
||||
if (!keyValue.EndsWith('/'))
|
||||
keyValue += '/';
|
||||
|
||||
if (!account.ServiceURLs.ContainsKey(keyName) || (account.ServiceURLs.ContainsKey(keyName) && (string)account.ServiceURLs[keyName] != keyValue))
|
||||
if (!account.ServiceURLs.TryGetValue(keyName, out object oserv) || !keyValue.Equals((string)oserv))
|
||||
{
|
||||
account.ServiceURLs[keyName] = keyValue;
|
||||
newUrls = true;
|
||||
@@ -1083,9 +1084,9 @@ namespace OpenSim.Services.LLLoginService
|
||||
// m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]);
|
||||
}
|
||||
|
||||
if (!account.ServiceURLs.ContainsKey("GatekeeperURI") && !string.IsNullOrEmpty(m_GatekeeperURL))
|
||||
if (!string.IsNullOrEmpty(m_GatekeeperURL) && (!account.ServiceURLs.TryGetValue("GatekeeperURI", out object ogate) || !m_GatekeeperURL.Equals((string)ogate)))
|
||||
{
|
||||
m_log.DebugFormat("[LLLOGIN SERVICE]: adding gatekeeper uri {0}", m_GatekeeperURL);
|
||||
m_log.Debug($"[LLLOGIN SERVICE]: adding gatekeeper uri {m_GatekeeperURL}");
|
||||
account.ServiceURLs["GatekeeperURI"] = m_GatekeeperURL;
|
||||
newUrls = true;
|
||||
}
|
||||
@@ -1095,7 +1096,6 @@ namespace OpenSim.Services.LLLoginService
|
||||
if (newUrls)
|
||||
m_UserAccountService.StoreUserAccount(account);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, TeleportFlags flags, out string reason)
|
||||
|
||||
Reference in New Issue
Block a user