From 4a18444e6e2965260f02b1fcadf25ce390d3e2bb Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Fri, 6 Jan 2017 21:10:09 -0500 Subject: [PATCH] Allow avatar to be charged group membership fees when a money module is in use --- OpenSim/Addons/Groups/GroupsModule.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index d3085f6863..0e3a1729b5 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs @@ -979,10 +979,28 @@ namespace OpenSim.Groups { if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + GroupRecord groupRecord = GetGroupRecord(groupID); + IMoneyModule money = remoteClient.Scene.RequestModuleInterface(); + + // Should check to see if there's an outstanding invitation + + if (money != null && groupRecord.MembershipFee > 0) + { + // Does the agent have the funds to cover the group join fee? + if (!money.AmountCovered(remoteClient.AgentId, groupRecord.MembershipFee)) + { + remoteClient.SendAlertMessage("Insufficient funds to join the group."); + remoteClient.SendJoinGroupReply(groupID, false); + return; + } + } + string reason = string.Empty; - // Should check to see if OpenEnrollment, or if there's an outstanding invitation + if (m_groupData.AddAgentToGroup(GetRequestingAgentIDStr(remoteClient), GetRequestingAgentIDStr(remoteClient), groupID, UUID.Zero, string.Empty, out reason)) { + if (money != null && groupRecord.MembershipFee > 0) + money.ApplyCharge(remoteClient.AgentId, groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName); remoteClient.SendJoinGroupReply(groupID, true);