From bc1f01c9488cb56a97156d0ff69ce73f3f5684e6 Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Mon, 15 Mar 2010 12:04:30 +0200 Subject: fix for EXT-5989 [HARD CODED]. ".... paid you...... L$... " - message needs translation --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 361f4e2326..b90e3dcda4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4458,20 +4458,37 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // have missed something during an event. // *TODO: Translate LLSD args; - args["MESSAGE"] = desc; + // this is a marker to retrieve avatar name from server message: // " paid you L$" const std::string marker = "paid you L$"; + args["MESSAGE"] = desc; + // extract avatar name from system message - std::string name = desc.substr(0, desc.find(marker, 0)); + S32 marker_pos = desc.find(marker, 0); + + std::string base_name = desc.substr(0, marker_pos); + + std::string name = base_name; 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)) { + //description always comes not localized. lets fix this + + //ammount paid + std::string ammount = desc.substr(marker_pos + marker.length(),desc.length() - marker.length() - marker_pos); + + //reform description + std::string paid_you = LLTrans::getString("paid_you_ldollars"); + std::string new_description = base_name + paid_you + ammount; + + args["MESSAGE"] = new_description; + args["NAME"] = name; LLSD payload; payload["from_id"] = from_id; -- cgit v1.2.3 From fee3752311907c774b595246f1dbb93ef5b8cd53 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Mon, 15 Mar 2010 18:06:04 +0200 Subject: Implemented normal task EXT-5905 - Resolving offers. Added functionality to make Toasts accept multiple user inputs(clicks on option buttons). --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 361f4e2326..de92e5f2ae 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1081,6 +1081,21 @@ LLOfferInfo::LLOfferInfo(const LLSD& sd) mHost = LLHost(sd["sender"].asString()); } +LLOfferInfo::LLOfferInfo(const LLOfferInfo& info) +{ + mIM = info.mIM; + mFromID = info.mFromID; + mFromGroup = info.mFromGroup; + mFromObject = info.mFromObject; + mTransactionID = info.mTransactionID; + mFolderID = info.mFolderID; + mObjectID = info.mObjectID; + mType = info.mType; + mFromName = info.mFromName; + mDesc = info.mDesc; + mHost = info.mHost; +} + LLSD LLOfferInfo::asLLSD() { LLSD sd; @@ -1570,7 +1585,12 @@ void inventory_offer_handler(LLOfferInfo* info) } else // Agent -> Agent Inventory Offer { + payload["reusable"] = true; + p.responder = info; // Note: sets inventory_offer_callback as the callback + // *TODO fix memory leak + // inventory_offer_callback() is not invoked if user received notification and + // closes viewer(without responding the notification) p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2)); p.name = "UserGiveItem"; -- cgit v1.2.3 From 13710336cb46a26f00751b1badac2f2dfc14350a Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Tue, 16 Mar 2010 15:24:28 +0200 Subject: EXT-5989 [HARD CODED]. ".... paid you...... L$... " - message needs translation Reviwed https://codereview.productengine.com/secondlife/r/13/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b90e3dcda4..e882597c59 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4484,11 +4484,13 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) std::string ammount = desc.substr(marker_pos + marker.length(),desc.length() - marker.length() - marker_pos); //reform description - std::string paid_you = LLTrans::getString("paid_you_ldollars"); - std::string new_description = base_name + paid_you + ammount; + LLStringUtil::format_map_t str_args; + str_args["NAME"] = base_name; + str_args["AMOUNT"] = ammount; + std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); + args["MESSAGE"] = new_description; - args["NAME"] = name; LLSD payload; payload["from_id"] = from_id; -- cgit v1.2.3 From 30c586e77031f0c9141e8b8b96c344a6a9007876 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 17:04:55 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Update for TeleportOffered and OfferFriendship offers. --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e6cf6e45ac..d44f5161f6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2318,6 +2318,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["from_id"] = from_id; payload["lure_id"] = session_id; payload["godlike"] = FALSE; + payload["reusable"] = true; LLNotificationsUtil::add("TeleportOffered", args, payload); } } @@ -2386,6 +2387,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { + payload["reusable"] = true; args["[MESSAGE]"] = message; LLNotificationsUtil::add("OfferFriendship", args, payload); } -- cgit v1.2.3 From 628f24c4913692617ef359d01842d95eae35059e Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 17:34:50 +0200 Subject: Fixed normal task EXT-6282 - [TRANSLATED BUT IN EN]? - System message when receiving inventory offers: The item term needs to be localized Localized asset type names will be taken from strings.xml. Reviewed by Mike Antipov https://codereview.productengine.com/secondlife/r/15/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e882597c59..2b4f33b8ed 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1500,7 +1500,9 @@ void inventory_offer_handler(LLOfferInfo* info) std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType)); if (!typestr.empty()) { - args["OBJECTTYPE"] = typestr; + // human readable matches string name from strings.xml + // lets get asset type localized name + args["OBJECTTYPE"] = LLTrans::getString(typestr); } else { -- cgit v1.2.3 From b3f305ae9464201445328f9e6c980357aba21ef7 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Tue, 16 Mar 2010 18:29:56 +0200 Subject: Implemented normal task EXT-5982([HARD CODED] on L$ kaufen window (Buy L$)). - Moved hardcoded strings in LLFloaterBuyCurrency::buyCurrency() calls to strings.xml Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/33/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2b4f33b8ed..eed3f25231 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -272,7 +272,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_ } else { - LLFloaterBuyCurrency::buyCurrency("Giving", amount); + LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving"), amount); } } -- cgit v1.2.3 From 8bf0509959e5f8ff7d8628d02f9193c8609b2f31 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Wed, 17 Mar 2010 13:22:29 +0200 Subject: fixed EXT-6350 [HARD CODED] - System message when loosing connectivity needs to be localized extracted strings used in LLAppViewer::forceDisconnect(...) calls Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/41/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index eed3f25231..bd0012057c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3080,7 +3080,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) << x << ":" << y << " current pos " << gAgent.getPositionGlobal() << LL_ENDL; - LLAppViewer::instance()->forceDisconnect("You were sent to an invalid region."); + LLAppViewer::instance()->forceDisconnect(LLTrans::getString("SentToInvalidRegion")); return; } -- cgit v1.2.3 From c74f87015118a6da7036623d026fc512f46af9d5 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Thu, 18 Mar 2010 19:42:38 +0200 Subject: (EXT-5982) [FRAGMENTATION] L$ kaufen window (Buy L$) - Moved hardcoded strings in LLFloaterBuyCurrency::buyCurrency() calls to strings.xml Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/56/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index bd0012057c..210557f68f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -272,7 +272,9 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_ } else { - LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving"), amount); + LLStringUtil::format_map_t args; + args["AMOUNT"] = llformat("%d", amount); + LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving", args), amount); } } -- cgit v1.2.3 From 90cb98cc02d6694ba01cfcb35d71c7659a8ed7b8 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Thu, 18 Mar 2010 21:15:43 +0200 Subject: Implemented normal task EXT-5986 ([HARD CODED]. "You paid ...... L$... " - message needs translation). String is server side hardcoded! - Moved strings to strings.xml - Parsed incoming "You paid" messages in code via regex --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 210557f68f..32edbec822 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -105,6 +105,7 @@ #include "llpanelplaceprofile.h" #include // +#include #if LL_WINDOWS // For Windows specific error handler #include "llwindebug.h" // For the invalid message handler @@ -4500,8 +4501,64 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) payload["from_id"] = from_id; LLNotificationsUtil::add("PaymentRecived", args, payload); } + //AD *HACK: Parsing incoming string to localize messages that come from server! EXT-5986 + // It's only a temporarily and ineffective measure. It doesn't affect performance much + // because we get here only for specific type of messages, but anyway it is not right to do it! + // *TODO: Server-side changes should be made and this code removed. else { + if(desc.find("You paid")==0) + { + // Regular expression for message parsing- change it in case of server-side changes. + // Each set of parenthesis will later be used to find arguments of message we generate + // in the end of this if- (.*) gives us name of money receiver, (\\d+)-amount of money we pay + // and ([^$]*)- reason of payment + boost::regex expr("You paid (.*)L\\$(\\d+)\\s?([^$]*)."); + boost::match_results matches; + if(boost::regex_match(desc, matches, expr)) + { + // Name of full localizable notification string + // there are three types of this string- with name of receiver and reason of payment, + // without name and without reason (but not simultaneously) + // example of string without name - You paid L$100 to create a group. + // example of string without reason - You paid Smdby Linden L$100. + // example of string with reason and name - You paid Smbdy Linden L$100 for a land access pass. + std::string line = "you_paid_ldollars_no_name"; + + // arguments of string which will be in notification + LLStringUtil::format_map_t str_args; + + // extracting amount of money paid (without L$ symbols). It is always present. + str_args["[AMOUNT]"] = std::string(matches[2]); + + // extracting name of person/group you are paying (it may be absent) + std::string name = std::string(matches[1]); + if(!name.empty()) + { + str_args["[NAME]"] = name; + line = "you_paid_ldollars"; + } + + // extracting reason of payment (it may be absent) + std::string reason = std::string(matches[3]); + if (reason.empty()) + { + line = "you_paid_ldollars_no_reason"; + } + else + { + std::string localized_reason; + // if we haven't found localized string for reason of payment leave it as it was + str_args["[REASON]"] = LLTrans::findString(localized_reason, reason) ? localized_reason : reason; + } + + // forming final message string by retrieving localized version from xml + // and applying previously found arguments + line = LLTrans::getString(line, str_args); + args["MESSAGE"] = line; + } + } + LLNotificationsUtil::add("SystemMessage", args); } -- cgit v1.2.3 From 37812054480843bca8e9016e3f816e9fdee6e7d3 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Fri, 19 Mar 2010 15:32:14 +0200 Subject: Related to EXT-5986 ([HARD CODED]. "You paid ...... L$... " - message needs translation) - Slightly modified regexp to avoid adding of extra space after names and also made demands to the end of the message string more strict by escaping "." Reviewed by Kent at https://codereview.productengine.com/secondlife/r/55/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 32edbec822..2ba8bd7551 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4513,7 +4513,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // Each set of parenthesis will later be used to find arguments of message we generate // in the end of this if- (.*) gives us name of money receiver, (\\d+)-amount of money we pay // and ([^$]*)- reason of payment - boost::regex expr("You paid (.*)L\\$(\\d+)\\s?([^$]*)."); + boost::regex expr("You paid (?:.{0}|(.*) )L\\$(\\d+)\\s?([^$]*)\\."); boost::match_results matches; if(boost::regex_match(desc, matches, expr)) { -- cgit v1.2.3 From 1c4eeed50fddd32c43fc4093492727035c9da49b Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 19 Mar 2010 16:35:45 +0200 Subject: fixed EXT-6451 Name of people sending a IM some times is NoBody LLSD::maps keys accross the code are used in mix of cases, lower and upper. Using "from_id" and "FROM_ID" causes avatar id to be null and thus "no body" was displayed. BUT this fix is of no use since several minutes ago viewer-offers feature was merged into release, which overrides avatar name with "Second Life" to display message about teleport offering as system message Reviewed by Q at https://codereview.productengine.com/secondlife/r/72/ --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f0b61bbf45..7ecff4c2d8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5567,6 +5567,8 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) args["TO_NAME"] = target_name; LLSD payload; + + //*TODO please rewrite all keys to the same case, lower or upper payload["from_id"] = target_id; payload["SESSION_NAME"] = target_name; payload["SUPPRESS_TOAST"] = true; -- cgit v1.2.3 From a2150863f97bf4fc49ecc17a2405177abe9d8f73 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 19 Mar 2010 17:18:53 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Reusable notifications are deleted when user closes IM floater(old - when user closes Viewer). --HG-- branch : product-engine --- indra/newview/llviewermessage.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7ecff4c2d8..3d0dfbed40 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1590,7 +1590,6 @@ void inventory_offer_handler(LLOfferInfo* info) } else // Agent -> Agent Inventory Offer { - payload["reusable"] = true; p.responder = info; // Note: sets inventory_offer_callback as the callback // *TODO fix memory leak @@ -2323,7 +2322,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["from_id"] = from_id; payload["lure_id"] = session_id; payload["godlike"] = FALSE; - payload["reusable"] = true; LLNotificationsUtil::add("TeleportOffered", args, payload); } } @@ -2392,7 +2390,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - payload["reusable"] = true; args["[MESSAGE]"] = message; LLNotificationsUtil::add("OfferFriendship", args, payload); } -- cgit v1.2.3