virtual void post(ResponsePtr response, const LLSD& context, const LLSD& input) const { LLSD body; LLUUID temp_session_id; LLUUID session_id; bool success; body = input["body"]; success = body["success"].asBoolean(); temp_session_id = body["temp_session_id"].asUUID(); if ( success ) { session_id = body["session_id"].asUUID(); gIMMgr->updateFloaterSessionID( temp_session_id, session_id); LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(session_id); if (floaterp) { floaterp->setSpeakers(body); //apply updates we've possibly received previously floaterp->updateSpeakersList( gIMMgr->getPendingAgentListUpdates(session_id)); if ( body.has("session_info") ) { floaterp->processSessionUpdate(body["session_info"]); } //aply updates we've possibly received previously floaterp->updateSpeakersList( gIMMgr->getPendingAgentListUpdates(session_id)); } gIMMgr->clearPendingAgentListUpdates(session_id); } else { //throw an error dialog and close the temp session's //floater LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(temp_session_id); if ( floater ) { floater->showSessionStartError(body["error"].asString()); } } gIMMgr->clearPendingAgentListUpdates(session_id); }
void result(const LLSD& content) { if ( gIMMgr) { LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(mSessionID); if (floaterp) { //we've accepted our invitation //and received a list of agents that were //currently in the session when the reply was sent //to us. Now, it is possible that there were some agents //to slip in/out between when that message was sent to us //and now. //the agent list updates we've received have been //accurate from the time we were added to the session //but unfortunately, our base that we are receiving here //may not be the most up to date. It was accurate at //some point in time though. floaterp->setSpeakers(content); //we now have our base of users in the session //that was accurate at some point, but maybe not now //so now we apply all of the udpates we've received //in case of race conditions floaterp->updateSpeakersList( gIMMgr->getPendingAgentListUpdates(mSessionID)); if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE ) { floaterp->requestAutoConnect(); LLFloaterIMPanel::onClickStartCall(floaterp); // always open IM window when connecting to voice LLFloaterChatterBox::showInstance(TRUE); } else if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE ) { LLFloaterChatterBox::showInstance(TRUE); } } gIMMgr->clearPendingAgentListUpdates(mSessionID); gIMMgr->clearPendingInvitation(mSessionID); } }