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 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 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