also do it grid side, like original commit, so older regions get the fix

This commit is contained in:
UbitUmarov
2021-01-30 02:01:57 +00:00
parent 6bdaef4e04
commit 2266483ce7

View File

@@ -93,7 +93,8 @@ namespace OpenSim.Server.Handlers
public bool ClassifiedUpdate(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if(!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "Error parsing classified update request";
@@ -103,9 +104,15 @@ namespace OpenSim.Server.Handlers
string result = string.Empty;
UserClassifiedAdd ad = new UserClassifiedAdd();
object Ad = (object)ad;
OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]);
if(Service.ClassifiedUpdate(ad, ref result))
object Ad = ad;
OSD.DeserializeMembers(ref Ad, (OSDMap)tmpParams);
//If no maturity bits are set, set PG maturity bit. This works
// around a viewer bug. It simplifies the ability to search ads
// based on maturity level. 0x4e is bits 1 (old viewers mature), 2 (pg), 3 (Mature) and 6 (Adult).
if ((ad.Flags & 0x4e) == 0)
ad.Flags |= 0x04;
if (Service.ClassifiedUpdate(ad, ref result))
{
response.Result = OSD.SerializeMembers(ad);
return true;
@@ -138,7 +145,8 @@ namespace OpenSim.Server.Handlers
public bool ClassifiedInfoRequest(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "no parameters supplied";
@@ -149,9 +157,14 @@ namespace OpenSim.Server.Handlers
string result = string.Empty;
UserClassifiedAdd ad = new UserClassifiedAdd();
object Ad = (object)ad;
OSD.DeserializeMembers(ref Ad, (OSDMap)json["params"]);
OSD.DeserializeMembers(ref Ad, (OSDMap)tmpParams);
if(Service.ClassifiedInfoRequest(ref ad, ref result))
{
//If no maturity bits are set, set PG maturity bit. This works
// around a viewer bug. It simplifies the ability to search ads
// based on maturity level. 0x4e is bits 1 (old viewers mature), 2 (pg), 3 (Mature) and 6 (Adult).
if ((ad.Flags & 0x4e) == 0)
ad.Flags |= 0x04;
response.Result = OSD.SerializeMembers(ad);
return true;
}
@@ -165,17 +178,17 @@ namespace OpenSim.Server.Handlers
#region Picks
public bool AvatarPicksRequest(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
m_log.DebugFormat ("Avatar Picks Request");
return false;
}
OSDMap request = (OSDMap)json["params"];
OSDMap request = (OSDMap)tmpParams;
UUID creatorId = new UUID(request["creatorId"].AsString());
OSDArray data = (OSDArray) Service.AvatarPicksRequest(creatorId);
response.Result = data;
@@ -184,7 +197,8 @@ namespace OpenSim.Server.Handlers
public bool PickInfoRequest(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "no parameters supplied";
@@ -195,7 +209,7 @@ namespace OpenSim.Server.Handlers
string result = string.Empty;
UserProfilePick pick = new UserProfilePick();
object Pick = (object)pick;
OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]);
OSD.DeserializeMembers(ref Pick, (OSDMap)tmpParams);
if(Service.PickInfoRequest(ref pick, ref result))
{
response.Result = OSD.SerializeMembers(pick);
@@ -209,7 +223,8 @@ namespace OpenSim.Server.Handlers
public bool PicksUpdate(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "no parameters supplied";
@@ -220,7 +235,7 @@ namespace OpenSim.Server.Handlers
string result = string.Empty;
UserProfilePick pick = new UserProfilePick();
object Pick = (object)pick;
OSD.DeserializeMembers(ref Pick, (OSDMap)json["params"]);
OSD.DeserializeMembers(ref Pick, (OSDMap)tmpParams);
if(Service.PicksUpdate(ref pick, ref result))
{
response.Result = OSD.SerializeMembers(pick);
@@ -235,14 +250,15 @@ namespace OpenSim.Server.Handlers
public bool PicksDelete(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
m_log.DebugFormat ("Avatar Picks Delete Request");
return false;
}
OSDMap request = (OSDMap)json["params"];
OSDMap request = tmpParams as OSDMap;
UUID pickId = new UUID(request["pickId"].AsString());
if(Service.PicksDelete(pickId))
return true;
@@ -256,7 +272,8 @@ namespace OpenSim.Server.Handlers
#region Notes
public bool AvatarNotesRequest(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "Params missing";
@@ -266,7 +283,7 @@ namespace OpenSim.Server.Handlers
UserProfileNotes note = new UserProfileNotes();
object Note = (object)note;
OSD.DeserializeMembers(ref Note, (OSDMap)json["params"]);
OSD.DeserializeMembers(ref Note, (OSDMap)tmpParams);
if(Service.AvatarNotesRequest(ref note))
{
response.Result = OSD.SerializeMembers(note);
@@ -280,7 +297,8 @@ namespace OpenSim.Server.Handlers
public bool NotesUpdate(OSDMap json, ref JsonRpcResponse response)
{
if(!json.ContainsKey("params"))
OSD tmpParams;
if (!json.TryGetValue("params", out tmpParams) || !(tmpParams is OSDMap))
{
response.Error.Code = ErrorCode.ParseError;
response.Error.Message = "No parameters";
@@ -291,7 +309,7 @@ namespace OpenSim.Server.Handlers
string result = string.Empty;
UserProfileNotes note = new UserProfileNotes();
object Notes = (object) note;
OSD.DeserializeMembers(ref Notes, (OSDMap)json["params"]);
OSD.DeserializeMembers(ref Notes, (OSDMap)tmpParams);
if(Service.NotesUpdate(ref note, ref result))
{
response.Result = OSD.SerializeMembers(note);