std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { if (!gCacheName) { // probably at the login screen, use short string for layout return LLTrans::getString("LoadingData"); } std::string agent_id_string = getIDStringFromUrl(url); if (agent_id_string.empty()) { // something went wrong, just give raw url return unescapeUrl(url); } LLUUID agent_id(agent_id_string); if (agent_id.isNull()) { return LLTrans::getString("AvatarNameNobody"); } LLAvatarName av_name; if (LLAvatarNameCache::get(agent_id, &av_name)) { return getName(av_name); } else { LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentCompleteName::onAvatarNameCache, this, _1, _2)); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } }
void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers) { if ( !speakers.isMap() ) return; if ( speakers.has("agent_info") && speakers["agent_info"].isMap() ) { LLSD::map_const_iterator speaker_it; for(speaker_it = speakers["agent_info"].beginMap(); speaker_it != speakers["agent_info"].endMap(); ++speaker_it) { LLUUID agent_id(speaker_it->first); LLPointer<LLSpeaker> speakerp = setSpeaker( agent_id, LLStringUtil::null, LLSpeaker::STATUS_TEXT_ONLY); if ( speaker_it->second.isMap() ) { BOOL is_moderator = speakerp->mIsModerator; speakerp->mIsModerator = speaker_it->second["is_moderator"]; speakerp->mModeratorMutedText = speaker_it->second["mutes"]["text"]; // Fire event only if moderator changed if ( is_moderator != speakerp->mIsModerator ) { LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl; fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator"); } } } } else if ( speakers.has("agents" ) && speakers["agents"].isArray() ) { //older, more decprecated way. Need here for //using older version of servers LLSD::array_const_iterator speaker_it; for(speaker_it = speakers["agents"].beginArray(); speaker_it != speakers["agents"].endArray(); ++speaker_it) { const LLUUID agent_id = (*speaker_it).asUUID(); LLPointer<LLSpeaker> speakerp = setSpeaker( agent_id, LLStringUtil::null, LLSpeaker::STATUS_TEXT_ONLY); } } }
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { if (!gCacheName) { // probably at the login screen, use short string for layout return LLTrans::getString("AvatarNameWaiting"); } std::string agent_id_string = getIDStringFromUrl(url); if (agent_id_string.empty()) { // something went wrong, just give raw url return unescapeUrl(url); } LLUUID agent_id(agent_id_string); if (agent_id.isNull()) { return LLTrans::getString("AvatarNameNobody"); } LLAvatarName av_name; if (LLAvatarNameCache::get(agent_id, &av_name)) { std::string label = av_name.getCompleteName(); // handle suffixes like /mute or /offerteleport label = localize_slapp_label(url, label); return label; } else { // <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..." //if (mAvatarNameCacheConnection.connected()) //{ // mAvatarNameCacheConnection.disconnect(); //} //mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); boost::signals2::connection connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); mAvatarNameCacheConnections.insert(std::make_pair(agent_id, connection)); // </FS:Ansariel> addObserver(agent_id_string, url, cb); return LLTrans::getString("AvatarNameWaiting"); } }
void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers) { if ( !speakers.isMap() ) return; if ( speakers.has("agent_info") && speakers["agent_info"].isMap() ) { LLSD::map_const_iterator speaker_it; for(speaker_it = speakers["agent_info"].beginMap(); speaker_it != speakers["agent_info"].endMap(); ++speaker_it) { LLUUID agent_id(speaker_it->first); LLPointer<LLSpeaker> speakerp = setSpeaker( agent_id, LLStringUtil::null, LLSpeaker::STATUS_TEXT_ONLY); if ( speaker_it->second.isMap() ) { speakerp->mIsModerator = speaker_it->second["is_moderator"]; speakerp->mModeratorMutedText = speaker_it->second["mutes"]["text"]; } } } else if ( speakers.has("agents" ) && speakers["agents"].isArray() ) { //older, more decprecated way. Need here for //using older version of servers LLSD::array_const_iterator speaker_it; for(speaker_it = speakers["agents"].beginArray(); speaker_it != speakers["agents"].endArray(); ++speaker_it) { const LLUUID agent_id = (*speaker_it).asUUID(); LLPointer<LLSpeaker> speakerp = setSpeaker( agent_id, LLStringUtil::null, LLSpeaker::STATUS_TEXT_ONLY); } } }
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { if (!gCacheName) { // probably at the login screen, use short string for layout return LLTrans::getString("LoadingData"); } std::string agent_id_string = getIDStringFromUrl(url); if (agent_id_string.empty()) { // something went wrong, just give raw url return unescapeUrl(url); } LLUUID agent_id(agent_id_string); if (agent_id.isNull()) { return LLTrans::getString("AvatarNameNobody"); } LLAvatarName av_name; if (LLAvatarNameCache::get(agent_id, &av_name)) { std::string label = av_name.getCompleteName(); // handle suffixes like /mute or /offerteleport label = localize_slapp_label(url, label); return label; } else { if (mAvatarNameCacheConnection.connected()) { mAvatarNameCacheConnection.disconnect(); } mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } }
void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) { if ( !update.isMap() ) return; if ( update.has("agent_updates") && update["agent_updates"].isMap() ) { LLSD::map_const_iterator update_it; for( update_it = update["agent_updates"].beginMap(); update_it != update["agent_updates"].endMap(); ++update_it) { LLUUID agent_id(update_it->first); LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id); LLSD agent_data = update_it->second; if (agent_data.isMap() && agent_data.has("transition")) { if (agent_data["transition"].asString() == "LEAVE" && speakerp.notNull()) { setSpeakerNotInChannel(speakerp); } else if (agent_data["transition"].asString() == "ENTER") { // add or update speaker speakerp = setSpeaker(agent_id); } else { llwarns << "bad membership list update " << ll_print_sd(agent_data["transition"]) << llendl; } } if (speakerp.isNull()) continue; // should have a valid speaker from this point on if (agent_data.isMap() && agent_data.has("info")) { LLSD agent_info = agent_data["info"]; if (agent_info.has("is_moderator")) { BOOL is_moderator = speakerp->mIsModerator; speakerp->mIsModerator = agent_info["is_moderator"]; // Fire event only if moderator changed if ( is_moderator != speakerp->mIsModerator ) fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator"); } if (agent_info.has("mutes")) { speakerp->mModeratorMutedText = agent_info["mutes"]["text"]; } } } } else if ( update.has("updates") && update["updates"].isMap() ) { LLSD::map_const_iterator update_it; for ( update_it = update["updates"].beginMap(); update_it != update["updates"].endMap(); ++update_it) { LLUUID agent_id(update_it->first); LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id); std::string agent_transition = update_it->second.asString(); if (agent_transition == "LEAVE" && speakerp.notNull()) { setSpeakerNotInChannel(speakerp); } else if ( agent_transition == "ENTER") { // add or update speaker speakerp = setSpeaker(agent_id); } else { llwarns << "bad membership list update " << agent_transition << llendl; } } } }
virtual void post( ResponsePtr responder, const LLSD& context, const LLSD& input) const { LLHost host(input["sender"].asString()); LLViewerRegionPtr region = LLWorld::getInstance()->getRegion(host); if( !region ) { return; } S32 target_index = input["body"]["Index"][0]["Prey"].asInteger(); S32 you_index = input["body"]["Index"][0]["You" ].asInteger(); LLDynamicArray<U32>* avatar_locs = ®ion->mMapAvatars; LLDynamicArray<LLUUID>* avatar_ids = ®ion->mMapAvatarIDs; avatar_locs->reset(); avatar_ids->reset(); //llinfos << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << llendl; //llinfos << "my agent id = " << gAgent.getID() << llendl; //llinfos << ll_pretty_print_sd(input) << llendl; LLSD locs = input["body"]["Location"], agents = input["body"]["AgentData"]; LLSD::array_iterator locs_it = locs.beginArray(), agents_it = agents.beginArray(); BOOL has_agent_data = input["body"].has("AgentData"); for(int i=0; locs_it != locs.endArray(); i++, locs_it++) { U8 x = locs_it->get("X").asInteger(), y = locs_it->get("Y").asInteger(), z = locs_it->get("Z").asInteger(); // treat the target specially for the map, and don't add you or the target if(i == target_index) { #if 0 LLVector3d global_pos(region->getOriginGlobal()); global_pos.mdV[VX] += (F64)x; global_pos.mdV[VY] += (F64)y; global_pos.mdV[VZ] += (F64)z * 4.0; LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos); #endif } else if( i != you_index) { U32 loc = x << 16 | y << 8 | z; loc = loc; U32 pos = 0x0; pos |= x; pos <<= 8; pos |= y; pos <<= 8; pos |= z; avatar_locs->put(pos); //llinfos << "next pos: " << x << "," << y << "," << z << ": " << pos << llendl; if(has_agent_data) // for backwards compatibility with old message format { LLUUID agent_id(agents_it->get("AgentID").asUUID()); //llinfos << "next agent: " << agent_id.asString() << llendl; avatar_ids->put(agent_id); } } if (has_agent_data) { agents_it++; } } }
void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) { if ( !update.isMap() ) return; if ( update.has("agent_updates") && update["agent_updates"].isMap() ) { LLSD::map_const_iterator update_it; for( update_it = update["agent_updates"].beginMap(); update_it != update["agent_updates"].endMap(); ++update_it) { LLUUID agent_id(update_it->first); LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id); LLSD agent_data = update_it->second; if (agent_data.isMap() && agent_data.has("transition")) { if (agent_data["transition"].asString() == "LEAVE" && speakerp.notNull()) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); } else if (agent_data["transition"].asString() == "ENTER") { // add or update speaker speakerp = setSpeaker(agent_id); } else { llwarns << "bad membership list update " << ll_print_sd(agent_data["transition"]) << llendl; } } if (speakerp.isNull()) continue; // should have a valid speaker from this point on if (agent_data.isMap() && agent_data.has("info")) { LLSD agent_info = agent_data["info"]; if (agent_info.has("is_moderator")) { speakerp->mIsModerator = agent_info["is_moderator"]; } if (agent_info.has("mutes")) { speakerp->mModeratorMutedText = agent_info["mutes"]["text"]; } } } } else if ( update.has("updates") && update["updates"].isMap() ) { LLSD::map_const_iterator update_it; for ( update_it = update["updates"].beginMap(); update_it != update["updates"].endMap(); ++update_it) { LLUUID agent_id(update_it->first); LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id); std::string agent_transition = update_it->second.asString(); if (agent_transition == "LEAVE" && speakerp.notNull()) { speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL; speakerp->mDotColor = INACTIVE_COLOR; speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT); } else if ( agent_transition == "ENTER") { // add or update speaker speakerp = setSpeaker(agent_id); } else { llwarns << "bad membership list update " << agent_transition << llendl; } } } }