Skip to content
Snippets Groups Projects
Commit e4724977 authored by James Cook's avatar James Cook
Browse files

DEV-50013 Display names for online/offline notifications

Reviewed with Leyla
parent 0df5c0e8
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
//#include <iterator> //#include <iterator>
#include "indra_constants.h" #include "indra_constants.h"
#include "llavatarnamecache.h"
#include "llcachename.h" #include "llcachename.h"
#include "llstl.h" #include "llstl.h"
#include "lltimer.h" #include "lltimer.h"
...@@ -96,8 +97,10 @@ const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f; ...@@ -96,8 +97,10 @@ const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f;
// static // static
LLAvatarTracker LLAvatarTracker::sInstance; LLAvatarTracker LLAvatarTracker::sInstance;
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
const LLAvatarName& av_name,
bool online,
LLSD payload);
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// Class LLAvatarTracker /// Class LLAvatarTracker
...@@ -681,8 +684,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) ...@@ -681,8 +684,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
{ {
tracking_id = mTrackingData->mAvatarID; tracking_id = mTrackingData->mAvatarID;
} }
BOOL notify = FALSE;
LLSD args;
LLSD payload; LLSD payload;
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
{ {
...@@ -692,16 +693,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) ...@@ -692,16 +693,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
if(info) if(info)
{ {
setBuddyOnline(agent_id,online); 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 else
{ {
...@@ -717,11 +708,31 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) ...@@ -717,11 +708,31 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
// *TODO: get actual inventory id // *TODO: get actual inventory id
gInventory.addChangedMask(LLInventoryObserver::CALLING_CARD, LLUUID::null); gInventory.addChangedMask(LLInventoryObserver::CALLING_CARD, LLUUID::null);
} }
if(notify) 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));
}
mModifyMask |= LLFriendObserver::ONLINE;
instance().notifyObservers();
gInventory.notifyObservers();
}
}
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 // Popup a notify box with online status of this agent
LLNotificationPtr notification; // Use display name only because this user is your friend
LLSD args;
args["NAME"] = av_name.mDisplayName;
LLNotificationPtr notification;
if (online) if (online)
{ {
notification = notification =
...@@ -742,12 +753,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) ...@@ -742,12 +753,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);
} }
mModifyMask |= LLFriendObserver::ONLINE;
instance().notifyObservers();
gInventory.notifyObservers();
}
}
void LLAvatarTracker::formFriendship(const LLUUID& id) void LLAvatarTracker::formFriendship(const LLUUID& id)
{ {
if(id.notNull()) if(id.notNull())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment