From b26ffff01e034178fa534d1e1bc0850530c09f7e Mon Sep 17 00:00:00 2001 From: Cinders Date: Sat, 16 Mar 2013 12:38:26 -0600 Subject: [PATCH] Refactor to use reportToNearbyChat in a few places --- indra/newview/llnetmap.cpp | 10 +--- indra/newview/llviewerparcelmedia.cpp | 76 ++++++--------------------- 2 files changed, 18 insertions(+), 68 deletions(-) diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 1e6313851f..0c5b033b40 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -73,9 +73,8 @@ #include "llfloatersidepanelcontainer.h" #include "lggcontactsets.h" -#include "llnotificationsutil.h" -#include "llnotificationmanager.h" #include "llavataractions.h" +#include "fscommon.h" static LLDefaultChildRegistry::Register r1("net_map"); @@ -1267,12 +1266,7 @@ void LLNetMap::camAvatar() F32 range = dist_vec(mClosestAgentAtLastRightClickPos, gAgent.getPositionGlobal()); if (range > gSavedSettings.getF32("RenderFarClip") || gObjectList.findObject(mClosestAgentAtLastRightClick) == NULL) { - LLChat chat; - chat.mText = LLTrans::getString("minimap_no_focus"); - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("minimap_no_focus")); } else { diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index da9a51cf03..f897db5053 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -42,7 +42,6 @@ #include "llviewerparcelmediaautoplay.h" #include "llnotifications.h" #include "llnotificationsutil.h" -#include "llnotificationmanager.h" //#include "llfirstuse.h" #include "llpluginclassmedia.h" #include "llviewertexture.h" @@ -50,6 +49,7 @@ #include "lltrans.h" #include "llvieweraudio.h" +#include "fscommon.h" // For media filter reportToNearbyChat // Static Variables @@ -924,12 +924,7 @@ void LLViewerParcelMedia::filterMediaUrl(LLParcel* parcel) { LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - LLChat chat; - chat.mText = LLTrans::getString("MediaFilterMediaContentBlocked", format_args);; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentBlocked", format_args)); sMediaLastActionPlay = false; } else @@ -984,12 +979,6 @@ void callback_media_alert2(const LLSD ¬ification, const LLSD &response, LLPar std::string media_url = parcel->getMediaURL(); std::string domain = LLViewerParcelMedia::extractDomain(media_url); - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); - LLViewerParcelMedia::sMediaLastActionPlay = false; if ((option == 0) && allow) //allow now { @@ -1009,8 +998,7 @@ void callback_media_alert2(const LLSD ¬ification, const LLSD &response, LLPar LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - chat.mText = LLTrans::getString("MediaFilterMediaContentDomainAlwaysAllowed", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentDomainAlwaysAllowed", format_args)); LLViewerParcelMedia::sCurrentMedia = *parcel; if (parcel->getName() == currentparcel->getName()) { @@ -1027,8 +1015,7 @@ void callback_media_alert2(const LLSD ¬ification, const LLSD &response, LLPar LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - chat.mText = LLTrans::getString("MediaFilterMediaContentDomainAlwaysBlocked", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentDomainAlwaysBlocked", format_args)); } else if ((option == 2) && allow) // Whitelist URL { @@ -1039,8 +1026,7 @@ void callback_media_alert2(const LLSD ¬ification, const LLSD &response, LLPar LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[MEDIAURL]"] = media_url; - chat.mText = LLTrans::getString("MediaFilterMediaContentUrlAlwaysAllowed", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentUrlAlwaysAllowed", format_args)); LLViewerParcelMedia::sCurrentMedia = *parcel; if (parcel->getName() == currentparcel->getName()) { @@ -1057,8 +1043,7 @@ void callback_media_alert2(const LLSD ¬ification, const LLSD &response, LLPar LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[MEDIAURL]"] = media_url; - chat.mText = LLTrans::getString("MediaFilterMediaContentUrlAlwaysBlocked", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterMediaContentUrlAlwaysBlocked", format_args)); } // We've dealt with the alert, so mark it as inactive. @@ -1256,12 +1241,7 @@ void LLViewerParcelMedia::filterAudioUrl(std::string media_url) { LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - LLChat chat; - chat.mText = LLTrans::getString("MediaFilterAudioContentBlocked", format_args); - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentBlocked", format_args)); LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); sAudioLastActionPlay = false; } @@ -1310,11 +1290,6 @@ void callback_audio_alert2(const LLSD ¬ification, const LLSD &response, std:: S32 option = LLNotificationsUtil::getSelectedOption(notification, response); std::string domain = LLViewerParcelMedia::extractDomain(media_url); - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - if ((option== 0) && allow) // allow now { if (gAudiop != NULL) @@ -1342,8 +1317,7 @@ void callback_audio_alert2(const LLSD ¬ification, const LLSD &response, std:: LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - chat.mText = LLTrans::getString("MediaFilterAudioContentDomainAlwaysAllowed", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentDomainAlwaysAllowed", format_args)); if (gAudiop != NULL) { LLViewerParcelMedia::sCurrentMusic = media_url; @@ -1360,8 +1334,7 @@ void callback_audio_alert2(const LLSD ¬ification, const LLSD &response, std:: LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - chat.mText = LLTrans::getString("MediaFilterAudioContentDomainAlwaysBlocked", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentDomainAlwaysBlocked", format_args)); if (gAudiop != NULL) { LLViewerParcelMedia::sCurrentMusic = ""; @@ -1378,8 +1351,7 @@ void callback_audio_alert2(const LLSD ¬ification, const LLSD &response, std:: LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[MEDIAURL]"] = media_url; - chat.mText = LLTrans::getString("MediaFilterAudioContentUrlAlwaysAllowed", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentUrlAlwaysAllowed", format_args)); if (gAudiop != NULL) { LLViewerParcelMedia::sCurrentMusic = media_url; @@ -1396,8 +1368,7 @@ void callback_audio_alert2(const LLSD ¬ification, const LLSD &response, std:: LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[MEDIAURL]"] = media_url; - chat.mText = LLTrans::getString("MediaFilterAudioContentUrlAlwaysBlocked", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterAudioContentUrlAlwaysBlocked", format_args)); if (gAudiop != NULL) { LLViewerParcelMedia::sCurrentMusic = ""; @@ -1588,13 +1559,7 @@ void LLViewerParcelMedia::filterMOAPUrl(LLMediaDataClientObject *object, LLObjec { LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - LLChat chat; - chat.mText = LLTrans::getString("MediaFilterSharedMediaContentBlocked", domain); - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); - //LLOverlayBar::audioFilterStop(); + reportToNearbyChat(LLTrans::getString("MediaFilterSharedMediaContentBlocked", domain)); sAudioLastActionPlay = false; } else @@ -1648,11 +1613,6 @@ void callback_MOAP_alert2(const LLSD ¬ification, const LLSD &response, LLMedi S32 option = LLNotificationsUtil::getSelectedOption(notification, response); std::string domain = LLViewerParcelMedia::extractDomain(media_url); - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; - if ((option== 0) && allow) // allow now { nav_object->doNavigate(object, texture_index, media_url); @@ -1673,8 +1633,7 @@ void callback_MOAP_alert2(const LLSD ¬ification, const LLSD &response, LLMedi LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - chat.mText = LLTrans::getString("MediaFilterSharedMediaContentDomainAlwaysAllowed", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterSharedMediaContentDomainAlwaysAllowed", format_args)); nav_object->doNavigate(object, texture_index, media_url); LLViewerParcelMedia::sCurrentMOAP = media_url; LLViewerParcelMedia::sMOAPLastActionPlay = true; @@ -1688,8 +1647,7 @@ void callback_MOAP_alert2(const LLSD ¬ification, const LLSD &response, LLMedi LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[DOMAIN]"] = domain; - chat.mText = LLTrans::getString("MediaFilterSharedMediaContentDomainAlwaysBlocked", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterSharedMediaContentDomainAlwaysBlocked", format_args)); LLViewerParcelMedia::sCurrentMOAP = ""; LLViewerParcelMedia::sMOAPLastActionPlay = false; } @@ -1702,8 +1660,7 @@ void callback_MOAP_alert2(const LLSD ¬ification, const LLSD &response, LLMedi LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[MEDIAURL]"] = media_url; - chat.mText = LLTrans::getString("MediaFilterSharedMediaContentUrlAlwaysAllowed", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterSharedMediaContentUrlAlwaysAllowed", format_args)); nav_object->doNavigate(object, texture_index, media_url); LLViewerParcelMedia::sCurrentMOAP = media_url; LLViewerParcelMedia::sMOAPLastActionPlay = true; @@ -1717,8 +1674,7 @@ void callback_MOAP_alert2(const LLSD ¬ification, const LLSD &response, LLMedi LLViewerParcelMedia::saveDomainFilterList(); LLStringUtil::format_map_t format_args; format_args["[MEDIAURL]"] = media_url; - chat.mText = LLTrans::getString("MediaFilterSharedMediaContentUrlAlwaysBlocked", format_args); - LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + reportToNearbyChat(LLTrans::getString("MediaFilterSharedMediaContentUrlAlwaysBlocked", format_args)); LLViewerParcelMedia::sCurrentMOAP = ""; LLViewerParcelMedia::sMOAPLastActionPlay = false; }