// static void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void**) { LLUUID agent_id; LLUUID query_id; LLUUID avatar_id; std::string first_name; std::string last_name; msg->getUUID("AgentData", "AgentID", agent_id); msg->getUUID("AgentData", "QueryID", query_id); // Not for us if (agent_id != gAgent.getID()) return; // Dialog already closed LLFloaterAvatarPicker *self = sInstance; if (!self) return; // these are not results from our last request if (query_id != self->mQueryID) { return; } LLScrollListCtrl* search_results = self->getChild<LLScrollListCtrl>("SearchResults"); // clear "Searching" label on first results search_results->deleteAllItems(); self->mResultsReturned = TRUE; BOOL found_one = FALSE; S32 num_new_rows = msg->getNumberOfBlocks("Data"); for (S32 i = 0; i < num_new_rows; i++) { 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]"] = self->childGetText("Edit"); avatar_name = self->getString("not_found", map); search_results->setEnabled(FALSE); self->childDisable("Select"); } else { avatar_name = first_name + " " + last_name; search_results->setEnabled(TRUE); found_one = TRUE; } LLSD element; element["id"] = avatar_id; // value element["columns"][0]["value"] = avatar_name; element["columns"][0]["color"] = gColors.getColor("DefaultListText").getValue(); search_results->addElement(element); } if (found_one) { self->childEnable("Select"); search_results->selectFirstItem(); self->onList(search_results, self); search_results->setFocus(TRUE); } }
// static void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void**) { LLUUID agent_id; LLUUID query_id; LLUUID avatar_id; std::string first_name; std::string last_name; msg->getUUID("AgentData", "AgentID", agent_id); msg->getUUID("AgentData", "QueryID", query_id); // Not for us if (agent_id != gAgent.getID()) return; LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker"); // floater is closed or these are not results from our last request if (NULL == floater || query_id != floater->mQueryID) { return; } LLScrollListCtrl* search_results = floater->getChild<LLScrollListCtrl>("SearchResults"); // clear "Searching" label on first results if (floater->mNumResultsReturned++ == 0) { search_results->deleteAllItems(); } BOOL found_one = FALSE; S32 num_new_rows = msg->getNumberOfBlocks("Data"); for (S32 i = 0; i < num_new_rows; i++) { 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 { 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; } 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) { floater->getChildView("ok_btn")->setEnabled(TRUE); search_results->selectFirstItem(); floater->onList(); search_results->setFocus(TRUE); } }