diff options
author | Igor Borovkov <iborovkov@productengine.com> | 2009-12-22 16:39:56 +0200 |
---|---|---|
committer | Igor Borovkov <iborovkov@productengine.com> | 2009-12-22 16:39:56 +0200 |
commit | 304e321f89e9a517ba90d6b41999a65591639ad9 (patch) | |
tree | 0d4cfae37cf60fa40f45a3b761262c216e1b3810 /indra | |
parent | c72de2edf0a2f7590fd43d86c59e83afcf7e8bcf (diff) |
implemented EXT-3515 Click on IM button for multiple selected Avatars each time creates new IM session
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llavataractions.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llgroupactions.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llimview.h | 8 |
4 files changed, 71 insertions, 9 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index c5a1ffdcb3..9f7a36e209 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -243,7 +243,6 @@ void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids) return; } - // start the call once the session has fully initialized gIMMgr->autoStartCallOnStartup(session_id); make_ui_sound("UISndStartIM"); diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 22658b4d65..7dd8ea694e 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -138,12 +138,7 @@ void LLGroupActions::startCall(const LLUUID& group_id) } // start the call - // *TODO: move this to LLIMMgr? - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); - if (session && session->mSessionInitialized) - gIMMgr->startCall(session_id); - else - gIMMgr->autoStartCallOnStartup(session_id); + gIMMgr->autoStartCallOnStartup(session_id); make_ui_sound("UISndStartIM"); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 8917cc11e1..85880af923 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -429,6 +429,50 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const (LLIMModel::LLIMSession*) NULL); } +//*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code +LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const std::vector<LLUUID>& ids) +{ + S32 num = ids.size(); + if (!num) return NULL; + + if (mId2SessionMap.empty()) return NULL; + + std::map<LLUUID, LLIMSession*>::const_iterator it = mId2SessionMap.begin(); + for (; it != mId2SessionMap.end(); ++it) + { + LLIMSession* session = (*it).second; + + if (!session->isAdHoc()) continue; + if (session->mInitialTargetIDs.size() != num) continue; + + std::list<LLUUID> tmp_list(session->mInitialTargetIDs.begin(), session->mInitialTargetIDs.end()); + + std::vector<LLUUID>::const_iterator iter = ids.begin(); + while (iter != ids.end()) + { + tmp_list.remove(*iter); + ++iter; + + if (tmp_list.empty()) + { + break; + } + } + + if (tmp_list.empty() && iter == ids.end()) + { + return session; + } + } + + return NULL; +} + +bool LLIMModel::LLIMSession::isAdHoc() +{ + return IM_SESSION_CONFERENCE_START == mType || (IM_SESSION_INVITE == mType && !gAgent.isInGroup(mSessionID)); +} + void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id) { LLIMSession* session = findIMSession(old_session_id); @@ -2097,7 +2141,13 @@ BOOL LLIMMgr::getIMReceived() const void LLIMMgr::autoStartCallOnStartup(const LLUUID& session_id) { LLIMModel::LLIMSession *session = LLIMModel::getInstance()->findIMSession(session_id); - if (session) + if (!session) return; + + if (session->mSessionInitialized) + { + startCall(session_id); + } + else { session->mStartCallOnInitialize = true; } @@ -2159,12 +2209,22 @@ LLUUID LLIMMgr::addSession( bool new_session = !LLIMModel::getInstance()->findIMSession(session_id); + //works only for outgoing ad-hoc sessions + if (new_session && IM_SESSION_CONFERENCE_START == dialog && ids.size()) + { + LLIMModel::LLIMSession* ad_hoc_found = LLIMModel::getInstance()->findAdHocIMSession(ids); + if (ad_hoc_found) + { + new_session = false; + session_id = ad_hoc_found->mSessionID; + } + } + if (new_session) { LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice); } - //*TODO remove this "floater" thing when Communicate Floater's gone LLFloaterIMPanel* floater = findFloaterBySession(session_id); if(!floater) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 09f0c9df71..c928546219 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -74,6 +74,8 @@ public: void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction); static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata); + bool isAdHoc(); + LLUUID mSessionID; std::string mName; EInstantMessage mType; @@ -133,6 +135,12 @@ public: */ LLIMSession* findIMSession(const LLUUID& session_id) const; + /** + * Find an Ad-Hoc IM Session with specified participants + * @return first found Ad-Hoc session or NULL if the session does not exist + */ + LLIMSession* findAdHocIMSession(const std::vector<LLUUID>& ids); + /** * Rebind session data to a new session id. */ |