diff options
author | Justin Clark-Casey (justincc) | 2012-05-03 01:45:49 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-03 01:45:49 +0100 |
commit | 231a3bf147315a9284140476d2b09e13c3fee1c0 (patch) | |
tree | f04ffb5bb43d919c1687af57e4cb48829f6dc437 /OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |
parent | Comment out the five second sleep in etm.DoTeleport() if the old agent needs ... (diff) | |
download | opensim-SC-231a3bf147315a9284140476d2b09e13c3fee1c0.zip opensim-SC-231a3bf147315a9284140476d2b09e13c3fee1c0.tar.gz opensim-SC-231a3bf147315a9284140476d2b09e13c3fee1c0.tar.bz2 opensim-SC-231a3bf147315a9284140476d2b09e13c3fee1c0.tar.xz |
Implement optional name and description on http stream handlers so that we can relate a slow request to what the handler actually does and the agent it serves, if applicable.
This is most useful for capabilities where the url is not self-describing.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | 93 |
1 files changed, 49 insertions, 44 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs index 91872c5..52c4f44 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs | |||
@@ -115,67 +115,66 @@ namespace OpenSim.Region.ClientStack.Linden | |||
115 | UUID capID = UUID.Random(); | 115 | UUID capID = UUID.Random(); |
116 | 116 | ||
117 | // m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); | 117 | // m_log.Debug("[NEW FILE AGENT INVENTORY VARIABLE PRICE]: /CAPS/" + capID); |
118 | caps.RegisterHandler("NewFileAgentInventoryVariablePrice", | 118 | caps.RegisterHandler( |
119 | 119 | "NewFileAgentInventoryVariablePrice", | |
120 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>("POST", | 120 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDNewFileAngentInventoryVariablePriceReplyResponse>( |
121 | "/CAPS/" + capID.ToString(), | 121 | "POST", |
122 | delegate(LLSDAssetUploadRequest req) | 122 | "/CAPS/" + capID.ToString(), |
123 | { | 123 | req => NewAgentInventoryRequest(req, agentID), |
124 | return NewAgentInventoryRequest(req,agentID); | 124 | "NewFileAgentInventoryVariablePrice", |
125 | })); | 125 | agentID.ToString())); |
126 | |||
127 | } | 126 | } |
128 | 127 | ||
129 | #endregion | 128 | #endregion |
130 | 129 | ||
131 | public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) | 130 | public LLSDNewFileAngentInventoryVariablePriceReplyResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest, UUID agentID) |
132 | { | 131 | { |
133 | |||
134 | //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit | 132 | //TODO: The Mesh uploader uploads many types of content. If you're going to implement a Money based limit |
135 | // You need to be aware of this and | 133 | // you need to be aware of this |
136 | |||
137 | 134 | ||
138 | //if (llsdRequest.asset_type == "texture" || | 135 | //if (llsdRequest.asset_type == "texture" || |
139 | // llsdRequest.asset_type == "animation" || | 136 | // llsdRequest.asset_type == "animation" || |
140 | // llsdRequest.asset_type == "sound") | 137 | // llsdRequest.asset_type == "sound") |
141 | // { | 138 | // { |
142 | // check user level | 139 | // check user level |
143 | ScenePresence avatar = null; | ||
144 | IClientAPI client = null; | ||
145 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
146 | 140 | ||
147 | if (avatar != null) | 141 | ScenePresence avatar = null; |
142 | IClientAPI client = null; | ||
143 | m_scene.TryGetScenePresence(agentID, out avatar); | ||
144 | |||
145 | if (avatar != null) | ||
146 | { | ||
147 | client = avatar.ControllingClient; | ||
148 | |||
149 | if (avatar.UserLevel < m_levelUpload) | ||
148 | { | 150 | { |
149 | client = avatar.ControllingClient; | 151 | if (client != null) |
150 | 152 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | |
151 | if (avatar.UserLevel < m_levelUpload) | 153 | |
152 | { | 154 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
153 | if (client != null) | 155 | errorResponse.rsvp = ""; |
154 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient permissions.", false); | 156 | errorResponse.state = "error"; |
155 | 157 | return errorResponse; | |
156 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | ||
157 | errorResponse.rsvp = ""; | ||
158 | errorResponse.state = "error"; | ||
159 | return errorResponse; | ||
160 | } | ||
161 | } | 158 | } |
159 | } | ||
162 | 160 | ||
163 | // check funds | 161 | // check funds |
164 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); | 162 | IMoneyModule mm = m_scene.RequestModuleInterface<IMoneyModule>(); |
165 | 163 | ||
166 | if (mm != null) | 164 | if (mm != null) |
165 | { | ||
166 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) | ||
167 | { | 167 | { |
168 | if (!mm.UploadCovered(agentID, mm.UploadCharge)) | 168 | if (client != null) |
169 | { | 169 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); |
170 | if (client != null) | 170 | |
171 | client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | 171 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
172 | 172 | errorResponse.rsvp = ""; | |
173 | LLSDNewFileAngentInventoryVariablePriceReplyResponse errorResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 173 | errorResponse.state = "error"; |
174 | errorResponse.rsvp = ""; | 174 | return errorResponse; |
175 | errorResponse.state = "error"; | ||
176 | return errorResponse; | ||
177 | } | ||
178 | } | 175 | } |
176 | } | ||
177 | |||
179 | // } | 178 | // } |
180 | 179 | ||
181 | string assetName = llsdRequest.name; | 180 | string assetName = llsdRequest.name; |
@@ -189,8 +188,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
189 | AssetUploader uploader = | 188 | AssetUploader uploader = |
190 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 189 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
191 | llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); | 190 | llsdRequest.asset_type, capsBase + uploaderPath, MainServer.Instance, m_dumpAssetsToFile); |
191 | |||
192 | MainServer.Instance.AddStreamHandler( | 192 | MainServer.Instance.AddStreamHandler( |
193 | new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 193 | new BinaryStreamHandler( |
194 | "POST", | ||
195 | capsBase + uploaderPath, | ||
196 | uploader.uploaderCaps, | ||
197 | "NewFileAgentInventoryVariablePrice", | ||
198 | agentID.ToString())); | ||
194 | 199 | ||
195 | string protocol = "http://"; | 200 | string protocol = "http://"; |
196 | 201 | ||
@@ -199,10 +204,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
199 | 204 | ||
200 | string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + | 205 | string uploaderURL = protocol + m_scene.RegionInfo.ExternalHostName + ":" + MainServer.Instance.Port.ToString() + capsBase + |
201 | uploaderPath; | 206 | uploaderPath; |
202 | 207 | ||
203 | 208 | ||
204 | LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); | 209 | LLSDNewFileAngentInventoryVariablePriceReplyResponse uploadResponse = new LLSDNewFileAngentInventoryVariablePriceReplyResponse(); |
205 | |||
206 | 210 | ||
207 | uploadResponse.rsvp = uploaderURL; | 211 | uploadResponse.rsvp = uploaderURL; |
208 | uploadResponse.state = "upload"; | 212 | uploadResponse.state = "upload"; |
@@ -220,6 +224,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
220 | pinventoryItem, pparentFolder, pdata, pinventoryType, | 224 | pinventoryItem, pparentFolder, pdata, pinventoryType, |
221 | passetType,agentID); | 225 | passetType,agentID); |
222 | }; | 226 | }; |
227 | |||
223 | return uploadResponse; | 228 | return uploadResponse; |
224 | } | 229 | } |
225 | 230 | ||