summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/lltransactionflags.cpp6
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp8
-rw-r--r--indra/newview/llviewermessage.cpp99
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml20
4 files changed, 101 insertions, 32 deletions
diff --git a/indra/llinventory/lltransactionflags.cpp b/indra/llinventory/lltransactionflags.cpp
index e0f87aa7db..79f8589bb1 100644
--- a/indra/llinventory/lltransactionflags.cpp
+++ b/indra/llinventory/lltransactionflags.cpp
@@ -114,6 +114,9 @@ std::string build_transfer_message_to_source(
std::ostringstream ostr;
if(dest_id.isNull())
{
+ // *NOTE: Do not change these strings! The viewer matches
+ // them in llviewermessage.cpp to perform localization.
+ // If you need to make changes, add a new, localizable message. JC
ostr << "You paid L$" << amount;
switch(transaction_type)
{
@@ -160,6 +163,9 @@ std::string build_transfer_message_to_destination(
return description;
}
std::ostringstream ostr;
+ // *NOTE: Do not change these strings! The viewer matches
+ // them in llviewermessage.cpp to perform localization.
+ // If you need to make changes, add a new, localizable message. JC
ostr << source_name << " paid you L$" << amount;
append_reason(ostr, transaction_type, description);
ostr << ".";
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 4d1a8fcb04..9c60483416 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -46,7 +46,9 @@ using namespace LLNotificationsUI;
const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
REVOKED_MODIFY_RIGHTS("RevokedModifyRights"), OBJECT_GIVE_ITEM(
"ObjectGiveItem"),
- PAYMENT_RECIVED("PaymentRecived"),
+ PAYMENT_RECEIVED("PaymentReceived"),
+ PAYMENT_RECEIVED_FOR("PaymentReceivedFor"),
+ PAYMENT_SENT("PaymentSent"),
ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
USER_GIVE_ITEM("UserGiveItem"),
INVENTORY_ACCEPTED("InventoryAccepted"),
@@ -63,7 +65,9 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
{
return GRANTED_MODIFY_RIGHTS == notification->getName()
|| REVOKED_MODIFY_RIGHTS == notification->getName()
- || PAYMENT_RECIVED == notification->getName()
+ || PAYMENT_RECEIVED == notification->getName()
+ || PAYMENT_RECEIVED_FOR == notification->getName()
+ || PAYMENT_SENT == notification->getName()
|| OFFER_FRIENDSHIP == notification->getName()
|| FRIENDSHIP_OFFERED == notification->getName()
|| SERVER_OBJECT_MESSAGE == notification->getName()
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 10d5d002cd..f8da6eab3d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -105,6 +105,7 @@
#include "llpanelplaceprofile.h"
#include <boost/algorithm/string/split.hpp> //
+#include <boost/regex.hpp>
#if LL_WINDOWS // For Windows specific error handler
#include "llwindebug.h" // For the invalid message handler
@@ -2038,6 +2039,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
invite_bucket = (struct invite_bucket_t*) &binary_bucket[0];
S32 membership_fee = ntohl(invite_bucket->membership_fee);
+ // IDEVO Clean up legacy name "Resident" in message constructed in
+ // lldatagroups.cpp
+ U32 pos = message.find(" has invited you to join a group.\n");
+ if (pos != std::string::npos)
+ {
+ // use cleaned-up name from above
+ message = name + message.substr(pos);
+ }
+
LLSD payload;
payload["transaction_id"] = session_id;
payload["group_id"] = from_id;
@@ -4439,6 +4449,67 @@ void process_time_dilation(LLMessageSystem *msg, void **user_data)
*/
+static void show_money_balance_notification(const std::string& desc)
+{
+ // Intercept some messages constructed in lltransactionflags.cpp
+ // to fix avatar names and allow localization.
+ LLSD args;
+ LLSD payload;
+ std::string name;
+ boost::smatch match;
+ const char* notification_name = NULL;
+
+ // <name> paid you L$<amount> for <reason>.
+ static const boost::regex paid_you_for("(.+) paid you L\\$(\\d+) for (.*)\\.");
+ // <name> paid you L$<amount>.
+ static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\.");
+ // You paid <name> L$<amount> [for <reason>].
+ static const boost::regex you_paid("You paid (.*) L\\$(\\d+)(.+)\\.");
+
+ if (boost::regex_match(desc, match, paid_you_for))
+ {
+ name = match[1].str();
+ // IDEVO strip legacy "Resident" name
+ name = name.substr(0, name.find(" Resident"));
+ args["NAME"] = name;
+ args["AMOUNT"] = match[2].str();
+ args["REASON"] = match[3].str();
+ notification_name = "PaymentReceivedFor";
+ }
+ else if (boost::regex_match(desc, match, paid_you))
+ {
+ name = match[1].str();
+ // IDEVO strip legacy "Resident" name
+ name = name.substr(0, name.find(" Resident"));
+ args["NAME"] = name;
+ args["AMOUNT"] = match[2].str();
+ notification_name = "PaymentReceived";
+ }
+ else if (boost::regex_match(desc, match, you_paid))
+ {
+ name = match[1].str();
+ // IDEVO strip legacy "Resident" name
+ name = name.substr(0, name.find(" Resident"));
+ args["NAME"] = name;
+ args["AMOUNT"] = match[2].str();
+ args["REASON"] = match[3].str();
+ notification_name = "PaymentSent";
+ }
+
+ // if name extracted and name cache contains avatar id send loggable notification
+ LLUUID from_id;
+ if (notification_name != NULL
+ && gCacheName->getUUID(name, from_id))
+ {
+ payload["from_id"] = from_id;
+ LLNotificationsUtil::add(notification_name, args, payload);
+ }
+ else
+ {
+ args["MESSAGE"] = desc;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
+}
void process_money_balance_reply( LLMessageSystem* msg, void** )
{
@@ -4483,33 +4554,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
if(!desc.empty() && gSavedSettings.getBOOL("NotifyMoneyChange")
&& (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend()))
{
- // Make the user confirm the transaction, since they might
- // have missed something during an event.
- // *TODO: Translate
- LLSD args;
- args["MESSAGE"] = desc;
-
- // this is a marker to retrieve avatar name from server message:
- // "<avatar name> paid you L$"
- const std::string marker = "paid you L$";
-
- // extract avatar name from system message
- std::string name = desc.substr(0, desc.find(marker, 0));
- LLStringUtil::trim(name);
-
- // if name extracted and name cache contains avatar id send loggable notification
- LLUUID from_id;
- if(name.size() > 0 && gCacheName->getUUID(name, from_id))
- {
- args["NAME"] = name;
- LLSD payload;
- payload["from_id"] = from_id;
- LLNotificationsUtil::add("PaymentRecived", args, payload);
- }
- else
- {
- LLNotificationsUtil::add("SystemMessage", args);
- }
+ show_money_balance_notification(desc);
// Once the 'recent' container gets large enough, chop some
// off the beginning.
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 665a49b6d8..a69d9c78a7 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4621,11 +4621,25 @@ Please select at least one type of content to search (General, Moderate, or Adul
<notification
icon="notify.tga"
- name="PaymentRecived"
+ name="PaymentReceived"
type="notify">
-[MESSAGE]
+[NAME] paid you L$[AMOUNT].
</notification>
-
+
+ <notification
+ icon="notify.tga"
+ name="PaymentReceivedFor"
+ type="notify">
+[NAME] paid you L$[AMOUNT] for [REASON].
+ </notification>
+
+ <notification
+ icon="notify.tga"
+ name="PaymentSent"
+ type="notify">
+You paid [NAME] L$[AMOUNT][REASON].
+ </notification>
+
<notification
icon="notify.tga"
name="EventNotification"