From 130214c766763855b733c9b5d4e177afe0c39865 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 11:01:00 -0800 Subject: Fix "Resident" names in IM and chat --- indra/newview/llviewermessage.cpp | 70 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0358efc0af..b7d3e407c6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1647,6 +1647,60 @@ bool inspect_remote_object_callback(const LLSD& notification, const LLSD& respon } static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback); +// Strip out "Resident" for display, but only if the message came from a user +// (rather than a script) +static std::string clean_name_from_im(const std::string& name, EInstantMessage type) +{ + U32 pos = 0; + switch(type) + { + case IM_NOTHING_SPECIAL: + case IM_MESSAGEBOX: + case IM_GROUP_INVITATION: + case IM_INVENTORY_OFFERED: + case IM_INVENTORY_ACCEPTED: + case IM_INVENTORY_DECLINED: + case IM_GROUP_VOTE: + case IM_GROUP_MESSAGE_DEPRECATED: + //IM_TASK_INVENTORY_OFFERED + //IM_TASK_INVENTORY_ACCEPTED + //IM_TASK_INVENTORY_DECLINED + case IM_NEW_USER_DEFAULT: + case IM_SESSION_INVITE: + case IM_SESSION_P2P_INVITE: + case IM_SESSION_GROUP_START: + case IM_SESSION_CONFERENCE_START: + case IM_SESSION_SEND: + case IM_SESSION_LEAVE: + //IM_FROM_TASK + case IM_BUSY_AUTO_RESPONSE: + case IM_CONSOLE_AND_CHAT_HISTORY: + case IM_LURE_USER: + case IM_LURE_ACCEPTED: + case IM_LURE_DECLINED: + case IM_GODLIKE_LURE_USER: + case IM_YET_TO_BE_USED: + case IM_GROUP_ELECTION_DEPRECATED: + //IM_GOTO_URL + //IM_FROM_TASK_AS_ALERT + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_INVENTORY_ACCEPTED: + case IM_GROUP_NOTICE_INVENTORY_DECLINED: + case IM_GROUP_INVITATION_ACCEPT: + case IM_GROUP_INVITATION_DECLINE: + case IM_GROUP_NOTICE_REQUESTED: + case IM_FRIENDSHIP_OFFERED: + case IM_FRIENDSHIP_ACCEPTED: + case IM_FRIENDSHIP_DECLINED_DEPRECATED: + //IM_TYPING_START + //IM_TYPING_STOP + pos = name.find(" Resident"); + return name.substr(0, pos); + default: + return name; + } +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -1694,6 +1748,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { name = LLTrans::getString("Unnamed"); } + // IDEVO convert new-style "Resident" names for display + name = clean_name_from_im(name, dialog); BOOL is_busy = gAgent.getBusy(); BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); @@ -2494,6 +2550,15 @@ void process_decline_callingcard(LLMessageSystem* msg, void**) LLNotificationsUtil::add("CallingCardDeclined"); } +static std::string clean_name_from_chat(const std::string& full_name, EChatSourceType type) +{ + if (type == CHAT_SOURCE_AGENT) + { + U32 pos = full_name.find(" Resident"); + return full_name.substr(0, pos); + } + return full_name; +} void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { @@ -2510,7 +2575,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLViewerObject* chatter; msg->getString("ChatData", "FromName", from_name); - chat.mFromName = from_name; + //chat.mFromName = from_name; msg->getUUID("ChatData", "SourceID", from_id); chat.mFromID = from_id; @@ -2529,6 +2594,9 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mTime = LLFrameTimer::getElapsedSeconds(); + // IDEVO Correct for new-style "Resident" names + chat.mFromName = clean_name_from_chat(from_name, chat.mSourceType); + BOOL is_busy = gAgent.getBusy(); BOOL is_muted = FALSE; -- cgit v1.2.3 From 146e9d5e4d9a9a4f33d9ccd47a901980972b7ab9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 17:06:18 -0800 Subject: Support returning full_name (and SLID) for LLCacheName::get() calls Changed callback signature to full_name instead of first_name,last_name Eliminated all calls to legacy (non-signal/non-boost-bind) lookup mechanism Change Pay dialog names to SLURL links Tweaked layout of Pay Resident and Pay via Object floaters to make SLURLs fit Consolidate name first + " " + last concatenation in LLCacheName::buildFullName() Reviewed with Kelly --- indra/newview/llviewermessage.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b7d3e407c6..79e21b3ee7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -983,27 +983,24 @@ void open_inventory_offer(const std::vector& items, const std::string& f } void inventory_offer_mute_callback(const LLUUID& blocked_id, - const std::string& first_name, - const std::string& last_name, - BOOL is_group, LLOfferInfo* offer = NULL) + const std::string& full_name, + bool is_group, + LLOfferInfo* offer = NULL) { - std::string from_name; + std::string from_name = full_name; LLMute::EType type; if (is_group) { type = LLMute::GROUP; - from_name = first_name; } else if(offer && offer->mFromObject) { //we have to block object by name because blocked_id is an id of owner type = LLMute::BY_NAME; - from_name = offer->mFromName; } else { type = LLMute::AGENT; - from_name = first_name + " " + last_name; } // id should be null for BY_NAME mute, see LLMuteList::add for details @@ -1129,7 +1126,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // * we can't build two messages at once. if (2 == button) // Block { - gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this)); + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,this)); } std::string from_string; // Used in the pop-up. @@ -1270,7 +1267,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const // * we can't build two messages at once. if (2 == button) { - gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this)); + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,this)); } LLMessageSystem* msg = gMessageSystem; @@ -4761,7 +4758,7 @@ void handle_show_mean_events(void *) //LLFloaterBump::showInstance(); } -void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false) +void mean_name_callback(const LLUUID &id, const std::string& full_name, bool is_group) { if (gNoRender) { @@ -4783,8 +4780,7 @@ void mean_name_callback(const LLUUID &id, const std::string& first, const std::s LLMeanCollisionData *mcd = *iter; if (mcd->mPerp == id) { - mcd->mFirstName = first; - mcd->mLastName = last; + mcd->mFullName = full_name; } } } @@ -4838,8 +4834,7 @@ void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **use { LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag); gMeanCollisionList.push_front(mcd); - const BOOL is_group = FALSE; - gCacheName->get(perp, is_group, &mean_name_callback); + gCacheName->get(perp, false, boost::bind(&mean_name_callback, _1, _2, _3)); } } } @@ -5738,7 +5733,7 @@ static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", ca // We've got the name of the person who owns the object hurling the url. // Display confirmation dialog. -void callback_load_url_name(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group) +void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool is_group) { std::vector::iterator it; for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) @@ -5751,11 +5746,11 @@ void callback_load_url_name(const LLUUID& id, const std::string& first, const st std::string owner_name; if (is_group) { - owner_name = first + LLTrans::getString("Group"); + owner_name = full_name + LLTrans::getString("Group"); } else { - owner_name = first + " " + last; + owner_name = full_name; } // For legacy name-only mutes. @@ -5815,7 +5810,8 @@ void process_load_url(LLMessageSystem* msg, void**) // Add to list of pending name lookups gLoadUrlList.push_back(payload); - gCacheName->get(owner_id, owner_is_group, &callback_load_url_name); + gCacheName->get(owner_id, owner_is_group, + boost::bind(&callback_load_url_name, _1, _2, _3)); } -- cgit v1.2.3 From c0b7c93c18783d6a426cf43265f34c86bdeceb4a Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 4 Feb 2010 20:38:40 -0800 Subject: Converted all gCacheName->getName to getFullName for SLID compatibility Also eliminated notification "ObjectGiveItemUnknownUser" because the SLURL-based name lookup will always retrieve the user name. Fixed a bug with ObjectGiveItem where the SLURL would be incorrect for a group. --- indra/newview/llviewermessage.cpp | 47 ++++++++++++--------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d8d149bb94..266cad67f4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1030,7 +1030,6 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, bool matches(const LLNotificationPtr notification) const { if(notification->getName() == "ObjectGiveItem" - || notification->getName() == "ObjectGiveItemUnknownUser" || notification->getName() == "UserGiveItem") { return (notification->getPayload()["from_id"].asUUID() == blocked_id); @@ -1334,12 +1333,12 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const } else { - std::string first_name, last_name; - if (gCacheName->getName(mFromID, first_name, last_name)) + std::string full_name; + if (gCacheName->getFullName(mFromID, full_name)) { from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName - + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + first_name + " " + last_name; - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + first_name + " " + last_name; + + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + full_name; + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + full_name; } else { @@ -1507,30 +1506,6 @@ void inventory_offer_handler(LLOfferInfo* info) return; } - // Name cache callbacks don't store userdata, so can't save - // off the LLOfferInfo. Argh. - BOOL name_found = FALSE; - if (info->mFromGroup) - { - std::string group_name; - if (gCacheName->getGroupName(info->mFromID, group_name)) - { - args["FIRST"] = group_name; - args["LAST"] = ""; - name_found = TRUE; - } - } - else - { - std::string first_name, last_name; - if (gCacheName->getName(info->mFromID, first_name, last_name)) - { - args["FIRST"] = first_name; - args["LAST"] = last_name; - name_found = TRUE; - } - } - // If mObjectID is null then generate the object_id based on msg to prevent // multiple creation of chiclets for same object. LLUUID object_id = info->mObjectID; @@ -1545,7 +1520,14 @@ void inventory_offer_handler(LLOfferInfo* info) payload["give_inventory_notification"] = FALSE; args["OBJECTFROMNAME"] = info->mFromName; args["NAME"] = info->mFromName; - args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about"); + if (info->mFromGroup) + { + args["NAME_SLURL"] = LLSLURL::buildCommand("group", info->mFromID, "about"); + } + else + { + args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about"); + } std::string verb = "select?name=" + LLURI::escape(msg); args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str()); @@ -1558,7 +1540,7 @@ void inventory_offer_handler(LLOfferInfo* info) args["ITEM_SLURL"] = msg; // Note: sets inventory_task_offer_callback as the callback p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_task_offer_callback, info, _1, _2)); - p.name = name_found ? "ObjectGiveItem" : "ObjectGiveItemUnknownUser"; + p.name = "ObjectGiveItem"; // Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory. LLNotifications::instance().add(p); } @@ -5726,8 +5708,7 @@ void process_script_dialog(LLMessageSystem* msg, void**) LLNotificationPtr notification; if (!first_name.empty()) { - args["FIRST"] = first_name; - args["LAST"] = last_name; + args["NAME"] = LLCacheName::buildFullname(first_name, last_name); notification = LLNotifications::instance().add( LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD())); } -- cgit v1.2.3 From 42176145c9e81dd99b65f88152df50a7b3ccf834 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Feb 2010 14:55:30 -0800 Subject: Converted names build from avatar object LLNameValue pairs to SLID Added temporary getDisplayName() to LLCacheName Moved temporary placeholder display names into LLCacheName Eliminated rarely used LLAgentUI::buildName in favor of buildFullName Standardized buildFullName capitalization --- indra/newview/llviewermessage.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 266cad67f4..3cc6b9b591 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2517,9 +2517,8 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) LLNameValue* nvlast = source->getNVPair("LastName"); if (nvfirst && nvlast) { - args["FIRST"] = nvfirst->getString(); - args["LAST"] = nvlast->getString(); - source_name = std::string(nvfirst->getString()) + " " + nvlast->getString(); + source_name = LLCacheName::buildFullName( + nvfirst->getString(), nvlast->getString()); } } @@ -5065,7 +5064,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) // so we'll reuse the same namespace for both throttle types. std::string throttle_name = owner_name; std::string self_name; - LLAgentUI::buildName( self_name ); + LLAgentUI::buildFullname( self_name ); if( owner_name == self_name ) { throttle_name = taskid.getString(); @@ -5708,7 +5707,7 @@ void process_script_dialog(LLMessageSystem* msg, void**) LLNotificationPtr notification; if (!first_name.empty()) { - args["NAME"] = LLCacheName::buildFullname(first_name, last_name); + args["NAME"] = LLCacheName::buildFullName(first_name, last_name); notification = LLNotifications::instance().add( LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD())); } -- cgit v1.2.3 From e14a641619afc9948b590c2caf8df8df02bdbfe3 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 16 Feb 2010 17:18:36 -0800 Subject: DEV-46234 Group Invite contains SLID with Resident, and DEV-46231 Pay resident notification contains SLID with Resident last name, and DEV-46232 Payment confirmation of buy and sell parcel of land contains SLID with Resident in both notifications Clean up server-side name strings with regex matching. Reviewed with Simon. --- indra/newview/llviewermessage.cpp | 99 ++++++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 27 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') 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 // +#include #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; + + // paid you L$ for . + static const boost::regex paid_you_for("(.+) paid you L\\$(\\d+) for (.*)\\."); + // paid you L$. + static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\."); + // You paid L$ [for ]. + 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: - // " 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. -- cgit v1.2.3 From 5774acb84e486c1eabad88093e80e3985d36dfcb Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 17 Feb 2010 09:19:06 -0800 Subject: Added function LLCacheName::cleanFullName() to strip " Resident" from strings --- indra/newview/llviewermessage.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f8da6eab3d..6ead920946 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1631,7 +1631,6 @@ static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("Ser // (rather than a script) static std::string clean_name_from_im(const std::string& name, EInstantMessage type) { - U32 pos = 0; switch(type) { case IM_NOTHING_SPECIAL: @@ -1674,8 +1673,7 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t case IM_FRIENDSHIP_DECLINED_DEPRECATED: //IM_TYPING_START //IM_TYPING_STOP - pos = name.find(" Resident"); - return name.substr(0, pos); + return LLCacheName::cleanFullName(name); default: return name; } @@ -2557,16 +2555,6 @@ void process_decline_callingcard(LLMessageSystem* msg, void**) LLNotificationsUtil::add("CallingCardDeclined"); } -static std::string clean_name_from_chat(const std::string& full_name, EChatSourceType type) -{ - if (type == CHAT_SOURCE_AGENT) - { - U32 pos = full_name.find(" Resident"); - return full_name.substr(0, pos); - } - return full_name; -} - void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { LLChat chat; @@ -2582,7 +2570,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLViewerObject* chatter; msg->getString("ChatData", "FromName", from_name); - //chat.mFromName = from_name; msg->getUUID("ChatData", "SourceID", from_id); chat.mFromID = from_id; @@ -2602,7 +2589,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mTime = LLFrameTimer::getElapsedSeconds(); // IDEVO Correct for new-style "Resident" names - chat.mFromName = clean_name_from_chat(from_name, chat.mSourceType); + if (chat.mChatType == CHAT_SOURCE_AGENT) + { + chat.mFromName = LLCacheName::cleanFullName(from_name); + } + else + { + chat.mFromName = from_name; + } BOOL is_busy = gAgent.getBusy(); @@ -4470,7 +4464,7 @@ static void show_money_balance_notification(const std::string& desc) { name = match[1].str(); // IDEVO strip legacy "Resident" name - name = name.substr(0, name.find(" Resident")); + name = LLCacheName::cleanFullName(name); args["NAME"] = name; args["AMOUNT"] = match[2].str(); args["REASON"] = match[3].str(); @@ -4480,7 +4474,7 @@ static void show_money_balance_notification(const std::string& desc) { name = match[1].str(); // IDEVO strip legacy "Resident" name - name = name.substr(0, name.find(" Resident")); + name = LLCacheName::cleanFullName(name); args["NAME"] = name; args["AMOUNT"] = match[2].str(); notification_name = "PaymentReceived"; @@ -4489,7 +4483,7 @@ static void show_money_balance_notification(const std::string& desc) { name = match[1].str(); // IDEVO strip legacy "Resident" name - name = name.substr(0, name.find(" Resident")); + name = LLCacheName::cleanFullName(name); args["NAME"] = name; args["AMOUNT"] = match[2].str(); args["REASON"] = match[3].str(); -- cgit v1.2.3 From 53ff6652f08f70fe924398f65b0e289e009d1e8c Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 17 Feb 2010 11:01:53 -0800 Subject: Fix typo, should unbreak Linux/Mac builds --- 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 6ead920946..5b16347db3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2589,7 +2589,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mTime = LLFrameTimer::getElapsedSeconds(); // IDEVO Correct for new-style "Resident" names - if (chat.mChatType == CHAT_SOURCE_AGENT) + if (chat.mSourceType == CHAT_SOURCE_AGENT) { chat.mFromName = LLCacheName::cleanFullName(from_name); } -- cgit v1.2.3 From f3e0e9a5264a80d146a1d4d77fd9c4f5d3070278 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 24 Feb 2010 14:31:46 -0800 Subject: Hack to refresh name tags when I change my display name. Also fixes a crash when turning on display names. --- indra/newview/llviewermessage.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5b16347db3..1a4d34b217 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -33,9 +33,11 @@ #include "llviewerprecompiledheaders.h" #include "llviewermessage.h" +// Linden libraries #include "llanimationstates.h" #include "llaudioengine.h" #include "llavataractions.h" +#include "llavatarnamecache.h" // IDEVO HACK #include "lscript_byteformat.h" #include "lleconomy.h" #include "lleventtimer.h" @@ -82,6 +84,7 @@ #include "llspeakers.h" #include "lltrans.h" #include "llviewerfoldertype.h" +#include "llvoavatar.h" // IDEVO HACK #include "lluri.h" #include "llviewergenericmessage.h" #include "llviewermenu.h" @@ -2661,6 +2664,20 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } chat.mText = mesg; + // IDEVO HACK Use chat to invalidate names + if (chat.mSourceType == CHAT_SOURCE_AGENT + && chat.mText == "refreshname") + { + LLAvatarNameCache::erase(chat.mFromID); + + // force name tag to update + LLVOAvatar* avatar = dynamic_cast(chatter); + if (avatar) + { + avatar->invalidateName(); + } + } + // Look for the start of typing so we can put "..." in the bubbles. if (CHAT_TYPE_START == chat.mChatType) { -- cgit v1.2.3 From 91d9bf2330769aee840514570cce8b4463ce6ab5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 24 Feb 2010 15:44:05 -0800 Subject: DEV-46506 User name and last name appears on the notification message from script --- 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 1a4d34b217..309bed7fc3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5152,7 +5152,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) S32 count = 0; LLSD args; args["OBJECTNAME"] = object_name; - args["NAME"] = owner_name; + args["NAME"] = LLCacheName::cleanFullName(owner_name); // check the received permission flags against each permission for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) -- cgit v1.2.3 From 36c35bca2663447216027015c10aa921ab75abfb Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 25 Feb 2010 17:06:17 -0800 Subject: Support multiple fonts, colors and styles in name tags Simplified LLHUDText string API to be UTF8 only Added per-text segment font support Changed LLVOAvatar invalidateNameTag to clearNameTag --- 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 309bed7fc3..83d52fbbfc 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2674,7 +2674,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLVOAvatar* avatar = dynamic_cast(chatter); if (avatar) { - avatar->invalidateName(); + avatar->clearNameTag(); } } -- cgit v1.2.3 From 04d27007fdd46688c86be85013272da3373f77fc Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 2 Mar 2010 11:14:59 -0800 Subject: DEV-46936 SLID last name appears when resident returns an object to its owner Fixed with some regular expression cleanup magic --- 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 83d52fbbfc..0815ce486d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1682,6 +1682,23 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } } +static std::string clean_name_from_task_im(const std::string& msg) +{ + boost::smatch match; + static const boost::regex returned_exp( + "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); + if (boost::regex_match(msg, match, returned_exp)) + { + // match objects are 1-based for groups + std::string final = match[1].str(); + std::string name = match[2].str(); + final += LLCacheName::cleanFullName(name); + final += match[3].str(); + return final; + } + return msg; +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2234,6 +2251,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id = LLUUID::null; } + // IDEVO Some messages have embedded resident names + message = clean_name_from_task_im(message); + LLSD query_string; query_string["owner"] = from_id; query_string["slurl"] = location; -- cgit v1.2.3 From b7d3d80dddba80268c72e406877701cbaa4856a3 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 2 Mar 2010 15:13:56 -0800 Subject: DEV-46231 "You paid" shows last name Resident if amount is L$1 Bad regex --- 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 0815ce486d..6a131082da 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4495,7 +4495,7 @@ static void show_money_balance_notification(const std::string& desc) // paid you L$. static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\."); // You paid L$ [for ]. - static const boost::regex you_paid("You paid (.*) L\\$(\\d+)(.+)\\."); + static const boost::regex you_paid("You paid (.*) L\\$(\\d+)(.*)\\."); if (boost::regex_match(desc, match, paid_you_for)) { -- cgit v1.2.3 From 10fc6ee4a012fa7232868261d6e11a76652c3cca Mon Sep 17 00:00:00 2001 From: James Cook Date: Sat, 13 Mar 2010 22:00:40 -0800 Subject: Hack to use display names for text chat --- indra/newview/llviewermessage.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6a8832b64d..a1ff0f3747 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2627,7 +2627,18 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // IDEVO Correct for new-style "Resident" names if (chat.mSourceType == CHAT_SOURCE_AGENT) { - chat.mFromName = LLCacheName::cleanFullName(from_name); + // JAMESDEBUG - I don't know if it's OK to change this here, if + // anything downstream does lookups by name, for instance + LLAvatarName av_name; + if (LLAvatarNameCache::useDisplayNames() + && LLAvatarNameCache::get(from_id, &av_name)) + { + chat.mFromName = av_name.mDisplayName; + } + else + { + chat.mFromName = LLCacheName::cleanFullName(from_name); + } } else { -- cgit v1.2.3 From 0b14880d14c412e9841284c357789a973e1f0f40 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 29 Mar 2010 17:33:40 -0700 Subject: Fix conflicting localizations of "You paid..." notification --- indra/newview/llviewermessage.cpp | 133 +++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 65 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 1491febd78..ffe638dfbf 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4530,68 +4530,71 @@ 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; - - // paid you L$ for . - static const boost::regex paid_you_for("(.+) paid you L\\$(\\d+) for (.*)\\."); - // paid you L$. - static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\."); - // You paid L$ [for ]. - 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 = LLCacheName::cleanFullName(name); - 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 = LLCacheName::cleanFullName(name); - 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 = LLCacheName::cleanFullName(name); - 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); - } -} +// Both Product Engine and I wrote solutions to non-localized payment messages. +// Their code probably has more localized strings against it. +// James Cook, 2010-03-27 +// +//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; +// +// // paid you L$ for . +// static const boost::regex paid_you_for("(.+) paid you L\\$(\\d+) for (.*)\\."); +// // paid you L$. +// static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\."); +// // You paid L$ [for ]. +// 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 = LLCacheName::cleanFullName(name); +// 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 = LLCacheName::cleanFullName(name); +// 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 = LLCacheName::cleanFullName(name); +// 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** ) { @@ -4667,13 +4670,13 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) //reform description LLStringUtil::format_map_t str_args; - str_args["NAME"] = base_name; + str_args["NAME"] = LLCacheName::cleanFullName(name); str_args["AMOUNT"] = ammount; std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); args["MESSAGE"] = new_description; - args["NAME"] = name; + args["NAME"] = LLCacheName::cleanFullName(name); LLSD payload; payload["from_id"] = from_id; LLNotificationsUtil::add("PaymentReceived", args, payload); @@ -4712,7 +4715,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) std::string name = std::string(matches[1]); if(!name.empty()) { - str_args["[NAME]"] = name; + str_args["[NAME]"] = LLCacheName::cleanFullName(name); line = "you_paid_ldollars"; } -- cgit v1.2.3 From 8a702f9493d764d133ff2c62168c1c3503dde56c Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 30 Mar 2010 16:42:00 -0700 Subject: Work-in-progress localization/name fixup for object returns --- indra/newview/llviewermessage.cpp | 89 +++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 23 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ffe638dfbf..07288dc96f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1717,21 +1717,54 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } } -static std::string clean_name_from_task_im(const std::string& msg) +//static std::string clean_name_from_task_im(const std::string& msg) +//{ +// boost::smatch match; +// static const boost::regex returned_exp( +// "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); +// if (boost::regex_match(msg, match, returned_exp)) +// { +// // match objects are 1-based for groups +// std::string final = match[1].str(); +// std::string name = match[2].str(); +// final += LLCacheName::cleanFullName(name); +// final += match[3].str(); +// return final; +// } +// return msg; +//} + +static void parse_bucket_im_from_task(const std::string& bucket, + const LLUUID& from_id, + BOOL from_group, + const LLUUID& to_id, + const LLVector3& position, + const std::string& message, + std::string *object_slurl, + std::string *final_message) { - boost::smatch match; - static const boost::regex returned_exp( - "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); - if (boost::regex_match(msg, match, returned_exp)) - { - // match objects are 1-based for groups - std::string final = match[1].str(); - std::string name = match[2].str(); - final += LLCacheName::cleanFullName(name); - final += match[3].str(); - return final; - } - return msg; + static const std::string DEREZ_TO_OWNER = "|derezToOwner"; + if (bucket.compare(0, DEREZ_TO_OWNER.length(), DEREZ_TO_OWNER)) + { + // ...starts with special tag + // See simulator LLRoundRobin::derezObjectsBackToOwner() for details + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("|"); + tokenizer tokens(bucket, sep); + tokenizer::iterator token_it = tokens.begin(); + //S32 destination_type; + //S32 object_count; + + // JAMESDEBUG TODO: HERE + *object_slurl = "JAMESDEBUG"; + *final_message = "JAMESDEBUG"; + } + else + { + // ...normal IM from task + *object_slurl = bucket; + *final_message = message; + } } void process_improved_im(LLMessageSystem *msg, void **user_data) @@ -2263,9 +2296,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) return; } - // Build a link to open the object IM info window. - std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1); - if (session_id.notNull()) { chat.mFromID = session_id; @@ -2280,18 +2310,31 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id ^ gAgent.getSessionID(); } + // Build a link to open the object IM info window. + // Also handle localization for certain system messages + // sent as IM_FROM_TASK. + std::string object_slurl; + std::string final_message; + std::string bucket_im_from_task = + ll_safe_string((char*)binary_bucket, binary_bucket_size-1); + parse_bucket_im_from_task( + bucket_im_from_task, + from_id, from_group, to_id, position, message, + &object_slurl, &final_message); + if(SYSTEM_FROM == name) { // System's UUID is NULL (fixes EXT-4766) - chat.mFromID = from_id = LLUUID::null; + chat.mFromID = LLUUID::null; + from_id = LLUUID::null; } // IDEVO Some messages have embedded resident names - message = clean_name_from_task_im(message); + //message = clean_name_from_task_im(message); LLSD query_string; query_string["owner"] = from_id; - query_string["slurl"] = location; + query_string["slurl"] = object_slurl; query_string["name"] = name; if (from_group) { @@ -2312,7 +2355,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { LLSD args; args["owner_id"] = from_id; - args["slurl"] = location; + args["slurl"] = object_slurl; args["type"] = LLNotificationsUI::NT_NEARBYCHAT; LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); } @@ -2323,13 +2366,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLSD substitutions; substitutions["NAME"] = name; - substitutions["MSG"] = message; + substitutions["MSG"] = final_message; LLSD payload; payload["object_id"] = session_id; payload["owner_id"] = from_id; payload["from_id"] = from_id; - payload["slurl"] = location; + payload["slurl"] = object_slurl; payload["name"] = name; std::string session_name; gCacheName->getFullName(from_id, session_name); -- cgit v1.2.3 From 6b5464109271612b066dcc2030ad8219fd12ac7a Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 31 Mar 2010 10:02:58 -0700 Subject: Backed out changeset: 18811ebc0e95 Won't fix localization of object returns - just fix names --- indra/newview/llviewermessage.cpp | 89 ++++++++++----------------------------- 1 file changed, 23 insertions(+), 66 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 07288dc96f..ffe638dfbf 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1717,54 +1717,21 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } } -//static std::string clean_name_from_task_im(const std::string& msg) -//{ -// boost::smatch match; -// static const boost::regex returned_exp( -// "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); -// if (boost::regex_match(msg, match, returned_exp)) -// { -// // match objects are 1-based for groups -// std::string final = match[1].str(); -// std::string name = match[2].str(); -// final += LLCacheName::cleanFullName(name); -// final += match[3].str(); -// return final; -// } -// return msg; -//} - -static void parse_bucket_im_from_task(const std::string& bucket, - const LLUUID& from_id, - BOOL from_group, - const LLUUID& to_id, - const LLVector3& position, - const std::string& message, - std::string *object_slurl, - std::string *final_message) +static std::string clean_name_from_task_im(const std::string& msg) { - static const std::string DEREZ_TO_OWNER = "|derezToOwner"; - if (bucket.compare(0, DEREZ_TO_OWNER.length(), DEREZ_TO_OWNER)) - { - // ...starts with special tag - // See simulator LLRoundRobin::derezObjectsBackToOwner() for details - typedef boost::tokenizer > tokenizer; - boost::char_separator sep("|"); - tokenizer tokens(bucket, sep); - tokenizer::iterator token_it = tokens.begin(); - //S32 destination_type; - //S32 object_count; - - // JAMESDEBUG TODO: HERE - *object_slurl = "JAMESDEBUG"; - *final_message = "JAMESDEBUG"; - } - else - { - // ...normal IM from task - *object_slurl = bucket; - *final_message = message; - } + boost::smatch match; + static const boost::regex returned_exp( + "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); + if (boost::regex_match(msg, match, returned_exp)) + { + // match objects are 1-based for groups + std::string final = match[1].str(); + std::string name = match[2].str(); + final += LLCacheName::cleanFullName(name); + final += match[3].str(); + return final; + } + return msg; } void process_improved_im(LLMessageSystem *msg, void **user_data) @@ -2296,6 +2263,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) return; } + // Build a link to open the object IM info window. + std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1); + if (session_id.notNull()) { chat.mFromID = session_id; @@ -2310,31 +2280,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id ^ gAgent.getSessionID(); } - // Build a link to open the object IM info window. - // Also handle localization for certain system messages - // sent as IM_FROM_TASK. - std::string object_slurl; - std::string final_message; - std::string bucket_im_from_task = - ll_safe_string((char*)binary_bucket, binary_bucket_size-1); - parse_bucket_im_from_task( - bucket_im_from_task, - from_id, from_group, to_id, position, message, - &object_slurl, &final_message); - if(SYSTEM_FROM == name) { // System's UUID is NULL (fixes EXT-4766) - chat.mFromID = LLUUID::null; - from_id = LLUUID::null; + chat.mFromID = from_id = LLUUID::null; } // IDEVO Some messages have embedded resident names - //message = clean_name_from_task_im(message); + message = clean_name_from_task_im(message); LLSD query_string; query_string["owner"] = from_id; - query_string["slurl"] = object_slurl; + query_string["slurl"] = location; query_string["name"] = name; if (from_group) { @@ -2355,7 +2312,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { LLSD args; args["owner_id"] = from_id; - args["slurl"] = object_slurl; + args["slurl"] = location; args["type"] = LLNotificationsUI::NT_NEARBYCHAT; LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); } @@ -2366,13 +2323,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLSD substitutions; substitutions["NAME"] = name; - substitutions["MSG"] = final_message; + substitutions["MSG"] = message; LLSD payload; payload["object_id"] = session_id; payload["owner_id"] = from_id; payload["from_id"] = from_id; - payload["slurl"] = object_slurl; + payload["slurl"] = location; payload["name"] = name; std::string session_name; gCacheName->getFullName(from_id, session_name); -- cgit v1.2.3 From 7381679cd0f77a2b91b2fce5f0060afc2d359f5a Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 1 Apr 2010 10:15:37 -0700 Subject: Add TransactionInfo to MoneyBalanceReply, unpack test data --- indra/newview/llviewermessage.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ffe638dfbf..2502cd4303 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4610,6 +4610,24 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " " << committed << LL_ENDL; + // Added in server 1.40 and viewer 2.1, support for localization + // and agent ids for name lookup. + S32 transaction_type = 0; + U32 transaction_flags = 0; + LLUUID source_id; + LLUUID dest_id; + S32 amount = 0; + std::string item_description; + if (msg->has("TransactionInfo")) + { + msg->getS32("TransactionInfo", "TransactionType", transaction_type); + msg->getU32("TransactionInfo", "TransactionFlags", transaction_flags); + msg->getUUID("TransactionInfo", "SourceID", source_id); + msg->getUUID("TransactionInfo", "DestID", dest_id); + msg->getS32("TransactionInfo", "Amount", amount); + msg->getString("TransactionInfo", "ItemDescription", item_description); + } + if (gStatusBar) { // S32 old_balance = gStatusBar->getBalance(); @@ -4649,7 +4667,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // " paid you L$" const std::string marker = "paid you L$"; - args["MESSAGE"] = desc; + args["MESSAGE"] = desc + item_description; // JAMESDEBUG // extract avatar name from system message S32 marker_pos = desc.find(marker, 0); -- cgit v1.2.3 From 28236d001bfbfa2a17c6372c615721b347b9cc38 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 1 Apr 2010 14:11:29 -0700 Subject: Debug spam --- indra/newview/llviewermessage.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2502cd4303..8b762eadac 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4626,6 +4626,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) msg->getUUID("TransactionInfo", "DestID", dest_id); msg->getS32("TransactionInfo", "Amount", amount); msg->getString("TransactionInfo", "ItemDescription", item_description); + llinfos << "JAMESDEBUG ItemDescription " << item_description << llendl; } if (gStatusBar) -- cgit v1.2.3 From 71dfe17fd16500cbb124a53611472174972df37a Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 2 Apr 2010 09:45:17 -0700 Subject: Updated to latest MoneyBalanceReply message format --- indra/newview/llviewermessage.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8b762eadac..8f68c34736 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4613,20 +4613,23 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // Added in server 1.40 and viewer 2.1, support for localization // and agent ids for name lookup. S32 transaction_type = 0; - U32 transaction_flags = 0; LLUUID source_id; + BOOL is_source_group = FALSE; LLUUID dest_id; + BOOL is_dest_group = FALSE; S32 amount = 0; std::string item_description; if (msg->has("TransactionInfo")) { msg->getS32("TransactionInfo", "TransactionType", transaction_type); - msg->getU32("TransactionInfo", "TransactionFlags", transaction_flags); msg->getUUID("TransactionInfo", "SourceID", source_id); + msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group); msg->getUUID("TransactionInfo", "DestID", dest_id); + msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group); msg->getS32("TransactionInfo", "Amount", amount); msg->getString("TransactionInfo", "ItemDescription", item_description); - llinfos << "JAMESDEBUG ItemDescription " << item_description << llendl; + llinfos << "JAMESDEBUG money_balance_reply source " << source_id + << " item " << item_description << llendl; } if (gStatusBar) -- cgit v1.2.3 From adcee4486b1ff7e3d60e3cd608172b15525242bc Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 7 Apr 2010 16:18:28 -0700 Subject: Added debug info to "you paid" messages for testing MoneyBalanceReply --- indra/newview/llviewermessage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8f68c34736..9cecf1fcca 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4671,7 +4671,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // " paid you L$" const std::string marker = "paid you L$"; - args["MESSAGE"] = desc + item_description; // JAMESDEBUG + args["MESSAGE"] = desc + llformat(" JAMESDEBUG %d", transaction_type); // JAMESDEBUG; // extract avatar name from system message S32 marker_pos = desc.find(marker, 0); @@ -4697,7 +4697,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); - args["MESSAGE"] = new_description; + args["MESSAGE"] = new_description + llformat(" JAMESDEBUG %d", transaction_type); // JAMESDEBUG args["NAME"] = LLCacheName::cleanFullName(name); LLSD payload; payload["from_id"] = from_id; @@ -4757,7 +4757,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // forming final message string by retrieving localized version from xml // and applying previously found arguments line = LLTrans::getString(line, str_args); - args["MESSAGE"] = line; + args["MESSAGE"] = line + llformat(" JAMESDEBUG %d", transaction_type); // JAMESDEBUG; } } -- cgit v1.2.3 From c70c2631f0dc1db46fa5e6088605e21f5e3743ba Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 15 Apr 2010 16:19:39 -0700 Subject: Remove old hack to chat "refreshname" to trigger name tag updates --- indra/newview/llviewermessage.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9cecf1fcca..13f52d8db7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2731,20 +2731,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } chat.mText = mesg; - // IDEVO HACK Use chat to invalidate names - if (chat.mSourceType == CHAT_SOURCE_AGENT - && chat.mText == "refreshname") - { - LLAvatarNameCache::erase(chat.mFromID); - - // force name tag to update - LLVOAvatar* avatar = dynamic_cast(chatter); - if (avatar) - { - avatar->clearNameTag(); - } - } - // Look for the start of typing so we can put "..." in the bubbles. if (CHAT_TYPE_START == chat.mChatType) { -- cgit v1.2.3 From 69de1f4eb7cdd063bbdd7b4019a6a9799fc5dc5f Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 16 Apr 2010 19:06:17 -0700 Subject: Accept expires timestamp as UTC datetime in LLSD --- indra/newview/llviewermessage.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 13f52d8db7..000eb45121 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4615,6 +4615,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) msg->getS32("TransactionInfo", "Amount", amount); msg->getString("TransactionInfo", "ItemDescription", item_description); llinfos << "JAMESDEBUG money_balance_reply source " << source_id + << " dest " << dest_id << " item " << item_description << llendl; } -- cgit v1.2.3 From af5dd4fbfa6fdee3d38167ec1153d01fd4265b35 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 26 Apr 2010 14:20:07 -0700 Subject: Strip some debug spam --- indra/newview/llviewermessage.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 000eb45121..0d4bf6e40f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4614,9 +4614,9 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group); msg->getS32("TransactionInfo", "Amount", amount); msg->getString("TransactionInfo", "ItemDescription", item_description); - llinfos << "JAMESDEBUG money_balance_reply source " << source_id + LL_DEBUGS("Money") << "MoneyBalanceReply source " << source_id << " dest " << dest_id - << " item " << item_description << llendl; + << " item " << item_description << LL_ENDL; } if (gStatusBar) @@ -4658,7 +4658,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // " paid you L$" const std::string marker = "paid you L$"; - args["MESSAGE"] = desc + llformat(" JAMESDEBUG %d", transaction_type); // JAMESDEBUG; + args["MESSAGE"] = desc; // extract avatar name from system message S32 marker_pos = desc.find(marker, 0); @@ -4683,8 +4683,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) str_args["AMOUNT"] = ammount; std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); - - args["MESSAGE"] = new_description + llformat(" JAMESDEBUG %d", transaction_type); // JAMESDEBUG + args["MESSAGE"] = new_description; args["NAME"] = LLCacheName::cleanFullName(name); LLSD payload; payload["from_id"] = from_id; @@ -4744,7 +4743,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) // forming final message string by retrieving localized version from xml // and applying previously found arguments line = LLTrans::getString(line, str_args); - args["MESSAGE"] = line + llformat(" JAMESDEBUG %d", transaction_type); // JAMESDEBUG; + args["MESSAGE"] = line; } } -- cgit v1.2.3 From 831dd9ca40f199f2a9e89eee56d12e217ced0cc4 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 30 Apr 2010 17:32:27 -0700 Subject: Partial display name support in money transaction notifications --- indra/newview/llviewermessage.cpp | 319 +++++++++++++++++++++----------------- 1 file changed, 180 insertions(+), 139 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0d4bf6e40f..ea41c6da11 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -132,6 +132,8 @@ extern BOOL gDebugClicks; // function prototypes bool check_offer_throttle(const std::string& from_name, bool check_only); +static void process_money_balance_reply_extended(LLMessageSystem* msg); +static void process_money_balance_reply_legacy(const std::string& desc); //inventory offer throttle globals LLFrameTimer gThrottleTimer; @@ -4588,14 +4590,66 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) S32 credit = 0; S32 committed = 0; std::string desc; + LLUUID tid; + msg->getUUID("MoneyData", "TransactionID", tid); msg->getS32("MoneyData", "MoneyBalance", balance); msg->getS32("MoneyData", "SquareMetersCredit", credit); msg->getS32("MoneyData", "SquareMetersCommitted", committed); msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc); LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " " << committed << LL_ENDL; + + if (gStatusBar) + { + gStatusBar->setBalance(balance); + gStatusBar->setLandCredit(credit); + gStatusBar->setLandCommitted(committed); + } + + if (desc.empty() + || !gSavedSettings.getBOOL("NotifyMoneyChange")) + { + // ...nothing to display + return; + } + // Suppress duplicate messages about the same transaction + static std::deque recent; + if (std::find(recent.rbegin(), recent.rend(), tid) != recent.rend()) + { + return; + } + + // Once the 'recent' container gets large enough, chop some + // off the beginning. + const U32 MAX_LOOKBACK = 30; + const S32 POP_FRONT_SIZE = 12; + if(recent.size() > MAX_LOOKBACK) + { + LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL; + recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE); + } + //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL; + recent.push_back(tid); + + if (msg->has("TransactionInfo")) + { + // JAMESDEBUG TODO - for test, do both!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + process_money_balance_reply_legacy(desc); + + // ...message has extended info for localization + process_money_balance_reply_extended(msg); + } + else + { + // *NOTE: Can remove this after server 1.40 is widely deployed. + process_money_balance_reply_legacy(desc); + } +} + +static void process_money_balance_reply_extended(LLMessageSystem* msg) +{ // Added in server 1.40 and viewer 2.1, support for localization // and agent ids for name lookup. S32 transaction_type = 0; @@ -4605,163 +4659,150 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) BOOL is_dest_group = FALSE; S32 amount = 0; std::string item_description; - if (msg->has("TransactionInfo")) - { - msg->getS32("TransactionInfo", "TransactionType", transaction_type); - msg->getUUID("TransactionInfo", "SourceID", source_id); - msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group); - msg->getUUID("TransactionInfo", "DestID", dest_id); - msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group); - msg->getS32("TransactionInfo", "Amount", amount); - msg->getString("TransactionInfo", "ItemDescription", item_description); - LL_DEBUGS("Money") << "MoneyBalanceReply source " << source_id - << " dest " << dest_id - << " item " << item_description << LL_ENDL; - } - - if (gStatusBar) - { - // S32 old_balance = gStatusBar->getBalance(); - // This is an update, not the first transmission of balance - /* if (old_balance != 0) - { - // this is actually an update - if (balance > old_balance) - { - LLFirstUse::useBalanceIncrease(balance - old_balance); - } - else if (balance < old_balance) - { - LLFirstUse::useBalanceDecrease(balance - old_balance); - } - } - */ - gStatusBar->setBalance(balance); - gStatusBar->setLandCredit(credit); - gStatusBar->setLandCommitted(committed); - } + msg->getS32("TransactionInfo", "TransactionType", transaction_type); + msg->getUUID("TransactionInfo", "SourceID", source_id); + msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group); + msg->getUUID("TransactionInfo", "DestID", dest_id); + msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group); + msg->getS32("TransactionInfo", "Amount", amount); + msg->getString("TransactionInfo", "ItemDescription", item_description); + LL_INFOS("Money") << "MoneyBalanceReply source " << source_id + << " dest " << dest_id + << " type " << transaction_type + << " item " << item_description << LL_ENDL; + + const char* source_type = (is_source_group ? "group" : "agent"); + std::string source_slurl = + LLSLURL::buildCommand( source_type, source_id, "about"); + + const char* dest_type = (is_dest_group ? "group" : "agent"); + std::string dest_slurl = + LLSLURL::buildCommand( dest_type, dest_id, "about"); - LLUUID tid; - msg->getUUID("MoneyData", "TransactionID", tid); - static std::deque recent; - 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; - + // + // + // JAMESDEBUG TODO HERE!!! + // + // - // this is a marker to retrieve avatar name from server message: - // " paid you L$" - const std::string marker = "paid you L$"; + switch (transaction_type) + { + case TRANS_OBJECT_SALE: + case TRANS_LAND_SALE: + case TRANS_LAND_PASS_SALE: + case TRANS_GROUP_LAND_DEED: + case TRANS_GROUP_CREATE: + case TRANS_GROUP_JOIN: + case TRANS_UPLOAD_CHARGE: + default: + llinfos << "HERE!" << llendl; + break; + } +} - args["MESSAGE"] = desc; +// *NOTE: This can be removed after server 1.40 is widely deployed, as it will +// send an extra TransactionInfo block to allow proper localization. +static void process_money_balance_reply_legacy(const std::string& desc) +{ + LLSD args; - // extract avatar name from system message - S32 marker_pos = desc.find(marker, 0); + // this is a marker to retrieve avatar name from server message: + // " paid you L$" + const std::string marker = "paid you L$"; - std::string base_name = desc.substr(0, marker_pos); - - std::string name = base_name; - LLStringUtil::trim(name); + args["MESSAGE"] = desc; - // 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 + // extract avatar name from system message + S32 marker_pos = desc.find(marker, 0); - //ammount paid - std::string ammount = desc.substr(marker_pos + marker.length(),desc.length() - marker.length() - marker_pos); + std::string base_name = desc.substr(0, marker_pos); - //reform description - LLStringUtil::format_map_t str_args; - str_args["NAME"] = LLCacheName::cleanFullName(name); - str_args["AMOUNT"] = ammount; - std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); - - args["MESSAGE"] = new_description; - args["NAME"] = LLCacheName::cleanFullName(name); - LLSD payload; - payload["from_id"] = from_id; - LLNotificationsUtil::add("PaymentReceived", 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 + 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 + LLStringUtil::format_map_t str_args; + str_args["NAME"] = LLCacheName::cleanFullName(name); + str_args["AMOUNT"] = ammount; + std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); + + args["MESSAGE"] = new_description; + args["NAME"] = LLCacheName::cleanFullName(name); + LLSD payload; + payload["from_id"] = from_id; + LLNotificationsUtil::add("PaymentReceived", 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) { - 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 (?:.{0}|(.*) )L\\$(\\d+)\\s?([^$]*)\\."); + boost::match_results matches; + if(boost::regex_match(desc, matches, expr)) { - // 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 (?:.{0}|(.*) )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()) { - // 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]"] = LLCacheName::cleanFullName(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; - } + str_args["[NAME]"] = LLCacheName::cleanFullName(name); + line = "you_paid_ldollars"; + } - // forming final message string by retrieving localized version from xml - // and applying previously found arguments - line = LLTrans::getString(line, str_args); - args["MESSAGE"] = line; + // 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; } - } - LLNotificationsUtil::add("SystemMessage", args); + // forming final message string by retrieving localized version from xml + // and applying previously found arguments + line = LLTrans::getString(line, str_args); + args["MESSAGE"] = line; + } } - // Once the 'recent' container gets large enough, chop some - // off the beginning. - const U32 MAX_LOOKBACK = 30; - const S32 POP_FRONT_SIZE = 12; - if(recent.size() > MAX_LOOKBACK) - { - LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL; - recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE); - } - //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL; - recent.push_back(tid); + LLNotificationsUtil::add("SystemMessage", args); } + } bool handle_special_notification_callback(const LLSD& notification, const LLSD& response) -- cgit v1.2.3 From 894261e4e4aea8a15bef33fdf34807812a1c73bb Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 13 May 2010 16:30:15 -0700 Subject: Fix build errors introduced in last merge --- indra/newview/llviewermessage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e5fdda62d5..11ab6e7de4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5008,11 +5008,11 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) const char* source_type = (is_source_group ? "group" : "agent"); std::string source_slurl = - LLSLURL::buildCommand( source_type, source_id, "about"); + LLSLURL( source_type, source_id, "about").getSLURLString(); const char* dest_type = (is_dest_group ? "group" : "agent"); std::string dest_slurl = - LLSLURL::buildCommand( dest_type, dest_id, "about"); + LLSLURL( dest_type, dest_id, "about").getSLURLString(); // // -- cgit v1.2.3 From 22cef83f9a1008b341c905b0e9840fa37c4930fa Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 21 May 2010 15:26:18 -0700 Subject: DEV-49489 Money transaction msgs use display names Server 1.40 will be deployed before Viewer 2.1, and it sends more extensive money transaction messages, so I removed all the old crufty localization code. If Viewer 2.1 connects to an older server (like a dev grid) money transaction messages will be English only. This simplifies the code tremendously. Reviewed with Leyla --- indra/newview/llviewermessage.cpp | 323 ++++++++++++++++---------------------- 1 file changed, 134 insertions(+), 189 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index cff1db3230..4188a214a8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -141,7 +141,6 @@ extern BOOL gDebugClicks; // function prototypes bool check_offer_throttle(const std::string& from_name, bool check_only); static void process_money_balance_reply_extended(LLMessageSystem* msg); -static void process_money_balance_reply_legacy(const std::string& desc); //inventory offer throttle globals LLFrameTimer gThrottleTimer; @@ -4852,71 +4851,6 @@ void process_time_dilation(LLMessageSystem *msg, void **user_data) } */ -// Both Product Engine and I wrote solutions to non-localized payment messages. -// Their code probably has more localized strings against it. -// James Cook, 2010-03-27 -// -//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; -// -// // paid you L$ for . -// static const boost::regex paid_you_for("(.+) paid you L\\$(\\d+) for (.*)\\."); -// // paid you L$. -// static const boost::regex paid_you("(.+) paid you L\\$(\\d+)\\."); -// // You paid L$ [for ]. -// 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 = LLCacheName::cleanFullName(name); -// 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 = LLCacheName::cleanFullName(name); -// 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 = LLCacheName::cleanFullName(name); -// 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** ) { @@ -4969,19 +4903,84 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) if (msg->has("TransactionInfo")) { - // JAMESDEBUG TODO - for test, do both!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - process_money_balance_reply_legacy(desc); - // ...message has extended info for localization process_money_balance_reply_extended(msg); } else { - // *NOTE: Can remove this after server 1.40 is widely deployed. - process_money_balance_reply_legacy(desc); + // Only old dev grids will not supply the TransactionInfo block, + // so we can just use the hard-coded English string. + LLSD args; + args["MESSAGE"] = desc; + LLNotificationsUtil::add("SystemMessage", args); + } +} + +static std::string reason_from_transaction_type(S32 transaction_type, + const std::string& item_desc) +{ + // *NOTE: The keys for the reason strings are unusual because + // an earlier version of the code used English language strings + // extracted from hard-coded server English descriptions. + // Keeping them so we don't have to re-localize them. + switch (transaction_type) + { + case TRANS_OBJECT_SALE: + { + LLStringUtil::format_map_t arg; + arg["ITEM"] = item_desc; + return LLTrans::getString("for item", arg); + } + case TRANS_LAND_SALE: + return LLTrans::getString("for a parcel of land"); + + case TRANS_LAND_PASS_SALE: + return LLTrans::getString("for a land access pass"); + + case TRANS_GROUP_LAND_DEED: + return LLTrans::getString("for deeding land"); + + case TRANS_GROUP_CREATE: + return LLTrans::getString("to create a group"); + + case TRANS_GROUP_JOIN: + return LLTrans::getString("to join a group"); + + case TRANS_UPLOAD_CHARGE: + return LLTrans::getString("to upload"); + + default: + llwarns << "Unknown transaction type " + << transaction_type << llendl; + return std::string(); } } +static void money_balance_group_notify(const LLUUID& group_id, + const std::string& name, + bool is_group, + std::string notification, + 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 void money_balance_avatar_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + std::string notification, + 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 void process_money_balance_reply_extended(LLMessageSystem* msg) { // Added in server 1.40 and viewer 2.1, support for localization @@ -5008,138 +5007,84 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) const char* source_type = (is_source_group ? "group" : "agent"); std::string source_slurl = - LLSLURL( source_type, source_id, "about").getSLURLString(); + LLSLURL( source_type, source_id, "inspect").getSLURLString(); const char* dest_type = (is_dest_group ? "group" : "agent"); std::string dest_slurl = - LLSLURL( dest_type, dest_id, "about").getSLURLString(); + LLSLURL( dest_type, dest_id, "inspect").getSLURLString(); - // - // - // JAMESDEBUG TODO HERE!!! - // - // - - switch (transaction_type) - { - case TRANS_OBJECT_SALE: - case TRANS_LAND_SALE: - case TRANS_LAND_PASS_SALE: - case TRANS_GROUP_LAND_DEED: - case TRANS_GROUP_CREATE: - case TRANS_GROUP_JOIN: - case TRANS_UPLOAD_CHARGE: - default: - llinfos << "HERE!" << llendl; - break; - } -} - -// *NOTE: This can be removed after server 1.40 is widely deployed, as it will -// send an extra TransactionInfo block to allow proper localization. -static void process_money_balance_reply_legacy(const std::string& desc) -{ - LLSD args; - - // 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 - S32 marker_pos = desc.find(marker, 0); - - std::string base_name = desc.substr(0, marker_pos); + std::string reason = + reason_from_transaction_type(transaction_type, item_description); - 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)) + LLStringUtil::format_map_t args; + args["REASON"] = reason; // could be empty + args["AMOUNT"] = llformat("%d", amount); + + // Need to delay until name looked up, so need to know whether or not + // is group + bool is_name_group = false; + LLUUID name_id; + std::string message; + std::string notification; + LLSD final_args; + LLSD payload; + + bool you_paid_someone = (source_id == gAgentID); + if (you_paid_someone) { - //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 - LLStringUtil::format_map_t str_args; - str_args["NAME"] = LLCacheName::cleanFullName(name); - str_args["AMOUNT"] = ammount; - std::string new_description = LLTrans::getString("paid_you_ldollars", str_args); - - args["MESSAGE"] = new_description; - args["NAME"] = LLCacheName::cleanFullName(name); - LLSD payload; - payload["from_id"] = from_id; - LLNotificationsUtil::add("PaymentReceived", args, payload); + args["NAME"] = dest_slurl; + is_name_group = is_dest_group; + name_id = dest_id; + if (!reason.empty()) + { + message = LLTrans::getString("you_paid_ldollars", args); + } + else + { + message = LLTrans::getString("you_paid_ldollars_no_reason", args); + } + final_args["MESSAGE"] = message; + notification = "PaymentSent"; } - //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) + else { + // ...someone paid you + args["NAME"] = source_slurl; + is_name_group = is_source_group; + name_id = source_id; + if (!reason.empty()) { - // 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 (?:.{0}|(.*) )L\\$(\\d+)\\s?([^$]*)\\."); - boost::match_results matches; - if(boost::regex_match(desc, matches, expr)) - { - // Name of full localizable notification string - // there are four types of this string- with name of receiver and reason of payment, - // without name and without reason (both may also be absent 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. - // example of string with no info - You paid L$50. - 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]"] = LLCacheName::cleanFullName(name); - line = "you_paid_ldollars"; - } - - // extracting reason of payment (it may be absent) - std::string reason = std::string(matches[3]); - if (reason.empty()) - { - line = name.empty() ? "you_paid_ldollars_no_info" : "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; - } + message = LLTrans::getString("paid_you_ldollars", args); } + else { + message = LLTrans::getString("paid_you_ldollars_no_reason", args); + } + final_args["MESSAGE"] = message; - LLNotificationsUtil::add("SystemMessage", args); + // make notification loggable + payload["from_id"] = source_id; + notification = "PaymentReceived"; } + // Despite using SLURLs, wait until the name is available before + // showing the notification, otherwise the UI layout is strange and + // the user sees a "Loading..." message + if (is_name_group) + { + gCacheName->get(name_id, true, + boost::bind(&money_balance_group_notify, + _1, _2, _3, + notification, final_args, payload)); + } + else { + LLAvatarNameCache::get(name_id, + boost::bind(&money_balance_avatar_notify, + _1, _2, + notification, final_args, payload)); + } } + + bool handle_special_notification_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); -- cgit v1.2.3 From 77e6fcd4230f7540c9f4d6f3d503737c6eaf408c Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 25 May 2010 11:39:06 -0700 Subject: DEV-50013 WIP gCacheName->getGroup() to distinguish from av lookups Helps with global finds looking for remaining calls to patch. Reviewed with Leyla. --- 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 4188a214a8..3d486d3889 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5070,7 +5070,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) // the user sees a "Loading..." message if (is_name_group) { - gCacheName->get(name_id, true, + gCacheName->getGroup(name_id, boost::bind(&money_balance_group_notify, _1, _2, _3, notification, final_args, payload)); -- cgit v1.2.3 From b921d251b8708be7922456e69120559e0f4c69fa Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 26 May 2010 12:02:29 -0700 Subject: DEV-50466 Fix spurious warnings when someone pays you --- indra/newview/llviewermessage.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 21ba38ecfc..ccd2f6ea0e 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4948,6 +4948,13 @@ static std::string reason_from_transaction_type(S32 transaction_type, case TRANS_UPLOAD_CHARGE: return LLTrans::getString("to upload"); + // These have no reason to display, but are expected and should not + // generate warnings + case TRANS_GIFT: + case TRANS_PAY_OBJECT: + case TRANS_OBJECT_PAYS: + return std::string(); + default: llwarns << "Unknown transaction type " << transaction_type << llendl; -- cgit v1.2.3 From 39bf9a6eec24bc480a7f4de19a3e09b98b9ae5ef Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 26 May 2010 17:38:04 -0700 Subject: changed you paid... message to use non-linked name url --- 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 ccd2f6ea0e..6ead2e2457 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5017,7 +5017,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) const char* dest_type = (is_dest_group ? "group" : "agent"); std::string dest_slurl = - LLSLURL( dest_type, dest_id, "inspect").getSLURLString(); + LLSLURL( dest_type, dest_id, "completename").getSLURLString(); std::string reason = reason_from_transaction_type(transaction_type, item_description); -- cgit v1.2.3 From 0a5ec5da9c52eeb0475414e67e4ac906c82d05cc Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 27 May 2010 18:29:21 -0700 Subject: DEV-50013 Object returned to lost and found uses display names --- indra/newview/llviewermessage.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6ead2e2457..704f4b4902 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2024,7 +2024,8 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } } -static std::string clean_name_from_task_im(const std::string& msg) +static std::string clean_name_from_task_im(const std::string& msg, + BOOL from_group) { boost::smatch match; static const boost::regex returned_exp( @@ -2034,7 +2035,20 @@ static std::string clean_name_from_task_im(const std::string& msg) // match objects are 1-based for groups std::string final = match[1].str(); std::string name = match[2].str(); - final += LLCacheName::cleanFullName(name); + // Don't try to clean up group names + if (!from_group) + { + if (LLAvatarNameCache::useDisplayNames()) + { + // ...just convert to username + final += LLCacheName::buildUsername(name); + } + else + { + // ...strip out legacy "Resident" name + final += LLCacheName::cleanFullName(name); + } + } final += match[3].str(); return final; } @@ -2593,7 +2607,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } // IDEVO Some messages have embedded resident names - message = clean_name_from_task_im(message); + message = clean_name_from_task_im(message, from_group); LLSD query_string; query_string["owner"] = from_id; -- cgit v1.2.3 From 5be933062b0e8dfe6955480b333450a32a444a33 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 28 May 2010 13:30:25 -0700 Subject: adding name lookup callback for friendship requested notification --- indra/newview/llviewermessage.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6ead2e2457..cdcbe20a94 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2041,6 +2041,16 @@ static std::string clean_name_from_task_im(const std::string& msg) return msg; } +void notification_display_name_callback(const LLUUID& id, + const LLAvatarName& av_name, + const std::string& name, + LLSD& substitutions, + const LLSD& payload) +{ + substitutions["NAME"] = av_name.mDisplayName; + LLNotificationsUtil::add(name, substitutions, payload); +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2803,7 +2813,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) args["NAME"] = name; LLSD payload; payload["from_id"] = from_id; - LLNotificationsUtil::add("FriendshipAccepted", args, payload); + LLAvatarNameCache::get(from_id, boost::bind(¬ification_display_name_callback, + _1, + _2, + "FriendshipAccepted", + args, + payload)); } break; -- cgit v1.2.3 From 7666922593084fc741931662ba846284e39f6e9c Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 1 Jun 2010 06:57:51 -0700 Subject: Clean up some comments --- 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 cca1415f9c..182b216cbb 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3006,7 +3006,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // IDEVO Correct for new-style "Resident" names if (chat.mSourceType == CHAT_SOURCE_AGENT) { - // JAMESDEBUG - I don't know if it's OK to change this here, if + // I don't know if it's OK to change this here, if // anything downstream does lookups by name, for instance LLAvatarName av_name; if (LLAvatarNameCache::useDisplayNames() -- cgit v1.2.3 From bc7837a697bb1b9dac3bef9019dac1fcce2ffa0a Mon Sep 17 00:00:00 2001 From: leyla Date: Wed, 2 Jun 2010 11:23:02 -0700 Subject: notification fixes --- indra/newview/llviewermessage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 182b216cbb..e4b04b5d4f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6088,9 +6088,9 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) // Record the offer. { std::string target_name; - gCacheName->getFullName(target_id, target_name); + gCacheName->getFullName(target_id, target_name); // for im log filenames LLSD args; - args["TO_NAME"] = target_name; + args["TO_NAME"] = LLSLURL("agent", target_id, "displayname").getSLURLString();; LLSD payload; -- cgit v1.2.3 From 2d7302f9cb2269e7fe22cb927634d99aa5c7a1bb Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 2 Jun 2010 16:16:35 -0700 Subject: DEV-50467 You paid (nobody) message when creating group and classified Also fixes DEV-50470, Attempting to create a group with insufficient funds generates nobody paid you L$-1 notice. Needed to be more clever about which strings to show when partial information is available about the transaction. Reviewed with Leyla. --- indra/newview/llviewermessage.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e4b04b5d4f..9fa9ac626f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4976,6 +4976,9 @@ static std::string reason_from_transaction_type(S32 transaction_type, case TRANS_UPLOAD_CHARGE: return LLTrans::getString("to upload"); + + case TRANS_CLASSIFIED_CHARGE: + return LLTrans::getString("to publish a classified ad"); // These have no reason to display, but are expected and should not // generate warnings @@ -5040,6 +5043,12 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) << " type " << transaction_type << " item " << item_description << LL_ENDL; + if (source_id.isNull() && dest_id.isNull()) + { + // this is a pure balance update, no notification required + return; + } + const char* source_type = (is_source_group ? "group" : "agent"); std::string source_slurl = LLSLURL( source_type, source_id, "inspect").getSLURLString(); @@ -5072,11 +5081,27 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) name_id = dest_id; if (!reason.empty()) { - message = LLTrans::getString("you_paid_ldollars", args); + if (dest_id.notNull()) + { + message = LLTrans::getString("you_paid_ldollars", args); + } + else + { + // transaction fee to the system, eg, to create a group + message = LLTrans::getString("you_paid_ldollars_no_name", args); + } } else { - message = LLTrans::getString("you_paid_ldollars_no_reason", args); + if (dest_id.notNull()) + { + message = LLTrans::getString("you_paid_ldollars_no_reason", args); + } + else + { + // no target, no reason, you just paid money + message = LLTrans::getString("you_paid_ldollars_no_info", args); + } } final_args["MESSAGE"] = message; notification = "PaymentSent"; -- cgit v1.2.3 From 0789897d6127637f2b5f99d8e107fbd3df577173 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 2 Jun 2010 16:31:05 -0700 Subject: removed "SESSION_NAME" in favor of doing a gCacheName lookup reviewed by James --- 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 e4b04b5d4f..86865343a8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1909,7 +1909,6 @@ protected: void modifyNotificationParams() { LLSD payload = mParams.payload; - payload["SESSION_NAME"] = mName; mParams.payload = payload; } }; @@ -2142,7 +2141,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_CONSOLE_AND_CHAT_HISTORY: // *TODO: Translate args["MESSAGE"] = message; - payload["SESSION_NAME"] = name; payload["from_id"] = from_id; LLNotificationsUtil::add("IMSystemMessageTip",args, payload); break; @@ -6096,7 +6094,6 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) //*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; LLNotificationsUtil::add("TeleportOfferSent", args, payload); } -- cgit v1.2.3