From 4fb588187106b18724d730e6235fc57454744341 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 29 May 2015 10:22:46 -0700 Subject: Set media viewer mime probe to follow redirection. Coroutines for group moderation. --- indra/newview/llspeakers.cpp | 98 ++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'indra/newview/llspeakers.cpp') 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; @@ -264,49 +265,6 @@ bool LLSpeakersDelayActionsStorage::isTimerStarted(const LLUUID& speaker_id) return (mActionTimersMap.size() > 0) && (mActionTimersMap.find(speaker_id) != mActionTimersMap.end()); } -// -// 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) -- cgit v1.2.3 From 0d3fb07bfa205b65f242ef2b761e827ff30e42fe Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 3 Jun 2015 16:04:40 -0700 Subject: Remove vestigial httpclient.h include from files that no longer need it. --- indra/newview/llspeakers.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 125b7e5355..9a9739c9cb 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -34,7 +34,6 @@ #include "llgroupmgr.h" #include "llsdutil.h" #include "lluicolortable.h" -#include "llhttpclient.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llvoavatar.h" -- cgit v1.2.3 From b262ded7e0cf21314524bf702b0e4fe28a3c3060 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 1 Jul 2015 18:33:29 -0400 Subject: MAINT-5351: Remove 'self' parameter from coroutine functions. lleventcoro_test.cpp runs clean (as modified for new API), and all the rest builds clean, but the resulting viewer is as yet untested. --- indra/newview/llspeakers.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 9a9739c9cb..3b060d8343 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -841,7 +841,7 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); } void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) @@ -866,10 +866,10 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu data["params"]["mute_info"]["voice"] = !unmute; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); } -void LLIMSpeakerMgr::moderationActionCoro(LLCoros::self& self, std::string url, LLSD action) +void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -881,7 +881,7 @@ void LLIMSpeakerMgr::moderationActionCoro(LLCoros::self& self, std::string url, LLUUID sessionId = action["session-id"]; - LLSD result = httpAdapter->postAndYield(self, httpRequest, url, action, httpOpts); + LLSD result = httpAdapter->postAndYield(httpRequest, url, action, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -948,7 +948,7 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); } void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted) -- cgit v1.2.3 From 247eb0c9c3418c10be8f2a0e3c8116758efa702f Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 7 Jul 2015 19:41:27 +0100 Subject: Backout selfles merge 738255dbbfd679d9e615baab3398e5e345bbb3c5 --- indra/newview/llspeakers.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 3b060d8343..9a9739c9cb 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -841,7 +841,7 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); } void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) @@ -866,10 +866,10 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu data["params"]["mute_info"]["voice"] = !unmute; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); } -void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) +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 @@ -881,7 +881,7 @@ void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) LLUUID sessionId = action["session-id"]; - LLSD result = httpAdapter->postAndYield(httpRequest, url, action, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, action, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -948,7 +948,7 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); } void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted) -- cgit v1.2.3 From efa9a0f99c17b2b937120bcad6e3d45944122ed9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 10 Jul 2015 19:30:10 -0400 Subject: Backed out changeset bab1000e1b2d: restore 'selfless' changes --- indra/newview/llspeakers.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 9a9739c9cb..3b060d8343 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -841,7 +841,7 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); } void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) @@ -866,10 +866,10 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu data["params"]["mute_info"]["voice"] = !unmute; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); } -void LLIMSpeakerMgr::moderationActionCoro(LLCoros::self& self, std::string url, LLSD action) +void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -881,7 +881,7 @@ void LLIMSpeakerMgr::moderationActionCoro(LLCoros::self& self, std::string url, LLUUID sessionId = action["session-id"]; - LLSD result = httpAdapter->postAndYield(self, httpRequest, url, action, httpOpts); + LLSD result = httpAdapter->postAndYield(httpRequest, url, action, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -948,7 +948,7 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); } void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted) -- cgit v1.2.3 From 75c6549fde060e974c90636685962ee373f94202 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 18 Sep 2015 11:39:22 -0700 Subject: Set consistent terminology for yield/wait -> suspend for coroutines. --- indra/newview/llspeakers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 3b060d8343..974029254f 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -881,7 +881,7 @@ void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) LLUUID sessionId = action["session-id"]; - LLSD result = httpAdapter->postAndYield(httpRequest, url, action, httpOpts); + LLSD result = httpAdapter->postAndSuspend(httpRequest, url, action, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); -- cgit v1.2.3