void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param)
{
	LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
	std::string text = input->getText() + "\n";

	std::string url = gAgent.getRegion()->getCapability("SimConsoleAsync");
	if (url.empty())
	{
		// Fall back to the old API
		url = gAgent.getRegion()->getCapability("SimConsole");
		if (url.empty())
		{
			text += CONSOLE_UNAVAILABLE + PROMPT;
		}
		else
		{
			// Using SimConsole (deprecated)
			LLHTTPClient::post(
				url,
				LLSD(input->getText()),
				new ConsoleResponder(mOutput));
		}
	}
	else
	{
		// Using SimConsoleAsync
		LLHTTPClient::post(
			url,
			LLSD(input->getText()),
			new AsyncConsoleResponder);
	}

	mOutput->appendText(text, false, false);
	input->clear();
}
void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, void* userdata)
{
	LLFloaterRegionDebugConsole* panel = (LLFloaterRegionDebugConsole*)userdata;
	if(panel)
	{
		LLLineEditor* input = static_cast<LLLineEditor*>(ctrl);
		std::string text = input->getText() + "\n";

		std::string url = gAgent.getRegion()->getCapability("SimConsoleAsync");
		if (url.empty())
		{
			text += CONSOLE_UNAVAILABLE + PROMPT;
		}
		else
		{
			// Using SimConsoleAsync
			LLHTTPClient::post(
				url,
				LLSD(input->getText()),
				new AsyncConsoleResponder);
		}

		panel->mOutput->appendText(text, false, false);
		input->clear();
	}
}
Example #3
0
void LLFloaterLuaConsole::onClickReset(void *data)
{
    LLFloaterLuaConsole *self = (LLFloaterLuaConsole *)data;

	FLLua::init();

    LLLineEditor *editor = self->getChild<LLLineEditor>("Lua Editor", TRUE);

    if(editor->getLength()) 
	{
		editor->updateHistory();
		editor->clear();
	}
}
Example #4
0
void LLFloaterLuaConsole::onClickSend(void *data)
{
	LLFloaterLuaConsole *self = (LLFloaterLuaConsole *)data;
	LLLineEditor *editor = self->getChild<LLLineEditor>("Lua Editor", TRUE);

	if(editor->getLength()) 
	{
		LLColor4 text_color = gSavedSettings.getColor4("llOwnerSayChatColor");
		LLViewerTextEditor *out = self->getChild<LLViewerTextEditor>("Lua Output Editor");
		out->appendColoredText("] "+editor->getText(), false, true, text_color); //echo command, like a proper console.
		FLLua::callCommand(editor->getText());
		editor->updateHistory();
		editor->clear();
	}
}