Update/Modernize LLAvatarName and LLAvatarNameCache and _EVERYTHING_ they touch
Fairly certain this adds the feature in which the user may click the online notification to open a chat with the user coming online. Translators may want to look at the xml changes of this change to see what to update Removes old LegacyMultiAttachmentSupport patch Moves LLAvatarName-centric functions into LLAvatarName from elsewhere. Adds boost::signals2::connections to name polling places. Removes more old icky static callbacks Merge from Alchemy, credit where due~ Update notifications.xml to have a bunch of the tags from upstream to ease diffing
This commit is contained in:
@@ -38,35 +38,29 @@
|
||||
|
||||
#include "llcallingcard.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
//#include <iterator>
|
||||
|
||||
#include "indra_constants.h"
|
||||
#include "llcachename.h"
|
||||
//#include "llcachename.h"
|
||||
#include "llstl.h"
|
||||
#include "lltimer.h"
|
||||
#include "lluuid.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llbutton.h"
|
||||
//#include "llinventory.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llinventoryobserver.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llnotifications.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llimview.h"
|
||||
#include "lltrans.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llviewernetwork.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llimview.h"
|
||||
#include "llimpanel.h"
|
||||
#include "llavatarname.h"
|
||||
#include "llavatarnamecache.h"
|
||||
|
||||
///----------------------------------------------------------------------------
|
||||
/// Local function declarations, constants, enums, and typedefs
|
||||
@@ -111,8 +105,6 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id,
|
||||
LLAvatarTracker::LLAvatarTracker() :
|
||||
mTrackingData(NULL),
|
||||
mTrackedAgentValid(false),
|
||||
//mInventory(NULL),
|
||||
//mInventoryObserver(NULL),
|
||||
mModifyMask(0x0)
|
||||
{
|
||||
}
|
||||
@@ -121,7 +113,9 @@ LLAvatarTracker::~LLAvatarTracker()
|
||||
{
|
||||
deleteTrackingData();
|
||||
std::for_each(mObservers.begin(), mObservers.end(), DeletePointer());
|
||||
mObservers.clear();
|
||||
std::for_each(mBuddyInfo.begin(), mBuddyInfo.end(), DeletePairedPointer());
|
||||
mBuddyInfo.clear();
|
||||
}
|
||||
|
||||
void LLAvatarTracker::track(const LLUUID& avatar_id, const std::string& name)
|
||||
@@ -184,13 +178,13 @@ LLVector3d LLAvatarTracker::getGlobalPos()
|
||||
if(!mTrackedAgentValid || !mTrackingData) return LLVector3d();
|
||||
LLVector3d global_pos;
|
||||
|
||||
LLVOAvatar* avatarp = gObjectList.findAvatar(mTrackingData->mAvatarID);
|
||||
if(avatarp && !avatarp->isDead())
|
||||
LLVOAvatar* av = gObjectList.findAvatar(mTrackingData->mAvatarID);
|
||||
if(av && !av->isDead())
|
||||
{
|
||||
global_pos = avatarp->getPositionGlobal();
|
||||
global_pos = av->getPositionGlobal();
|
||||
// HACK - for making the tracker point above the avatar's head
|
||||
// rather than its groin
|
||||
global_pos.mdV[VZ] += 0.7f * (avatarp->mBodySize.mV[VZ] + avatarp->mAvatarOffset.mV[VZ]);
|
||||
global_pos.mdV[VZ] += 0.7f * (av->mBodySize.mV[VZ] + av->mAvatarOffset.mV[VZ]);
|
||||
|
||||
mTrackingData->mGlobalPositionEstimate = global_pos;
|
||||
}
|
||||
@@ -210,10 +204,10 @@ void LLAvatarTracker::getDegreesAndDist(F32& rot,
|
||||
|
||||
LLVector3d global_pos;
|
||||
|
||||
LLVOAvatar* avatarp = gObjectList.findAvatar(mTrackingData->mAvatarID);
|
||||
if(avatarp && !avatarp->isDead())
|
||||
LLViewerObject* object = gObjectList.findObject(mTrackingData->mAvatarID);
|
||||
if(object && !object->isDead())
|
||||
{
|
||||
global_pos = avatarp->getPositionGlobal();
|
||||
global_pos = object->getPositionGlobal();
|
||||
mTrackingData->mGlobalPositionEstimate = global_pos;
|
||||
}
|
||||
else
|
||||
@@ -272,7 +266,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds)
|
||||
<< ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline")
|
||||
<< ", TO: " << mBuddyInfo[agent_id]->getRightsGrantedTo()
|
||||
<< ", FROM: " << mBuddyInfo[agent_id]->getRightsGrantedFrom()
|
||||
<< llendl;
|
||||
<< LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -282,7 +276,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds)
|
||||
<< " [" << (e_r->isOnline() ? "Online" : "Offline") << "->" << (n_r->isOnline() ? "Online" : "Offline")
|
||||
<< ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo()
|
||||
<< ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo()
|
||||
<< "]" << llendl;
|
||||
<< "]" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
notifyObservers();
|
||||
@@ -315,6 +309,7 @@ void LLAvatarTracker::terminateBuddy(const LLUUID& id)
|
||||
msg->nextBlock("ExBlock");
|
||||
msg->addUUID("OtherID", id);
|
||||
gAgent.sendReliableMessage();
|
||||
|
||||
addChangedMask(LLFriendObserver::REMOVE, id);
|
||||
delete buddy;
|
||||
}
|
||||
@@ -345,7 +340,7 @@ void LLAvatarTracker::setBuddyOnline(const LLUUID& id, bool is_online)
|
||||
else
|
||||
{
|
||||
llwarns << "!! No buddy info found for " << id
|
||||
<< ", setting to " << (is_online ? "Online" : "Offline") << llendl;
|
||||
<< ", setting to " << (is_online ? "Online" : "Offline") << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +457,7 @@ void LLAvatarTracker::findAgent()
|
||||
msg->nextBlockFast(_PREHASH_AgentBlock);
|
||||
msg->addUUIDFast(_PREHASH_Hunter, gAgentID);
|
||||
msg->addUUIDFast(_PREHASH_Prey, mTrackingData->mAvatarID);
|
||||
msg->addU32Fast(_PREHASH_SpaceIP, 0); // will get filled in by simulator
|
||||
msg->addIPAddrFast(_PREHASH_SpaceIP, 0); // will get filled in by simulator // <alchemy/>
|
||||
msg->nextBlockFast(_PREHASH_LocationBlock);
|
||||
const F64 NO_LOCATION = 0.0;
|
||||
msg->addF64Fast(_PREHASH_GlobalX, NO_LOCATION);
|
||||
@@ -640,20 +635,40 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg)
|
||||
{
|
||||
std::string fullname;
|
||||
LLSD args;
|
||||
if (LLAvatarNameCache::getPNSName(agent_id, fullname))
|
||||
if (LLAvatarNameCache::getNSName(agent_id, fullname))
|
||||
args["NAME"] = fullname;
|
||||
|
||||
LLSD payload;
|
||||
payload["from_id"] = agent_id;
|
||||
if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights)
|
||||
{
|
||||
LLNotificationsUtil::add("GrantedModifyRights",args, payload);
|
||||
LLNotifications::instance().add("GrantedModifyRights",args, payload);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("RevokedModifyRights",args, payload);
|
||||
LLNotifications::instance().add("RevokedModifyRights",args, payload);
|
||||
}
|
||||
}
|
||||
// <Alchemy>
|
||||
if ((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MAP_LOCATION)
|
||||
{
|
||||
std::string fullname;
|
||||
LLSD args;
|
||||
if (LLAvatarNameCache::getNSName(agent_id, fullname))
|
||||
args["NAME"] = fullname;
|
||||
|
||||
LLSD payload;
|
||||
payload["from_id"] = agent_id;
|
||||
if (LLRelationship::GRANT_MAP_LOCATION & new_rights)
|
||||
{
|
||||
LLNotifications::instance().add("GrantedMapRights", args, payload);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotifications::instance().add("RevokedMapRights", args, payload);
|
||||
}
|
||||
}
|
||||
// </Alchemy>
|
||||
(mBuddyInfo[agent_id])->setRightsFrom(new_rights);
|
||||
}
|
||||
}
|
||||
@@ -697,7 +712,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
|
||||
else
|
||||
{
|
||||
llwarns << "Received online notification for unknown buddy: "
|
||||
<< agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << llendl;
|
||||
<< agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << LL_ENDL;
|
||||
}
|
||||
|
||||
if(tracking_id == agent_id)
|
||||
@@ -711,9 +726,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
|
||||
if(chat_notify)
|
||||
{
|
||||
// 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));
|
||||
LLAvatarNameCache::get(agent_id,boost::bind(&on_avatar_name_cache_notify,_1, _2, online, payload));
|
||||
}
|
||||
|
||||
mModifyMask |= LLFriendObserver::ONLINE;
|
||||
@@ -729,22 +742,33 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id,
|
||||
{
|
||||
// Popup a notify box with online status of this agent
|
||||
// Use display name only because this user is your friend
|
||||
std::string name;
|
||||
LLAvatarNameCache::getPNSName(av_name, name);
|
||||
LLSD args;
|
||||
args["NAME"] = name;
|
||||
args["NAME"] = av_name.getNSName();
|
||||
args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus");
|
||||
|
||||
// Popup a notify box with online status of this agent
|
||||
LLNotificationPtr notification = LLNotificationsUtil::add(online ? "FriendOnline" : "FriendOffline", args, payload);
|
||||
LLNotificationPtr notification;
|
||||
if (online)
|
||||
{
|
||||
notification =
|
||||
LLNotifications::instance().add("FriendOnlineOffline",
|
||||
args,
|
||||
payload,
|
||||
boost::bind(&LLAvatarActions::startIM, agent_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
notification =
|
||||
LLNotifications::instance().add("FriendOnlineOffline", 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);
|
||||
LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id);
|
||||
if (floater)
|
||||
if (LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(session_id))
|
||||
{
|
||||
std::string notifyMsg = notification->getMessage();
|
||||
if (!notifyMsg.empty())
|
||||
floater->addHistoryLine(notifyMsg,gSavedSettings.getColor4("SystemChatColor"));
|
||||
std::string notify_msg = notification->getMessage();
|
||||
if (!notify_msg.empty())
|
||||
floater->addHistoryLine(notify_msg, gSavedSettings.getColor4("SystemChatColor"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,7 +836,7 @@ void LLTrackingData::agentFound(const LLUUID& prey,
|
||||
if(prey != mAvatarID)
|
||||
{
|
||||
llwarns << "LLTrackingData::agentFound() - found " << prey
|
||||
<< " but looking for " << mAvatarID << llendl;
|
||||
<< " but looking for " << mAvatarID << LL_ENDL;
|
||||
}
|
||||
mHaveInfo = true;
|
||||
mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
|
||||
@@ -821,8 +845,8 @@ void LLTrackingData::agentFound(const LLUUID& prey,
|
||||
|
||||
bool LLTrackingData::haveTrackingInfo()
|
||||
{
|
||||
LLVOAvatar* avatarp = gObjectList.findAvatar(mAvatarID);
|
||||
if(avatarp && !avatarp->isDead())
|
||||
LLViewerObject* object = gObjectList.findObject(mAvatarID);
|
||||
if(object && !object->isDead())
|
||||
{
|
||||
mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY);
|
||||
mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
|
||||
@@ -876,7 +900,7 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship
|
||||
{
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get( buddy_id, &av_name);
|
||||
buddy_map_t::value_type value(av_name.mDisplayName, buddy_id);
|
||||
buddy_map_t::value_type value(av_name.getDisplayName(), buddy_id);
|
||||
if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION))
|
||||
{
|
||||
mMappable.insert(value);
|
||||
@@ -898,7 +922,9 @@ bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship*
|
||||
const S32& friend_name_system();
|
||||
bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy)
|
||||
{
|
||||
LLAvatarNameCache::getPNSName(buddy_id, mFullName, friend_name_system());
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get(buddy_id, &av_name);
|
||||
mFullName = av_name.getNSName(friend_name_system());
|
||||
buddy_map_t::value_type value(mFullName, buddy_id);
|
||||
if(buddy->isOnline())
|
||||
{
|
||||
@@ -910,5 +936,3 @@ bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bud
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user