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 From 22ae981afb86e31eed777d57e16151c1b7de30ae Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 15 Jul 2010 17:13:38 -0700 Subject: DEV-50739 Message recieved by Send Message to Region function is from Username only reviewed by Richard cc#221 --- indra/newview/llviewermessage.cpp | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6f2b684834..83dec4383c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2093,6 +2093,25 @@ protected: }; +// Callback for name resolution of a god/estate message +void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message) +{ + LLSD args; + args["NAME"] = av_name.getCompleteName(); + args["MESSAGE"] = message; + LLNotificationsUtil::add("GodMessage", args); + + // Treat like a system message and put in chat history. + chat.mText = av_name.getCompleteName() + ": " + message; + + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat", LLSD()); + if(nearby_chat) + { + nearby_chat->addMessage(chat); + } + +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2240,21 +2259,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else if (to_id.isNull()) { - // Message to everyone from GOD - args["NAME"] = name; - args["MESSAGE"] = message; - LLNotificationsUtil::add("GodMessage", args); - - // Treat like a system message and put in chat history. - // Claim to be from a local agent so it doesn't go into - // console. - chat.mText = name + separator_string + message; - - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat", LLSD()); - if(nearby_chat) - { - nearby_chat->addMessage(chat); - } + // Message to everyone from GOD, look up the fullname since + // server always slams name to legacy names + LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message)); } else { -- cgit v1.2.3 From 2278db1b41649f7ba2a60461585792d9d779ff53 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 20 Jul 2010 17:07:26 -0700 Subject: DEV-50726 Userame shown in notification to giver of an in inventory item --- 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 6c3b165bec..490b3c7f0a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2555,7 +2555,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_ACCEPTED: { - args["NAME"] = name; + args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; LLSD payload; payload["from_id"] = from_id; LLNotificationsUtil::add("InventoryAccepted", args, payload); @@ -2563,7 +2563,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } case IM_INVENTORY_DECLINED: { - args["NAME"] = name; + args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; LLSD payload; payload["from_id"] = from_id; LLNotificationsUtil::add("InventoryDeclined", args, payload); -- cgit v1.2.3 From 8038cbcf0e2ee23b3337a2ec0106ec4284d52c29 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 21 Jul 2010 16:59:59 -0700 Subject: DEV-50472 Transaction notifications wrap and amounts cannot be seen in notifications list --- indra/newview/llviewermessage.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 490b3c7f0a..1488bc8350 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5088,13 +5088,29 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) return; } - const char* source_type = (is_source_group ? "group" : "agent"); - std::string source_slurl = - 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, "completename").getSLURLString(); + std::string source_slurl; + if (is_source_group) + { + source_slurl = + LLSLURL( "group", source_id, "inspect").getSLURLString(); + } + else + { + source_slurl = + LLSLURL( "agent", source_id, "completename").getSLURLString(); + } + + std::string dest_slurl; + if (is_dest_group) + { + dest_slurl = + LLSLURL( "group", dest_id, "inspect").getSLURLString(); + } + else + { + dest_slurl = + LLSLURL( "agent", dest_id, "completename").getSLURLString(); + } std::string reason = reason_from_transaction_type(transaction_type, item_description); -- cgit v1.2.3 From 9bb2c74dc59073db5ad91e1053f9bd04836b4ce8 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 6 Aug 2010 13:06:28 -0700 Subject: fix for local chat --- indra/newview/llviewermessage.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0c61e52bc2..0ed7ab835b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3077,15 +3077,20 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) { // 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 + + if (LLAvatarNameCache::useDisplayNames()) { - chat.mFromName = LLCacheName::cleanFullName(from_name); + LLAvatarName av_name; + LLAvatarNameCache::get(from_id, &av_name); + + if (!av_name.mDisplayName.empty()) + { + chat.mFromName = av_name.mDisplayName; + } + else + { + chat.mFromName = LLCacheName::cleanFullName(from_name); + } } } else -- cgit v1.2.3 From be50a053ed4ae7d0b15fc20f1c6ca0973c56ffd9 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 12 Aug 2010 09:46:45 -0700 Subject: first pass at hints --- indra/newview/llviewermessage.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a04c919310..9bb734a3d3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -56,6 +56,7 @@ #include "llagentcamera.h" #include "llcallingcard.h" #include "llbuycurrencyhtml.h" +#include "llfirstuse.h" #include "llfloaterbuyland.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" @@ -1763,6 +1764,8 @@ void inventory_offer_handler(LLOfferInfo* info) return; } + LLFirstUse::inventoryOffer(); + // Avoid the Accept/Discard dialog if the user so desires. JC if (gSavedSettings.getBOOL("AutoAcceptNewInventory") && (info->mType == LLAssetType::AT_NOTECARD -- cgit v1.2.3 From 87d9a34ab869a6e31d83cae8cc55beaebc0c7ff9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 18 Aug 2010 11:50:24 -0700 Subject: DEV-52669 FIX Inventory Notification not given if first Inventory Item comes from buying object contents --- 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 9bb734a3d3..067c0f3a80 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1080,6 +1080,7 @@ bool check_offer_throttle(const std::string& from_name, bool check_only) void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name) { + LLFirstUse::inventoryOffer(); for (uuid_vec_t::const_iterator obj_iter = objects.begin(); obj_iter != objects.end(); ++obj_iter) -- cgit v1.2.3 From af108e324ae45ba3a055e7b55bea3f3b03c7f48d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 19 Aug 2010 13:24:37 -0700 Subject: DEV-52669 FIX Inventory notification not given if first item comes from buying contents --- indra/newview/llviewermessage.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 067c0f3a80..71dff61f41 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -937,6 +937,15 @@ protected: //one global instance to bind them LLOpenTaskOffer* gNewInventoryObserver=NULL; +class LLNewInventoryHintObserver : public LLInventoryAddedObserver +{ +protected: + /*virtual*/ void done() + { + LLFirstUse::newInventory(); + } +}; + void start_new_inventory_observer() { if (!gNewInventoryObserver) //task offer observer @@ -952,6 +961,8 @@ void start_new_inventory_observer() gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver; gInventory.addObserver(gInventoryMoveObserver); } + + gInventory.addObserver(new LLNewInventoryHintObserver()); } class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver @@ -1080,7 +1091,6 @@ bool check_offer_throttle(const std::string& from_name, bool check_only) void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name) { - LLFirstUse::inventoryOffer(); for (uuid_vec_t::const_iterator obj_iter = objects.begin(); obj_iter != objects.end(); ++obj_iter) @@ -1765,8 +1775,6 @@ void inventory_offer_handler(LLOfferInfo* info) return; } - LLFirstUse::inventoryOffer(); - // Avoid the Accept/Discard dialog if the user so desires. JC if (gSavedSettings.getBOOL("AutoAcceptNewInventory") && (info->mType == LLAssetType::AT_NOTECARD -- cgit v1.2.3 From c39d74ac985e789eef8ee988cf8ba80fb2402683 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 19 Aug 2010 14:23:14 -0700 Subject: synchronous llavatarcachename::get calls now return true even if entry is expired --- indra/newview/llviewermessage.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0ed7ab835b..5c36792a0d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3078,19 +3078,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // I don't know if it's OK to change this here, if // anything downstream does lookups by name, for instance - if (LLAvatarNameCache::useDisplayNames()) - { - LLAvatarName av_name; - LLAvatarNameCache::get(from_id, &av_name); - - if (!av_name.mDisplayName.empty()) - { - chat.mFromName = av_name.mDisplayName; - } - else - { - chat.mFromName = LLCacheName::cleanFullName(from_name); - } + LLAvatarName av_name; + if (LLAvatarNameCache::get(from_id, &av_name)) + { + chat.mFromName = av_name.mDisplayName; + } + else + { + chat.mFromName = LLCacheName::cleanFullName(from_name); } } else -- cgit v1.2.3 From eaf235978232d4ec69d95af562d7f5f52a2c09e7 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 19 Aug 2010 14:27:23 -0700 Subject: fixed line endings --- indra/newview/llviewermessage.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5c36792a0d..116c9656ae 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3078,14 +3078,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // 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::get(from_id, &av_name)) - { - chat.mFromName = av_name.mDisplayName; - } - else - { - chat.mFromName = LLCacheName::cleanFullName(from_name); + LLAvatarName av_name; + if (LLAvatarNameCache::get(from_id, &av_name)) + { + chat.mFromName = av_name.mDisplayName; + } + else + { + chat.mFromName = LLCacheName::cleanFullName(from_name); } } else -- cgit v1.2.3 From 9d64b4adf5e455336cbac0ece1598e14ebe40a48 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 20 Aug 2010 14:48:50 -0700 Subject: DEV-52870 FIX Inventory Notification not given if first Inventory Item comes from a user sharing an object or purchase from xstreet --- indra/newview/llviewermessage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 71dff61f41..7bf1031253 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1889,6 +1889,8 @@ void inventory_offer_handler(LLOfferInfo* info) LLPostponedNotification::add(p, info->mFromID, false); } } + + LLFirstUse::newInventory(); } bool lure_callback(const LLSD& notification, const LLSD& response) -- cgit v1.2.3 From 83bb4b9518da813a42e49366cea15e5ae9dc7507 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 Sep 2010 22:10:30 -0700 Subject: fixed merge --- indra/newview/llviewermessage.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 48d11e1f05..317d08cc52 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -49,6 +49,7 @@ #include "llagent.h" #include "llagentcamera.h" #include "llcallingcard.h" +#include "llchannelmanager.h" #include "llbuycurrencyhtml.h" #include "llfirstuse.h" #include "llfloaterbuyland.h" @@ -76,11 +77,13 @@ #include "llstatenums.h" #include "llstatusbar.h" #include "llimview.h" +#include "llscreenchannel.h" #include "llspeakers.h" #include "lltrans.h" #include "lltranslate.h" #include "llviewerfoldertype.h" #include "lluri.h" +#include "llviewercontrol.h" #include "llviewergenericmessage.h" #include "llviewermenu.h" #include "llviewerjoystick.h" -- cgit v1.2.3 From 949b60465593764118c03d0f4e112f69c41bab31 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 17 Sep 2010 15:01:44 -0700 Subject: Backed out changeset: d71309f8bd0e --- 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 317d08cc52..48d11e1f05 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -49,7 +49,6 @@ #include "llagent.h" #include "llagentcamera.h" #include "llcallingcard.h" -#include "llchannelmanager.h" #include "llbuycurrencyhtml.h" #include "llfirstuse.h" #include "llfloaterbuyland.h" @@ -77,13 +76,11 @@ #include "llstatenums.h" #include "llstatusbar.h" #include "llimview.h" -#include "llscreenchannel.h" #include "llspeakers.h" #include "lltrans.h" #include "lltranslate.h" #include "llviewerfoldertype.h" #include "lluri.h" -#include "llviewercontrol.h" #include "llviewergenericmessage.h" #include "llviewermenu.h" #include "llviewerjoystick.h" -- cgit v1.2.3 From 5b2d4a169830c10dd5bfc4c72ddd94ef80e658d3 Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Tue, 21 Sep 2010 19:11:40 +0300 Subject: STORM-163 FIXED Intermittent FPS drop related to "audio" (main thread hangs often on openal lock) Submitting a patch made by Aleric Inglewood (See VWR-14914). This bug happens for a lot of people, although it might be needed to have a fast multi core machine. I have seen it on 1.22.10 once, never used 1.23 sorry, and saw it often on snowglobe. I am sure it also affects 1.23 but I'd have to test that. The symptons are that on a viewer with normally a good, high FPS, sometimes it happens that the FPS dramatically drops (as low as 0.3, but it can also be anything higher, as high as 10, say). This particular jira is about a problem where the main thread is slowed down by a mutex lock in libopenal (most calls starting with 'al' in indra/llaudio/audioengine_openal.cpp and one in indra/llaudio/listener_openal.cpp). You can see that this is the case by opening the Frame Console (control-shift-2) and checking that the "audio" (and possibly misc) timings are very large compared to the Render time. --- indra/newview/llviewermessage.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c35173a7d4..2f3aeec9b3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4213,13 +4213,11 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) // Don't play sounds from a region with maturity above current agent maturity LLVector3d pos_global = objectp->getPositionGlobal(); - if( !gAgent.canAccessMaturityAtGlobal( pos_global ) ) + if (gAgent.canAccessMaturityAtGlobal(pos_global)) { - return; + // Add audioData starts a transfer internally. + sourcep->addAudioData(datap, FALSE); } - - // Add audioData starts a transfer internally. - sourcep->addAudioData(datap, FALSE); } void process_attached_sound(LLMessageSystem *msg, void **user_data) -- cgit v1.2.3 From 0a938d395c6bde13ead4f789056e7f9067e4dbd0 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 28 Sep 2010 19:40:31 +0300 Subject: STORM-266 FIXED displaying group notices in detached People SP. Fixed failure getting pointers to some child panels of LLSideTray while parent side panels are detached. --- 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 33c74e7465..26b7e0fb6d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6453,7 +6453,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) LLPanelLandCovenant::updateEstateOwnerName(owner_name); LLFloaterBuyLand::updateEstateOwnerName(owner_name); - LLPanelPlaceProfile* panel = LLSideTray::getInstance()->findChild("panel_place_profile"); + LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel("panel_place_profile"); if (panel) { panel->updateEstateName(estate_name); @@ -6587,7 +6587,7 @@ void onCovenantLoadComplete(LLVFS *vfs, LLPanelLandCovenant::updateCovenantText(covenant_text); LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid); - LLPanelPlaceProfile* panel = LLSideTray::getInstance()->findChild("panel_place_profile"); + LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel("panel_place_profile"); if (panel) { panel->updateCovenantText(covenant_text); -- cgit v1.2.3 From 42ed8e8ffadd6bd7d8784084e9a29badf5d75c5c Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 17:03:05 +0100 Subject: response is starting to limp along. --- indra/newview/llviewermessage.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 26b7e0fb6d..b78c7b3d66 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6171,10 +6171,14 @@ const S32 SCRIPT_DIALOG_BUTTON_STR_SIZE = 24; const S32 SCRIPT_DIALOG_MAX_MESSAGE_SIZE = 512; const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n"; +#include "lllslconstants.h" bool callback_script_dialog(const LLSD& notification, const LLSD& response) { LLNotificationForm form(notification["form"]); - std::string button = LLNotification::getSelectedOptionName(response); + //std::string button = "booya";//LLNotification::getSelectedOptionName(response); + std::string button = response[TEXTBOX_MAGIC_TOKEN].asString().empty() ? + LLNotification::getSelectedOptionName(response) : + response[TEXTBOX_MAGIC_TOKEN].asString(); S32 button_idx = LLNotification::getSelectedOption(notification, response); // Didn't click "Ignore" if (button_idx != -1) -- cgit v1.2.3 From 578ee535644931ede7dd74741d905d04d8da7fd6 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 17:20:16 +0100 Subject: work on response integrity. --- 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 b78c7b3d66..f897f5e733 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6176,9 +6176,9 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) { LLNotificationForm form(notification["form"]); //std::string button = "booya";//LLNotification::getSelectedOptionName(response); - std::string button = response[TEXTBOX_MAGIC_TOKEN].asString().empty() ? - LLNotification::getSelectedOptionName(response) : - response[TEXTBOX_MAGIC_TOKEN].asString(); + std::string button = response.has(TEXTBOX_MAGIC_TOKEN) ? + response[TEXTBOX_MAGIC_TOKEN].asString() : + LLNotification::getSelectedOptionName(response); S32 button_idx = LLNotification::getSelectedOption(notification, response); // Didn't click "Ignore" if (button_idx != -1) -- cgit v1.2.3 From f7f3df3a2c0b7a87828c4a2c777d9a94502f3d4e Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 18:39:47 +0100 Subject: make empty textboxes return an empty string instead of doing nothing. I hope. --- indra/newview/llviewermessage.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f897f5e733..321100e140 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6176,10 +6176,20 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) { LLNotificationForm form(notification["form"]); //std::string button = "booya";//LLNotification::getSelectedOptionName(response); - std::string button = response.has(TEXTBOX_MAGIC_TOKEN) ? - response[TEXTBOX_MAGIC_TOKEN].asString() : - LLNotification::getSelectedOptionName(response); - S32 button_idx = LLNotification::getSelectedOption(notification, response); + llwarns << "ok: " << response << llendl; + std::string rtn_text; + S32 button_idx; + if (response[TEXTBOX_MAGIC_TOKEN].isDefined()) + { + rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString(); + button_idx = 0; + } + else + { + rtn_text = LLNotification::getSelectedOptionName(response); + button_idx = LLNotification::getSelectedOption(notification, response); + } + llwarns << "rtn: " << rtn_text << " btnidx: " << button_idx << llendl; // Didn't click "Ignore" if (button_idx != -1) { @@ -6192,7 +6202,7 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) msg->addUUID("ObjectID", notification["payload"]["object_id"].asUUID()); msg->addS32("ChatChannel", notification["payload"]["chat_channel"].asInteger()); msg->addS32("ButtonIndex", button_idx); - msg->addString("ButtonLabel", button); + msg->addString("ButtonLabel", rtn_text); msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); } -- cgit v1.2.3 From ca1821048583acedaae7e1dbfe83a0b058faee2c Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 19:00:55 +0100 Subject: more robustness for empty-but-not-aborted textboxes. --- indra/newview/llviewermessage.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 321100e140..3a8f76aca1 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6179,15 +6179,14 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) llwarns << "ok: " << response << llendl; std::string rtn_text; S32 button_idx; - if (response[TEXTBOX_MAGIC_TOKEN].isDefined()) + button_idx = LLNotification::getSelectedOption(notification, response); + if (response[TEXTBOX_MAGIC_TOKEN].isString()) { rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString(); - button_idx = 0; } else { rtn_text = LLNotification::getSelectedOptionName(response); - button_idx = LLNotification::getSelectedOption(notification, response); } llwarns << "rtn: " << rtn_text << " btnidx: " << button_idx << llendl; // Didn't click "Ignore" -- cgit v1.2.3 From 4dfb0b7b2d76cf288cca34c23218c4769ec76991 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 19:33:03 +0100 Subject: finally, properly(?) deal with submitting empty text. --- indra/newview/llviewermessage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3a8f76aca1..e284d8d154 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6180,9 +6180,12 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) std::string rtn_text; S32 button_idx; button_idx = LLNotification::getSelectedOption(notification, response); - if (response[TEXTBOX_MAGIC_TOKEN].isString()) + if (response[TEXTBOX_MAGIC_TOKEN].isDefined()) { - rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString(); + if (response[TEXTBOX_MAGIC_TOKEN].isString()) + rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString(); + else + rtn_text.clear(); // bool marks empty string } else { -- cgit v1.2.3 From de84d95ba083c5a2ab827b9b51849d30ab11c7d3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 30 Sep 2010 11:15:58 +0100 Subject: minor tidy-up. --- 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 e284d8d154..02d27be4ec 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -37,6 +37,7 @@ #include "llfloaterreg.h" #include "llfollowcamparams.h" #include "llinventorydefines.h" +#include "lllslconstants.h" #include "llregionhandle.h" #include "llsdserialize.h" #include "llteleportflags.h" @@ -6171,7 +6172,6 @@ const S32 SCRIPT_DIALOG_BUTTON_STR_SIZE = 24; const S32 SCRIPT_DIALOG_MAX_MESSAGE_SIZE = 512; const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n"; -#include "lllslconstants.h" bool callback_script_dialog(const LLSD& notification, const LLSD& response) { LLNotificationForm form(notification["form"]); -- cgit v1.2.3 From 5b3f293453af7c54ef5c1913c706982ece8be1d0 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Thu, 30 Sep 2010 12:06:44 +0100 Subject: more de-crufting. --- indra/newview/llviewermessage.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 02d27be4ec..dfd7b1092a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6175,8 +6175,7 @@ const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n"; bool callback_script_dialog(const LLSD& notification, const LLSD& response) { LLNotificationForm form(notification["form"]); - //std::string button = "booya";//LLNotification::getSelectedOptionName(response); - llwarns << "ok: " << response << llendl; + std::string rtn_text; S32 button_idx; button_idx = LLNotification::getSelectedOption(notification, response); @@ -6191,7 +6190,7 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) { rtn_text = LLNotification::getSelectedOptionName(response); } - llwarns << "rtn: " << rtn_text << " btnidx: " << button_idx << llendl; + // Didn't click "Ignore" if (button_idx != -1) { -- cgit v1.2.3 From 77eda083f7295f13e652ffb75c79000b873588d3 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 30 Sep 2010 15:03:07 -0700 Subject: fixing [NAME] issue for friend notifications with no message --- 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 9b1f2e67c6..4e40b706a0 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2876,7 +2876,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); + args["NAME"] = LLSLURL("agent", from_id, "about").getSLURLString(); if(message.empty()) { //support for frienship offers from clients before July 2008 -- cgit v1.2.3 From b049db546a5970d268014f3d0d5375834cdaf59d Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 14 Oct 2010 12:01:40 -0700 Subject: DN-177 Cannot click on Name in Friend Request to view profile - and no profile pic in friend request --- 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 4e40b706a0..9b1f2e67c6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2876,7 +2876,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - args["NAME"] = LLSLURL("agent", from_id, "about").getSLURLString(); + args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); if(message.empty()) { //support for frienship offers from clients before July 2008 -- cgit v1.2.3 From 58f0e78cb491833440d85e105593bccc2d2aa4ab Mon Sep 17 00:00:00 2001 From: Dave SIMmONs Date: Tue, 12 Oct 2010 13:50:17 -0700 Subject: Initial work on viewer motion interpolation. Changes include: * InterpolationTime and InterpolationPhaseOut values in settings.xml to control new object interpolation code. Use zero to revert to old logic * Viewer motion interpolation lasts InterpolationTime and will start to phase out after InterpolationPhaseOut seconds * Changed LLWorld::getMinAllowedZ() to take a world-position as a parameter * Added LLVOAvatarSelf::resetRegionCrossingTimer() * Actually reset LLVOAvatarSelf::mRegionCrossingTimer so we get sensible timing data for region crossings * LLVOAvatarSelf::updateRegion() will update position value due to region changes Code reviewed by Ambroff * --- 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 26b7e0fb6d..8120c37874 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3722,6 +3722,7 @@ void process_crossed_region(LLMessageSystem* msg, void**) return; } LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL; + gAgentAvatarp->resetRegionCrossingTimer(); U32 sim_ip; msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip); -- cgit v1.2.3 From 23a217c66717912b99bc4c54cc8028fb7027e1be Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 27 Oct 2010 22:54:39 +0300 Subject: STORM-451 FIXED Disabled highlighting URLs in object name inside the llGiveInventory discard notification. Changes: * Wrapped object name with ... tags to disable URL parsing. * The decline message is now localized as a whole sentence (localizing separate phrases is often inapplicable for some languages). --- indra/newview/llviewermessage.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9b1f2e67c6..672213d3e8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1511,7 +1511,12 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // MUTE falls through to decline case IOR_DECLINE: { - log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; + { + LLStringUtil::format_map_t log_message_args; + log_message_args["DESC"] = mDesc; + log_message_args["NAME"] = mFromName; + log_message = LLTrans::getString("InvOfferDecline", log_message_args); + } chat.mText = log_message; if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 { @@ -1710,8 +1715,12 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE); // send the message msg->sendReliable(mHost); - - log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; + { + LLStringUtil::format_map_t log_message_args; + log_message_args["DESC"] = mDesc; + log_message_args["NAME"] = mFromName; + log_message = LLTrans::getString("InvOfferDecline", log_message_args); + } LLSD args; args["MESSAGE"] = log_message; LLNotificationsUtil::add("SystemMessage", args); -- cgit v1.2.3 From 0a27fe695e6db2272ea1af02a897b5db33c8b70f Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 3 Nov 2010 23:28:59 +0200 Subject: STORM-194 FIXED 'Show' button in inventory offer notification to open 'My Inventory' SP if attachments were offered. Removed the check preventing inventory SP from opening when an item of IT_ATTACHMENT type has been offered. --- indra/newview/llviewermessage.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 672213d3e8..598ad7afc6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1199,7 +1199,6 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam const BOOL auto_open = gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false !(asset_type == LLAssetType::AT_CALLINGCARD) && // don't open if it's a calling card - !(item && (item->getInventoryType() == LLInventoryType::IT_ATTACHMENT)) && // don't open if it's an item that's an attachment !from_name.empty(); // don't open if it's not from anyone. LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open); if(active_panel) -- cgit v1.2.3 From ee8df375449e97476408417ec6dea0d6a8853d73 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 10 Nov 2010 15:22:49 -0800 Subject: fixing group invite name scrubbing to work with server changes --- indra/newview/llviewermessage.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 598ad7afc6..0ca30d5f3d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2509,15 +2509,6 @@ 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; -- cgit v1.2.3 From d0de833d947b219eabae01abbb5750ad05e5e305 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 16 Nov 2010 23:26:08 +0200 Subject: STORM-563 FIXED Updated all localized XUI strings and notifications templates to use display names. Previously name substitutions were broken, so "[FIRST] [LAST]" was displayed instead of avatar name. Some of the affected notifications: * avatar went online/offline notification * object return notification * calling card offer * script dialog * auto-unmute notification. See the diff for more details. The fixes apply to all locales but English (which is already correct). Besides, I fixed calling card offer notification to display avatar name correctly. It was broken even in English. --- 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 7c0fc681a4..1f54940b25 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3031,6 +3031,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) } else { + args["NAME"] = source_name; LLNotificationsUtil::add("OfferCallingCard", args, payload); } } -- cgit v1.2.3