From c0b7c93c18783d6a426cf43265f34c86bdeceb4a Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 4 Feb 2010 20:38:40 -0800 Subject: Converted all gCacheName->getName to getFullName for SLID compatibility Also eliminated notification "ObjectGiveItemUnknownUser" because the SLURL-based name lookup will always retrieve the user name. Fixed a bug with ObjectGiveItem where the SLURL would be incorrect for a group. --- indra/newview/llcallingcard.cpp | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'indra/newview/llcallingcard.cpp') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index d988770f90..c4b7cee0d5 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -248,7 +248,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) using namespace std; U32 new_buddy_count = 0; - std::string first,last; + std::string full_name; LLUUID agent_id; for(buddy_map_t::const_iterator itr = buds.begin(); itr != buds.end(); ++itr) { @@ -258,7 +258,8 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) { ++new_buddy_count; mBuddyInfo[agent_id] = (*itr).second; - gCacheName->getName(agent_id, first, last); + // IDEVO JAMESDEBUG is this necessary? name is unused? + gCacheName->getFullName(agent_id, full_name); addChangedMask(LLFriendObserver::ADD, agent_id); lldebugs << "Added buddy " << agent_id << ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline") @@ -689,12 +690,11 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) setBuddyOnline(agent_id,online); if(chat_notify) { - std::string first, last; - if(gCacheName->getName(agent_id, first, last)) + std::string full_name; + if(gCacheName->getFullName(agent_id, full_name)) { notify = TRUE; - args["FIRST"] = first; - args["LAST"] = last; + args["NAME"] = full_name; } } } @@ -849,10 +849,8 @@ bool LLCollectProxyBuddies::operator()(const LLUUID& buddy_id, LLRelationship* b bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - gCacheName->getName(buddy_id, mFirst, mLast); - std::ostringstream fullname; - fullname << mFirst << " " << mLast; - buddy_map_t::value_type value(fullname.str(), buddy_id); + gCacheName->getFullName(buddy_id, mFullName); + buddy_map_t::value_type value(mFullName, buddy_id); if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) { mMappable.insert(value); @@ -862,10 +860,8 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - gCacheName->getName(buddy_id, mFirst, mLast); - std::ostringstream fullname; - fullname << mFirst << " " << mLast; - buddy_map_t::value_type value(fullname.str(), buddy_id); + gCacheName->getFullName(buddy_id, mFullName); + buddy_map_t::value_type value(mFullName, buddy_id); if(buddy->isOnline()) { mOnline.insert(value); @@ -875,10 +871,8 @@ bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - gCacheName->getName(buddy_id, mFirst, mLast); - std::ostringstream fullname; - fullname << mFirst << " " << mLast; - buddy_map_t::value_type value(fullname.str(), buddy_id); + gCacheName->getFullName(buddy_id, mFullName); + buddy_map_t::value_type value(mFullName, buddy_id); if(buddy->isOnline()) { mOnline.insert(value); @@ -889,5 +883,3 @@ bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bud } return true; } - - -- cgit v1.2.3 From 397fe6691018f428fb21760ffa7114948904fdd5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Mar 2010 11:21:06 -0800 Subject: Fixed merge conflict with online/offline notifications --- indra/newview/llcallingcard.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/newview/llcallingcard.cpp') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 2b124118ca..b4c4ddcbf4 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -694,12 +694,11 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) setBuddyOnline(agent_id,online); if(chat_notify) { - std::string first, last; - if(gCacheName->getName(agent_id, first, last)) + std::string full_name; + if(gCacheName->getFullName(agent_id, full_name)) { notify = TRUE; - args["FIRST"] = first; - args["LAST"] = last; + args["NAME"] = full_name; } } } -- cgit v1.2.3 From e47249777b79d9c7576f5df010de92f9bbb4f999 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 20 May 2010 14:16:02 -0700 Subject: DEV-50013 Display names for online/offline notifications Reviewed with Leyla --- indra/newview/llcallingcard.cpp | 77 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'indra/newview/llcallingcard.cpp') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 36de46a367..645ff1f3e9 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -43,6 +43,7 @@ //#include #include "indra_constants.h" +#include "llavatarnamecache.h" #include "llcachename.h" #include "llstl.h" #include "lltimer.h" @@ -96,8 +97,10 @@ const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f; // static LLAvatarTracker LLAvatarTracker::sInstance; - - +static void on_avatar_name_cache_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + bool online, + LLSD payload); ///---------------------------------------------------------------------------- /// Class LLAvatarTracker @@ -681,8 +684,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) { tracking_id = mTrackingData->mAvatarID; } - BOOL notify = FALSE; - LLSD args; LLSD payload; for(S32 i = 0; i < count; ++i) { @@ -692,16 +693,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) if(info) { setBuddyOnline(agent_id,online); - if(chat_notify) - { - std::string full_name; - if(gCacheName->getFullName(agent_id, full_name)) - { - notify = TRUE; - args["NAME"] = full_name; - } - - } } else { @@ -717,29 +708,12 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) // *TODO: get actual inventory id gInventory.addChangedMask(LLInventoryObserver::CALLING_CARD, LLUUID::null); } - if(notify) + if(chat_notify) { - // Popup a notify box with online status of this agent - LLNotificationPtr notification; - - if (online) - { - notification = - LLNotificationsUtil::add("FriendOnline", - args, - payload.with("respond_on_mousedown", TRUE), - boost::bind(&LLAvatarActions::startIM, agent_id)); - } - else - { - notification = - LLNotificationsUtil::add("FriendOffline", args, payload); - } - - // If there's an open IM session with this agent, send a notification there too. - LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); - std::string notify_msg = notification->getMessage(); - LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); + // Look up the name of this agent for the notification + LLAvatarNameCache::get(agent_id, + boost::bind(&on_avatar_name_cache_notify, + _1, _2, online, payload)); } mModifyMask |= LLFriendObserver::ONLINE; @@ -748,6 +722,37 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) } } +static void on_avatar_name_cache_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + bool online, + LLSD payload) +{ + // Popup a notify box with online status of this agent + // Use display name only because this user is your friend + LLSD args; + args["NAME"] = av_name.mDisplayName; + + LLNotificationPtr notification; + if (online) + { + notification = + LLNotificationsUtil::add("FriendOnline", + args, + payload.with("respond_on_mousedown", TRUE), + boost::bind(&LLAvatarActions::startIM, agent_id)); + } + else + { + notification = + LLNotificationsUtil::add("FriendOffline", args, payload); + } + + // If there's an open IM session with this agent, send a notification there too. + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); + std::string notify_msg = notification->getMessage(); + LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); +} + void LLAvatarTracker::formFriendship(const LLUUID& id) { if(id.notNull()) -- cgit v1.2.3 From 216c7d3e9a200975a4bf80df33c0a36a1f82072f Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 25 May 2010 14:14:08 -0700 Subject: Mappable Buddies now using new LLAvatarNames reviewed by James --- indra/newview/llcallingcard.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcallingcard.cpp') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 645ff1f3e9..9d22ac0652 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -51,6 +51,7 @@ #include "message.h" #include "llagent.h" +#include "llavatarnamecache.h" #include "llbutton.h" #include "llinventoryobserver.h" #include "llinventorymodel.h" @@ -873,8 +874,9 @@ bool LLCollectProxyBuddies::operator()(const LLUUID& buddy_id, LLRelationship* b bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - gCacheName->getFullName(buddy_id, mFullName); - buddy_map_t::value_type value(mFullName, buddy_id); + LLAvatarName av_name; + LLAvatarNameCache::get( buddy_id, &av_name); + buddy_map_t::value_type value(av_name.mDisplayName, buddy_id); if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) { mMappable.insert(value); -- cgit v1.2.3 From abcdff128c85c5a1188da8e36510f249e5918899 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 26 May 2010 16:24:08 -0700 Subject: Resident Chooser fixes --- indra/newview/llcallingcard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcallingcard.cpp') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 9d22ac0652..7a1524b15e 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -897,7 +897,9 @@ bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - gCacheName->getFullName(buddy_id, mFullName); + LLAvatarName av_name; + LLAvatarNameCache::get(buddy_id, &av_name); + mFullName = av_name.mDisplayName; buddy_map_t::value_type value(mFullName, buddy_id); if(buddy->isOnline()) { -- 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcallingcard.cpp') 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 -- cgit v1.2.3 From bc7837a697bb1b9dac3bef9019dac1fcce2ffa0a Mon Sep 17 00:00:00 2001 From: leyla Date: Wed, 2 Jun 2010 11:23:02 -0700 Subject: notification fixes --- indra/newview/llcallingcard.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/newview/llcallingcard.cpp') diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 9937364bc6..1685562013 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -638,12 +638,9 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) { if((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MODIFY_OBJECTS) { - std::string name; LLSD args; - if(gCacheName->getFullName(agent_id, name)) - { - args["NAME"] = name; - } + args["NAME"] = LLSLURL("agent", agent_id, "displayname").getSLURLString(); + LLSD payload; payload["from_id"] = agent_id; if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights) -- cgit v1.2.3