MAINT-7133 add object name to inventory offer chat message

Mnikolenko Productengine 2017-02-20 11:24:30 +02:00
parent 094c13d63b
commit da3fde24aa
3 changed files with 21 additions and 11 deletions

View File

@ -306,21 +306,23 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent,
//////////////////////////////////////////////////////////////////////////
//static
void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im_session_id)
void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im_session_id, const std::string& item_name, bool is_folder)
{
// compute id of possible IM session with agent that has "to_agent" id
LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, to_agent);
// If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat.
LLSD args;
args["user_id"] = to_agent;
args["ITEM_NAME"] = item_name;
std::string message_name = is_folder ? "inventory_folder_offered" : "inventory_item_offered";
if (im_session_id.notNull())
{
gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args);
gIMMgr->addSystemMessage(im_session_id, message_name, args);
}
// If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat.
else if (LLIMModel::getInstance()->findIMSession(session_id))
{
gIMMgr->addSystemMessage(session_id, "inventory_item_offered", args);
gIMMgr->addSystemMessage(session_id, message_name, args);
}
// If this item was given by drag-and-drop on avatar while IM panel wasn't open, log this action to IM history.
else
@ -331,7 +333,9 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im
// Build a new format username or firstname_lastname for legacy names
// to use it for a history log filename.
full_name = LLCacheName::buildUsername(full_name);
LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, LLTrans::getString("inventory_item_offered-im"));
LLUIString message = LLTrans::getString(message_name + "-im");
message.setArgs(args);
LLIMModel::instance().logToFile(full_name, LLTrans::getString("SECOND_LIFE"), im_session_id, message.getString());
}
}
}
@ -385,6 +389,7 @@ void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent,
{
if (!item) return;
std::string name;
std::string item_name = item->getName();
LLAgentUI::buildFullname(name);
LLUUID transaction_id;
transaction_id.generate();
@ -399,7 +404,7 @@ void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent,
gAgentSessionID,
to_agent,
name,
item->getName(),
item_name,
IM_ONLINE,
IM_INVENTORY_OFFERED,
transaction_id,
@ -421,7 +426,7 @@ void LLGiveInventory::commitGiveInventoryItem(const LLUUID& to_agent,
LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
logInventoryOffer(to_agent, im_session_id);
logInventoryOffer(to_agent, im_session_id, item_name);
// add buddy to recent people list
LLRecentPeople::instance().add(to_agent);
@ -501,7 +506,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent,
items,
LLInventoryModel::EXCLUDE_TRASH,
giveable);
std::string cat_name = cat->getName();
bool give_successful = true;
// MAX ITEMS is based on (sizeof(uuid)+2) * count must be <
// MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
@ -556,7 +561,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent,
gAgent.getSessionID(),
to_agent,
name,
cat->getName(),
cat_name,
IM_ONLINE,
IM_INVENTORY_OFFERED,
transaction_id,
@ -579,7 +584,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent,
LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
logInventoryOffer(to_agent, im_session_id);
logInventoryOffer(to_agent, im_session_id, cat_name, true);
}
return give_successful;

View File

@ -78,7 +78,9 @@ private:
* logs "Inventory item offered" to IM
*/
static void logInventoryOffer(const LLUUID& to_agent,
const LLUUID &im_session_id = LLUUID::null);
const LLUUID &im_session_id = LLUUID::null,
const std::string& item_name = std::string(),
bool is_folder = false);
static void commitGiveInventoryItem(const LLUUID& to_agent,
const LLInventoryItem* item,

View File

@ -3628,7 +3628,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
Conference with [AGENT_NAME]
</string>
<string name="inventory_item_offered-im">
Inventory item offered
Inventory item '[ITEM_NAME]' offered
</string>
<string name="inventory_folder_offered-im">
Inventory folder '[ITEM_NAME]' offered
</string>
<string name="share_alert">
Drag items from inventory here