summaryrefslogtreecommitdiff
path: root/indra/newview/llpathfindingobject.cpp
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-09-08 18:56:43 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-09-08 18:56:43 -0400
commit4091e47cf206a41cac7ee440b8fd2e2898006685 (patch)
tree61de24d7aa90171a5fb6481189567fe408d03786 /indra/newview/llpathfindingobject.cpp
parent81b9e29a1fe227c8f51c6a644b4e2e1afa6bcfb2 (diff)
parent09cd2a4b1a9f1ddf046fb0ce5d12988b968269a3 (diff)
DRTVWR-209 Merge of viewer-development with SH-3316 drano-http code.
cmake and other files didn't get moved over, do it by hand.
Diffstat (limited to 'indra/newview/llpathfindingobject.cpp')
-rw-r--r--indra/newview/llpathfindingobject.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/indra/newview/llpathfindingobject.cpp b/indra/newview/llpathfindingobject.cpp
index 916eceb4c8..858d3203c0 100644
--- a/indra/newview/llpathfindingobject.cpp
+++ b/indra/newview/llpathfindingobject.cpp
@@ -55,8 +55,10 @@ LLPathfindingObject::LLPathfindingObject()
mOwnerUUID(),
mHasOwnerName(false),
mOwnerName(),
+ mAvatarNameCacheConnection(),
mIsGroupOwned(false),
- mLocation()
+ mLocation(),
+ mOwnerNameSignal()
{
}
@@ -67,8 +69,10 @@ LLPathfindingObject::LLPathfindingObject(const std::string &pUUID, const LLSD &p
mOwnerUUID(),
mHasOwnerName(false),
mOwnerName(),
+ mAvatarNameCacheConnection(),
mIsGroupOwned(false),
- mLocation()
+ mLocation(),
+ mOwnerNameSignal()
{
parseObjectData(pObjectData);
}
@@ -80,14 +84,17 @@ LLPathfindingObject::LLPathfindingObject(const LLPathfindingObject& pOther)
mOwnerUUID(pOther.mOwnerUUID),
mHasOwnerName(false),
mOwnerName(),
+ mAvatarNameCacheConnection(),
mIsGroupOwned(pOther.mIsGroupOwned),
- mLocation(pOther.mLocation)
+ mLocation(pOther.mLocation),
+ mOwnerNameSignal()
{
fetchOwnerName();
}
LLPathfindingObject::~LLPathfindingObject()
{
+ disconnectAvatarNameCacheConnection();
}
LLPathfindingObject &LLPathfindingObject::operator =(const LLPathfindingObject& pOther)
@@ -115,6 +122,23 @@ std::string LLPathfindingObject::getOwnerName() const
return ownerName;
}
+LLPathfindingObject::name_connection_t LLPathfindingObject::registerOwnerNameListener(name_callback_t pOwnerNameCallback)
+{
+ llassert(hasOwner());
+
+ name_connection_t connection;
+ if (hasOwnerName())
+ {
+ pOwnerNameCallback(this);
+ }
+ else
+ {
+ connection = mOwnerNameSignal.connect(pOwnerNameCallback);
+ }
+
+ return connection;
+}
+
void LLPathfindingObject::parseObjectData(const LLSD &pObjectData)
{
llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD));
@@ -149,7 +173,7 @@ void LLPathfindingObject::fetchOwnerName()
mHasOwnerName = LLAvatarNameCache::get(mOwnerUUID, &mOwnerName);
if (!mHasOwnerName)
{
- LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2));
+ mAvatarNameCacheConnection = LLAvatarNameCache::get(mOwnerUUID, boost::bind(&LLPathfindingObject::handleAvatarNameFetch, this, _1, _2));
}
}
}
@@ -157,6 +181,19 @@ void LLPathfindingObject::fetchOwnerName()
void LLPathfindingObject::handleAvatarNameFetch(const LLUUID &pOwnerUUID, const LLAvatarName &pAvatarName)
{
llassert(mOwnerUUID == pOwnerUUID);
+
mOwnerName = pAvatarName;
mHasOwnerName = true;
+
+ disconnectAvatarNameCacheConnection();
+
+ mOwnerNameSignal(this);
+}
+
+void LLPathfindingObject::disconnectAvatarNameCacheConnection()
+{
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}