Skip to content

Commit

Permalink
Merge branch 'opensim:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AdilElFarissi authored Jan 2, 2025
2 parents e306a1c + d9e4389 commit 82842f2
Show file tree
Hide file tree
Showing 44 changed files with 1,034 additions and 242 deletions.
23 changes: 17 additions & 6 deletions OpenSim/Addons/Groups/Service/GroupsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,13 +1058,24 @@ ExtendedGroupNoticeData _NoticeDataToData(NoticeData data)
private bool HasPower(string agentID, UUID groupID, GroupPowers power)
{
RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
if (rmembership == null || (rmembership != null && rmembership.Length == 0))
if (rmembership is null || rmembership.Length == 0)
return false;

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 ( (UInt64.Parse(role.Data["Powers"]) & (ulong)power) != 0 )
if (role is null)
{
m_log.Warn($"[GROUPSERVICE] role with id {rdata.RoleID} is null");
continue;
}

if ((UInt64.Parse(role.Data["Powers"]) & (ulong)power) != 0)
return true;
}
return false;
Expand All @@ -1073,14 +1084,14 @@ private bool HasPower(string agentID, UUID groupID, GroupPowers power)
private bool IsOwner(string agentID, UUID groupID)
{
GroupData group = m_Database.RetrieveGroup(groupID);
if (group == null)
if (group is null)
return false;

RoleMembershipData rmembership = m_Database.RetrieveRoleMember(groupID, new UUID(group.Data["OwnerRoleID"]), agentID);
if (rmembership == null)
if(!UUID.TryParse(group.Data["OwnerRoleID"], out UUID ownerRoleID))
return false;

return true;
RoleMembershipData rmembership = m_Database.RetrieveRoleMember(groupID, ownerRoleID, agentID);
return rmembership is not null;
}
#endregion

Expand Down
4 changes: 2 additions & 2 deletions OpenSim/ConsoleClient/ConsoleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ static int Main(string[] args)

Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply);

string pidFile = serverConfig.GetString("PIDFile", String.Empty);

while (m_Server.Running)
{
System.Threading.Thread.Sleep(500);
MainConsole.Instance.Prompt();
}

if (pidFile != String.Empty)
string pidFile = serverConfig.GetString("PIDFile", string.Empty);
if (pidFile.Length > 0)
File.Delete(pidFile);

Environment.Exit(0);
Expand Down
3 changes: 1 addition & 2 deletions OpenSim/Data/MySQL/MySQLAuthenticationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ private void CheckColumnNames(IDataReader result)

public bool Store(AuthenticationData data)
{
if (data.Data.ContainsKey("UUID"))
data.Data.Remove("UUID");
data.Data.Remove("UUID");

string[] fields = new List<string>(data.Data.Keys).ToArray();

Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Data/MySQL/MySQLGroupsData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID)
public RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID)
{
RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), principalID.ToString() });
new string[] { groupID.ToString(), principalID });

return data;
}
Expand Down
13 changes: 11 additions & 2 deletions OpenSim/Data/MySQL/MySQLSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
"PhysicsShapeType, Density, GravityModifier, " +
"Friction, Restitution, Vehicle, PhysInertia, DynAttrs, " +
"RotationAxisLocks, sopanims, sitactrange, pseudocrc, " +
"lnkstBinData" +
"lnkstBinData, StartStr" +
") values (" + "?UUID, " +
"?CreationDate, ?Name, ?Text, " +
"?Description, ?SitName, ?TouchName, " +
Expand Down Expand Up @@ -207,7 +207,7 @@ public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
"?PhysicsShapeType, ?Density, ?GravityModifier, " +
"?Friction, ?Restitution, ?Vehicle, ?PhysInertia, ?DynAttrs, " +
"?RotationAxisLocks, ?sopanims, ?sitactrange, ?pseudocrc, " +
"?lnkstBinData)";
"?lnkstBinData, ?StartStr)";

FillPrimCommand(cmd, prim, obj.UUID, regionUUID);

Expand Down Expand Up @@ -362,6 +362,10 @@ public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
byte[] data = (byte[])reader["lnkstBinData"];
newSog.LinksetData = LinksetData.FromBin(data);
}
if(reader["StartStr"] is not DBNull)
{
newSog.RezStringParameter = (string)reader["StartStr"];
}
}
else
m_log.Warn($"[REGION DB]: duplicated SOG with root prim \"{prim.Name}\" {prim.UUID} in region {regionID}");
Expand Down Expand Up @@ -1623,6 +1627,11 @@ private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneG
cmd.Parameters.AddWithValue("lnkstBinData", prim.ParentGroup.LinksetData.ToBin());
else
cmd.Parameters.AddWithValue("lnkstBinData", null);

if(prim.IsRoot)
cmd.Parameters.AddWithValue("StartStr", prim.ParentGroup.RezStringParameter);
else
cmd.Parameters.AddWithValue("StartStr", null);
}

/// <summary>
Expand Down
5 changes: 5 additions & 0 deletions OpenSim/Data/MySQL/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -567,3 +567,8 @@ ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR2` varchar(36) NOT NULL DEFAU
ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR3` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE `regionsettings` ADD COLUMN `TerrainPBR4` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;

:VERSION 67 #----- add rez start string param column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `StartStr` text default NULL;
COMMIT;
15 changes: 12 additions & 3 deletions OpenSim/Data/PGSQL/PGSQLSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ FROM prims
byte[] data = (byte[])reader["lnkstBinData"];
grp.LinksetData = LinksetData.FromBin(data);
}
if(reader["StartStr"] is not DBNull)
{
grp.RezStringParameter = (string)reader["StartStr"];
}
}
else
{
Expand Down Expand Up @@ -352,7 +356,7 @@ UPDATE prims SET
""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, ""Vehicle"" = :Vehicle,
""PhysInertia"" = :PhysInertia, ""standtargetx"" =:standtargetx, ""standtargety"" =:standtargety, ""standtargetz"" =:standtargetz,
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims, ""lnkstBinData"" = :lnkstBinData
""sitactrange"" =:sitactrange, ""pseudocrc"" = :pseudocrc, ""sopanims"" = :sopanims, ""lnkstBinData"" = :lnkstBinData, ""StartStr"" = :StartStr
WHERE ""UUID"" = :UUID ;
Expand All @@ -368,7 +372,7 @@ INSERT INTO
""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""Vehicle"", ""PhysInertia"",
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"",""sopanims"",""lnkstBinData""
""standtargetx"", ""standtargety"", ""standtargetz"", ""sitactrange"", ""pseudocrc"",""sopanims"",""lnkstBinData"", ""StartStr""
) Select
:UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
:EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
Expand All @@ -380,7 +384,7 @@ INSERT INTO
:ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
:ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
:PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :Vehicle, :PhysInertia,
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims, :lnkstBinData
:standtargetx, :standtargety, :standtargetz,:sitactrange, :pseudocrc, :sopanims, :lnkstBinData, :StartStr
where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
";

Expand Down Expand Up @@ -1883,6 +1887,11 @@ private NpgsqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneG
else
parameters.Add(_Database.CreateParameterNullBytea("lnkstBinData"));

if(prim.IsRoot)
parameters.Add(_Database.CreateParameter("StartStr", prim.ParentGroup.RezStringParameter));
else
parameters.Add(_Database.CreateParameter("StartStr", null));

return parameters.ToArray();
}

Expand Down
5 changes: 5 additions & 0 deletions OpenSim/Data/PGSQL/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -1304,3 +1304,8 @@ CREATE TABLE "regionextra"
PRIMARY KEY ("RegionID", "Name")
);
COMMIT;

:VERSION 58 #----- add rez start string param column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `StartStr` TEXT;
COMMIT;
5 changes: 5 additions & 0 deletions OpenSim/Data/SQLite/Resources/RegionStore.migrations
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,8 @@ ALTER TABLE regionsettings ADD COLUMN TerrainPBR2 char(36) NOT NULL DEFAULT '000
ALTER TABLE regionsettings ADD COLUMN TerrainPBR3 char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE regionsettings ADD COLUMN TerrainPBR4 char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;

:VERSION 43 #----- add rez start string param column
BEGIN;
ALTER TABLE `prims` ADD COLUMN `StartStr` TEXT;
COMMIT;
11 changes: 10 additions & 1 deletion OpenSim/Data/SQLite/SQLiteSimulationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,10 @@ public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
byte[] data = (byte[])primRow["lnkstBinData"];
group.LinksetData = LinksetData.FromBin(data);
}

if(primRow["StartStr"] is not DBNull)
{
group.RezStringParameter = (string)primRow["StartStr"];
}
createdObjects.Add(group.UUID, group);
retvals.Add(group);
LoadItems(prim);
Expand Down Expand Up @@ -1251,6 +1254,7 @@ private static DataTable createPrimTable()
createCol(prims, "sopanims", typeof(byte[]));

createCol(prims, "lnkstBinData", typeof(byte[]));
createCol(prims, "StartStr", typeof(string));

// Add in contraints
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
Expand Down Expand Up @@ -2217,6 +2221,11 @@ private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGro
row["lnkstBinData"] = prim.ParentGroup.LinksetData.ToBin();
else
row["lnkstBinData"] = null;

if (prim.IsRoot)
row["StartStr"] = prim.ParentGroup.RezStringParameter;
else
row["StartStr"] = null;
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public void AddWebSocketHandler(string servicepath, WebSocketRequestDelegate han

public void RemoveWebSocketHandler(string servicepath)
{
m_WebSocketHandlers.TryRemove(servicepath, out WebSocketRequestDelegate dummy);
m_WebSocketHandlers.TryRemove(servicepath, out _);
}

public List<string> GetStreamHandlerKeys()
Expand Down Expand Up @@ -526,7 +526,7 @@ public void AddIndexPHPMethodHandler(string key, SimpleStreamMethod sh)

public void RemoveIndexPHPMethodHandler(string key)
{
m_indexPHPmethods.TryRemove(key, out SimpleStreamMethod sh);
m_indexPHPmethods.TryRemove(key, out _);
}

public SimpleStreamMethod TryGetIndexPHPMethodHandler(string key)
Expand All @@ -543,7 +543,7 @@ public void AddGloblaMethodHandler(string key, SimpleStreamMethod sh)

public void RemoveGlobalPMethodHandler(string key)
{
m_globalMethods.TryRemove(key, out SimpleStreamMethod sh);
m_globalMethods.TryRemove(key, out _);
}

public bool TryGetGlobalMethodHandler(string key, out SimpleStreamMethod sh)
Expand Down Expand Up @@ -2299,7 +2299,7 @@ protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpRespon
}
if (httpRequest.QueryFlags.Contains("about"))
{
httpResponse.Redirect("http://opensimulator.org/wiki/0.9.3.0_Release");
httpResponse.Redirect("http://opensimulator.org/wiki/0.9.3.1_Release");
return;
}
if (!httpRequest.QueryAsDictionary.TryGetValue("method", out string method) || string.IsNullOrWhiteSpace(method))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ private void OnRequestReceived(object sender, RequestEventArgs e)

private void OnFreeContext(object sender, DisconnectedEventArgs e)
{
var imp = sender as HttpClientContext;
if (imp == null || imp.contextID < 0)
return;

m_activeContexts.TryRemove(imp.contextID, out HttpClientContext dummy);
imp.Close();
if (sender is HttpClientContext imp && imp.contextID >= 0)
{
m_activeContexts.TryRemove(imp.contextID, out _);
imp.Close();
}
}


Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Framework/Servers/ServerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected void CreatePIDFile(string path)

try
{
string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
string pidstring = Environment.ProcessId.ToString();

using (FileStream fs = File.Create(path))
{
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Framework/TaskInventoryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void ResetIDs(UUID partID)
public TaskInventoryItem()
{
ScriptRunning = true;
CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
CreationDate = (uint)Util.UnixTimeSinceEpoch();
}
}
}
4 changes: 2 additions & 2 deletions OpenSim/Framework/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace OpenSim
{
public class VersionInfo
{
public const string VersionNumber = "0.9.3.0";
public const string AssemblyVersionNumber = "0.9.3.0";
public const string VersionNumber = "0.9.3.1";
public const string AssemblyVersionNumber = "0.9.3.1";

public const Flavour VERSION_FLAVOUR = Flavour.Dev;

Expand Down
Loading

0 comments on commit 82842f2

Please sign in to comment.