From 9874e4d1818661580d72f41a507b41d3e07aecd5 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 28 May 2010 13:27:30 -0700 Subject: fixed nearby and friends avatar picker bug --- indra/newview/llfloateravatarpicker.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index d9c580320a..b533e394ff 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -177,7 +177,20 @@ static void getSelectedAvatarData(const LLScrollListCtrl* from, uuid_vec_t& avat if (item->getUUID().notNull()) { avatar_ids.push_back(item->getUUID()); - avatar_names.push_back(sAvatarNameMap[item->getUUID()]); + + std::map::iterator iter = sAvatarNameMap.find(item->getUUID()); + if (iter != sAvatarNameMap.end()) + { + avatar_names.push_back(iter->second); + } + else + { + // the only case where it isn't in the name map is friends + // but it should be in the name cache + LLAvatarName av_name; + LLAvatarNameCache::get(item->getUUID(), &av_name); + avatar_names.push_back(av_name); + } } } } @@ -280,6 +293,8 @@ void LLFloaterAvatarPicker::populateNearMe() element["columns"][0]["value"] = av_name.mDisplayName; element["columns"][1]["column"] = "username"; element["columns"][1]["value"] = av_name.mUsername; + + sAvatarNameMap[av] = av_name; } near_me_scroller->addElement(element); empty = FALSE; @@ -314,7 +329,6 @@ void LLFloaterAvatarPicker::populateFriend() LLAvatarTracker::instance().applyFunctor(collector); LLCollectAllBuddies::buddy_map_t::iterator it; - for(it = collector.mOnline.begin(); it!=collector.mOnline.end(); it++) { friends_scroller->addStringUUIDItem(it->first, it->second); -- cgit v1.2.3 From def61c6999f83cc3c85cdccb6ac9f744c032c694 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 28 May 2010 13:28:05 -0700 Subject: removing deprecated add friend callback path for server 1.24 --- indra/newview/llavataractions.cpp | 34 +++------------------- indra/newview/llavataractions.h | 1 - .../newview/skins/default/xui/en/notifications.xml | 14 --------- 3 files changed, 4 insertions(+), 45 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 6534f7921c..89711de6f0 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -81,22 +81,13 @@ void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::strin } LLSD args; - args["NAME"] = LLSLURL("agent", id, "inspect").getSLURLString(); + args["NAME"] = LLSLURL("agent", id, "completename").getSLURLString(); LLSD payload; payload["id"] = id; payload["name"] = name; - // Look for server versions like: Second Life Server 1.24.4.95600 - if (gLastVersionChannel.find(" 1.24.") != std::string::npos) - { - // Old and busted server version, doesn't support friend - // requests with messages. - LLNotificationsUtil::add("AddFriend", args, payload, &callbackAddFriend); - } - else - { - LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); - } - + + LLNotificationsUtil::add("AddFriendWithMessage", args, payload, &callbackAddFriendWithMessage); + // add friend to recent people list LLRecentPeople::instance().add(id); } @@ -716,23 +707,6 @@ bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& respo } return false; } -// static -bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option == 0) - { - // Servers older than 1.25 require the text of the message to be the - // calling card folder ID for the offering user. JC - LLUUID calling_card_folder_id = - gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); - std::string message = calling_card_folder_id.asString(); - requestFriendship(notification["payload"]["id"].asUUID(), - notification["payload"]["name"].asString(), - message); - } - return false; -} // static void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message) diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index d106a83eea..2d69c01ffe 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -184,7 +184,6 @@ public: private: - static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool handleRemove(const LLSD& notification, const LLSD& response); static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 904084cfa7..5bae6271be 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2006,20 +2006,6 @@ Unable to buy land for the group: You do not have permission to buy land for your active group. - -Friends can give permissions to track each other on the map and receive online status updates. - -Offer friendship to [NAME]? - - - Date: Fri, 28 May 2010 13:28:50 -0700 Subject: changing notifications from "inspect" slurls to "completename" slurls --- indra/newview/llfloaterbuyland.cpp | 3 +-- indra/newview/llfloaterland.cpp | 6 +++--- indra/newview/llfloaterregioninfo.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 419253d938..5d7557a665 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -829,8 +829,7 @@ void LLFloaterBuyLandUI::updateNames() } else { - mParcelSellerName = - LLSLURL("agent", parcelp->getOwnerID(), "inspect").getSLURLString(); + mParcelSellerName = LLSLURL("agent", parcelp->getOwnerID(), "completename").getSLURLString(); } } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 167d4b09f7..2b24189813 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1390,7 +1390,7 @@ bool LLPanelLandObjects::callbackReturnOwnerObjects(const LLSD& notification, co } else { - args["NAME"] = LLSLURL("agent", owner_id, "inspect").getSLURLString(); + args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString(); LLNotificationsUtil::add("OtherObjectsReturned", args); } send_return_objects_message(parcel->getLocalID(), RT_OWNER); @@ -1719,7 +1719,7 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata) } else { - args["NAME"] = LLSLURL("agent", owner_id, "inspect").getSLURLString(); + args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString(); LLNotificationsUtil::add("ReturnObjectsOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerObjects, panelp, _1, _2)); } } @@ -1778,7 +1778,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata) } else { - args["NAME"] = LLSLURL("agent", owner_id, "inspect").getSLURLString(); + args["NAME"] = LLSLURL("agent", owner_id, "completename").getSLURLString(); LLNotificationsUtil::add("ReturnObjectsNotOwnedByUser", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOtherObjects, panelp, _1, _2)); } } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index df400b65d6..590e14a362 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1538,7 +1538,7 @@ void LLPanelEstateInfo::onKickUserCommit(const uuid_vec_t& ids) //Bring up a confirmation dialog LLSD args; - args["EVIL_USER"] = LLSLURL("agent", ids[0], "inspect").getSLURLString(); + args["EVIL_USER"] = LLSLURL("agent", ids[0], "completename").getSLURLString(); LLSD payload; payload["agent_id"] = ids[0]; LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, this, _1, _2)); -- cgit v1.2.3 From 5be933062b0e8dfe6955480b333450a32a444a33 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 28 May 2010 13:30:25 -0700 Subject: adding name lookup callback for friendship requested notification --- indra/newview/llviewermessage.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6ead2e2457..cdcbe20a94 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2041,6 +2041,16 @@ static std::string clean_name_from_task_im(const std::string& msg) return msg; } +void notification_display_name_callback(const LLUUID& id, + const LLAvatarName& av_name, + const std::string& name, + LLSD& substitutions, + const LLSD& payload) +{ + substitutions["NAME"] = av_name.mDisplayName; + LLNotificationsUtil::add(name, substitutions, payload); +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2803,7 +2813,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) args["NAME"] = name; LLSD payload; payload["from_id"] = from_id; - LLNotificationsUtil::add("FriendshipAccepted", args, payload); + LLAvatarNameCache::get(from_id, boost::bind(¬ification_display_name_callback, + _1, + _2, + "FriendshipAccepted", + args, + payload)); } break; -- cgit v1.2.3 From 26b601b99e43eac623c81a60e93094577b06d209 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 28 May 2010 15:45:23 -0700 Subject: Getting rid of some more old gCacheName calls --- indra/newview/llavataractions.cpp | 37 ++++++++++++++++--------------------- indra/newview/llinspectavatar.cpp | 2 +- 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 89711de6f0..6699449625 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -92,6 +92,11 @@ void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::strin LLRecentPeople::instance().add(id); } +void on_avatar_name_friendship(const LLUUID& id, const LLAvatarName av_name) +{ + LLAvatarActions::requestFriendshipDialog(id, av_name.getCompleteName()); +} + // static void LLAvatarActions::requestFriendshipDialog(const LLUUID& id) { @@ -100,9 +105,7 @@ void LLAvatarActions::requestFriendshipDialog(const LLUUID& id) return; } - std::string full_name; - gCacheName->getFullName(id, full_name); - requestFriendshipDialog(id, full_name); + LLAvatarNameCache::get(id, boost::bind(&on_avatar_name_friendship, _1, _2)); } // static @@ -127,10 +130,10 @@ void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids) if(ids.size() == 1) { LLUUID agent_id = ids[0]; - std::string full_name; - if(gCacheName->getFullName(agent_id, full_name)) + LLAvatarName av_name; + if(LLAvatarNameCache::get(agent_id, &av_name)) { - args["NAME"] = full_name; + args["NAME"] = av_name.mDisplayName; } msgType = "RemoveFromFriends"; @@ -158,14 +161,6 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee) if (invitee.isNull()) return; - //waiting until Name Cache gets updated with corresponding avatar name - std::string just_to_request_name; - if (!gCacheName->getFullName(invitee, just_to_request_name)) - { - gCacheName->get(invitee, FALSE, boost::bind((void (*)(const LLUUID&)) &LLAvatarActions::offerTeleport, invitee)); - return; - } - LLDynamicArray ids; ids.push_back(invitee); offerTeleport(ids); @@ -331,14 +326,14 @@ void LLAvatarActions::showProfile(const LLUUID& id) // static void LLAvatarActions::showOnMap(const LLUUID& id) { - std::string name; - if (!gCacheName->getFullName(id, name)) + LLAvatarName av_name; + if (!LLAvatarNameCache::get(id, &av_name)) { - gCacheName->get(id, FALSE, boost::bind(&LLAvatarActions::showOnMap, id)); + LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::showOnMap, id)); return; } - gFloaterWorldMap->trackAvatar(id, name); + gFloaterWorldMap->trackAvatar(id, av_name.mDisplayName); LLFloaterReg::showInstance("world_map"); } @@ -535,7 +530,7 @@ void LLAvatarActions::toggleBlock(const LLUUID& id) { std::string name; - gCacheName->getFullName(id, name); + gCacheName->getFullName(id, name); // needed for mute LLMute mute(id, name, LLMute::AGENT); if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) @@ -739,7 +734,7 @@ bool LLAvatarActions::isFriend(const LLUUID& id) bool LLAvatarActions::isBlocked(const LLUUID& id) { std::string name; - gCacheName->getFullName(id, name); + gCacheName->getFullName(id, name); // needed for mute return LLMuteList::getInstance()->isMuted(id, name); } @@ -747,7 +742,7 @@ bool LLAvatarActions::isBlocked(const LLUUID& id) bool LLAvatarActions::canBlock(const LLUUID& id) { std::string full_name; - gCacheName->getFullName(id, full_name); + gCacheName->getFullName(id, full_name); // needed for mute bool is_linden = (full_name.find("Linden") != std::string::npos); bool is_self = id == gAgentID; return !is_self && !is_linden; diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index a9b9557027..1cd1dcc7f0 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -733,7 +733,7 @@ void LLInspectAvatar::onClickZoomIn() void LLInspectAvatar::onClickFindOnMap() { - gFloaterWorldMap->trackAvatar(mAvatarID, mAvatarName.getLegacyName()); + gFloaterWorldMap->trackAvatar(mAvatarID, mAvatarName.mDisplayName); LLFloaterReg::showInstance("world_map"); } -- cgit v1.2.3 From 6863c9eb3d0b50dcf31ae8a8b4a2bab50e481296 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 1 Jun 2010 06:20:07 -0700 Subject: Avoid name lookups when loading chat history on startup Also fixes DEV-50451, ??? for object names in chat history log on login. --- indra/newview/llchathistory.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 5323ecce72..c52e8daf43 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -274,10 +274,14 @@ public: user_name->setValue(mFrom); updateMinUserNameWidth(); } - else if (mSourceType == CHAT_SOURCE_AGENT) + else if (mSourceType == CHAT_SOURCE_AGENT + && chat.mChatStyle != CHAT_STYLE_HISTORY) { - // ...from a normal user, lookup the name and fill in later, - // but start with blank so sample data from XUI XML doesn't + // ...from a normal user, lookup the name and fill in later. + // *NOTE: Do not do this for chat history logs, otherwise the viewer + // will flood the People API with lookup requests on startup + + // Start with blank so sample data from XUI XML doesn't // flash on the screen user_name->setValue( LLSD() ); LLAvatarNameCache::get(mAvatarID, -- cgit v1.2.3 From 7666922593084fc741931662ba846284e39f6e9c Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 1 Jun 2010 06:57:51 -0700 Subject: Clean up some comments --- indra/newview/llcallingcard.cpp | 2 +- indra/newview/llfolderview.h | 2 +- indra/newview/llfoldervieweventlistener.h | 2 +- indra/newview/llfolderviewitem.h | 2 +- indra/newview/llhudnametag.cpp | 4 ++-- indra/newview/lltoolpie.cpp | 2 +- indra/newview/llviewermessage.cpp | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 7a1524b15e..9937364bc6 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -264,7 +264,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) { ++new_buddy_count; mBuddyInfo[agent_id] = (*itr).second; - // IDEVO JAMESDEBUG is this necessary? name is unused? + // IDEVO: is this necessary? name is unused? gCacheName->getFullName(agent_id, full_name); addChangedMask(LLFriendObserver::ADD, agent_id); lldebugs << "Added buddy " << agent_id diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 0dfdbd364b..8efd645521 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -120,7 +120,7 @@ public: const std::string getFilterSubString(BOOL trim = FALSE); U32 getFilterObjectTypes() const; PermissionMask getFilterPermissions() const; - // JAMESDEBUG use getFilter()->getShowFolderState(); + // *NOTE: use getFilter()->getShowFolderState(); //LLInventoryFilter::EFolderShow getShowFolderState(); U32 getSortOrder() const; BOOL isFilterModified(); diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h index a2ef8c1d12..0e2185bde5 100644 --- a/indra/newview/llfoldervieweventlistener.h +++ b/indra/newview/llfoldervieweventlistener.h @@ -31,7 +31,7 @@ #ifndef LLFOLDERVIEWEVENTLISTENER_H #define LLFOLDERVIEWEVENTLISTENER_H -#include "lldarray.h" // JAMESDEBUG convert to std::vector +#include "lldarray.h" // *TODO: convert to std::vector #include "llfoldertype.h" #include "llfontgl.h" // just for StyleFlags enum #include "llinventorytype.h" diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 57c722afa4..894b9df967 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -57,7 +57,7 @@ enum EInventorySortGroup SG_ITEM }; -// JAMESDEBUG *TODO: do we really need one sort object per folder? +// *TODO: do we really need one sort object per folder? // can we just have one of these per LLFolderView ? class LLInventorySort { diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 2cb333a717..303f048dfc 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -286,7 +286,7 @@ void LLHUDNameTag::renderText(BOOL for_select) LLColor4 bg_color = LLUIColorTable::instance().getColor("NameTagBackground"); bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor); - // JAMESDEBUG - maybe a no-op + // maybe a no-op? //const S32 border_height = 16; //const S32 border_width = 16; const S32 border_height = 8; @@ -523,7 +523,7 @@ void LLHUDNameTag::renderText(BOOL for_select) { x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f); - // JAMESDEBUG HACK + // *HACK x_offset += 1; } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index ebef28fd64..7dd68d392e 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -860,7 +860,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l || !existing_inspector->getVisible() || existing_inspector->getKey()["avatar_id"].asUUID() != hover_object->getID()) { - // IDEVO JAMESDEBUG try to get display name + SLID + // IDEVO: try to get display name + username std::string final_name; std::string full_name; if (!gCacheName->getFullName(hover_object->getID(), full_name)) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index cca1415f9c..182b216cbb 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3006,7 +3006,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // IDEVO Correct for new-style "Resident" names if (chat.mSourceType == CHAT_SOURCE_AGENT) { - // JAMESDEBUG - I don't know if it's OK to change this here, if + // I don't know if it's OK to change this here, if // anything downstream does lookups by name, for instance LLAvatarName av_name; if (LLAvatarNameCache::useDisplayNames() -- cgit v1.2.3