aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llimview.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp
index dee1ed2..a6e2a13 100644
--- a/linden/indra/newview/llimview.cpp
+++ b/linden/indra/newview/llimview.cpp
@@ -310,6 +310,7 @@ LLIMMgr::LLIMMgr() :
310 delete dummy_floater; 310 delete dummy_floater;
311 311
312 mPendingVoiceInvitations = LLSD::emptyMap(); 312 mPendingVoiceInvitations = LLSD::emptyMap();
313 mPendingAgentListUpdates = LLSD::emptyMap();
313} 314}
314 315
315LLIMMgr::~LLIMMgr() 316LLIMMgr::~LLIMMgr()
@@ -725,15 +726,41 @@ public:
725 726
726 if (floaterp) 727 if (floaterp)
727 { 728 {
729 //we've accepted our invitation
730 //and received a list of agents that were
731 //currently in the session when the reply was sent
732 //to us. Now, it is possible that there were some agents
733 //to slip in/out between when that message was sent to us
734 //and now.
735
736 //the agent list updates we've received have been
737 //accurate from the time we were added to the session
738 //but unfortunately, our base that we are receiving here
739 //may not be the most up to date. It was accurate at
740 //some point in time though.
728 floaterp->setSpeakersList(content["agents"]); 741 floaterp->setSpeakersList(content["agents"]);
729 742
743 //we now have our base of users in the session
744 //that was accurate at some point, but maybe not now
745 //so now we apply all of the udpates we've received
746 //in case of race conditions
747
748 //reapplying a user entrance will do nothing
749 //reapplying a user leaving will not have the user
750 //in our base. So it's all good
751 floaterp->updateSpeakersList(
752 gIMMgr->getPendingAgentListUpdates(mSessionID));
753
730 if ( mIsVoiceInvitiation ) 754 if ( mIsVoiceInvitiation )
731 { 755 {
732 floaterp->requestAutoConnect(); 756 floaterp->requestAutoConnect();
733 LLFloaterIMPanel::onClickStartCall(floaterp); 757 LLFloaterIMPanel::onClickStartCall(floaterp);
758 // always open IM window when connecting to voice
759 LLFloaterChatterBox::showInstance(TRUE);
734 } 760 }
735 } 761 }
736 762
763 gIMMgr->clearPendingAgentListUpdates(mSessionID);
737 if ( mIsVoiceInvitiation ) 764 if ( mIsVoiceInvitiation )
738 { 765 {
739 gIMMgr->clearPendingVoiceInviation(mSessionID); 766 gIMMgr->clearPendingVoiceInviation(mSessionID);
@@ -779,6 +806,8 @@ void LLIMMgr::inviteUserResponse(S32 option, void* user_data)
779 { 806 {
780 im_floater->requestAutoConnect(); 807 im_floater->requestAutoConnect();
781 LLFloaterIMPanel::onClickStartCall(im_floater); 808 LLFloaterIMPanel::onClickStartCall(im_floater);
809 // always open IM window when connecting to voice
810 LLFloaterChatterBox::showInstance(TRUE);
782 } 811 }
783 812
784 gIMMgr->clearPendingVoiceInviation(invitep->mSessionID); 813 gIMMgr->clearPendingVoiceInviation(invitep->mSessionID);
@@ -911,6 +940,41 @@ void LLIMMgr::clearPendingVoiceInviation(const LLUUID& session_id)
911 } 940 }
912} 941}
913 942
943LLSD LLIMMgr::getPendingAgentListUpdates(const LLUUID& session_id)
944{
945 if ( mPendingAgentListUpdates.has(session_id.asString()) )
946 {
947 return mPendingAgentListUpdates[session_id.asString()];
948 }
949 else
950 {
951 return LLSD();
952 }
953}
954
955void LLIMMgr::addPendingAgentListUpdates(
956 const LLUUID& session_id,
957 const LLSD& updates)
958{
959 LLSD::map_const_iterator iter;
960
961 for ( iter = updates.beginMap();
962 iter != updates.endMap();
963 iter++)
964 {
965 //we only want to include the last update for a given agent
966 mPendingAgentListUpdates[session_id.asString()][iter->first] =
967 iter->second;
968 }
969}
970
971void LLIMMgr::clearPendingAgentListUpdates(const LLUUID& session_id)
972{
973 if ( mPendingAgentListUpdates.has(session_id.asString()) )
974 {
975 mPendingAgentListUpdates.erase(session_id.asString());
976 }
977}
914 978
915// create a floater and update internal representation for 979// create a floater and update internal representation for
916// consistency. Returns the pointer, caller (the class instance since 980// consistency. Returns the pointer, caller (the class instance since
@@ -1078,7 +1142,12 @@ public:
1078 if (floaterp) 1142 if (floaterp)
1079 { 1143 {
1080 floaterp->setSpeakersList(body["agents"]); 1144 floaterp->setSpeakersList(body["agents"]);
1145
1146 //aply updates we've possibly received previously
1147 floaterp->updateSpeakersList(
1148 gIMMgr->getPendingAgentListUpdates(session_id));
1081 } 1149 }
1150 gIMMgr->clearPendingAgentListUpdates(session_id);
1082 } 1151 }
1083 else 1152 else
1084 { 1153 {
@@ -1191,6 +1260,15 @@ public:
1191 { 1260 {
1192 floaterp->updateSpeakersList(input["body"]["updates"]); 1261 floaterp->updateSpeakersList(input["body"]["updates"]);
1193 } 1262 }
1263 else
1264 {
1265 //we don't have a floater yet..something went wrong
1266 //we are probably receiving an update here before
1267 //a start or an acceptance of an invitation. Race condition.
1268 gIMMgr->addPendingAgentListUpdates(
1269 input["body"]["session_id"].asUUID(),
1270 input["body"]["updates"]);
1271 }
1194 } 1272 }
1195}; 1273};
1196 1274