Exemple #1
0
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name)
{
	// start tab flashing when receiving im for background session from user
	if (source != LLUUID::null)
	{
		LLMultiFloater* hostp = getHost();
		if( !isInVisibleChain() 
			&& hostp 
			&& source != gAgent.getID())
		{
			hostp->setFloaterFlashing(this, TRUE);
		}
	}

	// Now we're adding the actual line of text, so erase the 
	// "Foo is typing..." text segment, and the optional timestamp
	// if it was present. JC
	removeTypingIndicator(NULL);

	// Actually add the line
	std::string timestring;
	bool prepend_newline = true;
	if (gSavedSettings.getBOOL("IMShowTimestamps"))
	{
		timestring = mHistoryEditor->appendTime(prepend_newline);
		prepend_newline = false;
	}

	std::string separator_string(": ");
	
	// 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
	if (!name.empty()) // If name exists, then add it to the front of the message.
	{
		// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
		if (name == SYSTEM_FROM)
		{
			mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color));
		}
		else
		{
			// Convert the name to a hotlink and add to message.
			mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source));
		}
		prepend_newline = false;
	}
	mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color));
	mHistoryEditor->blockUndo();

	if (!isInVisibleChain())
	{
		mNumUnreadMessages++;
	}
}
void LLFloaterChat::updateConsoleVisibility()
{
	// determine whether we should show console due to not being visible
	gConsole->setVisible( !isInVisibleChain()								// are we not in part of UI being drawn?
							|| isMinimized()								// are we minimized?
							|| (getHost() && getHost()->isMinimized() ));	// are we hosted in a minimized floater?
}
// Per-frame updates of visibility
void LLToolBar::refresh()
{
	BOOL show = gSavedSettings.getBOOL("ShowToolBar");
	BOOL mouselook = gAgent.cameraMouselook();
	setVisible(show && !mouselook);

	BOOL sitting = FALSE;
	if (gAgent.getAvatarObject())
	{
		sitting = gAgent.getAvatarObject()->mIsSitting;
	}

	childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying()) && !sitting );

	childSetEnabled("build_btn", LLViewerParcelMgr::getInstance()->agentCanBuild() );

	// Check to see if we're in build mode
	BOOL build_mode = LLToolMgr::getInstance()->inEdit();
	// And not just clicking on a scripted object
	if (LLToolGrab::getInstance()->getHideBuildHighlight())
	{
		build_mode = FALSE;
	}
	gSavedSettings.setBOOL("BuildBtnState", build_mode);

	if (isInVisibleChain())
	{
		updateCommunicateList();
	}
}
// Per-frame updates of visibility
void LLToolBar::refresh()
{
	if(!isAgentAvatarValid())
		return;

	static LLCachedControl<bool> show("ShowToolBar", true);
	static LLCachedControl<bool> ascent_fly_always_enabled("AscentFlyAlwaysEnabled", true);
	static LLCachedControl<bool> ascent_build_always_enabled("AscentBuildAlwaysEnabled", true);
	BOOL mouselook = gAgentCamera.cameraMouselook();
	setVisible(show && !mouselook);

	BOOL sitting = FALSE;
	static LLCachedControl<bool> continue_flying_on_unsit("LiruContinueFlyingOnUnsit");
	if (continue_flying_on_unsit)
	{
		sitting = false;
	}
	else if (gAgentAvatarp)
	{
		sitting = gAgentAvatarp->isSitting();
	}

	mFlyBtn->setEnabled((gAgent.canFly() || gAgent.getFlying() || ascent_fly_always_enabled) && !sitting );
	mBuildBtn->setEnabled((LLViewerParcelMgr::getInstance()->allowAgentBuild() || ascent_build_always_enabled));

	// Check to see if we're in build mode
	BOOL build_mode = LLToolMgr::getInstance()->inEdit();
	// And not just clicking on a scripted object
	if (LLToolGrab::getInstance()->getHideBuildHighlight())
	{
		build_mode = FALSE;
	}
	static LLCachedControl<bool> build_btn_state("BuildBtnState",false);
	if(build_btn_state!=(bool)build_mode)
		build_btn_state = build_mode;

// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-10 (RLVa-1.0.0g)
	// Called per-frame so this really can't be slow
	if (rlv_handler_t::isEnabled())
	{
		// If we're rez-restricted, we can still edit => allow build floater
		// If we're edit-restricted, we can still rez => allow build floater
		mBuildBtn->setEnabled(!(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)));

		mMapBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP));
		mRadarBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP));
		mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));
	}
// [/RLVa:KB]

	if (isInVisibleChain())
	{
		updateCommunicateList();
	}
}
void LLInventoryItemsList::doIdle()
{
	if (!mNeedsRefresh) return;

	if (isInVisibleChain() || mForceRefresh)
	{
		refresh();

		mRefreshCompleteSignal(this, LLSD());
	}
}
Exemple #6
0
// Per-frame updates of visibility
void LLToolBar::refresh()
{
	BOOL show = gSavedSettings.getBOOL("ShowToolBar");
	BOOL mouselook = gAgent.cameraMouselook();
	setVisible(show && !mouselook);

	if (isInVisibleChain())
	{
		updateCommunicateList();
	}
}
bool LLProgressView::onAlertModal(const LLSD& notify)
{
	// if the progress view is visible, it will obscure the notification window
	// in this case, we want to auto-accept WebLaunchExternalTarget notifications
	if (isInVisibleChain() && notify["sigtype"].asString() == "add")
	{
		LLNotificationPtr notifyp = LLNotifications::instance().find(notify["id"].asUUID());
		if (notifyp && notifyp->getName() == "WebLaunchExternalTarget")
		{
			notifyp->respondWithDefault();
		}
	}
	return false;
}
Exemple #8
0
// Per-frame updates of visibility
void LLToolBar::refresh()
{
	BOOL show = sShowToolBar;
	BOOL mouselook = gAgent.cameraMouselook();
	setVisible(show && !mouselook);

	BOOL sitting = FALSE;
	if (gAgent.getAvatarObject())
	{
		sitting = gAgent.getAvatarObject()->mIsSitting;
	}

	childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying()) && !sitting );

	childSetEnabled("build_btn", LLViewerParcelMgr::getInstance()->agentCanBuild() );

	// Check to see if we're in build mode
	BOOL build_mode = LLToolMgr::getInstance()->inEdit();
	// And not just clicking on a scripted object
	if (LLToolGrab::getInstance()->getHideBuildHighlight())
	{
		build_mode = FALSE;
	}
	//gSavedSettings.setBOOL("BuildBtnState", build_mode);
	LLAgent::sBuildBtnState = build_mode;

// [RLVa:KB] - Version: 1.23.4 | Alternate: Emerald-370 | Checked: 2009-07-10 (RLVa-1.0.0g)
	// Called per-frame so this really can't be slow
	if (rlv_handler_t::isEnabled())
	{
		// If we're rez-restricted, we can still edit => allow build floater
		// If we're edit-restricted, we can still rez => allow build floater
		childSetEnabled("build_btn", !(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) );

		childSetEnabled("map_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP) );
		childSetEnabled("radar_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP) );
		childSetEnabled("inventory_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV) );

		// Emerald-specific
		childSetEnabled("avatar_list_btn", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));
	}
// [/RLVa:KB]

	if (isInVisibleChain())
	{
		updateCommunicateList();
	}
}
void FSFloaterNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
{
	LLChat& tmp_chat = const_cast<LLChat&>(chat);
	bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory");
	bool show_timestamps_nearby_chat = gSavedSettings.getBOOL("FSShowTimestampsNearbyChat");
	// [FIRE-1641 : SJ]: Option to hide timestamps in nearby chat - add Timestamp when show_timestamps_nearby_chat is TRUE
	if (show_timestamps_nearby_chat)
	{
		if (tmp_chat.mTimeStr.empty())
		{
			tmp_chat.mTimeStr = appendTime();
		}
	}

	// <FS:Ansariel> Optional muted chat history
	tmp_chat.mFromName = chat.mFromName;
	LLSD chat_args = args;
	chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
	chat_args["show_time"] = show_timestamps_nearby_chat;
	chat_args["is_local"] = true;
	mChatHistoryMuted->appendMessage(chat, chat_args);
	// </FS:Ansariel> Optional muted chat history
	if (!chat.mMuted)
	{
		// <FS:Ansariel> Optional muted chat history
		//tmp_chat.mFromName = chat.mFromName;
		//LLSD chat_args = args;
		//chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
		//chat_args["show_timestamps_nearby_chat"] = show_timestamps_nearby_chat;
		// <(FS:Ansariel> Optional muted chat history
		mChatHistory->appendMessage(chat, chat_args);
	}

	if (archive)
	{
		mMessageArchive.push_back(chat);
		if (mMessageArchive.size() > 200)
		{
			mMessageArchive.erase(mMessageArchive.begin());
		}
	}

	// <FS:Ansariel> Optional muted chat history
	//if (args["do_not_log"].asBoolean()) 
	if (args["do_not_log"].asBoolean() || chat.mMuted) 
	// </FS:Ansariel> Optional muted chat history
	{
		return;
	}
	
	// AO: IF tab mode active, flash our tab
	if (isChatMultiTab())
	{
		LLMultiFloater* hostp = getHost();
        // KC: Don't flash tab on system messages
		if (!isInVisibleChain() && hostp
        && (chat.mSourceType == CHAT_SOURCE_AGENT || chat.mSourceType == CHAT_SOURCE_OBJECT))
		{
			hostp->setFloaterFlashing(this, TRUE);
		}
	}

	if (gSavedPerAccountSettings.getBOOL("LogNearbyChat"))
	{
		std::string from_name = chat.mFromName;

		if (chat.mSourceType == CHAT_SOURCE_AGENT)
		{
			// if the chat is coming from an agent, log the complete name
			LLAvatarName av_name;
			LLAvatarNameCache::get(chat.mFromID, &av_name);

			if (!av_name.isDisplayNameDefault())
			{
				from_name = av_name.getCompleteName();
			}

			// Ansariel: Handle IMs in nearby chat
			// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
			if (gSavedSettings.getBOOL("FSShowIMInChatHistory"))
			{
				if (chat.mChatType == CHAT_TYPE_IM_GROUP && !chat.mFromNameGroup.empty())
				{
					from_name = "IM: " + chat.mFromNameGroup + from_name;
				}
				else if (chat.mChatType == CHAT_TYPE_IM)
				{
					from_name = "IM: " + from_name;
				}

				// <FS:LO> hack to prevent chat logs from containing lines like "TIMESTANMP IM:: friend is on/offline" (aka the double ":" )
				if (from_name == "IM:")
				{
					from_name = "IM";
				}
				// </FS:LO>
			}
			// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
		}
		// <FS:LO> Make logging IMs to the chat history file toggleable again
		if (!(chat.mChatType == CHAT_TYPE_IM || chat.mChatType == CHAT_TYPE_IM_GROUP) ||
			(chat.mChatType == CHAT_TYPE_IM && chat.mSourceType == CHAT_SOURCE_OBJECT) ||
			gSavedSettings.getBOOL("FSLogIMInChatHistory"))
		{
			LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText);
		}
	}
}
Exemple #10
0
void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incolor, bool log_to_file, const LLUUID& source, const std::string& name)
{
	static const LLCachedControl<bool> mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false);
	static const LLCachedControl<LLColor4> mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f));

	if (gAgentID != source)
	{
		if (mKeywordsChangeColor)
		{
			if (AscentKeyword::hasKeyword(utf8msg, 2))
			{
				incolor = mKeywordsColor;
			}
		}

		if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus()))
		{
			static const LLCachedControl<std::string> ding("LiruNewMessageSound");
			static const LLCachedControl<std::string> dong("LiruNewMessageSoundForSystemMessages");
			LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong));
		}
	}

	const LLColor4& color = incolor;
	// start tab flashing when receiving im for background session from user
	if (source.notNull())
	{
		LLMultiFloater* hostp = getHost();
		if( !isInVisibleChain() 
			&& hostp 
			&& source != gAgentID)
		{
			hostp->setFloaterFlashing(this, TRUE);
		}
	}

	// Now we're adding the actual line of text, so erase the 
	// "Foo is typing..." text segment, and the optional timestamp
	// if it was present. JC
	removeTypingIndicator(NULL);

	// Actually add the line
	bool prepend_newline = true;
	if (gSavedSettings.getBOOL("IMShowTimestamps"))
	{
		mHistoryEditor->appendTime(prepend_newline);
		prepend_newline = false;
	}

	std::string show_name = name;
	bool is_irc = false;
	// 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
	if (!name.empty()) // If name exists, then add it to the front of the message.
	{
		// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
		if (name == SYSTEM_FROM)
		{
			mHistoryEditor->appendColoredText(name,false,prepend_newline,color);
		}
		else
		{
			// IRC style text starts with a colon here; empty names and system messages aren't irc style.
			static const LLCachedControl<bool> italicize("LiruItalicizeActions");
			is_irc = italicize && utf8msg[0] != ':';
			if (source.notNull())
				LLAvatarNameCache::getPNSName(source, show_name);
			// Convert the name to a hotlink and add to message.
			LLStyleSP source_style = LLStyleMap::instance().lookupAgent(source);
			source_style->mItalic = is_irc;
			mHistoryEditor->appendStyledText(show_name,false,prepend_newline,source_style);
		}
		prepend_newline = false;
	}

	// Append the chat message in style
	{
		LLStyleSP style(new LLStyle);
		style->setColor(color);
		style->mItalic = is_irc;
		style->mBold = gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source);
		mHistoryEditor->appendStyledText(utf8msg, false, prepend_newline, style);
	}

	if (log_to_file
		&& gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) 
	{
		std::string histstr;
		if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp"))
			histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + show_name + utf8msg;
		else
			histstr = show_name + utf8msg;

		// [Ansariel: Display name support]
		// Floater title contains display name -> bad idea to use that as filename
		// mLogLabel, however, is the old legacy name
		//LLLogChat::saveHistory(getTitle(),histstr);
		LLLogChat::saveHistory(mLogLabel, histstr);
		// [/Ansariel: Display name support]
	}

	if (source.notNull())
	{
		if (!isInVisibleChain() || (!hasFocus() && getParent() == gFloaterView))
		{
			mNumUnreadMessages++;
		}

		mSpeakers->speakerChatted(source);
		mSpeakers->setSpeakerTyping(source, FALSE);
	}
}