diff options
author | Kevin Cozens | 2016-08-18 15:01:35 -0400 |
---|---|---|
committer | Kevin Cozens | 2016-08-18 15:38:39 -0400 |
commit | 1b2e240bf8ba087827e05229554958eec3f7c9e7 (patch) | |
tree | 95f98794d0f6cc7d73520fd29bdf35a6b3e8f706 /OpenSim/Region/OptionalModules | |
parent | Fixed grammer in a comment (diff) | |
download | opensim-SC_OLD-1b2e240bf8ba087827e05229554958eec3f7c9e7.zip opensim-SC_OLD-1b2e240bf8ba087827e05229554958eec3f7c9e7.tar.gz opensim-SC_OLD-1b2e240bf8ba087827e05229554958eec3f7c9e7.tar.bz2 opensim-SC_OLD-1b2e240bf8ba087827e05229554958eec3f7c9e7.tar.xz |
Collect any group join fees. Pass group name when applying join/create fees.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 7663a39..626937c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -862,7 +862,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
862 | { | 862 | { |
863 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 863 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
864 | 864 | ||
865 | if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null) | 865 | GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name); |
866 | |||
867 | if (groupRecord != null) | ||
866 | { | 868 | { |
867 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); | 869 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); |
868 | return UUID.Zero; | 870 | return UUID.Zero; |
@@ -877,7 +879,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
877 | { | 879 | { |
878 | if (avatar.UserLevel < m_levelGroupCreate) | 880 | if (avatar.UserLevel < m_levelGroupCreate) |
879 | { | 881 | { |
880 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); | 882 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group."); |
881 | return UUID.Zero; | 883 | return UUID.Zero; |
882 | } | 884 | } |
883 | } | 885 | } |
@@ -885,14 +887,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
885 | // check funds | 887 | // check funds |
886 | // is there a money module present ? | 888 | // is there a money module present ? |
887 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); | 889 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); |
888 | if (money != null) | 890 | if (money != null && money.GroupCreationCharge > 0) |
889 | { | 891 | { |
890 | // do the transaction, that is if the agent has got sufficient funds | 892 | // do the transaction, that is if the agent has sufficient funds |
891 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { | 893 | if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { |
892 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); | 894 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to create a group."); |
893 | return UUID.Zero; | 895 | return UUID.Zero; |
894 | } | 896 | } |
895 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate); | 897 | money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name); |
896 | } | 898 | } |
897 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); | 899 | UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); |
898 | 900 | ||
@@ -1092,6 +1094,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1092 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation | 1094 | // Should check to see if OpenEnrollment, or if there's an outstanding invitation |
1093 | m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); | 1095 | m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); |
1094 | 1096 | ||
1097 | // check funds | ||
1098 | // is there a money module present ? | ||
1099 | GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null); | ||
1100 | IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>(); | ||
1101 | if (money != null && groupRecord.MembershipFee > 0) | ||
1102 | { | ||
1103 | // do the transaction, that is if the agent has sufficient funds | ||
1104 | if (!money.AmountCovered(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee)) { | ||
1105 | remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to join the group."); | ||
1106 | return; | ||
1107 | } | ||
1108 | money.ApplyCharge(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName); | ||
1109 | } | ||
1110 | |||
1095 | remoteClient.SendJoinGroupReply(groupID, true); | 1111 | remoteClient.SendJoinGroupReply(groupID, true); |
1096 | 1112 | ||
1097 | SendAgentGroupDataUpdate(remoteClient, true); | 1113 | SendAgentGroupDataUpdate(remoteClient, true); |