From 436f2beafdfe7b5cb1dcf01e62cdadd6ed11f3c9 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 11 Jul 2011 15:55:35 +0200 Subject: [PATCH] Show L$ transactions in nearby chat. Fixes FIRE-1470 --- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llviewermessage.cpp | 53 +++++++++++++++---- .../xui/en/panel_preferences_firestorm.xml | 13 +++++ 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4cb7212f3b..90a7eee767 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2,6 +2,17 @@ + FSPaymentInfoInChat + + Comment + If true, L$ balance changes will be shown in nearby chat instead of toasts. + Persist + 1 + Type + Boolean + Value + 0 + FSScriptDialogNoTransparency Comment diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ae07f84325..46c1fdd28d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5632,10 +5632,24 @@ static void money_balance_group_notify(const LLUUID& group_id, LLSD args, LLSD payload) { - // Message uses name SLURLs, don't actually have to substitute in - // the name. We're just making sure it's available. - // Notification is either PaymentReceived or PaymentSent - LLNotificationsUtil::add(notification, args, payload); + static LLCachedControl balance_change_in_chat(gSavedSettings, "FSPaymentInfoInChat"); + + if (balance_change_in_chat) + { + LLChat chat; + chat.mText = llformat(args["MESSAGE"].asString().c_str(), name.c_str()); + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLSD chat_args; + chat_args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, chat_args); + } + else + { + // Message uses name SLURLs, don't actually have to substitute in + // the name. We're just making sure it's available. + // Notification is either PaymentReceived or PaymentSent + LLNotificationsUtil::add(notification, args, payload); + } } static void money_balance_avatar_notify(const LLUUID& agent_id, @@ -5644,10 +5658,24 @@ static void money_balance_avatar_notify(const LLUUID& agent_id, LLSD args, LLSD payload) { - // Message uses name SLURLs, don't actually have to substitute in - // the name. We're just making sure it's available. - // Notification is either PaymentReceived or PaymentSent - LLNotificationsUtil::add(notification, args, payload); + static LLCachedControl balance_change_in_chat(gSavedSettings, "FSPaymentInfoInChat"); + + if (balance_change_in_chat) + { + LLChat chat; + chat.mText = llformat(args["MESSAGE"].asString().c_str(), av_name.getCompleteName().c_str()); + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLSD chat_args; + chat_args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, chat_args); + } + else + { + // Message uses name SLURLs, don't actually have to substitute in + // the name. We're just making sure it's available. + // Notification is either PaymentReceived or PaymentSent + LLNotificationsUtil::add(notification, args, payload); + } } static void process_money_balance_reply_extended(LLMessageSystem* msg) @@ -5662,6 +5690,11 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) S32 amount = 0; std::string item_description; + // Ansariel: If we output to chat history and probably console, + // don't create an SLURL for the name or we will end + // up with a SLURL in the console + static LLCachedControl balance_change_in_chat(gSavedSettings, "FSPaymentInfoInChat"); + msg->getS32("TransactionInfo", "TransactionType", transaction_type); msg->getUUID("TransactionInfo", "SourceID", source_id); msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group); @@ -5723,7 +5756,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) bool you_paid_someone = (source_id == gAgentID); if (you_paid_someone) { - args["NAME"] = dest_slurl; + args["NAME"] = balance_change_in_chat ? "%s" : dest_slurl; is_name_group = is_dest_group; name_id = dest_id; if (!reason.empty()) @@ -5755,7 +5788,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) } else { // ...someone paid you - args["NAME"] = source_slurl; + args["NAME"] = balance_change_in_chat ? "%s" : source_slurl; is_name_group = is_source_group; name_id = source_id; if (!reason.empty()) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml index b33a5b644f..b99c761885 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml @@ -902,7 +902,18 @@ width="50" height="20" control_name="PhoenixBoldGroupMods" + name="PhoenixBoldGroupMods" label="Show group moderator messages in bold"/> +