From 5e34a91ce65bbd74834ae012552b3ebe8592fe9a Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 14 Apr 2010 12:17:47 +0300 Subject: Fixed normal bug EXT-4301 (PDD: Dial-in to a PSTN bridge shows "(???) (???)" for the name.) * Implementation notes: ** special item is cloned from VCP to be used in LLAvatarList to reflect an Avaline caller. ** LLAvatarList extended to create instances of Avaline Caller ** Participant list now determines type of adding session participant (Avatar/Avaline Caller) and selects a way item will be created in avatar list * Implementation behavior: ** The problem is when Avaline caller ends a call it is removed from Voice Client session but still exists in LLSpeakerMgr. Server does not send such information. HUCK was implemented to notify subscribers that Avaline callers are not anymore in the voice call. ** For now Avaline Caller is removed from the LLSpeakerMgr List when it is removed from the Voice Client session. This happens in two cases: if Avaline Caller ends call itself or if Resident ends group call. ** If Resident joins group call where Avaline caller already exists that caller will appear in Resident's viewer (VCP & Group IM window) ** The callers are displayed as "AvaLine Caller 1", "AvaLine Caller 2" etc. * Known issues: ** LLNonAvatarCaller should be removed from VCP (for avaline p2p calls). Updated Avatar & Participant Lists can be used instead of it. Separate ticket will be opened to refactor this code. --HG-- branch : product-engine --- indra/newview/llavatarlist.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'indra/newview/llavatarlist.cpp') diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 407c5b6153..c7a5691d70 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -32,13 +32,18 @@ #include "llviewerprecompiledheaders.h" +// common +#include "lltrans.h" + #include "llavatarlist.h" #include "llagentdata.h" // for comparator // newview +#include "llavatariconctrl.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llcachename.h" #include "llrecentpeople.h" +#include "lltextutil.h" #include "lluuid.h" #include "llvoiceclient.h" #include "llviewercontrol.h" // for gSavedSettings @@ -193,6 +198,18 @@ void LLAvatarList::setDirty(bool val /*= true*/, bool force_refresh /*= false*/) } } +void LLAvatarList::addAvalineItem(const LLUUID& item_id, const LLUUID& session_id, const std::string& item_name) +{ + LL_DEBUGS("Avaline") << "Adding avaline item into the list: " << item_name << "|" << item_id << ", session: " << session_id << LL_ENDL; + LLAvalineListItem* item = new LLAvalineListItem; + item->setAvatarId(item_id, session_id, true, false); + item->setName(item_name); + + addItem(item, item_id); + mIDs.push_back(item_id); + sort(); +} + ////////////////////////////////////////////////////////////////////////// // PROTECTED SECTION ////////////////////////////////////////////////////////////////////////// @@ -471,3 +488,61 @@ bool LLAvatarItemAgentOnTopComparator::doCompare(const LLAvatarListItem* avatar_ } return LLAvatarItemNameComparator::doCompare(avatar_item1,avatar_item2); } + +/************************************************************************/ +/* class LLAvalineListItem */ +/************************************************************************/ +LLAvalineListItem::LLAvalineListItem(bool hide_number/* = true*/) : LLAvatarListItem(false) +, mIsHideNumber(hide_number) +{ + // should not use buildPanel from the base class to ensure LLAvalineListItem::postBuild is called. + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); +} + +BOOL LLAvalineListItem::postBuild() +{ + BOOL rv = LLAvatarListItem::postBuild(); + + if (rv) + { + setOnline(true); + showLastInteractionTime(false); + setShowProfileBtn(false); + setShowInfoBtn(false); + mAvatarIcon->setValue("Avaline_Icon"); + mAvatarIcon->setToolTip(std::string("")); + } + return rv; +} + +// to work correctly this method should be called AFTER setAvatarId for avaline callers with hidden phone number +void LLAvalineListItem::setName(const std::string& name) +{ + if (mIsHideNumber) + { + static U32 order = 0; + typedef std::map avaline_callers_nums_t; + static avaline_callers_nums_t mAvalineCallersNums; + + llassert(getAvatarId() != LLUUID::null); + + const LLUUID &uuid = getAvatarId(); + + if (mAvalineCallersNums.find(uuid) == mAvalineCallersNums.end()) + { + mAvalineCallersNums[uuid] = ++order; + LL_DEBUGS("Avaline") << "Set name for new avaline caller: " << uuid << ", order: " << order << LL_ENDL; + } + LLStringUtil::format_map_t args; + args["[ORDER]"] = llformat("%u", mAvalineCallersNums[uuid]); + std::string hidden_name = LLTrans::getString("AvalineCaller", args); + + LL_DEBUGS("Avaline") << "Avaline caller: " << uuid << ", name: " << hidden_name << LL_ENDL; + LLAvatarListItem::setName(hidden_name); + } + else + { + const std::string& formatted_phone = LLTextUtil::formatPhoneNumber(name); + LLAvatarListItem::setName(formatted_phone); + } +} -- cgit v1.2.3