diff options
author | UbitUmarov | 2016-08-19 00:16:59 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-19 00:16:59 +0100 |
commit | 861fa8a4082105105316f2eec610205a92b31e33 (patch) | |
tree | a7066f33ada55f5e7ca85ffaef3ac78ddc9f97ec | |
parent | missed another UserAccounts cache, add a few locks (diff) | |
parent | Collect any group join fees. Pass group name when applying join/create fees. (diff) | |
download | opensim-SC_OLD-861fa8a4082105105316f2eec610205a92b31e33.zip opensim-SC_OLD-861fa8a4082105105316f2eec610205a92b31e33.tar.gz opensim-SC_OLD-861fa8a4082105105316f2eec610205a92b31e33.tar.bz2 opensim-SC_OLD-861fa8a4082105105316f2eec610205a92b31e33.tar.xz |
Merge branch 'master' of opensimulator.org:/var/git/opensim
-rw-r--r-- | OpenSim/Addons/Groups/GroupsModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 30 |
2 files changed, 24 insertions, 8 deletions
diff --git a/OpenSim/Addons/Groups/GroupsModule.cs b/OpenSim/Addons/Groups/GroupsModule.cs index 3144ed0..57fbbf7 100644 --- a/OpenSim/Addons/Groups/GroupsModule.cs +++ b/OpenSim/Addons/Groups/GroupsModule.cs | |||
@@ -764,7 +764,7 @@ namespace OpenSim.Groups | |||
764 | } | 764 | } |
765 | 765 | ||
766 | // check funds | 766 | // check funds |
767 | // is there is a money module present ? | 767 | // is there a money module present ? |
768 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); | 768 | IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); |
769 | if (money != null) | 769 | if (money != null) |
770 | { | 770 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index ef9bcb1..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,22 +879,22 @@ 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 | } |
884 | 886 | ||
885 | // check funds | 887 | // check funds |
886 | // is there is 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); |