summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llspeakers.cpp98
-rwxr-xr-xindra/newview/llspeakers.h4
-rwxr-xr-xindra/newview/llviewermedia.cpp1
3 files changed, 54 insertions, 49 deletions
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 7867e1573c..125b7e5355 100755
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -39,6 +39,7 @@
#include "llviewerregion.h"
#include "llvoavatar.h"
#include "llworld.h"
+#include "llcorehttputil.h"
extern LLControlGroup gSavedSettings;
@@ -265,49 +266,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
//
@@ -883,7 +841,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, _1, url, data));
}
void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute)
@@ -907,10 +866,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, _1, url, data));
+}
+
+void LLIMSpeakerMgr::moderationActionCoro(LLCoros::self& self, 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->postAndYield(self, 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 )
@@ -949,7 +948,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, _1, url, data));
}
void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted)
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 0e69184125..1f3b2f584c 100755
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -30,6 +30,8 @@
#include "llevent.h"
#include "lleventtimer.h"
#include "llvoicechannel.h"
+#include "lleventcoro.h"
+#include "llcoros.h"
class LLSpeakerMgr;
@@ -333,6 +335,8 @@ protected:
*/
void forceVoiceModeratedMode(bool should_be_muted);
+ void moderationActionCoro(LLCoros::self& self, std::string url, LLSD action);
+
};
class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeakerMgr>
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 02167b099e..33421cba90 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2582,6 +2582,7 @@ void LLViewerMediaImpl::mimeDiscoveryCoro(LLCoros::self& self, std::string url)
mMimeProbe = httpAdapter;
+ httpOpts->setFollowRedirects(true);
httpOpts->setHeadersOnly(true);
httpHeaders->append(HTTP_OUT_HEADER_ACCEPT, "*/*");