summaryrefslogtreecommitdiff
path: root/indra/newview/llspeakers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llspeakers.cpp')
-rw-r--r--indra/newview/llspeakers.cpp99
1 files changed, 49 insertions, 50 deletions
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 44c980c96f..e7971028bf 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -34,11 +34,11 @@
#include "llgroupmgr.h"
#include "llsdutil.h"
#include "lluicolortable.h"
-#include "llhttpclient.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llvoavatar.h"
#include "llworld.h"
+#include "llcorehttputil.h"
extern LLControlGroup gSavedSettings;
@@ -265,49 +265,6 @@ bool LLSpeakersDelayActionsStorage::isTimerStarted(const LLUUID& speaker_id)
}
//
-// ModerationResponder
-//
-
-class ModerationResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(ModerationResponder);
-public:
- ModerationResponder(const LLUUID& session_id)
- {
- mSessionID = session_id;
- }
-
-protected:
- virtual void httpFailure()
- {
- LL_WARNS() << dumpResponse() << LL_ENDL;
-
- if ( gIMMgr )
- {
- //403 == you're not a mod
- //should be disabled if you're not a moderator
- if ( HTTP_FORBIDDEN == getStatus() )
- {
- gIMMgr->showSessionEventError(
- "mute",
- "not_a_mod_error",
- mSessionID);
- }
- else
- {
- gIMMgr->showSessionEventError(
- "mute",
- "generic_request_error",
- mSessionID);
- }
- }
- }
-
-private:
- LLUUID mSessionID;
-};
-
-//
// LLSpeakerMgr
//
@@ -870,7 +827,8 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
//current value represents ability to type, so invert
data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText;
- LLHTTPClient::post(url, data, new ModerationResponder(getSessionID()));
+ LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
+ boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));
}
void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute)
@@ -894,10 +852,50 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu
data["params"]["mute_info"] = LLSD::emptyMap();
data["params"]["mute_info"]["voice"] = !unmute;
- LLHTTPClient::post(
- url,
- data,
- new ModerationResponder(getSessionID()));
+ LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
+ boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));
+}
+
+void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("moderationActionCoro", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+
+ httpOpts->setWantHeaders(true);
+
+ LLUUID sessionId = action["session-id"];
+
+ LLSD result = httpAdapter->postAndSuspend(httpRequest, url, action, httpOpts);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ if (!status)
+ {
+ if (gIMMgr)
+ {
+ //403 == you're not a mod
+ //should be disabled if you're not a moderator
+ if (status == LLCore::HttpStatus(HTTP_FORBIDDEN))
+ {
+ gIMMgr->showSessionEventError(
+ "mute",
+ "not_a_mod_error",
+ sessionId);
+ }
+ else
+ {
+ gIMMgr->showSessionEventError(
+ "mute",
+ "generic_request_error",
+ sessionId);
+ }
+ }
+ return;
+ }
}
void LLIMSpeakerMgr::moderateVoiceAllParticipants( bool unmute_everyone )
@@ -936,7 +934,8 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo
data["params"]["update_info"]["moderated_mode"] = LLSD::emptyMap();
data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice;
- LLHTTPClient::post(url, data, new ModerationResponder(session_id));
+ LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro",
+ boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data));
}
void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted)