summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAlexanderP ProductEngine <apaschenko@productengine.com>2012-08-16 13:47:46 +0300
committerAlexanderP ProductEngine <apaschenko@productengine.com>2012-08-16 13:47:46 +0300
commit9a49dbcc456e1313750d5f8b127f29945f8d7ba9 (patch)
tree3433bfb7188af6ff51c03573ff4fc69416489868 /indra
parent3d2045877c07810188ecbd4aac14befea57ddfb3 (diff)
CHUI-299 (User can start IM session with themselves) FIXED: agent was excluded from the search results
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloateravatarpicker.cpp147
-rw-r--r--indra/newview/llfloateravatarpicker.h7
-rw-r--r--indra/newview/llimfloatercontainer.cpp2
3 files changed, 85 insertions, 71 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index 0290e7cdf0..47acdf7057 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -58,7 +58,8 @@ static std::map<LLUUID, LLAvatarName> sAvatarNameMap;
LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback,
BOOL allow_multiple,
- BOOL closeOnSelect)
+ BOOL closeOnSelect,
+ BOOL skip_agent)
{
// *TODO: Use a key to allow this not to be an effective singleton
LLFloaterAvatarPicker* floater =
@@ -73,6 +74,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback,
floater->setAllowMultiple(allow_multiple);
floater->mNearMeListComplete = FALSE;
floater->mCloseOnSelect = closeOnSelect;
+ floater->mExcludeAgentFromSearchResults = skip_agent;
if (!closeOnSelect)
{
@@ -581,35 +583,38 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
msg->getUUIDFast( _PREHASH_Data,_PREHASH_AvatarID, avatar_id, i);
msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, first_name, i);
msg->getStringFast(_PREHASH_Data,_PREHASH_LastName, last_name, i);
-
- std::string avatar_name;
- if (avatar_id.isNull())
- {
- LLStringUtil::format_map_t map;
- map["[TEXT]"] = floater->getChild<LLUICtrl>("Edit")->getValue().asString();
- avatar_name = floater->getString("not_found", map);
- search_results->setEnabled(FALSE);
- floater->getChildView("ok_btn")->setEnabled(FALSE);
- }
- else
+
+ if (avatar_id != agent_id || !floater->isExcludeAgentFromSearchResults()) // exclude agent from search results?
{
- avatar_name = LLCacheName::buildFullName(first_name, last_name);
- search_results->setEnabled(TRUE);
- found_one = TRUE;
+ std::string avatar_name;
+ if (avatar_id.isNull())
+ {
+ LLStringUtil::format_map_t map;
+ map["[TEXT]"] = floater->getChild<LLUICtrl>("Edit")->getValue().asString();
+ avatar_name = floater->getString("not_found", map);
+ search_results->setEnabled(FALSE);
+ floater->getChildView("ok_btn")->setEnabled(FALSE);
+ }
+ else
+ {
+ avatar_name = LLCacheName::buildFullName(first_name, last_name);
+ search_results->setEnabled(TRUE);
+ found_one = TRUE;
- LLAvatarName av_name;
- av_name.mLegacyFirstName = first_name;
- av_name.mLegacyLastName = last_name;
- av_name.mDisplayName = avatar_name;
- const LLUUID& agent_id = avatar_id;
- sAvatarNameMap[agent_id] = av_name;
+ LLAvatarName av_name;
+ av_name.mLegacyFirstName = first_name;
+ av_name.mLegacyLastName = last_name;
+ av_name.mDisplayName = avatar_name;
+ const LLUUID& agent_id = avatar_id;
+ sAvatarNameMap[agent_id] = av_name;
+ }
+ LLSD element;
+ element["id"] = avatar_id; // value
+ element["columns"][0]["column"] = "name";
+ element["columns"][0]["value"] = avatar_name;
+ search_results->addElement(element);
}
- LLSD element;
- element["id"] = avatar_id; // value
- element["columns"][0]["column"] = "name";
- element["columns"][0]["value"] = avatar_name;
- search_results->addElement(element);
}
if (found_one)
@@ -624,52 +629,58 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& content)
{
// Check for out-of-date query
- if (query_id != mQueryID) return;
+ if (query_id == mQueryID)
+ {
+ LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("SearchResults");
- LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("SearchResults");
+ LLSD agents = content["agents"];
+
+ // clear "Searching" label on first results
+ search_results->deleteAllItems();
- LLSD agents = content["agents"];
- if (agents.size() == 0)
- {
- LLStringUtil::format_map_t map;
- map["[TEXT]"] = childGetText("Edit");
LLSD item;
- item["id"] = LLUUID::null;
- item["columns"][0]["column"] = "name";
- item["columns"][0]["value"] = getString("not_found", map);
- search_results->addElement(item);
- search_results->setEnabled(false);
- getChildView("ok_btn")->setEnabled(false);
- return;
- }
+ LLSD::array_const_iterator it = agents.beginArray();
+ for ( ; it != agents.endArray(); ++it)
+ {
+ const LLSD& row = *it;
+ if (row["id"].asUUID() != gAgent.getID() || !mExcludeAgentFromSearchResults)
+ {
+ item["id"] = row["id"];
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "name";
+ columns[0]["value"] = row["display_name"];
+ columns[1]["column"] = "username";
+ columns[1]["value"] = row["username"];
+ search_results->addElement(item);
+
+ // add the avatar name to our list
+ LLAvatarName avatar_name;
+ avatar_name.fromLLSD(row);
+ sAvatarNameMap[row["id"].asUUID()] = avatar_name;
+ }
+ }
- // clear "Searching" label on first results
- search_results->deleteAllItems();
-
- LLSD item;
- LLSD::array_const_iterator it = agents.beginArray();
- for ( ; it != agents.endArray(); ++it)
- {
- const LLSD& row = *it;
- item["id"] = row["id"];
- LLSD& columns = item["columns"];
- columns[0]["column"] = "name";
- columns[0]["value"] = row["display_name"];
- columns[1]["column"] = "username";
- columns[1]["value"] = row["username"];
- search_results->addElement(item);
-
- // add the avatar name to our list
- LLAvatarName avatar_name;
- avatar_name.fromLLSD(row);
- sAvatarNameMap[row["id"].asUUID()] = avatar_name;
- }
-
- getChildView("ok_btn")->setEnabled(true);
- search_results->setEnabled(true);
- search_results->selectFirstItem();
- onList();
- search_results->setFocus(TRUE);
+ if (search_results->isEmpty())
+ {
+ LLStringUtil::format_map_t map;
+ map["[TEXT]"] = childGetText("Edit");
+ LLSD item;
+ item["id"] = LLUUID::null;
+ item["columns"][0]["column"] = "name";
+ item["columns"][0]["value"] = getString("not_found", map);
+ search_results->addElement(item);
+ search_results->setEnabled(false);
+ getChildView("ok_btn")->setEnabled(false);
+ }
+ else
+ {
+ getChildView("ok_btn")->setEnabled(true);
+ search_results->setEnabled(true);
+ search_results->selectFirstItem();
+ onList();
+ search_results->setFocus(TRUE);
+ }
+ }
}
//static
diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h
index 96c039443a..7067cd7b3e 100644
--- a/indra/newview/llfloateravatarpicker.h
+++ b/indra/newview/llfloateravatarpicker.h
@@ -45,7 +45,8 @@ public:
// Call this to select an avatar.
static LLFloaterAvatarPicker* show(select_callback_t callback,
BOOL allow_multiple = FALSE,
- BOOL closeOnSelect = FALSE);
+ BOOL closeOnSelect = FALSE,
+ BOOL skip_agent = FALSE);
LLFloaterAvatarPicker(const LLSD& key);
virtual ~LLFloaterAvatarPicker();
@@ -63,6 +64,7 @@ public:
std::string& tooltip_msg);
void openFriendsTab();
+ BOOL isExcludeAgentFromSearchResults() {return mExcludeAgentFromSearchResults;}
private:
void editKeystroke(class LLLineEditor* caller, void* user_data);
@@ -88,9 +90,10 @@ private:
virtual BOOL handleKeyHere(KEY key, MASK mask);
LLUUID mQueryID;
- int mNumResultsReturned;
+ int mNumResultsReturned;
BOOL mNearMeListComplete;
BOOL mCloseOnSelect;
+ BOOL mExcludeAgentFromSearchResults;
validate_signal_t mOkButtonValidateSignal;
select_callback_t mSelectionCallback;
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 6b7912205e..1e136b721c 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -414,7 +414,7 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width)
void LLIMFloaterContainer::onAddButtonClicked()
{
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE);
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE);
LLFloater* root_floater = gFloaterView->getParentFloater(this);
if (picker && root_floater)
{