summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
-rw-r--r--indra/newview/llviewerinventory.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 557e20a4b0..87d8f753b8 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1007,6 +1007,22 @@ void activate_gesture_cb(const LLUUID& inv_item)
LLGestureMgr::instance().activateGesture(inv_item);
}
+void set_default_permissions(LLViewerInventoryItem* item, std::string perm_type)
+{
+ llassert(item);
+ LLPermissions perm = item->getPermissions();
+ if (perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms(perm_type)
+ || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms(perm_type))
+ {
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms(perm_type));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms(perm_type));
+
+ item->setPermissions(perm);
+
+ item->updateServer(FALSE);
+ }
+}
+
void create_script_cb(const LLUUID& inv_item)
{
if (!inv_item.isNull())
@@ -1014,13 +1030,9 @@ void create_script_cb(const LLUUID& inv_item)
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
if (item)
{
- LLPermissions perm = item->getPermissions();
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts"));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts"));
+ set_default_permissions(item, "Scripts");
- item->setPermissions(perm);
-
- item->updateServer(FALSE);
+ // item was just created, update even if permissions did not changed
gInventory.updateItem(item);
gInventory.notifyObservers();
}
@@ -1036,13 +1048,8 @@ void create_gesture_cb(const LLUUID& inv_item)
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
if (item)
{
- LLPermissions perm = item->getPermissions();
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures"));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures"));
-
- item->setPermissions(perm);
+ set_default_permissions(item, "Gestures");
- item->updateServer(FALSE);
gInventory.updateItem(item);
gInventory.notifyObservers();
@@ -1061,13 +1068,8 @@ void create_notecard_cb(const LLUUID& inv_item)
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
if (item)
{
- LLPermissions perm = item->getPermissions();
- perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards"));
- perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards"));
+ set_default_permissions(item, "Notecards");
- item->setPermissions(perm);
-
- item->updateServer(FALSE);
gInventory.updateItem(item);
gInventory.notifyObservers();
}
@@ -1301,12 +1303,18 @@ void update_inventory_item(
if (updates.has("asset_id"))
{
updates.erase("asset_id");
- updates["hash_id"] = update_item->getTransactionID();
+ if (update_item->getTransactionID().notNull())
+ {
+ updates["hash_id"] = update_item->getTransactionID();
+ }
}
if (updates.has("shadow_id"))
{
updates.erase("shadow_id");
- updates["hash_id"] = update_item->getTransactionID();
+ if (update_item->getTransactionID().notNull())
+ {
+ updates["hash_id"] = update_item->getTransactionID();
+ }
}
AISAPI::completion_t cr = boost::bind(&doInventoryCb, cb, _1);
AISAPI::UpdateItem(item_id, updates, cr);