Esempio n. 1
0
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();
}
// virtual
BOOL LLFloaterReporter::postBuild()
{
	LLSLURL slurl;
	LLAgentUI::buildSLURL(slurl);
	getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString());

	enableControls(TRUE);

	// convert the position to a string
	LLVector3d pos = gAgent.getPositionGlobal();
	LLViewerRegion *regionp = gAgent.getRegion();
	if (regionp)
	{
		getChild<LLUICtrl>("sim_field")->setValue(regionp->getName());
		pos -= regionp->getOriginGlobal();
	}
	setPosBox(pos);

	// Take a screenshot, but don't draw this floater.
	setVisible(FALSE);
	takeScreenshot();
	setVisible(TRUE);

	// Default text to be blank
	getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null);
	getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null);
	mOwnerName = LLStringUtil::null;

	getChild<LLUICtrl>("summary_edit")->setFocus(TRUE);

	mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString();

	// send a message and ask for information about this region -
	// result comes back in processRegionInfo(..)
	LLMessageSystem* msg = gMessageSystem;
	msg->newMessage("RequestRegionInfo");
	msg->nextBlock("AgentData");
	msg->addUUID("AgentID", gAgent.getID());
	msg->addUUID("SessionID", gAgent.getSessionID());
	gAgent.sendReliableMessage();


	// abuser name is selected from a list
	LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit");
	le->setEnabled( false );

	LLButton* pick_btn = getChild<LLButton>("pick_btn");
	// XUI: Why aren't these in viewerart.ini?
	pick_btn->setImages(std::string("UIImgFaceUUID"),
						std::string("UIImgFaceSelectedUUID") );
	childSetAction("pick_btn", onClickObjPicker, this);
	childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this));

	childSetAction("send_btn", onClickSend, this);
	childSetAction("cancel_btn", onClickCancel, this);
	// grab the user's name
	std::string reporter;
	gAgent.buildFullname(reporter);
	getChild<LLUICtrl>("reporter_field")->setValue(reporter);

	center();

	return TRUE;
}
Esempio n. 3
0
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);
	}
}
Esempio n. 4
0
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();
}
//-----------------------------------------------------------------------------
// Member functions
//-----------------------------------------------------------------------------
LLFloaterReporter::LLFloaterReporter(
	const std::string& name,
	const LLRect& rect, 
	const std::string& title, 
	EReportType report_type)
	:	
	LLFloater(name, rect, title),
	mReportType(report_type),
	mObjectID(),
	mScreenID(),
	mAbuserID(),
	mDeselectOnClose( FALSE ),
	mPicking( FALSE), 
	mPosition(),
	mCopyrightWarningSeen( FALSE ),
	mResourceDatap(new LLResourceData())
{
	if (report_type == BUG_REPORT)
	{
		LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_bug.xml");
	}
	else
	{
		LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml");
	}

	childSetText("abuse_location_edit", gAgent.getSLURL() );

// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0a
	if (rlv_handler_t::isEnabled())
	{
		// Can't filter these since they get sent as part of the report so just hide them instead
		if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
		{
			childSetVisible("abuse_location_edit", false);
			childSetVisible("pos_field", false);
		}
		if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
		{
			childSetVisible("owner_name", false);
			childSetVisible("abuser_name_edit", false);
		}
	}
// [/RLVa:KB]

	LLButton* pick_btn = getChild<LLButton>("pick_btn");
	if (pick_btn)
	{
		// XUI: Why aren't these in viewerart.ini?
		pick_btn->setImages( std::string("UIImgFaceUUID"),
							std::string("UIImgFaceSelectedUUID") );
		childSetAction("pick_btn", onClickObjPicker, this);
	}

	if (report_type != BUG_REPORT)
	{
		// abuser name is selected from a list
		LLLineEditor* le = getChild<LLLineEditor>("abuser_name_edit");
		le->setEnabled( FALSE );
	}

	childSetAction("select_abuser", onClickSelectAbuser, this);

	childSetAction("send_btn", onClickSend, this);
	childSetAction("cancel_btn", onClickCancel, this);

	enableControls(TRUE);

	// convert the position to a string
	LLVector3d pos = gAgent.getPositionGlobal();
	LLViewerRegion *regionp = gAgent.getRegion();
	if (regionp)
	{
		pos -= regionp->getOriginGlobal();
	}
	setPosBox(pos);

	gReporterInstances.addData(report_type, this);

	// Take a screenshot, but don't draw this floater.
	setVisible(FALSE);
	takeScreenshot();
	setVisible(TRUE);

	// Default text to be blank
	childSetText("object_name", LLStringUtil::null);
	childSetText("owner_name", LLStringUtil::null);

	childSetFocus("summary_edit");

	mDefaultSummary = childGetText("details_edit");

	gDialogVisible = TRUE;

	// only request details for abuse reports (not BUG reports)
	if (report_type != BUG_REPORT)
	{
		// send a message and ask for information about this region - 
		// result comes back in processRegionInfo(..)
		LLMessageSystem* msg = gMessageSystem;
		msg->newMessage("RequestRegionInfo");
		msg->nextBlock("AgentData");
		msg->addUUID("AgentID", gAgent.getID());
		msg->addUUID("SessionID", gAgent.getSessionID());
		gAgent.sendReliableMessage();
	};
}
void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
{
	const LLUUID& base_in_item_id = get_linked_uuid(in_item_id);
	uuid_vec_t gest_item_ids;

	// Deactivate all gestures that match
	item_map_t::iterator it;
	for (it = mActive.begin(); it != mActive.end(); )
	{
		const LLUUID& item_id = (*it).first;
		LLMultiGesture* gest = (*it).second;

		// Don't deactivate the gesture we are looking for duplicates of
		// (for replaceGesture)
		if (!gest || item_id == base_in_item_id) 
		{
			// legal, can have null pointers in list
			++it;
		}
		else if ((!gest->mTrigger.empty() && gest->mTrigger == in->mTrigger)
				 || (gest->mKey != KEY_NONE && gest->mKey == in->mKey && gest->mMask == in->mMask))
		{
			gest_item_ids.push_back(item_id);

			stopGesture(gest);

			delete gest;
			gest = NULL;

			mActive.erase(it++);
			gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);

		}
		else
		{
			++it;
		}
	}

	// Inform database of the change
	LLMessageSystem* msg = gMessageSystem;
	BOOL start_message = TRUE;
	uuid_vec_t::const_iterator vit = gest_item_ids.begin();
	while (vit != gest_item_ids.end())
	{
		if (start_message)
		{
			msg->newMessage("DeactivateGestures");
			msg->nextBlock("AgentData");
			msg->addUUID("AgentID", gAgent.getID());
			msg->addUUID("SessionID", gAgent.getSessionID());
			msg->addU32("Flags", 0x0);
			start_message = FALSE;
		}
	
		msg->nextBlock("Data");
		msg->addUUID("ItemID", *vit);
		msg->addU32("GestureFlags", 0x0);

		if (msg->getCurrentSendTotal() > MTUBYTES)
		{
			gAgent.sendReliableMessage();
			start_message = TRUE;
		}

		++vit;
	}

	if (!start_message)
	{
		gAgent.sendReliableMessage();
	}

	// Add to the list of names for the user.
	for (vit = gest_item_ids.begin(); vit != gest_item_ids.end(); ++vit)
	{
		LLViewerInventoryItem* item = gInventory.getItem(*vit);
		if (!item) continue;

		mDeactivateSimilarNames.append(item->getName());
		mDeactivateSimilarNames.append("\n");
	}

	notifyObservers();
}
void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
{
	// Load up the assets
	S32 count = 0;
	LLViewerInventoryItem::item_array_t::const_iterator it;
	for (it = items.begin(); it != items.end(); ++it)
	{
		LLViewerInventoryItem* item = *it;

		if (isGestureActive(item->getUUID()))
		{
			continue;
		}
		else 
		{ // Make gesture active and persistent through login sessions.  -Aura 07-12-06
			activateGesture(item->getUUID());
		}

		count++;
	}

	mLoadingCount = count;
	mDeactivateSimilarNames.clear();

	for (it = items.begin(); it != items.end(); ++it)
	{
		LLViewerInventoryItem* item = *it;

		if (isGestureActive(item->getUUID()))
		{
			continue;
		}

		// Don't inform server, we'll do that in bulk
		const BOOL no_inform_server = FALSE;
		const BOOL deactivate_similar = TRUE;
		activateGestureWithAsset(item->getUUID(), item->getAssetUUID(),
								 no_inform_server,
								 deactivate_similar);
	}

	// Inform the database of this change
	LLMessageSystem* msg = gMessageSystem;

	BOOL start_message = TRUE;

	for (it = items.begin(); it != items.end(); ++it)
	{
		LLViewerInventoryItem* item = *it;

		if (isGestureActive(item->getUUID()))
		{
			continue;
		}

		if (start_message)
		{
			msg->newMessage("ActivateGestures");
			msg->nextBlock("AgentData");
			msg->addUUID("AgentID", gAgent.getID());
			msg->addUUID("SessionID", gAgent.getSessionID());
			msg->addU32("Flags", 0x0);
			start_message = FALSE;
		}
		
		msg->nextBlock("Data");
		msg->addUUID("ItemID", item->getUUID());
		msg->addUUID("AssetID", item->getAssetUUID());
		msg->addU32("GestureFlags", 0x0);

		if (msg->getCurrentSendTotal() > MTUBYTES)
		{
			gAgent.sendReliableMessage();
			start_message = TRUE;
		}
	}

	if (!start_message)
	{
		gAgent.sendReliableMessage();
	}
}
// static
void LLGestureMgr::onLoadComplete(LLVFS *vfs,
									   const LLUUID& asset_uuid,
									   LLAssetType::EType type,
									   void* user_data, S32 status, LLExtStat ext_status)
{
	LLLoadInfo* info = (LLLoadInfo*)user_data;

	LLUUID item_id = info->mItemID;
	BOOL inform_server = info->mInformServer;
	BOOL deactivate_similar = info->mDeactivateSimilar;

	delete info;
	info = NULL;
	LLGestureMgr& self = LLGestureMgr::instance();
	self.mLoadingCount--;

	if (0 == status)
	{
		LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
		S32 size = file.getSize();

		char* buffer = new char[size+1];
		if (buffer == NULL)
		{
			LL_ERRS() << "Memory Allocation Failed" << LL_ENDL;
			return;
		}

		file.read((U8*)buffer, size);		/* Flawfinder: ignore */
		// ensure there's a trailing NULL so strlen will work.
		buffer[size] = '\0';

		LLMultiGesture* gesture = new LLMultiGesture();

		LLDataPackerAsciiBuffer dp(buffer, size+1);
		BOOL ok = gesture->deserialize(dp);

		if (ok)
		{
			if (deactivate_similar)
			{
				self.deactivateSimilarGestures(gesture, item_id);

				// Display deactivation message if this was the last of the bunch.
				if (self.mLoadingCount == 0
					&& self.mDeactivateSimilarNames.length() > 0)
				{
					// we're done with this set of deactivations
					LLSD args;
					args["NAMES"] = self.mDeactivateSimilarNames;
					LLNotificationsUtil::add("DeactivatedGesturesTrigger", args);
				}
			}

			LLViewerInventoryItem* item = gInventory.getItem(item_id);
			if(item)
			{
				gesture->mName = item->getName();
			}
			else
			{
				// Watch this item and set gesture name when item exists in inventory
				self.setFetchID(item_id);
				self.startFetch();
			}
			self.mActive[item_id] = gesture;

			// Everything has been successful.  Add to the active list.
			gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);

			if (inform_server)
			{
				// Inform the database of this change
				LLMessageSystem* msg = gMessageSystem;
				msg->newMessage("ActivateGestures");
				msg->nextBlock("AgentData");
				msg->addUUID("AgentID", gAgent.getID());
				msg->addUUID("SessionID", gAgent.getSessionID());
				msg->addU32("Flags", 0x0);
				
				msg->nextBlock("Data");
				msg->addUUID("ItemID", item_id);
				msg->addUUID("AssetID", asset_uuid);
				msg->addU32("GestureFlags", 0x0);

				gAgent.sendReliableMessage();
			}
			callback_map_t::iterator i_cb = self.mCallbackMap.find(item_id);
			
			if(i_cb != self.mCallbackMap.end())
			{
				i_cb->second(gesture);
				self.mCallbackMap.erase(i_cb);
			}

			self.notifyObservers();
		}
		else
		{
			LL_WARNS() << "Unable to load gesture" << LL_ENDL;

			self.mActive.erase(item_id);
			
			delete gesture;
			gesture = NULL;
		}

		delete [] buffer;
		buffer = NULL;
	}
	else
	{
		LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );

		if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
			LL_ERR_FILE_EMPTY == status)
		{
			LLDelayedGestureError::gestureMissing( item_id );
		}
		else
		{
			LLDelayedGestureError::gestureFailedToLoad( item_id );
		}

		LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL;
		
		LLGestureMgr::instance().mActive.erase(item_id);			
	}
}
Esempio n. 9
0
void LLViewerRegion::unpackRegionHandshake()
{
	LLMessageSystem *msg = gMessageSystem;

	U32 region_flags;
	U8 sim_access;
	std::string sim_name;
	LLUUID sim_owner;
	BOOL is_estate_manager;
	F32 water_height;
	F32 billable_factor;
	LLUUID cache_id;

	msg->getU32		("RegionInfo", "RegionFlags", region_flags);
	msg->getU8		("RegionInfo", "SimAccess", sim_access);
	msg->getString	("RegionInfo", "SimName", sim_name);
	msg->getUUID	("RegionInfo", "SimOwner", sim_owner);
	msg->getBOOL	("RegionInfo", "IsEstateManager", is_estate_manager);
	msg->getF32		("RegionInfo", "WaterHeight", water_height);
	msg->getF32		("RegionInfo", "BillableFactor", billable_factor);
	msg->getUUID	("RegionInfo", "CacheID", cache_id );

	setRegionFlags(region_flags);
	setSimAccess(sim_access);
	setRegionNameAndZone(sim_name);
	setOwner(sim_owner);
	setIsEstateManager(is_estate_manager);
	setWaterHeight(water_height);
	setBillableFactor(billable_factor);
	setCacheID(cache_id);

	LLUUID region_id;
	msg->getUUID("RegionInfo2", "RegionID", region_id);
	setRegionID(region_id);
	
	// Retrieve the CR-53 (Homestead/Land SKU) information
	S32 classID = 0;
	S32 cpuRatio = 0;
	std::string coloName;
	std::string productSKU;
	std::string productName;

	// the only reasonable way to decide if we actually have any data is to
	// check to see if any of these fields have positive sizes
	if (msg->getSize("RegionInfo3", "ColoName") > 0 ||
	    msg->getSize("RegionInfo3", "ProductSKU") > 0 ||
	    msg->getSize("RegionInfo3", "ProductName") > 0)
	{
		msg->getS32     ("RegionInfo3", "CPUClassID",  classID);
		msg->getS32     ("RegionInfo3", "CPURatio",    cpuRatio);
		msg->getString  ("RegionInfo3", "ColoName",    coloName);
		msg->getString  ("RegionInfo3", "ProductSKU",  productSKU);
		msg->getString  ("RegionInfo3", "ProductName", productName);
		
		mClassID = classID;
		mCPURatio = cpuRatio;
		mColoName = coloName;
		mProductSKU = productSKU;
		mProductName = productName;
	}

	LLVLComposition *compp = getComposition();
	if (compp)
	{
		LLUUID tmp_id;

		msg->getUUID("RegionInfo", "TerrainDetail0", tmp_id);
		compp->setDetailTextureID(0, tmp_id);
		msg->getUUID("RegionInfo", "TerrainDetail1", tmp_id);
		compp->setDetailTextureID(1, tmp_id);
		msg->getUUID("RegionInfo", "TerrainDetail2", tmp_id);
		compp->setDetailTextureID(2, tmp_id);
		msg->getUUID("RegionInfo", "TerrainDetail3", tmp_id);
		compp->setDetailTextureID(3, tmp_id);

		F32 tmp_f32;
		msg->getF32("RegionInfo", "TerrainStartHeight00", tmp_f32);
		compp->setStartHeight(0, tmp_f32);
		msg->getF32("RegionInfo", "TerrainStartHeight01", tmp_f32);
		compp->setStartHeight(1, tmp_f32);
		msg->getF32("RegionInfo", "TerrainStartHeight10", tmp_f32);
		compp->setStartHeight(2, tmp_f32);
		msg->getF32("RegionInfo", "TerrainStartHeight11", tmp_f32);
		compp->setStartHeight(3, tmp_f32);

		msg->getF32("RegionInfo", "TerrainHeightRange00", tmp_f32);
		compp->setHeightRange(0, tmp_f32);
		msg->getF32("RegionInfo", "TerrainHeightRange01", tmp_f32);
		compp->setHeightRange(1, tmp_f32);
		msg->getF32("RegionInfo", "TerrainHeightRange10", tmp_f32);
		compp->setHeightRange(2, tmp_f32);
		msg->getF32("RegionInfo", "TerrainHeightRange11", tmp_f32);
		compp->setHeightRange(3, tmp_f32);

		// If this is an UPDATE (params already ready, we need to regenerate
		// all of our terrain stuff, by
		if (compp->getParamsReady())
		{
			getLand().dirtyAllPatches();
		}
		else
		{
			compp->setParamsReady();
		}
	}


	// Now that we have the name, we can load the cache file
	// off disk.
	loadObjectCache();

	// After loading cache, signal that simulator can start
	// sending data.
	// TODO: Send all upstream viewer->sim handshake info here.
	LLHost host = msg->getSender();
	msg->newMessage("RegionHandshakeReply");
	msg->nextBlock("AgentData");
	msg->addUUID("AgentID", gAgent.getID());
	msg->addUUID("SessionID", gAgent.getSessionID());
	msg->nextBlock("RegionInfo");
	msg->addU32("Flags", 0x0 );
	msg->sendReliable(host);
}
Esempio n. 10
0
// 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();
}
//void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-0.2.2a
void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel)
// [/RLVa:KB]
{
// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0b) | Modified: RLVa-1.2.0a
	// 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
			if (gRlvHandler.hasBehaviour(RLV_BHVR_SENDCHAT))
				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 (CHAT_CHANNEL_DEBUG == channel)
			{
				bool fIsEmote = RlvUtil::isEmote(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;
	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();

	LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);
}
Esempio n. 12
0
// static
void LLGestureManager::onLoadComplete(LLVFS *vfs,
									   const LLUUID& asset_uuid,
									   LLAssetType::EType type,
									   void* user_data, S32 status, LLExtStat ext_status)
{
	LLLoadInfo* info = (LLLoadInfo*)user_data;

	LLUUID item_id = info->mItemID;
	BOOL inform_server = info->mInformServer;
	BOOL deactivate_similar = info->mDeactivateSimilar;

	delete info;
	info = NULL;

	gGestureManager.mLoadingCount--;

	if (0 == status)
	{
		LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
		S32 size = file.getSize();

		char* buffer = new char[size+1];
		if (buffer == NULL)
		{
			llerrs << "Memory Allocation Failed" << llendl;
			return;
		}

		file.read((U8*)buffer, size);		/* Flawfinder: ignore */
		// ensure there's a trailing NULL so strlen will work.
		buffer[size] = '\0';

		LLMultiGesture* gesture = new LLMultiGesture();

		LLDataPackerAsciiBuffer dp(buffer, size+1);
		BOOL ok = gesture->deserialize(dp);

		if (ok)
		{
			if (deactivate_similar)
			{
				gGestureManager.deactivateSimilarGestures(gesture, item_id);

				// Display deactivation message if this was the last of the bunch.
				if (gGestureManager.mLoadingCount == 0
					&& gGestureManager.mDeactivateSimilarNames.length() > 0)
				{
					// we're done with this set of deactivations
					LLStringUtil::format_map_t args;
					args["[NAMES]"] = gGestureManager.mDeactivateSimilarNames;
					LLNotifyBox::showXml("DeactivatedGesturesTrigger", args);
				}
			}

			// Everything has been successful.  Add to the active list.
			gGestureManager.mActive[item_id] = gesture;
			gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
			if (inform_server)
			{
				// Inform the database of this change
				LLMessageSystem* msg = gMessageSystem;
				msg->newMessage("ActivateGestures");
				msg->nextBlock("AgentData");
				msg->addUUID("AgentID", gAgent.getID());
				msg->addUUID("SessionID", gAgent.getSessionID());
				msg->addU32("Flags", 0x0);
				
				msg->nextBlock("Data");
				msg->addUUID("ItemID", item_id);
				msg->addUUID("AssetID", asset_uuid);
				msg->addU32("GestureFlags", 0x0);

				gAgent.sendReliableMessage();
			}

			gGestureManager.notifyObservers();
		}
		else
		{
			llwarns << "Unable to load gesture" << llendl;

			gGestureManager.mActive.erase(item_id);
			
			delete gesture;
			gesture = NULL;
		}

		delete [] buffer;
		buffer = NULL;
	}
	else
	{
		LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );

		if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
			LL_ERR_FILE_EMPTY == status)
		{
			LLDelayedGestureError::gestureMissing( item_id );
		}
		else
		{
			LLDelayedGestureError::gestureFailedToLoad( item_id );
		}

		llwarns << "Problem loading gesture: " << status << llendl;
		
		gGestureManager.mActive.erase(item_id);			
	}
}
Esempio n. 13
0
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();
}