Mantis #8000, don't charge for updating classifieds. Thanks, Cinder!
Signed-off-by: Melanie Thielker <melanie@t-data.com>LSLKeyTest
parent
82244cca68
commit
0517e3d439
|
@ -31,6 +31,7 @@ using System.Text;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
|
@ -458,36 +459,43 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
int queryclassifiedPrice, IClientAPI remoteClient)
|
||||
{
|
||||
Scene s = (Scene)remoteClient.Scene;
|
||||
IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
|
||||
|
||||
if (money != null)
|
||||
{
|
||||
if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false);
|
||||
return;
|
||||
}
|
||||
money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
|
||||
}
|
||||
|
||||
UserClassifiedAdd ad = new UserClassifiedAdd();
|
||||
|
||||
Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
|
||||
ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||
ScenePresence p = FindPresence(remoteClient.AgentId);
|
||||
UUID creatorId = remoteClient.AgentId;
|
||||
ScenePresence p = FindPresence(creatorId);
|
||||
|
||||
string serverURI = string.Empty;
|
||||
GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
|
||||
|
||||
if (land == null)
|
||||
OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}};
|
||||
OSD Params = (OSD)parameters;
|
||||
if (!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
|
||||
{
|
||||
ad.ParcelName = string.Empty;
|
||||
remoteClient.SendAgentAlertMessage("Error fetching classifieds", false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
parameters = (OSDMap)Params;
|
||||
OSDArray list = (OSDArray)parameters["result"];
|
||||
bool exists = list.Cast<OSDMap>().Where(map => map.ContainsKey("classifieduuid"))
|
||||
.Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID));
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
ad.ParcelName = land.LandData.Name;
|
||||
IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
|
||||
if (money != null)
|
||||
{
|
||||
if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage("You do not have enough money to create this classified.", false);
|
||||
return;
|
||||
}
|
||||
money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
|
||||
}
|
||||
}
|
||||
|
||||
UserClassifiedAdd ad = new UserClassifiedAdd();
|
||||
|
||||
ad.ParcelName = land == null ? string.Empty : land.LandData.Name;
|
||||
ad.CreatorId = remoteClient.AgentId;
|
||||
ad.ClassifiedId = queryclassifiedID;
|
||||
ad.Category = Convert.ToInt32(queryCategory);
|
||||
|
@ -507,9 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
|||
|
||||
if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"Error updating classified", false);
|
||||
return;
|
||||
remoteClient.SendAgentAlertMessage("Error updating classified", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue