void lggBeamMaps::updateBeamChat(const LLVector3d& currentPos) { static LLCachedControl<bool> FSParticleChat(gSavedSettings, "FSParticleChat"); if (FSParticleChat) { if (!mPartsNow) { mPartsNow = true; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgentID); msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, "start"); msg->addU8Fast(_PREHASH_Type, 0); msg->addS32("Channel", 9000); gAgent.sendReliableMessage(); } if ((mBeamLastAt - currentPos).length() > .2f) { mBeamLastAt = currentPos; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgentID); msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, llformat("<%.6f, %.6f, %.6f>",(F32)(mBeamLastAt.mdV[VX]), (F32)(mBeamLastAt.mdV[VY]), (F32)(mBeamLastAt.mdV[VZ]))); msg->addU8Fast(_PREHASH_Type, 0); msg->addS32("Channel", 9000); // *TODO: make configurable gAgent.sendReliableMessage(); } } }
void LLPanelFriends::FriendImportState(LLUUID id, bool accepted) { std::string importstate = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "friendimportstate.dat"); if(LLFile::isfile(importstate)) { llifstream importer(importstate); LLSD data; LLSDSerialize::fromXMLDocument(data, importer); if(!data.has(id.asString()))return; LLSD user = data[id.asString()]; if(accepted) { BOOL can_map = user["can_map"].asBoolean(); BOOL can_mod = user["can_mod"].asBoolean(); BOOL see_online = user["see_online"].asBoolean(); S32 rights = 0; if(can_map)rights |= LLRelationship::GRANT_MAP_LOCATION; if(can_mod)rights |= LLRelationship::GRANT_MODIFY_OBJECTS; if(see_online)rights |= LLRelationship::GRANT_ONLINE_STATUS; if(is_agent_friend(id))//is this legit shit yo { const LLRelationship* friend_status = LLAvatarTracker::instance().getBuddyInfo(id); if(friend_status) { S32 tr = friend_status->getRightsGrantedTo(); if(tr != rights) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_GrantUserRights); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUID(_PREHASH_AgentID, gAgent.getID()); msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Rights); msg->addUUID(_PREHASH_AgentRelated, id); msg->addS32(_PREHASH_RelatedRights, rights); gAgent.sendReliableMessage(); } } } } data.erase(id.asString());//if they declined then we need to forget about it, if they accepted it is done llofstream export_file; export_file.open(importstate); LLSDSerialize::toPrettyXML(data, export_file); export_file.close(); } }
bool LLViewerInventoryCategory::fetchDescendents() { // <edit> if((mUUID == gLocalInventoryRoot) || (gInventory.isObjectDescendentOf(mUUID, gLocalInventoryRoot))) return false; // </edit> if((VERSION_UNKNOWN == mVersion) && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads. { const F32 FETCH_TIMER_EXPIRY = 10.0f; mDescendentsRequested.reset(); mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); // bitfield // 1 = by date // 2 = folders by date // Need to mask off anything but the first bit. // This comes from LLInventoryFilter from llfolderview.h U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; std::string url = gAgent.getCapability("agent/inventory"); // OGPX : was WebFetchInventoryDescendents if (url.empty()) //OGPX : agent/inventory Capability not found on agent domain. See if the region has one. { LL_INFOS_ONCE("fetchDescendents") << " agent/inventory not on AD, checking fallback to region " << LL_ENDL; //OGPX url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); } if (!url.empty()) //Capability found. Build up LLSD and use it. { LLInventoryModel::startBackgroundFetch(mUUID); } else { //Deprecated, but if we don't have a capability, use the old system. LL_INFOS_ONCE("fetchDescendents") << "WebFetchInventoryDescendents or agent/inventory capability not found. Using deprecated UDP message." << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessage("FetchInventoryDescendents"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("InventoryData"); msg->addUUID("FolderID", mUUID); msg->addUUID("OwnerID", mOwnerID); msg->addS32("SortOrder", sort_order); msg->addBOOL("FetchFolders", FALSE); msg->addBOOL("FetchItems", TRUE); gAgent.sendReliableMessage(); } return true; } return false; }
//<FS:TS> FIRE-787: break up too long chat lines into multiple messages // This function just sends the message, with no other processing. Moved out // of send_chat_from_viewer. void really_send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) { LLMessageSystem* msg = gMessageSystem; // <FS:ND> gMessageSystem can be 0, not sure how it is exactly to reproduce, maybe during viewer shutdown? if (!msg) { return; } // </FS:ND> if (channel >= 0) { msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, utf8_out_text); msg->addU8Fast(_PREHASH_Type, type); msg->addS32("Channel", channel); } else { msg->newMessage("ScriptDialogReply"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("Data"); msg->addUUID("ObjectID", gAgent.getID()); msg->addS32("ChatChannel", channel); msg->addS32("ButtonIndex", 0); msg->addString("ButtonLabel", utf8_out_text); } gAgent.sendReliableMessage(); }
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, utf8_out_text); msg->addU8Fast(_PREHASH_Type, type); msg->addS32("Channel", channel); gAgent.sendReliableMessage(); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); }
bool LLViewerInventoryCategory::fetchDescendents() { // <edit> if((mUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return false; // </edit> if (VERSION_UNKNOWN == mVersion && (!mDescendentsRequested.getStarted() || mDescendentsRequested.hasExpired())) // Expired check prevents multiple downloads. { const F32 FETCH_TIMER_EXPIRY = 10.0f; mDescendentsRequested.start(FETCH_TIMER_EXPIRY); // bitfield // 1 = by date // 2 = folders by date // Need to mask off anything but the first bit. // This comes from LLInventoryFilter from llfolderview.h U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); if (!url.empty()) //Capability found. Build up LLSD and use it. { LLInventoryModel::startBackgroundFetch(mUUID); } else { //Deprecated, but if we don't have a capability, use the old system. //llinfos << "FetchInventoryDescendents capability not found. Using deprecated UDP message." << llendl; LLMessageSystem* msg = gMessageSystem; msg->newMessage("FetchInventoryDescendents"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("InventoryData"); msg->addUUID("FolderID", mUUID); msg->addUUID("OwnerID", mOwnerID); msg->addS32("SortOrder", sort_order); msg->addBOOL("FetchFolders", FALSE); msg->addBOOL("FetchItems", TRUE); gAgent.sendReliableMessage(); } return true; } return false; }
void LLPanelClassified::sendClassifiedInfoUpdate() { // If we don't have a classified id yet, we'll need to generate one, // otherwise we'll keep overwriting classified_id 00000 in the database. if (mClassifiedID.isNull()) { // TODO: Don't do this on the client. mClassifiedID.generate(); } LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ClassifiedInfoUpdate); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Data); msg->addUUIDFast(_PREHASH_ClassifiedID, mClassifiedID); // TODO: fix this U32 category = mCategoryCombo->getCurrentIndex() + 1; msg->addU32Fast(_PREHASH_Category, category); msg->addStringFast(_PREHASH_Name, mNameEditor->getText()); msg->addStringFast(_PREHASH_Desc, mDescEditor->getText()); // fills in on simulator if null msg->addUUIDFast(_PREHASH_ParcelID, mParcelID); // fills in on simulator if null msg->addU32Fast(_PREHASH_ParentEstate, 0); msg->addUUIDFast(_PREHASH_SnapshotID, mSnapshotCtrl->getImageAssetID()); msg->addVector3dFast(_PREHASH_PosGlobal, mPosGlobal); BOOL mature = mMatureCombo->getCurrentIndex() == MATURE_CONTENT; BOOL auto_renew = FALSE; if (mAutoRenewCheck) { auto_renew = mAutoRenewCheck->get(); } // These flags doesn't matter here. const bool adult_enabled = false; const bool is_pg = false; U8 flags = pack_classified_flags_request(auto_renew, is_pg, mature, adult_enabled); msg->addU8Fast(_PREHASH_ClassifiedFlags, flags); msg->addS32("PriceForListing", mPriceForListing); gAgent.sendReliableMessage(); mDirty = false; }
void LLMuteList::updateAdd(const LLMute& mute) { // Update the database LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_UpdateMuteListEntry); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MuteData); msg->addUUIDFast(_PREHASH_MuteID, mute.mID); msg->addStringFast(_PREHASH_MuteName, mute.mName); msg->addS32("MuteType", mute.mType); msg->addU32("MuteFlags", mute.mFlags); gAgent.sendReliableMessage(); mIsLoaded = TRUE; // why is this here? -MG }
// static void LLFloaterAuction::onClickOK(void* data) { LLFloaterAuction* self = (LLFloaterAuction*)(data); if(self->mImageID.notNull()) { LLSD parcel_name = self->childGetValue("parcel_text"); // create the asset std::string* name = new std::string(parcel_name.asString()); gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_TGA, &auction_tga_upload_done, (void*)name, FALSE); self->getWindow()->incBusyCount(); std::string* j2c_name = new std::string(parcel_name.asString()); gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_TEXTURE, &auction_j2c_upload_done, (void*)j2c_name, FALSE); self->getWindow()->incBusyCount(); LLNotifyBox::showXml("UploadingAuctionSnapshot"); } LLMessageSystem* msg = gMessageSystem; msg->newMessage("ViewerStartAuction"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("ParcelData"); msg->addS32("LocalID", self->mParcelID); msg->addUUID("SnapshotID", self->mImageID); msg->sendReliable(self->mParcelHost); // clean up floater, and get out self->mImageID.setNull(); self->mImage = NULL; self->mParcelID = -1; self->mParcelHost.invalidate(); self->close(); }
void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 rights) { if(!avatar_id.isNull()) { LLMessageSystem* msg = gMessageSystem; // setup message header msg->newMessageFast(_PREHASH_GrantUserRights); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUID(_PREHASH_AgentID, gAgent.getID()); msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_Rights); msg->addUUID(_PREHASH_AgentRelated, avatar_id); msg->addS32(_PREHASH_RelatedRights, rights); gAgent.sendReliableMessage(); } }
// Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e bool rlvSendChatReply(S32 nChannel, const std::string& strReply) { if (!rlvIsValidReplyChannel(nChannel)) return false; // Copy/paste from send_chat_from_viewer() LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, strReply); msg->addU8Fast(_PREHASH_Type, CHAT_TYPE_SHOUT); msg->addS32("Channel", nChannel); gAgent.sendReliableMessage(); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); return true; }
void LLPanelPick::sendPickInfoUpdate() { // If we don't have a pick id yet, we'll need to generate one, // otherwise we'll keep overwriting pick_id 00000 in the database. if (mPickID.isNull()) { mPickID.generate(); } LLMessageSystem* msg = gMessageSystem; msg->newMessage("PickInfoUpdate"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("Data"); msg->addUUID("PickID", mPickID); msg->addUUID("CreatorID", mCreatorID); msg->addBOOL("TopPick", mTopPick); // fills in on simulator if null msg->addUUID("ParcelID", mParcelID); msg->addString("Name", mNameEditor->getText()); msg->addString("Desc", mDescEditor->getText()); msg->addUUID("SnapshotID", mSnapshotCtrl->getImageAssetID()); msg->addVector3d("PosGlobal", mPosGlobal); // Only top picks have a sort order S32 sort_order; if (mTopPick) { sort_order = atoi(mSortOrderEditor->getText().c_str()); } else { sort_order = 0; } msg->addS32("SortOrder", sort_order); msg->addBOOL("Enabled", mEnabledCheck->get()); gAgent.sendReliableMessage(); }
void lggBeamMaps::stopBeamChat() { if(gSavedSettings.getBOOL("EmeraldParticleChat")) { if(sPartsNow != FALSE) { sPartsNow = FALSE; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, "stop"); msg->addU8Fast(_PREHASH_Type, 0); msg->addS32("Channel", 9000); gAgent.sendReliableMessage(); sBeamLastAt = LLVector3d::zero; } } }
void lggBeamMaps::stopBeamChat() { static LLCachedControl<bool> FSParticleChat(gSavedSettings, "FSParticleChat"); if (FSParticleChat) { if (mPartsNow) { mPartsNow = false; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgentID); msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, "stop"); msg->addU8Fast(_PREHASH_Type, 0); msg->addS32("Channel", 9000); gAgent.sendReliableMessage(); mBeamLastAt = LLVector3d::zero; } } }
void LLMuteList::updateAdd(const LLMute& mute) { // External mutes (e.g. Avaline callers) are local only, don't send them to the server. if (mute.mType == LLMute::EXTERNAL) { return; } // Update the database LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_UpdateMuteListEntry); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_MuteData); msg->addUUIDFast(_PREHASH_MuteID, mute.mID); msg->addStringFast(_PREHASH_MuteName, mute.mName); msg->addS32("MuteType", mute.mType); msg->addU32("MuteFlags", mute.mFlags); gAgent.sendReliableMessage(); mIsLoaded = TRUE; // why is this here? -MG }
void LLFloaterFriends::sendRightsGrant(rights_map_t& ids) { if (ids.empty()) return; LLMessageSystem* msg = gMessageSystem; // setup message header msg->newMessageFast(_PREHASH_GrantUserRights); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUID(_PREHASH_AgentID, gAgent.getID()); msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); rights_map_t::iterator id_it; rights_map_t::iterator end_it = ids.end(); for(id_it = ids.begin(); id_it != end_it; ++id_it) { msg->nextBlockFast(_PREHASH_Rights); msg->addUUID(_PREHASH_AgentRelated, id_it->first); msg->addS32(_PREHASH_RelatedRights, id_it->second); } mNumRightsChanged = ids.size(); gAgent.sendReliableMessage(); }
void LLPanelDirLand::performQuery() { LLMessageSystem* msg = gMessageSystem; setupNewSearch(); // We could change the UI to allow arbitrary combinations of these options U32 search_type = ST_ALL; const std::string& type = childGetValue("type").asString(); if(!type.empty()) { if (FIND_AUCTION == type) search_type = ST_AUCTION; else if(FIND_MAINLANDSALES == type) search_type = ST_MAINLAND; else if(FIND_ESTATESALES == type) search_type = ST_ESTATE; } U32 query_flags = 0x0; if (gAgent.mAccess <= SIM_ACCESS_PG) query_flags |= DFQ_PG_SIMS_ONLY; const std::string& rating = childGetValue("rating").asString(); if (rating == PG_ONLY) { query_flags |= DFQ_PG_SIMS_ONLY; } else if (rating == MATURE_ONLY) { query_flags |= DFQ_MATURE_SIMS_ONLY; } LLScrollListCtrl* list = (LLScrollListCtrl*)getChildByName("results"); if (list) { std::string sort_name = list->getSortColumnName(); BOOL sort_asc = list->getSortAscending(); if (sort_name == "name") { query_flags |= DFQ_NAME_SORT; } else if (sort_name == "price") { query_flags |= DFQ_PRICE_SORT; } else if (sort_name == "per_meter") { query_flags |= DFQ_PER_METER_SORT; } else if (sort_name == "area") { query_flags |= DFQ_AREA_SORT; } if (sort_asc) { query_flags |= DFQ_SORT_ASC; } } if (childGetValue("pricecheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_PRICE; } if (childGetValue("areacheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_AREA; } msg->newMessage("DirLandQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", getSearchID()); msg->addU32("QueryFlags", query_flags); msg->addU32("SearchType", search_type); msg->addS32("Price", childGetValue("priceedit").asInteger()); msg->addS32("Area", childGetValue("areaedit").asInteger()); msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); gAgent.sendReliableMessage(); }
// void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) | Modified: RLVa-0.2.2a void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel) // [/RLVa:KB] { // [RLVa:KB] - Checked: 2009-08-05 (RLVa-1.0.1e) | Modified: RLVa-1.0.1e // Only process chat messages (ie not CHAT_TYPE_START, CHAT_TYPE_STOP, etc) if ( (rlv_handler_t::isEnabled()) && ( (CHAT_TYPE_WHISPER == type) || (CHAT_TYPE_NORMAL == type) || (CHAT_TYPE_SHOUT == type) ) ) { if (0 == channel) { // (We already did this before, but LLChatHandler::handle() calls this directly) if ( ((CHAT_TYPE_SHOUT == type) || (CHAT_TYPE_NORMAL == type)) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATNORMAL)) ) type = CHAT_TYPE_WHISPER; else if ( (CHAT_TYPE_SHOUT == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATSHOUT)) ) type = CHAT_TYPE_NORMAL; else if ( (CHAT_TYPE_WHISPER == type) && (gRlvHandler.hasBehaviour(RLV_BHVR_CHATWHISPER)) ) type = CHAT_TYPE_NORMAL; // Redirect chat if needed if ( ( (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE)) ) && (gRlvHandler.redirectChatOrEmote(utf8_out_text)) ) ) { return; } // Filter public chat if sendchat restricted (and filter anything that redirchat didn't redirect) if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT)) ) gRlvHandler.filterChat(utf8_out_text, true); } else { // Don't allow chat on a non-public channel if sendchannel restricted (unless the channel is an exception) if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHANNEL)) && (!gRlvHandler.isException(RLV_BHVR_SENDCHANNEL, channel)) ) return; // Don't allow chat on debug channel if @sendchat, @redirchat or @rediremote restricted (shows as public chat on viewers) if (channel >= CHAT_CHANNEL_DEBUG) { bool fIsEmote = rlvIsEmote(utf8_out_text); if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT)) || ((!fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIRCHAT))) || ((fIsEmote) && (gRlvHandler.hasBehaviour(RLV_BHVR_REDIREMOTE))) ) { return; } } } } // [/RLVa:KB] LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ChatFromViewer); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ChatData); msg->addStringFast(_PREHASH_Message, utf8_out_text); msg->addU8Fast(_PREHASH_Type, type); msg->addS32("Channel", channel); gAgent.sendReliableMessage(); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); }
void FSRadar::updateRadarList() { //Configuration LLWorld* world = LLWorld::getInstance(); LLMuteList* mutelist = LLMuteList::getInstance(); FSWSAssetBlacklist* blacklist = FSWSAssetBlacklist::getInstance(); static const F32 chat_range_say = LFSimFeatureHandler::getInstance()->sayRange(); static const F32 chat_range_shout = LFSimFeatureHandler::getInstance()->shoutRange(); static const std::string str_chat_entering = LLTrans::getString("entering_chat_range"); static const std::string str_chat_leaving = LLTrans::getString("leaving_chat_range"); static const std::string str_draw_distance_entering = LLTrans::getString("entering_draw_distance"); static const std::string str_draw_distance_leaving = LLTrans::getString("leaving_draw_distance"); static const std::string str_region_entering = LLTrans::getString("entering_region"); static const std::string str_region_entering_distance = LLTrans::getString("entering_region_distance"); static const std::string str_region_leaving = LLTrans::getString("leaving_region"); static const std::string str_avatar_age_alert = LLTrans::getString("avatar_age_alert"); static LLCachedControl<bool> RadarReportChatRangeEnter(gSavedSettings, "RadarReportChatRangeEnter"); static LLCachedControl<bool> RadarReportChatRangeLeave(gSavedSettings, "RadarReportChatRangeLeave"); static LLCachedControl<bool> RadarReportDrawRangeEnter(gSavedSettings, "RadarReportDrawRangeEnter"); static LLCachedControl<bool> RadarReportDrawRangeLeave(gSavedSettings, "RadarReportDrawRangeLeave"); static LLCachedControl<bool> RadarReportSimRangeEnter(gSavedSettings, "RadarReportSimRangeEnter"); static LLCachedControl<bool> RadarReportSimRangeLeave(gSavedSettings, "RadarReportSimRangeLeave"); static LLCachedControl<bool> RadarEnterChannelAlert(gSavedSettings, "RadarEnterChannelAlert"); static LLCachedControl<bool> RadarLeaveChannelAlert(gSavedSettings, "RadarLeaveChannelAlert"); static LLCachedControl<bool> RadarAvatarAgeAlert(gSavedSettings, "RadarAvatarAgeAlert"); static LLCachedControl<F32> nearMeRange(gSavedSettings, "NearMeRange"); static LLCachedControl<bool> limitRange(gSavedSettings, "LimitRadarByRange"); static LLCachedControl<F32> RenderFarClip(gSavedSettings, "RenderFarClip"); static LLCachedControl<bool> sFSLegacyRadarFriendColoring(gSavedSettings, "FSLegacyRadarFriendColoring"); static LLCachedControl<bool> sRadarColorNamesByDistance(gSavedSettings, "FSRadarColorNamesByDistance", false); static LLCachedControl<bool> RadarShowMutedAndDerendered(gSavedSettings, "FSRadarShowMutedAndDerendered"); static LLCachedControl<bool> sFSRadarEnhanceByBridge(gSavedSettings, "FSRadarEnhanceByBridge"); bool sUseLSLBridge = FSLSLBridge::instance().canUseBridge(); F32 drawRadius(RenderFarClip); const LLVector3d& posSelf = gAgent.getPositionGlobal(); LLViewerRegion* own_reg = gAgent.getRegion(); LLUUID regionSelf; if (own_reg) { regionSelf = own_reg->getRegionID(); } bool alertScripts = mRadarAlertRequest; // save the current value, so it doesn't get changed out from under us by another thread time_t now = time(NULL); //STEP 0: Clear model data mRadarEnterAlerts.clear(); mRadarLeaveAlerts.clear(); mRadarOffsetRequests.clear(); mRadarEntriesData.clear(); mAvatarStats.clear(); //STEP 1: Update our basic data model: detect Avatars & Positions in our defined range std::vector<LLVector3d> positions; uuid_vec_t avatar_ids; if (limitRange) { world->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), nearMeRange); } else { world->getAvatars(&avatar_ids, &positions); } // Determine lists of new added and removed avatars uuid_vec_t current_vec, added_vec, removed_vec; uuid_vec_t::iterator vec_it_end; entry_map_t::iterator em_it_end = mEntryList.end(); current_vec.reserve(mEntryList.size()); for (entry_map_t::iterator em_it = mEntryList.begin(); em_it != em_it_end; ++em_it) { current_vec.push_back(em_it->first); } LLCommonUtils::computeDifference(avatar_ids, current_vec, added_vec, removed_vec); // Remove old avatars from our list vec_it_end = removed_vec.end(); for (uuid_vec_t::iterator it = removed_vec.begin(); it != vec_it_end; ++it) { LLUUID avid = *it; entry_map_t::iterator found = mEntryList.find(avid); if (found != mEntryList.end()) { delete found->second; mEntryList.erase(found); } } // Add new avatars vec_it_end = added_vec.end(); for (uuid_vec_t::iterator it = added_vec.begin(); it != vec_it_end; ++it) { LLUUID avid = *it; mEntryList[avid] = new FSRadarEntry(avid); } LLLocalSpeakerMgr::getInstance()->update(TRUE); //STEP 2: Transform detected model list data into more flexible multimap data structure; //TS: Count avatars in chat range and in the same region U32 inChatRange = 0; U32 inSameRegion = 0; std::vector<LLVector3d>::const_iterator pos_it = positions.begin(), pos_end = positions.end(); uuid_vec_t::const_iterator item_it = avatar_ids.begin(), item_end = avatar_ids.end(); for (;pos_it != pos_end && item_it != item_end; ++pos_it, ++item_it) { // //2a. For each detected av, gather up all data we would want to display or use to drive alerts // LLUUID avId = static_cast<LLUUID>(*item_it); LLVector3d avPos = static_cast<LLVector3d>(*pos_it); if (avId == gAgentID) { continue; } // Skip modelling this avatar if its basic data is either inaccessible, or it's a dummy placeholder FSRadarEntry* ent = getEntry(avId); LLViewerRegion *reg = world->getRegionFromPosGlobal(avPos); if (!ent) // don't update this radar listing if data is inaccessible { continue; } // Try to get the avatar's viewer object - we will need it anyway later LLVOAvatar* avVo = (LLVOAvatar*)gObjectList.findObject(avId); static LLUICachedControl<bool> showdummyav("FSShowDummyAVsinRadar"); if (!showdummyav) { if (avVo && avVo->mIsDummy) { continue; } } bool is_muted = mutelist->isMuted(avId); bool is_blacklisted = blacklist->isBlacklisted(avId, LLAssetType::AT_OBJECT); bool should_be_ignored = is_muted || is_blacklisted; ent->mIgnore = should_be_ignored; if (!RadarShowMutedAndDerendered && should_be_ignored) { continue; } LLUUID avRegion; if (reg) { avRegion = reg->getRegionID(); } bool isInSameRegion = (avRegion == regionSelf); S32 seentime = (S32)difftime(now, ent->mFirstSeen); S32 hours = (S32)(seentime / 3600); S32 mins = (S32)((seentime - hours * 3600) / 60); S32 secs = (S32)((seentime - hours * 3600 - mins * 60)); std::string avSeenStr = llformat("%d:%02d:%02d", hours, mins, secs); S32 avStatusFlags = ent->mStatus; ERadarPaymentInfoFlag avFlag = FSRADAR_PAYMENT_INFO_NONE; if (avStatusFlags & AVATAR_TRANSACTED) { avFlag = FSRADAR_PAYMENT_INFO_USED; } else if (avStatusFlags & AVATAR_IDENTIFIED) { avFlag = FSRADAR_PAYMENT_INFO_FILLED; } S32 avAge = ent->mAge; std::string avName = ent->mName; U32 lastZOffsetTime = ent->mLastZOffsetTime; F32 avZOffset = ent->mZOffset; if (avPos[VZ] == AVATAR_UNKNOWN_Z_OFFSET) // if our official z position is AVATAR_UNKNOWN_Z_OFFSET, we need a correction. { // set correction if we have it if (avZOffset > 0.1f) { avPos[VZ] = avZOffset; } //schedule offset requests, if needed if (sUseLSLBridge && sFSRadarEnhanceByBridge && (now > (mRadarLastBulkOffsetRequestTime + FSRADAR_COARSE_OFFSET_INTERVAL)) && (now > lastZOffsetTime + FSRADAR_COARSE_OFFSET_INTERVAL)) { mRadarOffsetRequests.push_back(avId); ent->mLastZOffsetTime = now; } } F32 avRange = (avPos[VZ] != AVATAR_UNKNOWN_Z_OFFSET ? dist_vec(avPos, posSelf) : AVATAR_UNKNOWN_RANGE); ent->mRange = avRange; ent->mGlobalPos = avPos; ent->mRegion = avRegion; // //2b. Process newly detected avatars // radarfields_map_t::iterator last_sweep_found_it = mLastRadarSweep.find(avId); if (last_sweep_found_it == mLastRadarSweep.end()) { // chat alerts if (RadarReportChatRangeEnter && (avRange <= chat_range_say) && avRange > AVATAR_UNKNOWN_RANGE) { LLStringUtil::format_map_t args; args["DISTANCE"] = llformat("%3.2f", avRange); std::string message = formatString(str_chat_entering, args); make_ui_sound("UISndRadarChatEnter"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } if (RadarReportDrawRangeEnter && (avRange <= drawRadius) && avRange > AVATAR_UNKNOWN_RANGE) { LLStringUtil::format_map_t args; args["DISTANCE"] = llformat("%3.2f", avRange); std::string message = formatString(str_draw_distance_entering, args); make_ui_sound("UISndRadarDrawEnter"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } if (RadarReportSimRangeEnter && isInSameRegion) { make_ui_sound("UISndRadarSimEnter"); // <FS:PP> FIRE-6069: Radar alerts sounds if (avRange != AVATAR_UNKNOWN_RANGE) // Don't report an inaccurate range in localchat, if the true range is not known. { LLStringUtil::format_map_t args; args["DISTANCE"] = llformat("%3.2f", avRange); std::string message = formatString(str_region_entering_distance, args); LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } else { LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_region_entering)); } } if (RadarEnterChannelAlert || (alertScripts)) { // Autodetect Phoenix chat UUID compatibility. // If Leave channel alerts are not set, restrict reports to same-sim only. if (!RadarLeaveChannelAlert) { if (isInSameRegion) { mRadarEnterAlerts.push_back(avId); } } else { mRadarEnterAlerts.push_back(avId); } } } // // 2c. Process previously detected avatars // else { RadarFields rf = last_sweep_found_it->second; if (RadarReportChatRangeEnter || RadarReportChatRangeLeave) { if (RadarReportChatRangeEnter && (avRange <= chat_range_say && avRange > AVATAR_UNKNOWN_RANGE) && (rf.lastDistance > chat_range_say || rf.lastDistance == AVATAR_UNKNOWN_RANGE)) { LLStringUtil::format_map_t args; args["DISTANCE"] = llformat("%3.2f", avRange); std::string message = formatString(str_chat_entering, args); make_ui_sound("UISndRadarChatEnter"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } else if (RadarReportChatRangeLeave && (avRange > chat_range_say || avRange == AVATAR_UNKNOWN_RANGE) && (rf.lastDistance <= chat_range_say && rf.lastDistance > AVATAR_UNKNOWN_RANGE)) { make_ui_sound("UISndRadarChatLeave"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_chat_leaving)); } } if (RadarReportDrawRangeEnter || RadarReportDrawRangeLeave) { if (RadarReportDrawRangeEnter && (avRange <= drawRadius && avRange > AVATAR_UNKNOWN_RANGE) && (rf.lastDistance > drawRadius || rf.lastDistance == AVATAR_UNKNOWN_RANGE)) { LLStringUtil::format_map_t args; args["DISTANCE"] = llformat("%3.2f", avRange); std::string message = formatString(str_draw_distance_entering, args); make_ui_sound("UISndRadarDrawEnter"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } else if (RadarReportDrawRangeLeave && (avRange > drawRadius || avRange == AVATAR_UNKNOWN_RANGE) && (rf.lastDistance <= drawRadius && rf.lastDistance > AVATAR_UNKNOWN_RANGE)) { make_ui_sound("UISndRadarDrawLeave"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_draw_distance_leaving)); } } if (RadarReportSimRangeEnter || RadarReportSimRangeLeave) { if (RadarReportSimRangeEnter && isInSameRegion && avRegion != rf.lastRegion && rf.lastRegion.notNull()) { make_ui_sound("UISndRadarSimEnter"); // <FS:PP> FIRE-6069: Radar alerts sounds if (avRange != AVATAR_UNKNOWN_RANGE) // Don't report an inaccurate range in localchat, if the true range is not known. { LLStringUtil::format_map_t args; args["DISTANCE"] = llformat("%3.2f", avRange); std::string message = formatString(str_region_entering_distance, args); LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } else { LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_region_entering)); } } else if (RadarReportSimRangeLeave && rf.lastRegion == regionSelf && !isInSameRegion && avRegion.notNull()) { make_ui_sound("UISndRadarSimLeave"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_region_leaving)); } } //If we were manually asked to update an external source for all existing avatars, add them to the queue. if (alertScripts) { mRadarEnterAlerts.push_back(avId); } } // //2d. Prepare data for presentation view for this avatar // if (isInSameRegion) { inSameRegion++; } LLSD entry; LLSD entry_options; entry["id"] = avId; entry["name"] = avName; entry["in_region"] = isInSameRegion; entry["flags"] = avFlag; entry["seen"] = avSeenStr; entry["range"] = (avRange > AVATAR_UNKNOWN_RANGE ? llformat("%3.2f", avRange) : llformat(">%3.2f", drawRadius)); entry["typing"] = (avVo && avVo->isTyping()); entry["sitting"] = (avVo && (avVo->getParent() || avVo->isMotionActive(ANIM_AGENT_SIT_GROUND) || avVo->isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED))); entry["has_notes"] = ent->hasNotes(); if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { entry["age"] = (avAge > -1 ? llformat("%d", avAge) : ""); if (ent->hasAlertAge()) { entry_options["age_color"] = LLUIColorTable::instance().getColor("AvatarListItemAgeAlert", LLColor4::red).get().getValue(); if (RadarAvatarAgeAlert && !ent->hasAgeAlertPerformed()) { make_ui_sound("UISndRadarAgeAlert"); LLStringUtil::format_map_t args; args["AGE"] = llformat("%d", avAge); std::string message = formatString(str_avatar_age_alert, args); LLAvatarNameCache::get(avId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, message)); } ent->mAgeAlertPerformed = true; } } else { entry["age"] = "---"; } //AO: Set any range colors / styles LLUIColor range_color; if (avRange > AVATAR_UNKNOWN_RANGE) { if (avRange <= chat_range_say) { range_color = LLUIColorTable::instance().getColor("AvatarListItemChatRange", LLColor4::red); inChatRange++; } else if (avRange <= chat_range_shout) { range_color = LLUIColorTable::instance().getColor("AvatarListItemShoutRange", LLColor4::white); } else { range_color = LLUIColorTable::instance().getColor("AvatarListItemBeyondShoutRange", LLColor4::white); } } else { range_color = LLUIColorTable::instance().getColor("AvatarListItemBeyondShoutRange", LLColor4::white); } entry_options["range_color"] = range_color.get().getValue(); // Check if avatar is in draw distance and a VOAvatar instance actually exists if (avRange <= drawRadius && avRange > AVATAR_UNKNOWN_RANGE && avVo) { entry_options["range_style"] = LLFontGL::BOLD; } else { entry_options["range_style"] = LLFontGL::NORMAL; } // Set friends colors / styles LLFontGL::StyleFlags nameCellStyle = LLFontGL::NORMAL; const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(avId); if (relation && !sFSLegacyRadarFriendColoring && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { nameCellStyle = (LLFontGL::StyleFlags)(nameCellStyle | LLFontGL::BOLD); } if (is_muted) { nameCellStyle = (LLFontGL::StyleFlags)(nameCellStyle | LLFontGL::ITALIC); } entry_options["name_style"] = nameCellStyle; LLUIColor name_color = LLUIColorTable::instance().getColor("AvatarListItemIconDefaultColor", LLColor4::white); name_color = LGGContactSets::getInstance()->colorize(avId, (sRadarColorNamesByDistance ? range_color : name_color), LGG_CS_RADAR); if (LGGContactSets::getInstance()->hasFriendColorThatShouldShow(avId, LGG_CS_RADAR)) { name_color = LGGContactSets::getInstance()->getFriendColor(avId); } entry_options["name_color"] = name_color.get().getValue(); // Voice power level indicator LLVoiceClient* voice_client = LLVoiceClient::getInstance(); if (voice_client->voiceEnabled() && voice_client->isVoiceWorking()) { LLSpeaker* speaker = LLLocalSpeakerMgr::getInstance()->findSpeaker(avId); if (speaker && speaker->isInVoiceChannel()) { EVoicePowerLevel power_level = voice_client->getPowerLevel(avId); switch (power_level) { case VPL_PTT_Off: entry["voice_level_icon"] = "Radar_VoicePTT_Off"; break; case VPL_PTT_On: entry["voice_level_icon"] = "Radar_VoicePTT_On"; break; case VPL_Level1: entry["voice_level_icon"] = "Radar_VoicePTT_Lvl1"; break; case VPL_Level2: entry["voice_level_icon"] = "Radar_VoicePTT_Lvl2"; break; case VPL_Level3: entry["voice_level_icon"] = "Radar_VoicePTT_Lvl3"; break; default: break; } } } // Save data for our listeners LLSD entry_data; entry_data["entry"] = entry; entry_data["options"] = entry_options; mRadarEntriesData.push_back(entry_data); } // End STEP 2, all model/presentation row processing complete. // //STEP 3, process any bulk actions that require the whole model to be known first // // //3a. dispatch requests for ZOffset updates, working around minimap's inaccurate height // if (mRadarOffsetRequests.size() > 0) { static const std::string prefix = "getZOffsets|"; std::string msg = ""; U32 updatesPerRequest = 0; while (mRadarOffsetRequests.size() > 0) { LLUUID avId = mRadarOffsetRequests.back(); mRadarOffsetRequests.pop_back(); msg = llformat("%s%s,", msg.c_str(), avId.asString().c_str()); if (++updatesPerRequest > FSRADAR_MAX_OFFSET_REQUESTS) { msg = msg.substr(0, msg.size() - 1); FSLSLBridgeRequestResponder* responder = new FSLSLBridgeRequestRadarPosResponder(); FSLSLBridge::instance().viewerToLSL(prefix + msg, responder); //LL_INFOS() << " OFFSET REQUEST SEGMENT"<< prefix << msg << LL_ENDL; msg = ""; updatesPerRequest = 0; } } if (updatesPerRequest > 0) { msg = msg.substr(0, msg.size() - 1); FSLSLBridgeRequestResponder* responder = new FSLSLBridgeRequestRadarPosResponder(); FSLSLBridge::instance().viewerToLSL(prefix + msg, responder); //LL_INFOS() << " OFFSET REQUEST FINAL " << prefix << msg << LL_ENDL; } // clear out the dispatch queue mRadarOffsetRequests.clear(); mRadarLastBulkOffsetRequestTime = now; } // //3b: process alerts for avatars that where here last frame, but gone this frame (ie, they left) // as well as dispatch all earlier detected alerts for crossing range thresholds. // radarfields_map_t::iterator rf_it_end = mLastRadarSweep.end(); for (radarfields_map_t::iterator i = mLastRadarSweep.begin(); i != rf_it_end; ++i) { LLUUID prevId = i->first; RadarFields rf = i->second; if ((RadarShowMutedAndDerendered || !rf.lastIgnore) && mEntryList.find(prevId) == mEntryList.end()) { if (RadarReportChatRangeLeave && (rf.lastDistance <= chat_range_say) && rf.lastDistance > AVATAR_UNKNOWN_RANGE) { make_ui_sound("UISndRadarChatLeave"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(prevId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_chat_leaving)); } if (RadarReportDrawRangeLeave && (rf.lastDistance <= drawRadius) && rf.lastDistance > AVATAR_UNKNOWN_RANGE) { make_ui_sound("UISndRadarDrawLeave"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(prevId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_draw_distance_leaving)); } if (RadarReportSimRangeLeave && (rf.lastRegion == regionSelf || rf.lastRegion.isNull())) { make_ui_sound("UISndRadarSimLeave"); // <FS:PP> FIRE-6069: Radar alerts sounds LLAvatarNameCache::get(prevId, boost::bind(&FSRadar::radarAlertMsg, this, _1, _2, str_region_leaving)); } if (RadarLeaveChannelAlert) { mRadarLeaveAlerts.push_back(prevId); } } } static LLCachedControl<S32> RadarAlertChannel(gSavedSettings, "RadarAlertChannel"); U32 num_entering = mRadarEnterAlerts.size(); if (num_entering > 0) { mRadarFrameCount++; S32 chan(RadarAlertChannel); U32 num_this_pass = llmin(FSRADAR_MAX_AVATARS_PER_ALERT, num_entering); std::string msg = llformat("%d,%d", mRadarFrameCount, num_this_pass); U32 loop = 0; while (loop < num_entering) { for (S32 i = 0; i < num_this_pass; i++) { msg = llformat("%s,%s", msg.c_str(), mRadarEnterAlerts[loop + i].asString().c_str()); } LLMessageSystem* msgs = gMessageSystem; msgs->newMessage("ScriptDialogReply"); msgs->nextBlock("AgentData"); msgs->addUUID("AgentID", gAgent.getID()); msgs->addUUID("SessionID", gAgent.getSessionID()); msgs->nextBlock("Data"); msgs->addUUID("ObjectID", gAgent.getID()); msgs->addS32("ChatChannel", chan); msgs->addS32("ButtonIndex", 1); msgs->addString("ButtonLabel", msg.c_str()); gAgent.sendReliableMessage(); loop += num_this_pass; num_this_pass = llmin(FSRADAR_MAX_AVATARS_PER_ALERT, num_entering - loop); msg = llformat("%d,%d", mRadarFrameCount, num_this_pass); } } U32 num_leaving = mRadarLeaveAlerts.size(); if (num_leaving > 0) { mRadarFrameCount++; S32 chan(RadarAlertChannel); U32 num_this_pass = llmin(FSRADAR_MAX_AVATARS_PER_ALERT, num_leaving); std::string msg = llformat("%d,-%d", mRadarFrameCount, llmin(FSRADAR_MAX_AVATARS_PER_ALERT, num_leaving)); U32 loop = 0; while (loop < num_leaving) { for (S32 i = 0; i < num_this_pass; i++) { msg = llformat("%s,%s", msg.c_str(), mRadarLeaveAlerts[loop + i].asString().c_str()); } LLMessageSystem* msgs = gMessageSystem; msgs->newMessage("ScriptDialogReply"); msgs->nextBlock("AgentData"); msgs->addUUID("AgentID", gAgent.getID()); msgs->addUUID("SessionID", gAgent.getSessionID()); msgs->nextBlock("Data"); msgs->addUUID("ObjectID", gAgent.getID()); msgs->addS32("ChatChannel", chan); msgs->addS32("ButtonIndex", 1); msgs->addString("ButtonLabel", msg.c_str()); gAgent.sendReliableMessage(); loop += num_this_pass; num_this_pass = llmin(FSRADAR_MAX_AVATARS_PER_ALERT, num_leaving - loop); msg = llformat("%d,-%d", mRadarFrameCount, num_this_pass); } } // reset any active alert requests if (alertScripts) { mRadarAlertRequest = false; } // //STEP 4: Cache our current model data, so we can compare it with the next fresh group of model data for fast change detection. // mLastRadarSweep.clear(); em_it_end = mEntryList.end(); for (entry_map_t::iterator em_it = mEntryList.begin(); em_it != em_it_end; ++em_it) { FSRadarEntry* ent = em_it->second; RadarFields rf; rf.lastDistance = ent->mRange; rf.lastIgnore = ent->mIgnore; rf.lastRegion = LLUUID::null; if (ent->mGlobalPos != LLVector3d(0.0f, 0.0f, 0.0f)) { LLViewerRegion* lastRegion = world->getRegionFromPosGlobal(ent->mGlobalPos); if (lastRegion) { rf.lastRegion = lastRegion->getRegionID(); } } mLastRadarSweep[ent->mID] = rf; } // //STEP 5: Final data updates and notification of subscribers // mAvatarStats["total"] = llformat("%d", mLastRadarSweep.size() - 1); mAvatarStats["region"] = llformat("%d", inSameRegion); mAvatarStats["chatrange"] = llformat("%d", inChatRange); checkTracking(); // Inform our subscribers about updates if (!mUpdateSignal.empty()) { mUpdateSignal(mRadarEntriesData, mAvatarStats); } }
void LLPanelDirLand::performQuery() { BOOL inc_pg = childGetValue("incpg").asBoolean(); BOOL inc_mature = childGetValue("incmature").asBoolean(); BOOL inc_adult = childGetValue("incadult").asBoolean(); if (!(inc_pg || inc_mature || inc_adult)) { LLNotifyBox::showXml("NoContentToSearch"); return; } LLMessageSystem* msg = gMessageSystem; setupNewSearch(); // We could change the UI to allow arbitrary combinations of these options U32 search_type = ST_ALL; const std::string& type = childGetValue("type").asString(); if(!type.empty()) { if (FIND_AUCTION == type) search_type = ST_AUCTION; else if(FIND_MAINLANDSALES == type) search_type = ST_MAINLAND; else if(FIND_ESTATESALES == type) search_type = ST_ESTATE; } U32 query_flags = 0x0; if (gAgent.wantsPGOnly()) query_flags |= DFQ_PG_SIMS_ONLY; bool adult_enabled = gAgent.canAccessAdult(); bool mature_enabled = gAgent.canAccessMature(); if (inc_pg) { query_flags |= DFQ_INC_PG; } if (inc_mature && mature_enabled) { query_flags |= DFQ_INC_MATURE; } if (inc_adult && adult_enabled) { query_flags |= DFQ_INC_ADULT; } // Add old flags in case we are talking to an old dataserver if (inc_pg && !inc_mature) { query_flags |= DFQ_PG_SIMS_ONLY; } if (!inc_pg && inc_mature) { query_flags |= DFQ_MATURE_SIMS_ONLY; } LLScrollListCtrl* list = getChild<LLScrollListCtrl>("results"); if (list) { std::string sort_name = list->getSortColumnName(); BOOL sort_asc = list->getSortAscending(); if (sort_name == "name") { query_flags |= DFQ_NAME_SORT; } else if (sort_name == "price") { query_flags |= DFQ_PRICE_SORT; } else if (sort_name == "per_meter") { query_flags |= DFQ_PER_METER_SORT; } else if (sort_name == "area") { query_flags |= DFQ_AREA_SORT; } if (sort_asc) { query_flags |= DFQ_SORT_ASC; } } if (childGetValue("pricecheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_PRICE; } if (childGetValue("areacheck").asBoolean()) { query_flags |= DFQ_LIMIT_BY_AREA; } msg->newMessage("DirLandQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", getSearchID()); msg->addU32("QueryFlags", query_flags); msg->addU32("SearchType", search_type); msg->addS32("Price", childGetValue("priceedit").asInteger()); msg->addS32("Area", childGetValue("areaedit").asInteger()); msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); gAgent.sendReliableMessage(); }
// static void LLPanelDirFindAllOld::onClickSearch(void *userdata) { LLPanelDirFindAllOld *self = (LLPanelDirFindAllOld *)userdata; if (self->childGetValue("name").asString().length() < self->mMinSearchChars) { return; }; BOOL inc_pg = self->childGetValue("incpg").asBoolean(); BOOL inc_mature = self->childGetValue("incmature").asBoolean(); BOOL inc_adult = self->childGetValue("incadult").asBoolean(); if (!(inc_pg || inc_mature || inc_adult)) { LLNotificationsUtil::add("NoContentToSearch"); return; } self->setupNewSearch(); // Figure out scope U32 scope = 0x0; scope |= DFQ_PEOPLE; // people (not just online = 0x01 | 0x02) // places handled below scope |= DFQ_EVENTS; // events scope |= DFQ_GROUPS; // groups if (inc_pg) { scope |= DFQ_INC_PG; } if (inc_mature) { scope |= DFQ_INC_MATURE; } if (inc_adult) { scope |= DFQ_INC_ADULT; } if (self->childGetValue("filter_gaming").asBoolean()) { scope |= DFQ_FILTER_GAMING; } // send the message LLMessageSystem *msg = gMessageSystem; S32 start_row = 0; sendDirFindQuery(msg, self->mSearchID, self->childGetValue("name").asString(), scope, start_row); // Also look up classified ads. JC 12/2005 BOOL filter_auto_renew = FALSE; U32 classified_flags = pack_classified_flags_request(filter_auto_renew, inc_pg, inc_mature, inc_adult); msg->newMessage("DirClassifiedQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", self->mSearchID); msg->addString("QueryText", self->childGetValue("name").asString()); msg->addU32("QueryFlags", classified_flags); msg->addU32("Category", 0); // all categories msg->addS32("QueryStart", 0); gAgent.sendReliableMessage(); // Need to use separate find places query because places are // sent using the more compact DirPlacesReply message. U32 query_flags = DFQ_DWELL_SORT; if (inc_pg) { query_flags |= DFQ_INC_PG; } if (inc_mature) { query_flags |= DFQ_INC_MATURE; } if (inc_adult) { query_flags |= DFQ_INC_ADULT; } msg->newMessage("DirPlacesQuery"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID() ); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("QueryData"); msg->addUUID("QueryID", self->mSearchID ); msg->addString("QueryText", self->childGetValue("name").asString()); msg->addU32("QueryFlags", query_flags ); msg->addS32("QueryStart", 0 ); // Always get the first 100 when using find ALL msg->addS8("Category", LLParcel::C_ANY); msg->addString("SimName", NULL); gAgent.sendReliableMessage(); }