aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/UserProfiles
diff options
context:
space:
mode:
authorMelanie Thielker2016-08-20 22:44:00 +0100
committerMelanie Thielker2016-08-20 22:44:32 +0100
commit0517e3d439e6888a739de90286267ee2f946c8df (patch)
tree60d96c30abc3943d3dfdf93a821c5c5bdbe14f02 /OpenSim/Region/CoreModules/Avatar/UserProfiles
parentAllow creation of user appearance from a model avatar. Thank you, (diff)
downloadopensim-SC-0517e3d439e6888a739de90286267ee2f946c8df.zip
opensim-SC-0517e3d439e6888a739de90286267ee2f946c8df.tar.gz
opensim-SC-0517e3d439e6888a739de90286267ee2f946c8df.tar.bz2
opensim-SC-0517e3d439e6888a739de90286267ee2f946c8df.tar.xz
Mantis #8000, don't charge for updating classifieds. Thanks, Cinder!
Signed-off-by: Melanie Thielker <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/UserProfiles')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs52
1 files changed, 29 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 145f3db..61835f9 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -31,6 +31,7 @@ using System.Text;
31using System.Collections; 31using System.Collections;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Globalization; 33using System.Globalization;
34using System.Linq;
34using System.Net; 35using System.Net;
35using System.Net.Sockets; 36using System.Net.Sockets;
36using System.Reflection; 37using System.Reflection;
@@ -458,36 +459,43 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
458 int queryclassifiedPrice, IClientAPI remoteClient) 459 int queryclassifiedPrice, IClientAPI remoteClient)
459 { 460 {
460 Scene s = (Scene)remoteClient.Scene; 461 Scene s = (Scene)remoteClient.Scene;
461 IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
462
463 if (money != null)
464 {
465 if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
466 {
467 remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false);
468 return;
469 }
470 money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
471 }
472
473 UserClassifiedAdd ad = new UserClassifiedAdd();
474
475 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; 462 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
476 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); 463 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
477 ScenePresence p = FindPresence(remoteClient.AgentId); 464 UUID creatorId = remoteClient.AgentId;
478 465 ScenePresence p = FindPresence(creatorId);
466
479 string serverURI = string.Empty; 467 string serverURI = string.Empty;
480 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 468 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
481 469
482 if (land == null) 470 OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}};
471 OSD Params = (OSD)parameters;
472 if (!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
483 { 473 {
484 ad.ParcelName = string.Empty; 474 remoteClient.SendAgentAlertMessage("Error fetching classifieds", false);
475 return;
485 } 476 }
486 else 477 parameters = (OSDMap)Params;
478 OSDArray list = (OSDArray)parameters["result"];
479 bool exists = list.Cast<OSDMap>().Where(map => map.ContainsKey("classifieduuid"))
480 .Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID));
481
482 if (!exists)
487 { 483 {
488 ad.ParcelName = land.LandData.Name; 484 IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
485 if (money != null)
486 {
487 if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
488 {
489 remoteClient.SendAgentAlertMessage("You do not have enough money to create this classified.", false);
490 return;
491 }
492 money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
493 }
489 } 494 }
490 495
496 UserClassifiedAdd ad = new UserClassifiedAdd();
497
498 ad.ParcelName = land == null ? string.Empty : land.LandData.Name;
491 ad.CreatorId = remoteClient.AgentId; 499 ad.CreatorId = remoteClient.AgentId;
492 ad.ClassifiedId = queryclassifiedID; 500 ad.ClassifiedId = queryclassifiedID;
493 ad.Category = Convert.ToInt32(queryCategory); 501 ad.Category = Convert.ToInt32(queryCategory);
@@ -507,9 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
507 515
508 if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) 516 if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
509 { 517 {
510 remoteClient.SendAgentAlertMessage( 518 remoteClient.SendAgentAlertMessage("Error updating classified", false);
511 "Error updating classified", false);
512 return;
513 } 519 }
514 } 520 }
515 521