From 1006e2fd259d5f8136ca933eba8d57c8a980bf31 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 17 Oct 2012 17:14:44 -0700 Subject: CHUI-422 : Update the ad-hoc conversation with the known list of on line agents without waiting for server message (which often doesn't come...). --- indra/newview/llavataractions.cpp | 3 -- indra/newview/lleventpoll.cpp | 42 +++++++----------- indra/newview/llimview.cpp | 3 +- indra/newview/llspeakers.cpp | 92 ++++++--------------------------------- indra/newview/llspeakers.h | 4 -- 5 files changed, 32 insertions(+), 112 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 600df31c8b..7322b3bb0b 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -303,9 +303,6 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids, const LLUUID& float } LLIMFloater::show(session_id); -// gIMMgr->processAgentListUpdates(session_id, LLSD()); -// gIMMgr->startCall(session_id,LLVoiceChannel::OUTGOING_CALL); -// gIMMgr->endCall(session_id); make_ui_sound("UISndStartIM"); } diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 27f79dda2c..4f4d9a40b4 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -37,7 +37,6 @@ #include "llviewerregion.h" #include "message.h" #include "lltrans.h" -#include "llsdserialize.h" namespace { @@ -110,14 +109,14 @@ namespace const std::string& pollURL, const LLHost& sender) { LLHTTPClient::ResponderPtr result = new LLEventPollResponder(pollURL, sender); - llinfos << "Merov debug : LLEventPollResponder::start <" << sCount << "> " + llinfos << "LLEventPollResponder::start <" << sCount << "> " << pollURL << llendl; return result; } void LLEventPollResponder::stop() { - llinfos << "Merov debug : LLEventPollResponder::stop <" << mCount << "> " + llinfos << "LLEventPollResponder::stop <" << mCount << "> " << mPollURL << llendl; // there should be a way to stop a LLHTTPClient request in progress mDone = true; @@ -135,17 +134,17 @@ namespace LLViewerRegion *regionp = gAgent.getRegion(); if (!regionp) { - llinfos << "Merov debug : LLEventPoll initialized before region is added." << llendl; + llerrs << "LLEventPoll initialized before region is added." << llendl; } mSender = sender.getIPandPort(); - llinfos << "Merov debug : LLEventPoll initialized with sender " << mSender << llendl; + llinfos << "LLEventPoll initialized with sender " << mSender << llendl; makeRequest(); } LLEventPollResponder::~LLEventPollResponder() { stop(); - llinfos << "Merov debug : LLEventPollResponder::~Impl <" << mCount << "> " + lldebugs << "LLEventPollResponder::~Impl <" << mCount << "> " << mPollURL << llendl; } @@ -155,13 +154,11 @@ namespace const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - llinfos << "Merov debug : LLEventPollResponder::completedRaw url <" << mPollURL << ">, status = " << status << ", reason = " << reason << llendl; if (status == HTTP_BAD_GATEWAY) { // These errors are not parsable as LLSD, // which LLHTTPClient::Responder::completedRaw will try to do. - //completed(status, reason, LLSD()); - error(status, reason); + completed(status, reason, LLSD()); } else { @@ -175,12 +172,8 @@ namespace request["ack"] = mAcknowledge; request["done"] = mDone; - llinfos << "Merov debug : viewer->sim : LLEventPollResponder::makeRequest <" << mCount - << "> ack = " << LLSDXMLStreamer(mAcknowledge) - << ", error = " << mErrorCount - << ", sender = " << mSender - << ", url = " << mPollURL - << ", done = " << mDone << llendl; + lldebugs << "LLEventPollResponder::makeRequest <" << mCount << "> ack = " + << LLSDXMLStreamer(mAcknowledge) << llendl; LLHTTPClient::post(mPollURL, request, this); } @@ -190,16 +183,13 @@ namespace LLSD message; message["sender"] = mSender; message["body"] = content["body"]; - llinfos << "Merov debug : sim->viewer : LLEventPollResponder::handleMessage, msg_name = " << msg_name << ", message = " << LLSDOStreamer(message) << llendl; LLMessageSystem::dispatch(msg_name, message); } //virtual void LLEventPollResponder::error(U32 status, const std::string& reason) { - llinfos << "Merov debug : LLEventPollResponder::error, status = " << status << ", reason = " << reason << llendl; if (mDone) return; - llinfos << "Merov debug : LLEventPollResponder::error, status = " << status << ", reason = " << reason << llendl; // A HTTP_BAD_GATEWAY (502) error is our standard timeout response // we get this when there are no events. @@ -217,11 +207,11 @@ namespace + mErrorCount * EVENT_POLL_ERROR_RETRY_SECONDS_INC , this); - llinfos << "Merov debug : Unexpected HTTP error. status: " << status << ", reason: " << reason << llendl; + llwarns << "Unexpected HTTP error. status: " << status << ", reason: " << reason << llendl; } else { - llinfos << "Merov debug : LLEventPollResponder::error: <" << mCount << "> got " + llwarns << "LLEventPollResponder::error: <" << mCount << "> got " << status << ": " << reason << (mDone ? " -- done" : "") << llendl; stop(); @@ -237,7 +227,7 @@ namespace // continue running. if(gAgent.getRegion() && gAgent.getRegion()->getHost().getIPandPort() == mSender) { - llinfos << "Merov debug : Forcing disconnect due to stalled main region event poll." << llendl; + llwarns << "Forcing disconnect due to stalled main region event poll." << llendl; LLAppViewer::instance()->forceDisconnect(LLTrans::getString("AgentLostConnection")); } } @@ -246,8 +236,8 @@ namespace //virtual void LLEventPollResponder::result(const LLSD& content) { - llinfos << "Merov debug : LLEventPollResponder::result <" << mCount << "> " - << (mDone ? " -- done" : "") << ", content = " << LLSDOStreamer(content) << llendl; + lldebugs << "LLEventPollResponder::result <" << mCount << ">" + << (mDone ? " -- done" : "") << llendl; if (mDone) return; @@ -256,7 +246,7 @@ namespace if (!content.get("events") || !content.get("id")) { - llinfos << "Merov debug : received event poll with no events or id key" << llendl; + llwarns << "received event poll with no events or id key" << llendl; makeRequest(); return; } @@ -266,11 +256,11 @@ namespace if(mAcknowledge.isUndefined()) { - llinfos << "Merov debug : LLEventPollResponder: id undefined" << llendl; + llwarns << "LLEventPollResponder: id undefined" << llendl; } // was llinfos but now that CoarseRegionUpdate is TCP @ 1/second, it'd be too verbose for viewer logs. -MG - llinfos << "Merov debug : LLEventPollResponder::completed <" << mCount << "> " << events.size() << "events (id " + lldebugs << "LLEventPollResponder::completed <" << mCount << "> " << events.size() << "events (id " << LLSDXMLStreamer(mAcknowledge) << ")" << llendl; LLSD::array_const_iterator i = events.beginArray(); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e6f93aa9be..b5f22731f1 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -238,7 +238,6 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& //we need to wait for session initialization for outgoing ad-hoc and group chat session //correct session id for initiated ad-hoc chat will be received from the server - // Merov : MAINT-1551 : We need to read that mInitialTargetIDs when initializing the conversation if (!LLIMModel::getInstance()->sendStartSession(mSessionID, mOtherParticipantID, mInitialTargetIDs, mType)) { @@ -1301,6 +1300,7 @@ bool LLIMModel::sendStartSession( else if ( dialog == IM_SESSION_CONFERENCE_START ) { LLSD agents; + agents.append(gAgent.getID()); for (int i = 0; i < (S32) ids.size(); i++) { agents.append(ids[i]); @@ -1319,6 +1319,7 @@ bool LLIMModel::sendStartSession( data["params"] = agents; llinfos << "Merov debug : viewer-> sim : LLIMModel::sendStartSession, session id = " << temp_session_id << ", data = " << LLSDOStreamer(data) << llendl; + llinfos << "Merov debug : Extra info for LLIMModel::sendStartSession, other_participant_id = " << other_participant_id << ", agent id = " << gAgent.getID() << llendl; LLHTTPClient::post( url, data, diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 217efdf4af..64477765e1 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -36,7 +36,6 @@ #include "llviewerobjectlist.h" #include "llvoavatar.h" #include "llworld.h" -#include "llsdserialize.h" const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f); const LLColor4 ACTIVE_COLOR(0.5f, 0.5f, 0.5f, 1.f); @@ -297,23 +296,6 @@ private: LLUUID mSessionID; }; -class UpdateResponder : public LLHTTPClient::Responder -{ -public: - UpdateResponder(const LLUUID& session_id) - { - mSessionID = session_id; - } - - virtual void error(U32 status, const std::string& reason) - { - llinfos << "Merov debug : UpdateResponder error, on " << mSessionID << ", status = " << status << ": " << reason << llendl; - } - -private: - LLUUID mSessionID; -}; - // // LLSpeakerMgr // @@ -322,11 +304,8 @@ LLSpeakerMgr::LLSpeakerMgr(LLVoiceChannel* channelp) : mVoiceChannel(channelp) , mVoiceModerated(false) , mModerateModeHandledFirstTime(false) -, mSessionUpdated(false) -, mSessionID() { static LLUICachedControl remove_delay ("SpeakerParticipantRemoveDelay", 10.0); -// mSessionID = getSessionID(); mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLSpeakerMgr::removeSpeaker, this, _1), remove_delay); } @@ -348,7 +327,6 @@ LLPointer LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin mSpeakers.insert(std::make_pair(speakerp->mID, speakerp)); mSpeakersSorted.push_back(speakerp); LL_DEBUGS("Speakers") << "Added speaker " << id << llendl; - //llinfos << "Merov debug : setSpeaker, add, id = " << id << ", name = " << name << llendl; fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add"); } else @@ -369,7 +347,6 @@ LLPointer LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin } else { - llinfos << "Merov debug : setSpeaker, speaker not found? id = " << id << ", name = " << name << llendl; LL_WARNS("Speakers") << "Speaker " << id << " not found" << llendl; } } @@ -550,62 +527,24 @@ void LLSpeakerMgr::updateSpeakerList() LLUUID session_id = getSessionID(); if ((mSpeakers.size() == 0) && (!session_id.isNull())) { - //llinfos << "Merov debug : LLSpeakerMgr::updateSpeakerList: No speakers in " << session_id << llendl; - // MAINT-1551 : If the list is empty for too long, we should send a message to the sim so that - // it sends the participant list again. - updateSession(); + // If the list is empty, we update it with whatever was used to initiate the call so that it doesn't stay empty too long. + // *TODO: Fix the server side code that sometimes forgets to send back the list of agents after a chat started + // (IOW, fix why we get no ChatterBoxSessionAgentListUpdates message after the initial ChatterBoxSessionStartReply) + LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); + for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();it!=session->mInitialTargetIDs.end();++it) + { + // We only add avatars that are on line + if (LLAvatarTracker::instance().isBuddyOnline(*it)) + { + setSpeaker(*it, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT); + } + } + // Also add the current agent + setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT); } } } -void LLSpeakerMgr::updateSession() -{ - // We perform this update if is has never been done or if the session id changed (which happens in ad-hoc sessions) - if (mSessionUpdated && (mSessionID == getSessionID())) - return; - - std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); - LLSD data; - -// That doesn't work apparently because we are not in the invite list so we get error 500 -// data["method"] = "accept invitation"; -// data["session-id"] = getSessionID(); - -// That doesn't work because we're not a moderator on an IM session so our request is rejected as such (error 403) - data["method"] = "session update"; - data["session-id"] = getSessionID(); - data["params"] = LLSD::emptyMap(); - data["params"]["update_info"] = LLSD::emptyMap(); - data["params"]["update_info"]["moderated_mode"] = LLSD::emptyMap(); - data["params"]["update_info"]["moderated_mode"]["voice"] = false; - -// That doesn't work, we eventually time out (error 502)... -// data["method"] = "call"; -// data["session-id"] = getSessionID(); - - data["params"] = LLSD::emptyArray(); -// for (int i = 0; i < count; i++) -// { -// data["params"].append(ids[i]); -// } - data["params"].append(gAgentID); - data["method"] = "invite"; - data["session-id"] = getSessionID(); - - llinfos << "Merov debug : viewer->sim : LLSpeakerMgr::updateSession, session id = " << getSessionID() << ", data = " << LLSDOStreamer(data) << llendl; - - LLHTTPClient::post(url, data, new UpdateResponder(getSessionID())); - - // bit of extra in the case of invite being sent - data.clear(); - data["method"] = "accept invitation"; - data["session-id"] = getSessionID(); - LLHTTPClient::post(url, data, new UpdateResponder(getSessionID())); - - mSessionUpdated = true; - mSessionID = getSessionID(); -} - void LLSpeakerMgr::setSpeakerNotInChannel(LLSpeaker* speakerp) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; @@ -872,7 +811,6 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) //current value represents ability to type, so invert data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText; - llinfos << "Merov debug : viewer->sim : LLIMSpeakerMgr::toggleAllowTextChat, session id = " << getSessionID() << ", data = " << LLSDOStreamer(data) << llendl; LLHTTPClient::post(url, data, new ModerationResponder(getSessionID())); } @@ -897,7 +835,6 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu data["params"]["mute_info"] = LLSD::emptyMap(); data["params"]["mute_info"]["voice"] = !unmute; - llinfos << "Merov debug : viewer->sim : LLIMSpeakerMgr::moderateVoiceParticipant, session id = " << getSessionID() << ", data = " << LLSDOStreamer(data) << llendl; LLHTTPClient::post( url, data, @@ -940,7 +877,6 @@ 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; - llinfos << "Merov debug : viewer->sim : LLIMSpeakerMgr::moderateVoiceSession, session id = " << session_id << ", data = " << LLSDOStreamer(data) << llendl; LLHTTPClient::post(url, data, new ModerationResponder(session_id)); } diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index 8a80c4619e..8ab08661d3 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -258,10 +258,6 @@ protected: void setSpeakerNotInChannel(LLSpeaker* speackerp); bool removeSpeaker(const LLUUID& speaker_id); - void updateSession(); - bool mSessionUpdated; - LLUUID mSessionID; - typedef std::map > speaker_map_t; speaker_map_t mSpeakers; -- cgit v1.2.3