aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs8
2 files changed, 28 insertions, 12 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 112a41f..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,26 +879,26 @@ 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
899 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly"); 901 remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
900 902
901 // Update the founder with new group information. 903 // Update the founder with new group information.
902 SendAgentGroupDataUpdate(remoteClient, false); 904 SendAgentGroupDataUpdate(remoteClient, false);
@@ -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);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 83f08e0..eb64f71 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -1008,11 +1008,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1008 respData.Add("error", e.ToString()); 1008 respData.Add("error", e.ToString());
1009 return respData; 1009 return respData;
1010 } 1010 }
1011 }
1012 1011
1013 if ((m_cacheTimeout > 0) && (CacheKey != null)) 1012 if ((m_cacheTimeout > 0) && (CacheKey != null))
1014 { 1013 {
1015 m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); 1014 m_memoryCache.AddOrUpdate(CacheKey, resp, 10.0);
1015 }
1016 } 1016 }
1017 1017
1018 if (resp.Value is Hashtable) 1018 if (resp.Value is Hashtable)