diff options
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
| -rwxr-xr-x | indra/newview/llviewermessage.cpp | 123 | 
1 files changed, 68 insertions, 55 deletions
| diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ab9ea5618e..df5c7d5c2e 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -45,6 +45,7 @@  #include "llsd.h"  #include "llsdserialize.h"  #include "llteleportflags.h" +#include "lltoastnotifypanel.h"  #include "lltransactionflags.h"  #include "llvfile.h"  #include "llvfs.h" @@ -110,6 +111,7 @@  #include "llpanelblockedlist.h"  #include "llpanelplaceprofile.h"  #include "llviewerregion.h" +#include "llfloaterregionrestarting.h"  #include <boost/algorithm/string/split.hpp> //  #include <boost/regex.hpp> @@ -2407,14 +2409,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)  					&& from_id.notNull() //not a system message  					&& to_id.notNull()) //not global message  		{ -			// return a standard "do not disturb" message, but only do it to online IM  +			// return a standard "do not disturb" message, but only do it to online IM  			// (i.e. not other auto responses and not store-and-forward IM) -			if (!gIMMgr->hasSession(session_id)) -			{ -				// if there is not a panel for this conversation (i.e. it is a new IM conversation -				// initiated by the other party) then... -				send_do_not_disturb_message(msg, from_id, session_id); -			} + +			send_do_not_disturb_message(msg, from_id, session_id);  			// now store incoming IM in chat history @@ -3228,7 +3226,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)  			payload["online"] = (offline == IM_ONLINE);  			payload["sender"] = msg->getSender().getIPandPort(); -			if (is_muted) +			bool add_notification = true; +			for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances()) +				, tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti) +			{ +				LLToastNotifyPanel& panel = *ti; +				const std::string& notification_name = panel.getNotificationName(); +				if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled()) +				{ +					add_notification = false; +					break; +				} +			} + +			if (is_muted && add_notification)  			{  				LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);  			} @@ -3239,6 +3250,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)  					send_do_not_disturb_message(msg, from_id);  				}  				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); + +				if (add_notification) +				{  				if(message.empty())  				{  					//support for frienship offers from clients before July 2008 @@ -3254,6 +3268,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)  				}  			}  		} +		}  		break;  	case IM_FRIENDSHIP_ACCEPTED: @@ -3816,19 +3831,6 @@ public:  				LLInventoryModel::EXCLUDE_TRASH,  				is_card);  		} -		LLSD args; -		if ( land_items.count() > 0 ) -		{	// Show notification that they can now teleport to landmarks.  Use a random landmark from the inventory -			S32 random_land = ll_rand( land_items.count() - 1 ); -			args["NAME"] = land_items[random_land]->getName(); -			LLNotificationsUtil::add("TeleportToLandmark",args); -		} -		if ( card_items.count() > 0 ) -		{	// Show notification that they can now contact people.  Use a random calling card from the inventory -			S32 random_card = ll_rand( card_items.count() - 1 ); -			args["NAME"] = card_items[random_card]->getName(); -			LLNotificationsUtil::add("TeleportToPerson",args); -		}  		gInventory.removeObserver(this);  		delete this; @@ -4105,18 +4107,6 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)  		if (isAgentAvatarValid())  		{ -			// Chat the "back" SLURL. (DEV-4907) - -			LLSLURL slurl; -			gAgent.getTeleportSourceSLURL(slurl); -			LLSD substitution = LLSD().with("[T_SLURL]", slurl.getSLURLString()); -			std::string completed_from = LLAgent::sTeleportProgressMessages["completed_from"]; -			LLStringUtil::format(completed_from, substitution); - -			LLSD args; -			args["MESSAGE"] = completed_from; -			LLNotificationsUtil::add("SystemMessageTip", args); -  			// Set the new position  			gAgentAvatarp->setPositionAgent(agent_pos);  			gAgentAvatarp->clearChat(); @@ -5748,7 +5738,6 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)  	std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);  	LLStringUtil::toLower(regionMaturity);  	llsdBlock["REGIONMATURITY"] = regionMaturity; -	  	bool returnValue = false;  	LLNotificationPtr maturityLevelNotification;  	std::string notifySuffix = "_Notify"; @@ -5918,6 +5907,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)  			(notificationID == "RegionEntryAccessBlocked") ||  			(notificationID == "LandClaimAccessBlocked") ||  			(notificationID == "LandBuyAccessBlocked") +  		   )  		{  			/*--------------------------------------------------------------------- @@ -5959,7 +5949,41 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)  			snap_filename += SCREEN_HOME_FILENAME;  			gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);  		} -		 + +		if (notificationID == "RegionRestartMinutes" || +			notificationID == "RegionRestartSeconds") +		{ +			S32 seconds; +			if (notificationID == "RegionRestartMinutes") +			{ +				seconds = 60 * static_cast<S32>(llsdBlock["MINUTES"].asInteger()); +			} +			else +			{ +				seconds = static_cast<S32>(llsdBlock["SECONDS"].asInteger()); +			} + +			LLFloaterRegionRestarting* floaterp = LLFloaterReg::findTypedInstance<LLFloaterRegionRestarting>("region_restarting"); + +			if (floaterp) +			{ +				LLFloaterRegionRestarting::updateTime(seconds); +			} +			else +			{ +				LLSD params; +				params["NAME"] = llsdBlock["NAME"]; +				params["SECONDS"] = (LLSD::Integer)seconds; +				LLFloaterRegionRestarting* restarting_floater = dynamic_cast<LLFloaterRegionRestarting*>(LLFloaterReg::showInstance("region_restarting", params)); +				if(restarting_floater) +				{ +					restarting_floater->center(); +				} +			} + +			send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 1.0f); +		} +  		LLNotificationsUtil::add(notificationID, llsdBlock);  		return true;  	}	 @@ -6019,7 +6043,6 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data)  	std::string message;  	msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message); -  	process_special_alert_messages(message);  	if (!attempt_standard_notification(msgsystem)) @@ -6043,7 +6066,6 @@ bool handle_not_age_verified_alert(const std::string &pAlertName)  bool handle_special_alerts(const std::string &pAlertName)  {  	bool isHandled = false; -  	if (LLStringUtil::compareStrings(pAlertName, "NotAgeVerified") == 0)  	{ @@ -6079,26 +6101,17 @@ void process_alert_core(const std::string& message, BOOL modal)  		// System message is important, show in upper-right box not tip  		std::string text(message.substr(1));  		LLSD args; -		if (text.substr(0,17) == "RESTART_X_MINUTES") -		{ -			S32 mins = 0; -			LLStringUtil::convertToS32(text.substr(18), mins); -			args["MINUTES"] = llformat("%d",mins); -			LLNotificationsUtil::add("RegionRestartMinutes", args); -		} -		else if (text.substr(0,17) == "RESTART_X_SECONDS") + +		// *NOTE: If the text from the server ever changes this line will need to be adjusted. +		std::string restart_cancelled = "Region restart cancelled."; +		if (text.substr(0, restart_cancelled.length()) == restart_cancelled)  		{ -			S32 secs = 0; -			LLStringUtil::convertToS32(text.substr(18), secs); -			args["SECONDS"] = llformat("%d",secs); -			LLNotificationsUtil::add("RegionRestartSeconds", args); -		} -		else -		{ -			std::string new_msg =LLNotifications::instance().getGlobalString(text); -			args["MESSAGE"] = new_msg; -			LLNotificationsUtil::add("SystemMessage", args); +			LLFloaterRegionRestarting::close();  		} + +		std::string new_msg =LLNotifications::instance().getGlobalString(text); +		args["MESSAGE"] = new_msg; +		LLNotificationsUtil::add("SystemMessage", args);  	}  	else if (modal)  	{ | 
