|
31 | 31 | #include "llvoavatar.h" |
32 | 32 | #include "llvoiceclient.h" |
33 | 33 | #include "llviewerobjectlist.h" |
| 34 | +#include "llviewerparcelmgr.h" |
| 35 | +#include "roles_constants.h" |
34 | 36 |
|
35 | 37 | #include "llnearbyvoicemoderation.h" |
36 | 38 |
|
37 | 39 | LLNearbyVoiceModeration::LLNearbyVoiceModeration() |
38 | 40 | { |
39 | | - // TODO: default to false, when appropriate info cap is added |
40 | | - mIsNearbyChatModerator = true; |
41 | | - mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { updateModeratorStatus(); }); |
42 | 41 | } |
43 | 42 |
|
44 | 43 | LLNearbyVoiceModeration::~LLNearbyVoiceModeration() |
45 | 44 | { |
46 | | - if (mParcelCallbackConnection.connected()) |
47 | | - { |
48 | | - mParcelCallbackConnection.disconnect(); |
49 | | - } |
50 | 45 | } |
51 | 46 |
|
52 | 47 | LLVOAvatar* LLNearbyVoiceModeration::getVOAvatarFromId(const LLUUID& agent_id) |
@@ -192,51 +187,8 @@ void LLNearbyVoiceModeration::showMutedNotification(bool is_muted) |
192 | 187 | } |
193 | 188 | } |
194 | 189 |
|
195 | | -void LLNearbyVoiceModeration::updateModeratorStatus() |
196 | | -{ |
197 | | - LL_WARNS() << "Request moderator status info" << LL_ENDL; |
198 | | - // TODO: Uncomment and set correct capability name, when appropriate info cap is added |
199 | | - /* |
200 | | - if (LLViewerRegion* region = gAgent.getRegion()) |
201 | | - { |
202 | | -
|
203 | | - std::string url = region->getCapability("SpatialVoiceModerationInfoRequest"); |
204 | | - if (!url.empty()) |
205 | | - { |
206 | | - LLCoros::instance().launch("getModeratorStatusCoro", [url]() { getModeratorStatusCoro(url); }); |
207 | | - } |
208 | | - } |
209 | | - */ |
210 | | -} |
211 | | - |
212 | | -void LLNearbyVoiceModeration::getModeratorStatusCoro(std::string cap_url) |
| 190 | +bool LLNearbyVoiceModeration::isNearbyChatModerator() |
213 | 191 | { |
214 | | - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); |
215 | | - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getModeratorStatusCoro", httpPolicy)); |
216 | | - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); |
217 | | - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); |
218 | | - LLCore::HttpHeaders::ptr_t httpHeaders; |
219 | | - |
220 | | - httpOpts->setFollowRedirects(true); |
221 | | - |
222 | | - LLSD result = httpAdapter->getAndSuspend(httpRequest, cap_url, httpOpts, httpHeaders); |
223 | | - |
224 | | - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; |
225 | | - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); |
226 | | - |
227 | | - if (!status) |
228 | | - { |
229 | | - LL_WARNS() << "Failed to get nearby voice moderator info" << LL_ENDL; |
230 | | - return; |
231 | | - } |
232 | | - else if (!result["success"].asBoolean()) |
233 | | - { |
234 | | - LL_WARNS() << "Failed to get nearby voice moderator info: " << result["message"] << LL_ENDL; |
235 | | - return; |
236 | | - } |
237 | | - |
238 | | - // TODO: update the field, when appropriate info cap is added |
239 | | - bool is_moderator = result["moderator"].asBoolean(); |
240 | | - LLNearbyVoiceModeration::getInstance()->setNearbyChatModerator(is_moderator); |
| 192 | + return gAgent.canManageEstate() || LLViewerParcelMgr::getInstance()->allowVoiceModeration(); |
241 | 193 | } |
242 | 194 |
|
0 commit comments