void LLPanelDirClassified::performQuery()
{
	lldebugs << "LLPanelDirClassified::performQuery()" << llendl;
	// This sets mSearchID and clears the list of results
	setupNewSearch();

	// send the message
	LLMessageSystem *msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_DirClassifiedQuery);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());

	BOOL filter_mature = !childGetValue("incmature").asBoolean();
	BOOL filter_auto_renew = FALSE;
	U32 query_flags = pack_classified_flags(filter_mature, filter_auto_renew);
	//if (gAgent.isTeen()) query_flags |= DFQ_PG_SIMS_ONLY;

	U32 category = childGetValue("Category").asInteger();
	
	msg->nextBlockFast(_PREHASH_QueryData);
	msg->addUUIDFast(_PREHASH_QueryID, mSearchID );
	msg->addStringFast(_PREHASH_QueryText, childGetValue("name").asString());
	msg->addU32Fast(_PREHASH_QueryFlags, query_flags);
	msg->addU32Fast(_PREHASH_Category, category);
	msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);

	gAgent.sendReliableMessage();
}
void LLPanelDirPlaces::queryCore(const std::string& name, 
								 S32 category, 
								 U32 flags)
{
	setupNewSearch();

// JC: Sorting by dwell severely impacts the performance of the query.
// Instead of sorting on the dataserver, we sort locally once the results
// are received.
// IW: Re-enabled dwell sort based on new 3-character minimum description
// Hopefully we'll move to next-gen Find before this becomes a big problem

	flags |= DFQ_DWELL_SORT;

	LLMessageSystem* msg = gMessageSystem;

	msg->newMessage("DirPlacesQuery");
	msg->nextBlock("AgentData");
	msg->addUUID("AgentID", gAgent.getID());
	msg->addUUID("SessionID", gAgent.getSessionID());
	msg->nextBlock("QueryData");
	msg->addUUID("QueryID", getSearchID());
	msg->addString("QueryText", name);
	msg->addU32("QueryFlags", flags);
	msg->addS8("Category", (S8)category);
	// No longer support queries by region name, too many regions
	// for combobox, no easy way to do autocomplete. JC
	msg->addString("SimName", "");
	msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
	gAgent.sendReliableMessage();
}
// virtual
void LLPanelDirPeople::performQuery()
{
	if (childGetValue("name").asString().length() < mMinSearchChars)
	{
		return;
	}

	// filter short words out of the query string
	// and indidate if we did have to filter it
	// The shortest username is 2 characters long.
	// *fix This is no longer true, M Linden is a exception that demonstrates the invalidity of this assumption.
	std::string query_string = childGetValue("name").asString();
	/*const S32 SHORTEST_WORD_LEN = 2;
	bool query_was_filtered = false;
	std::string query_string = LLPanelDirBrowser::filterShortWords( 
			childGetValue("name").asString(), 
				SHORTEST_WORD_LEN, 
					query_was_filtered );

	// possible we threw away all the short words in the query so check length
	if ( query_string.length() < mMinSearchChars )
	{
		LLNotifications::instance().add("SeachFilteredOnShortWordsEmpty");
		return;
	};

	// if we filtered something out, display a popup
	if ( query_was_filtered )
	{
		LLSD args;
		args["FINALQUERY"] = query_string;
		LLNotifications::instance().add("SeachFilteredOnShortWords", args);
	};*/

	setupNewSearch();

	U32 scope = DFQ_PEOPLE;

	// send the message
	sendDirFindQuery(
		gMessageSystem,
		mSearchID,
		query_string,
		scope,
		mSearchStart);
}
Beispiel #4
0
// virtual
void LLPanelDirGroups::performQuery()
{
	if (childGetValue("name").asString().length() < mMinSearchChars)
	{
		return;
	}

	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;
	}

	setupNewSearch();

	// groups
	U32 scope = DFQ_GROUPS;
	if (inc_pg)
	{
		scope |= DFQ_INC_PG;
	}
	if (inc_mature)
	{
		scope |= DFQ_INC_MATURE;
	}
	if (inc_adult)
	{
		scope |= DFQ_INC_ADULT;
	}

	mCurrentSortColumn = "score";
	mCurrentSortAscending = FALSE;

	// send the message
	sendDirFindQuery(
		gMessageSystem,
		mSearchID,
		childGetValue("name").asString(),
		scope,
		mSearchStart);
}
void LLPanelDirClassified::performQuery()
{
	lldebugs << "LLPanelDirClassified::performQuery()" << llendl;

	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))
	{
		LLNotificationsUtil::add("NoContentToSearch");
		return;
	}

	// This sets mSearchID and clears the list of results
	setupNewSearch();

	// send the message
	LLMessageSystem *msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_DirClassifiedQuery);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());

	BOOL filter_auto_renew = FALSE;
	U32 query_flags = pack_classified_flags_request(filter_auto_renew, inc_pg, inc_mature, inc_adult);
	//if (gAgent.isTeen()) query_flags |= DFQ_PG_SIMS_ONLY;
	if (childGetValue("filter_gaming")) query_flags |= DFQ_FILTER_GAMING;

	U32 category = childGetValue("Category").asInteger();
	
	msg->nextBlockFast(_PREHASH_QueryData);
	msg->addUUIDFast(_PREHASH_QueryID, mSearchID );
	msg->addStringFast(_PREHASH_QueryText, childGetValue("name").asString());
	msg->addU32Fast(_PREHASH_QueryFlags, query_flags);
	msg->addU32Fast(_PREHASH_Category, category);
	msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);

	gAgent.sendReliableMessage();
}
void LLPanelDirClassified::onClickDelete()
{
	LLUUID classified_id;
	S32 type;

	getSelectedInfo(&classified_id, &type);

	// Clear out the list.  Deleting a classified will cause a refresh to be
	// sent.
	setupNewSearch();

	LLMessageSystem* msg = gMessageSystem;

	msg->newMessageFast(_PREHASH_ClassifiedGodDelete);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	msg->nextBlockFast(_PREHASH_Data);
	msg->addUUIDFast(_PREHASH_ClassifiedID, classified_id);
	msg->addUUIDFast(_PREHASH_QueryID, mSearchID);
	gAgent.sendReliableMessage();
}
void LLPanelDirEvents::performQueryOrDelete(U32 event_id)
{
	S32 relative_day = mDay;
	// Update the date field to show the date IN THE SERVER'S
	// TIME ZONE, as that is what will be displayed in each event

	// Get time UTC
	time_t utc_time = time_corrected();

	// Correct for offset
	utc_time += relative_day * 24 * 60 * 60;

	// There's only one internal tm buffer.
	struct tm* internal_time;

	// Convert to Pacific, based on server's opinion of whether
	// it's daylight savings time there.
	internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);
	std::string date;
	timeStructToFormattedString(internal_time, "%m-%d", date);
	childSetValue("date_text", date);

	// Record the relative day so back and forward buttons
	// offset from this day.
	mDay = relative_day;

	mDoneQuery = TRUE;

	U32 scope = DFQ_DATE_EVENTS;
	if ( gAgent.wantsPGOnly()) scope |= DFQ_PG_SIMS_ONLY;
	if ( childGetValue("incpg").asBoolean() ) scope |= DFQ_INC_PG;
	if ( childGetValue("incmature").asBoolean() ) scope |= DFQ_INC_MATURE;
	if ( childGetValue("incadult").asBoolean() ) scope |= DFQ_INC_ADULT;
	if (childGetValue("filter_gaming").asBoolean()) scope |= DFQ_FILTER_GAMING;
	
	// Add old query flags in case we are talking to an old server
	if ( childGetValue("incpg").asBoolean() && !childGetValue("incmature").asBoolean())
	{
		scope |= DFQ_PG_EVENTS_ONLY;
	}
	
	if ( !( scope & (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT )))
	{
		LLNotificationsUtil::add("NoContentToSearch");
		return;
	}
	
	setupNewSearch();

	std::ostringstream params;

	// Date mode for the search
	if ("current" == childGetValue("date_mode").asString())
	{
		params << "u|";
	}
	else
	{
		params << mDay << "|";
	}

	// Categories are stored in the database in table indra.event_category
	// XML must match.
	U32 cat_id = childGetValue("category combo").asInteger();

	params << cat_id << "|";
	params << childGetValue("event_search_text").asString();

	// send the message
	if (0 == event_id)
	{
		
		sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart);
	}
	else
	{
		// This delete will also perform a query.
		LLMessageSystem* msg = gMessageSystem;

		msg->newMessageFast(_PREHASH_EventGodDelete);

		msg->nextBlockFast(_PREHASH_AgentData);
		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());

		msg->nextBlockFast(_PREHASH_EventData);
		msg->addU32Fast(_PREHASH_EventID, event_id);

		msg->nextBlockFast(_PREHASH_QueryData);
		msg->addUUIDFast(_PREHASH_QueryID, mSearchID);
		msg->addStringFast(_PREHASH_QueryText, params.str());
		msg->addU32Fast(_PREHASH_QueryFlags, scope);
		msg->addS32Fast(_PREHASH_QueryStart, mSearchStart);
		gAgent.sendReliableMessage();
	}
}
Beispiel #8
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();
}
// virtual
void LLPanelDirGroups::performQuery()
{
	std::string group_name = childGetValue("name").asString();
	if (group_name.length() < mMinSearchChars)
	{
		return;
	}

    // "hi " is three chars but not a long-enough search
	std::string query_string = group_name;
	LLStringUtil::trim( query_string );
	bool query_was_filtered = (query_string != group_name);

	// possible we threw away all the short words in the query so check length
	if ( query_string.length() < mMinSearchChars )
	{
		LLNotifications::instance().add("SeachFilteredOnShortWordsEmpty");
		return;
	};

	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))
	{
		LLNotifications::instance().add("NoContentToSearch");
		return;
	}

	// if we filtered something out, display a popup
	if ( query_was_filtered )
	{
		LLSD args;
		args["[FINALQUERY]"] = query_string;
		LLNotifications::instance().add("SeachFilteredOnShortWords", args);
	};

	setupNewSearch();

	// groups
	U32 scope = DFQ_GROUPS;
	if (inc_pg)
	{
		scope |= DFQ_INC_PG;
	}
	if (inc_mature)
	{
		scope |= DFQ_INC_MATURE;
	}
	if (inc_adult)
	{
		scope |= DFQ_INC_ADULT;
	}

	mCurrentSortColumn = "score";
	mCurrentSortAscending = FALSE;

	// send the message
	sendDirFindQuery(
		gMessageSystem,
		mSearchID,
		query_string,
		scope,
		mSearchStart);
}
void LLPanelDirFindAllOld::onClickSearch()
{
	if (childGetValue("name").asString().length() < mMinSearchChars)
	{
		return;
	}

	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))
	{
		LLNotificationsUtil::add("NoContentToSearch");
		return;
	}

	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 (hasChild("filter_gaming") && childGetValue("filter_gaming").asBoolean())
	{
		scope |= DFQ_FILTER_GAMING;
	}

	// send the message
	LLMessageSystem *msg = gMessageSystem;
	S32 start_row = 0;
	sendDirFindQuery(msg, mSearchID, 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", mSearchID);
	msg->addString("QueryText", 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", mSearchID );
	msg->addString("QueryText", 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();
}
Beispiel #11
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();
}
void LLPanelDirEvents::performQueryOrDelete(U32 event_id)
{
	S32 relative_day = mDay;
	// Update the date field to show the date IN THE SERVER'S
	// TIME ZONE, as that is what will be displayed in each event

	// Get time UTC
	time_t utc_time = time_corrected();

	// Correct for offset
	utc_time += relative_day * 24 * 60 * 60;

	// There's only one internal tm buffer.
	struct tm* internal_time;

	// Convert to Pacific, based on server's opinion of whether
	// it's daylight savings time there.
	internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime);

	std::string buffer = llformat("%d/%d",
			1 + internal_time->tm_mon,		// Jan = 0
			internal_time->tm_mday);	// 2001 = 101
	childSetValue("date_text", buffer);

	// Record the relative day so back and forward buttons
	// offset from this day.
	mDay = relative_day;

	mDoneQuery = TRUE;

	setupNewSearch();

	U32 scope = DFQ_DATE_EVENTS;
	if ( !childGetValue("incmature").asBoolean() ) scope |= DFQ_PG_EVENTS_ONLY;

	std::ostringstream params;

	// Date mode for the search
	if ("current" == childGetValue("date_mode").asString())
	{
		params << "u|";
	}
	else
	{
		params << mDay << "|";
	}

	// Categories are stored in the database in table indra.event_category
	// XML must match.
	U32 cat_id = childGetValue("category combo").asInteger();

	params << cat_id << "|";
	params << childGetValue("event_search_text").asString();

	// send the message
	if (0 == event_id)
	{
		sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart);
	}
	else
	{
		// This delete will also perform a query.
		LLMessageSystem* msg = gMessageSystem;

		msg->newMessageFast(_PREHASH_EventGodDelete);

		msg->nextBlockFast(_PREHASH_AgentData);
		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());

		msg->nextBlockFast(_PREHASH_EventData);
		msg->addU32Fast(_PREHASH_EventID, event_id);

		msg->nextBlockFast(_PREHASH_QueryData);
		msg->addUUIDFast(_PREHASH_QueryID, mSearchID);
		msg->addStringFast(_PREHASH_QueryText, params.str());
		msg->addU32Fast(_PREHASH_QueryFlags, scope);
		msg->addS32Fast(_PREHASH_QueryStart, mSearchStart);
		gAgent.sendReliableMessage();
	}
}