From 6ef3ba4e113a4f87440f0ad3cafb348383c61504 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 28 May 2013 17:38:58 -0400 Subject: [PATCH] Definitely avoid IMs never opening from friends list, and attempt to look up friend names we don't have to prevent this "waiting" chat session problem. The const LLRelationship* info was likely null at times, or names weren't looked up, we just failed silently and played the start IM sound as though nothing had happened, this won't happen anymore. --- indra/newview/llfloaterfriends.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 2ea281745..d759fd52c 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -843,6 +843,14 @@ void LLPanelFriends::updateColumns(void* user_data) } } +static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(true); + gIMMgr->addSession(LLCacheName::cleanFullName(av_name.getLegacyName()), IM_NOTHING_SPECIAL, agent_id); + make_ui_sound("UISndStartIM"); +} + void LLPanelFriends::onClickIM(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; @@ -851,23 +859,17 @@ void LLPanelFriends::onClickIM(void* user_data) const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs(); if(!ids.empty()) { - static LLCachedControl tear_off("OtherChatsTornOff"); - if(!tear_off) gIMMgr->setFloaterOpen(TRUE); if(ids.size() == 1) { - LLUUID agent_id = ids[0]; - const LLRelationship* info = LLAvatarTracker::instance().getBuddyInfo(agent_id); - std::string fullname; - if(info && gCacheName->getFullName(agent_id, fullname)) - { - gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); - } + LLAvatarNameCache::get(ids[0], boost::bind(&on_avatar_name_cache_start_im, _1, _2)); } else { + static LLCachedControl tear_off("OtherChatsTornOff"); + if (!tear_off) gIMMgr->setFloaterOpen(true); gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], ids); + make_ui_sound("UISndStartIM"); } - make_ui_sound("UISndStartIM"); } }