Skip to content
Snippets Groups Projects
Commit c06742b2 authored by Denis Serdjuk's avatar Denis Serdjuk
Browse files

fixed Bug Low EXT-4732 Group invitation is broken for offline avatars

Cause:
gObjectList does contain offline avatars and panel could get avatar name and fill the list
Solution:
This situation is possible only for offline friend, therefore extra avatartracker search has been added.

--HG--
branch : product-engine
parent 8b609519
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "llagent.h" #include "llagent.h"
#include "llfloateravatarpicker.h" #include "llfloateravatarpicker.h"
#include "llbutton.h" #include "llbutton.h"
#include "llcallingcard.h"
#include "llcombobox.h" #include "llcombobox.h"
#include "llgroupactions.h" #include "llgroupactions.h"
#include "llgroupmgr.h" #include "llgroupmgr.h"
...@@ -405,16 +406,13 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) ...@@ -405,16 +406,13 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids)
{ {
LLUUID agent_id = agent_ids[i]; LLUUID agent_id = agent_ids[i];
LLViewerObject* dest = gObjectList.findObject(agent_id); LLViewerObject* dest = gObjectList.findObject(agent_id);
std::string fullname;
if(dest && dest->isAvatar()) if(dest && dest->isAvatar())
{ {
std::string fullname;
LLSD args;
LLNameValue* nvfirst = dest->getNVPair("FirstName"); LLNameValue* nvfirst = dest->getNVPair("FirstName");
LLNameValue* nvlast = dest->getNVPair("LastName"); LLNameValue* nvlast = dest->getNVPair("LastName");
if(nvfirst && nvlast) if(nvfirst && nvlast)
{ {
args["FIRST"] = std::string(nvfirst->getString());
args["LAST"] = std::string(nvlast->getString());
fullname = std::string(nvfirst->getString()) + " " + std::string(nvlast->getString()); fullname = std::string(nvfirst->getString()) + " " + std::string(nvlast->getString());
} }
if (!fullname.empty()) if (!fullname.empty())
...@@ -427,10 +425,44 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids) ...@@ -427,10 +425,44 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids)
names.push_back("(Unknown)"); names.push_back("(Unknown)");
} }
} }
else
{
//looks like user try to invite offline friend
//for offline avatar_id gObjectList.findObject() will return null
//so we need to do this additional search in avatar tracker, see EXT-4732
if (LLAvatarTracker::instance().isBuddy(agent_id))
{
if (!gCacheName->getFullName(agent_id, fullname))
{
// actually it should happen, just in case
gCacheName->get(LLUUID(agent_id), false, boost::bind(
&LLPanelGroupInvite::addUserCallback, this, _1, _2,
_3));
// for this special case!
//when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence
// removed id will be added in callback
agent_ids.erase(agent_ids.begin() + i);
}
else
{
names.push_back(fullname);
}
}
}
} }
mImplementation->addUsers(names, agent_ids); mImplementation->addUsers(names, agent_ids);
} }
void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const std::string& first_name, const std::string& last_name)
{
std::vector<std::string> names;
std::vector<LLUUID> agent_ids;
std::string full_name = first_name + " " + last_name;
agent_ids.push_back(id);
names.push_back(first_name + " " + last_name);
mImplementation->addUsers(names, agent_ids);
}
void LLPanelGroupInvite::draw() void LLPanelGroupInvite::draw()
{ {
LLPanel::draw(); LLPanel::draw();
......
...@@ -43,6 +43,10 @@ class LLPanelGroupInvite ...@@ -43,6 +43,10 @@ class LLPanelGroupInvite
~LLPanelGroupInvite(); ~LLPanelGroupInvite();
void addUsers(std::vector<LLUUID>& agent_ids); void addUsers(std::vector<LLUUID>& agent_ids);
/**
* this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers().
*/
void addUserCallback(const LLUUID& id, const std::string& first_name, const std::string& last_name);
void clear(); void clear();
void update(); void update();
......
...@@ -233,6 +233,10 @@ class LLDebugBeacon ...@@ -233,6 +233,10 @@ class LLDebugBeacon
extern LLViewerObjectList gObjectList; extern LLViewerObjectList gObjectList;
// Inlines // Inlines
/**
* Note:
* it will return NULL for offline avatar_id
*/
inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id)
{ {
std::map<LLUUID, LLPointer<LLViewerObject> >::iterator iter = mUUIDObjectMap.find(id); std::map<LLUUID, LLPointer<LLViewerObject> >::iterator iter = mUUIDObjectMap.find(id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment