/*virtual*/
void LLClassifiedStatsResponder::httpSuccess()
{
	const LLSD& content = getContent();
	if (!content.isMap())
	{
		failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
		return;
	}
	S32 teleport = content["teleport_clicks"].asInteger();
	S32 map = content["map_clicks"].asInteger();
	S32 profile = content["profile_clicks"].asInteger();
	S32 search_teleport = content["search_teleport_clicks"].asInteger();
	S32 search_map = content["search_map_clicks"].asInteger();
	S32 search_profile = content["search_profile_clicks"].asInteger();

	LLPanelClassifiedInfo::setClickThrough(	mClassifiedID, 
											teleport + search_teleport, 
											map + search_map,
											profile + search_profile,
											true);

	// <FS:Ansariel> FIRE-8787: Also update legacy profiles
	FSPanelClassifiedInfo::setClickThrough(	mClassifiedID, 
											teleport + search_teleport, 
											map + search_map,
											profile + search_profile,
											true);
}
/* virtual */
void AISCommand::httpSuccess()
{
	// Command func holds a reference to self, need to release it
	// after a success or final failure.
	setCommandFunc(no_op);
		
	const LLSD& content = getContent();
	if (!content.isMap())
	{
		failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
		return;
	}
	mRetryPolicy->onSuccess();
		
	gInventory.onAISUpdateReceived("AISCommand", content);

	if (mCallback)
	{
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2015-06-24 (Catznip-3.7)
		// If we were feeling daring we'd call LLInventoryCallback::fire for every item but it would take additional work to investigate whether all LLInventoryCallback derived classes
		// were designed to handle multiple fire calls (with legacy link creation only one would ever fire per link creation) so we'll be cautious and only call for the first one for now
		// (note that the LL code as written below will always call fire once with the NULL UUID for anything but CopyLibraryCategoryCommand so even the above is an improvement)
		uuid_list_t ids;
		getResponseUUIDs(content, ids);
		mCallback->fire( (!ids.empty()) ? *ids.begin() : LLUUID::null );
// [/SL:KB]
//		LLUUID id; // will default to null if parse fails.
//		getResponseUUID(content,id);
//		mCallback->fire(id);
	}
}
Пример #3
0
	/*virtual*/ void httpSuccess()
	{
		const LLSD& content = getContent();
		if (!content.isMap())
		{
			failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
			return;
		}
		// Pull expiration out of headers if available
		F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(getResponseHeaders());
		F64 now = LLFrameTimer::getTotalSeconds();

		const LLSD& agents = content["agents"];
		LLSD::array_const_iterator it = agents.beginArray();
		for ( ; it != agents.endArray(); ++it)
		{
			const LLSD& row = *it;
			LLUUID agent_id = row["id"].asUUID();

			LLAvatarName av_name;
			av_name.fromLLSD(row);

			// Use expiration time from header
			av_name.mExpires = expires;

			LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << LL_ENDL;
			av_name.dump();
			
			// cache it and fire signals
			LLAvatarNameCache::processName(agent_id, av_name);
		}

		// Same logic as error response case
		const LLSD& unresolved_agents = content["bad_ids"];
		S32  num_unresolved = unresolved_agents.size();
		if (num_unresolved > 0)
		{
            LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; "
                                    << "expires in " << expires - now << " seconds"
                                    << LL_ENDL;
			it = unresolved_agents.beginArray();
			for ( ; it != unresolved_agents.endArray(); ++it)
			{
				const LLUUID& agent_id = *it;

				LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result "
                                        << "failed id " << agent_id
                                        << LL_ENDL;

                LLAvatarNameCache::handleAgentError(agent_id);
			}
		}
        LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result " 
                                 << LLAvatarNameCache::sCache.size() << " cached names"
                                 << LL_ENDL;
    }
void fetchScriptLimitsRegionInfoResponder::httpSuccess()
{
	const LLSD& content = getContent();
	if (!content.isMap())
	{
		failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content);
		return;
	}
	//we don't need to test with a fake response here (shouldn't anyway)

#ifdef DUMP_REPLIES_TO_LLINFOS

	LLSDNotationStreamer notation_streamer(content);
	std::ostringstream nice_llsd;
	nice_llsd << notation_streamer;

	OSMessageBox(nice_llsd.str(), "main cap response:", 0);

	LL_INFOS() << "main cap response:" << content << LL_ENDL;

#endif

	// at this point we have an llsd which should contain ether one or two urls to the services we want.
	// first we look for the details service:
	if(content.has("ScriptResourceDetails"))
	{
		LLHTTPClient::get(content["ScriptResourceDetails"], new fetchScriptLimitsRegionDetailsResponder(mInfo));
	}
	else
	{
		LLFloaterScriptLimits* instance = LLFloaterScriptLimits::findInstance();
		if(!instance)
		{
			LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
		}
	}

	// then the summary service:
	if(content.has("ScriptResourceSummary"))
	{
		LLHTTPClient::get(content["ScriptResourceSummary"], new fetchScriptLimitsRegionSummaryResponder(mInfo));
	}
}
void fetchScriptLimitsAttachmentInfoResponder::httpSuccess()
{
	const LLSD& content_ref = getContent();

#ifdef USE_FAKE_RESPONSES

	// just add the summary, as that's all I'm testing currently!
	LLSD fake_content = LLSD::emptyMap();
	LLSD summary = LLSD::emptyMap();
	LLSD available = LLSD::emptyArray();
	LLSD available_urls = LLSD::emptyMap();
	LLSD available_memory = LLSD::emptyMap();
	LLSD used = LLSD::emptyArray();
	LLSD used_urls = LLSD::emptyMap();
	LLSD used_memory = LLSD::emptyMap();

	used_urls["type"] = "urls";
	used_urls["amount"] = FAKE_NUMBER_OF_URLS;
	available_urls["type"] = "urls";
	available_urls["amount"] = FAKE_AVAILABLE_URLS;
	used_memory["type"] = "memory";
	used_memory["amount"] = FAKE_AMOUNT_OF_MEMORY;
	available_memory["type"] = "memory";
	available_memory["amount"] = FAKE_AVAILABLE_MEMORY;

	used.append(used_urls);
	used.append(used_memory);
	available.append(available_urls);
	available.append(available_memory);

	summary["available"] = available;
	summary["used"] = used;

	fake_content["summary"] = summary;
	fake_content["attachments"] = content_ref["attachments"];

	const LLSD& content = fake_content;

#else

	const LLSD& content = content_ref;

#endif

	if (!content.isMap())
	{
		failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content);
		return;
	}

#ifdef DUMP_REPLIES_TO_LLINFOS

	LLSDNotationStreamer notation_streamer(content);
	std::ostringstream nice_llsd;
	nice_llsd << notation_streamer;

	OSMessageBox(nice_llsd.str(), "attachment response:", 0);

	LL_INFOS() << "attachment response:" << content << LL_ENDL;

#endif

	LLFloaterScriptLimits* instance = LLFloaterScriptLimits::findInstance();

	if(!instance)
	{
		LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
	}
	else
	{
		LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
		if(tab)
		{
			LLPanelScriptLimitsAttachment* panel = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel");
			if(panel)
			{
				panel->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));

				LLButton* btn = panel->getChild<LLButton>("refresh_list_btn");
				if(btn)
				{
					btn->setEnabled(true);
				}

				panel->setAttachmentDetails(content);
			}
			else
			{
				LL_WARNS() << "Failed to get script_limits_my_avatar_panel" << LL_ENDL;
			}
		}
		else
		{
			LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL;
		}
	}
}
void fetchScriptLimitsRegionDetailsResponder::httpSuccess()
{
	const LLSD& content_ref = getContent();
#ifdef USE_FAKE_RESPONSES
/*
Updated detail service, ** denotes field added:

result (map)
+-parcels (array of maps)
  +-id (uuid)
  +-local_id (S32)**
  +-name (string)
  +-owner_id (uuid) (in ERS as owner, but owner_id in code)
  +-objects (array of maps)
    +-id (uuid)
    +-name (string)
	+-owner_id (uuid) (in ERS as owner, in code as owner_id)
	+-owner_name (sting)**
	+-location (map)**
	  +-x (float)
	  +-y (float)
	  +-z (float)
    +-resources (map) (this is wrong in the ERS but right in code)
      +-type (string)
      +-amount (int)
*/
	LLSD fake_content;
	LLSD resource = LLSD::emptyMap();
	LLSD location = LLSD::emptyMap();
	LLSD object = LLSD::emptyMap();
	LLSD objects = LLSD::emptyArray();
	LLSD parcel = LLSD::emptyMap();
	LLSD parcels = LLSD::emptyArray();

	resource["urls"] = FAKE_NUMBER_OF_URLS;
	resource["memory"] = FAKE_AMOUNT_OF_MEMORY;

	location["x"] = 128.0f;
	location["y"] = 128.0f;
	location["z"] = 0.0f;

	object["id"] = LLUUID("d574a375-0c6c-fe3d-5733-da669465afc7");
	object["name"] = "Gabs fake Object!";
	object["owner_id"] = LLUUID("8dbf2d41-69a0-4e5e-9787-0c9d297bc570");
	object["owner_name"] = "Gabs Linden";
	object["location"] = location;
	object["resources"] = resource;

	objects.append(object);

	parcel["id"] = LLUUID("da05fb28-0d20-e593-2728-bddb42dd0160");
	parcel["local_id"] = 42;
	parcel["name"] = "Gabriel Linden\'s Sub Plot";
	parcel["objects"] = objects;
	parcels.append(parcel);

	fake_content["parcels"] = parcels;
	const LLSD& content = fake_content;

#else

	const LLSD& content = content_ref;

#endif

	if (!content.isMap())
	{
		failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content);
		return;
	}

#ifdef DUMP_REPLIES_TO_LLINFOS

	LLSDNotationStreamer notation_streamer(content);
	std::ostringstream nice_llsd;
	nice_llsd << notation_streamer;

	OSMessageBox(nice_llsd.str(), "details response:", 0);

	LL_INFOS() << "details response:" << content << LL_ENDL;

#endif

	LLFloaterScriptLimits* instance = LLFloaterScriptLimits::findInstance();

	if(!instance)
	{
		LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
	}
	else
	{
		LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
		if(tab)
		{
			LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
			if(panel_memory)
			{
				panel_memory->setRegionDetails(content);
			}
			else
			{
				LL_WARNS() << "Failed to get scriptlimits memory panel" << LL_ENDL;
			}
		}
		else
		{
			LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL;
		}
	}
}
void fetchScriptLimitsRegionSummaryResponder::httpSuccess()
{
	const LLSD& content_ref = getContent();
#ifdef USE_FAKE_RESPONSES

	LLSD fake_content;
	LLSD summary = LLSD::emptyMap();
	LLSD available = LLSD::emptyArray();
	LLSD available_urls = LLSD::emptyMap();
	LLSD available_memory = LLSD::emptyMap();
	LLSD used = LLSD::emptyArray();
	LLSD used_urls = LLSD::emptyMap();
	LLSD used_memory = LLSD::emptyMap();

	used_urls["type"] = "urls";
	used_urls["amount"] = FAKE_NUMBER_OF_URLS;
	available_urls["type"] = "urls";
	available_urls["amount"] = FAKE_AVAILABLE_URLS;
	used_memory["type"] = "memory";
	used_memory["amount"] = FAKE_AMOUNT_OF_MEMORY;
	available_memory["type"] = "memory";
	available_memory["amount"] = FAKE_AVAILABLE_MEMORY;

//summary response:{'summary':{'available':[{'amount':i731,'type':'urls'},{'amount':i895577,'type':'memory'},{'amount':i731,'type':'urls'},{'amount':i895577,'type':'memory'}],'used':[{'amount':i329,'type':'urls'},{'amount':i66741,'type':'memory'}]}}

	used.append(used_urls);
	used.append(used_memory);
	available.append(available_urls);
	available.append(available_memory);

	summary["available"] = available;
	summary["used"] = used;

	fake_content["summary"] = summary;

	const LLSD& content = fake_content;

#else

	const LLSD& content = content_ref;

#endif

	if (!content.isMap())
	{
		failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content);
		return;
	}


#ifdef DUMP_REPLIES_TO_LLINFOS

	LLSDNotationStreamer notation_streamer(content);
	std::ostringstream nice_llsd;
	nice_llsd << notation_streamer;

	OSMessageBox(nice_llsd.str(), "summary response:", 0);

	LL_WARNS() << "summary response:" << *content << LL_ENDL;

#endif

	LLFloaterScriptLimits* instance = LLFloaterScriptLimits::findInstance();
	if(!instance)
	{
		LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL;
	}
	else
	{
		LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
		if(tab)
		{
			LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel");
			if(panel_memory)
			{
				panel_memory->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string("")));

				LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn");
				if(btn)
				{
					btn->setEnabled(true);
				}

				panel_memory->setRegionSummary(content);
			}
		}
	}
}