diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 1117f2a..91872c5 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |||
@@ -56,6 +56,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
56 | // private IAssetService m_assetService; | 56 | // private IAssetService m_assetService; |
57 | private bool m_dumpAssetsToFile = false; | 57 | private bool m_dumpAssetsToFile = false; |
58 | private bool m_enabled = true; | 58 | private bool m_enabled = true; |
59 | private int m_levelUpload = 0; | ||
59 | 60 | ||
60 | #region IRegionModuleBase Members | 61 | #region IRegionModuleBase Members |
61 | 62 | ||
@@ -72,6 +73,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
72 | return; | 73 | return; |
73 | 74 | ||
74 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); | 75 | m_enabled = meshConfig.GetBoolean("AllowMeshUpload", true); |
76 | m_levelUpload = meshConfig.GetInt("LevelUpload", 0); | ||
75 | } | 77 | } |
76 | 78 | ||
77 | public void AddRegion(Scene pScene) | 79 | public void AddRegion(Scene pScene) |
@@ -137,25 +139,41 @@ namespace OpenSim.Region.ClientStack.Linden | |||
137 | // llsdRequest.asset_type == "animation" || | 139 | // llsdRequest.asset_type == "animation" || |
138 | // llsdRequest.asset_type == "sound") | 140 | // llsdRequest.asset_type == "sound") |
139 | // { | 141 | // { |
142 | // check user level | ||
143 | ScenePresence avatar = null; | ||
140 | IClientAPI client = null; | 144 | IClientAPI client = null; |
145 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
141 | 146 | ||
142 | 147 | if (avatar != null) | |
148 | { | ||
149 | client = avatar.ControllingClient; | ||
150 | |||
151 | if (avatar.UserLevel < m_levelUpload) | ||
152 | { | ||
153 | if (client != null) | ||
154 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | ||
155 | |||
156 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | ||
157 | errorResponse.rsvp = ""; | ||
158 | errorResponse.state = "error"; | ||
159 | return errorResponse; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | // check funds | ||
143 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); | 164 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); |
144 | 165 | ||
145 | if (mm != null) | 166 | if (mm != null) |
146 | { | 167 | { |
147 | if (m_scene.TryGetClient(agentID, out client)) | 168 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) |
148 | { | 169 | { |
149 | if (!mm.UploadCovered(client.AgentId, mm.UploadCharge)) | 170 | if (client != null) |
150 | { | 171 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
151 | if (client != null) | 172 | |
152 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 173 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
153 | 174 | errorResponse.rsvp = ""; | |
154 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 175 | errorResponse.state = "error"; |
155 | errorResponse.rsvp = ""; | 176 | return errorResponse; |
156 | errorResponse.state = "error"; | ||
157 | return errorResponse; | ||
158 | } | ||
159 | } | 177 | } |
160 | } | 178 | } |
161 | // } | 179 | // } |