Merge branch 'master' of opensimulator.org:/var/git/opensim

LSLKeyTest
UbitUmarov 2016-08-19 00:16:59 +01:00
commit 861fa8a408
2 changed files with 24 additions and 8 deletions

View File

@ -764,7 +764,7 @@ namespace OpenSim.Groups
} }
// check funds // check funds
// is there is a money module present ? // is there a money module present ?
IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
if (money != null) if (money != null)
{ {

View File

@ -862,7 +862,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
if (m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name) != null) GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), UUID.Zero, name);
if (groupRecord != null)
{ {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists."); remoteClient.SendCreateGroupReply(UUID.Zero, false, "A group with the same name already exists.");
return UUID.Zero; return UUID.Zero;
@ -877,22 +879,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
if (avatar.UserLevel < m_levelGroupCreate) if (avatar.UserLevel < m_levelGroupCreate)
{ {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient permissions to create a group."); remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient permissions to create a group.");
return UUID.Zero; return UUID.Zero;
} }
} }
// check funds // check funds
// is there is a money module present ? // is there a money module present ?
IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>(); IMoneyModule money = scene.RequestModuleInterface<IMoneyModule>();
if (money != null) if (money != null && money.GroupCreationCharge > 0)
{ {
// do the transaction, that is if the agent has got sufficient funds // do the transaction, that is if the agent has sufficient funds
if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) { if (!money.AmountCovered(remoteClient.AgentId, money.GroupCreationCharge)) {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got insufficient funds to create a group."); remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to create a group.");
return UUID.Zero; return UUID.Zero;
} }
money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate); money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, MoneyTransactionType.GroupCreate, name);
} }
UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient));
@ -1092,6 +1094,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Should check to see if OpenEnrollment, or if there's an outstanding invitation // Should check to see if OpenEnrollment, or if there's an outstanding invitation
m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero); m_groupData.AddAgentToGroup(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient), groupID, UUID.Zero);
// check funds
// is there a money module present ?
GroupRecord groupRecord = m_groupData.GetGroupRecord(GetRequestingAgentID(remoteClient), groupID, null);
IMoneyModule money = remoteClient.Scene.RequestModuleInterface<IMoneyModule>();
if (money != null && groupRecord.MembershipFee > 0)
{
// do the transaction, that is if the agent has sufficient funds
if (!money.AmountCovered(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee)) {
remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have insufficient funds to join the group.");
return;
}
money.ApplyCharge(GetRequestingAgentID(remoteClient), groupRecord.MembershipFee, MoneyTransactionType.GroupJoin, groupRecord.GroupName);
}
remoteClient.SendJoinGroupReply(groupID, true); remoteClient.SendJoinGroupReply(groupID, true);
SendAgentGroupDataUpdate(remoteClient, true); SendAgentGroupDataUpdate(remoteClient, true);