diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 1b98a70c62a61acaa254f20121e8103d18698786..b6903fbd7e6771f2c820ea198d7477764c3c7c30 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -488,7 +488,8 @@ LLNotification::LLNotification(const LLSDParamAdapter<Params>& p) : mResponderObj(NULL), mId(p.id.isProvided() ? p.id : LLUUID::generateNewID()), mOfferFromAgent(p.offer_from_agent), - mIsDND(p.is_dnd) + mIsDND(p.is_dnd), + mForceChat(p.force_to_chat) { if (p.functor.name.isChosen()) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index a24bae3d02bcb02538ee4014f45448e1c6fc9c10..ab1b7e1a61d3552165bbaa8777852ae03acfaf16 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -327,6 +327,7 @@ friend class LLNotifications; Optional<void*> responder; Optional<bool> offer_from_agent; Optional<bool> is_dnd; + Optional<bool> force_to_chat; struct Functor : public LLInitParam::ChoiceBlock<Functor> { @@ -354,7 +355,8 @@ friend class LLNotifications; substitutions("substitutions"), expiry("expiry"), offer_from_agent("offer_from_agent", false), - is_dnd("is_dnd", false) + is_dnd("is_dnd", false), + force_to_chat("force_to_chat", false) { time_stamp = LLDate::now(); responder = nullptr; @@ -369,7 +371,8 @@ friend class LLNotifications; substitutions("substitutions"), expiry("expiry"), offer_from_agent("offer_from_agent", false), - is_dnd("is_dnd", false) + is_dnd("is_dnd", false), + force_to_chat("force_to_chat", false) { functor.name = _name; name = _name; @@ -397,6 +400,7 @@ friend class LLNotifications; LLNotificationResponderPtr mResponder; bool mOfferFromAgent; bool mIsDND; + bool mForceChat; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -554,6 +558,16 @@ friend class LLNotifications; mIsDND = flag; } + bool isSendToChatForced() const + { + return mForceChat; + } + + void setSendToChatForced(const bool flag) + { + mForceChat = flag; + } + std::string getType() const; std::string getMessage() const; std::string getFooter() const; diff --git a/indra/newview/app_settings/settings_alchemy.xml b/indra/newview/app_settings/settings_alchemy.xml index 98adff3d6cacdfc4b1310164ecc4a7a553ca948f..6bcf2b9d65805a027972e204bbe5262e3513b859 100644 --- a/indra/newview/app_settings/settings_alchemy.xml +++ b/indra/newview/app_settings/settings_alchemy.xml @@ -651,6 +651,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>AlchemyOnlineOfflineToChat</key> + <map> + <key>Comment</key> + <string>Log online and offline notifications to local chat</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>AlchemyPreProcLSLOptimizer</key> <map> <key>Comment</key> diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index a002b02fefb19c3da27039bf093abbeb9cb6b7ea..6340140ab29750b55c1979a8a78b726d626cb63b 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -749,21 +749,25 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, args["NAME"] = av_name.getDisplayName(); args["STATUS"] = online ? online_status : offline_status; - LLNotificationPtr notification; + LLNotification::Params notify_params; + notify_params.name = "FriendOnlineOffline"; + notify_params.substitutions = args; if (online) { - notification = - LLNotifications::instance().add("FriendOnlineOffline", - args, - payload.with("respond_on_mousedown", TRUE), - boost::bind(&LLAvatarActions::startIM, agent_id)); + notify_params.payload = payload.with("respond_on_mousedown", TRUE); + + LLNotification::Params::Functor functor_p; + functor_p.function = boost::bind(&LLAvatarActions::startIM, agent_id); + notify_params.functor = functor_p; } else { - notification = - LLNotifications::instance().add("FriendOnlineOffline", args, payload); + notify_params.payload = payload; } + notify_params.force_to_chat = gSavedSettings.getBOOL("AlchemyOnlineOfflineToChat"); + LLNotificationPtr notification = LLNotifications::instance().add(notify_params); + // If there's an open IM session with this agent, send a notification there too. LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); std::string notify_msg = notification->getMessage(); diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 91f93067deb477532d44ccf49ad3a3f4496fc484..8384b3a04de8ae7e3763fd9d264f207ed06946e7 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -80,7 +80,7 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification, bo } // archive message in nearby chat - if (notification->canLogToChat()) + if (notification->canLogToChat() || notification->isSendToChatForced()) { LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0298a5fc86b12e3e134fa8a1582a384aa243e698..d8461e409686fb9c42572ea1a3e6cebdd823d2e9 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2260,17 +2260,24 @@ void sendRadarAlert(const LLUUID& agent, const std::string& region_str, bool ent LLSD args; args["AGENT"] = LLSLURL("agent", agent, "inspect").getSLURLString(); args["REGION"] = region_str; - static LLCachedControl<bool> sLogToChat(gSavedSettings, "AlchemyRadarAlertsToChat", false); + + LLNotification::Params notify_params; + notify_params.substitutions = args; if (entering) { - LLNotificationsUtil::add(sLogToChat ? "RadarAlertEnterChat" : "RadarAlertEnter", args, - LLSD().with("respond_on_mousedown", TRUE), - boost::bind(&ALAvatarActions::zoomIn, agent)); + notify_params.name = "RadarAlertEnter"; + notify_params.payload = LLSD().with("respond_on_mousedown", TRUE); + notify_params.functor.function = boost::bind(&ALAvatarActions::zoomIn, agent); } else { - LLNotificationsUtil::add(sLogToChat ? "RadarAlertLeaveChat" : "RadarAlertLeave", args); + notify_params.name = "RadarAlertLeave"; } + + static LLCachedControl<bool> sLogRadarToChat(gSavedSettings, "AlchemyRadarAlertsToChat", false); + notify_params.force_to_chat = sLogRadarToChat; + LLNotifications::instance().add(notify_params); + } static uuid_vec_t mVecAgents; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 1b734eab47b09c63c94c5fde6b3a3f695ad4df0e..acd32b74a3f21311df7efa8d32697fcf0d80ce87 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -12332,13 +12332,6 @@ the region "[REGION]"? <tag>radar</tag> [AGENT] has entered [REGION]. </notification> - <notification - icon="notifytip.tga" - name="RadarAlertEnterChat" - type="notifytip"> - <tag>radar</tag> - [AGENT] has entered [REGION]. - </notification> <notification icon="notifytip.tga" name="RadarAlertLeave" @@ -12347,13 +12340,6 @@ the region "[REGION]"? <tag>radar</tag> [AGENT] has left [REGION]. </notification> - <notification - icon="notifytip.tga" - name="RadarAlertLeaveChat" - type="notifytip"> - <tag>radar</tag> - [AGENT] has left [REGION]. - </notification> <notification icon="notify.tga" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml index 93c97ded251b9ce9a33719a8047d324d30e979ba..3a2957f9f0a76540b15561f6f3da27e6addcea49 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml @@ -36,13 +36,21 @@ layout="topleft" left_delta="150" name="friends_online_notify_checkbox" - width="300" /> + width="30" /> + <check_box + control_name="AlchemyOnlineOfflineToChat" + height="16" + label="In Nearby Chat" + layout="topleft" + left_delta="170" + name="friends_online_notify_checkbox_chat" + width="20" /> <check_box control_name="NotifyMoneyReceived" height="16" label="When I get L$" layout="topleft" - left_delta="-150" + left_delta="-320" top_pad="4" name="notify_money_received_checkbox" width="300" />