std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string format = ""; if (gSavedSettings.getBOOL("SecondsInChatAndIMs")) { format = gSavedSettings.getString("LongTimeFormat"); } else { format = gSavedSettings.getString("ShortTimeFormat"); } std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
void LLEventNotifier::update() { if (mNotificationTimer.getElapsedTimeF32() > 30.f) { // Check our notifications again and send out updates // if they happen. time_t alert_time = time_corrected() + 5 * 60; en_map::iterator iter; for (iter = mEventNotifications.begin(); iter != mEventNotifications.end();) { LLEventNotification *np = iter->second; if (np->getEventDate() < (alert_time)) { LLSD args; args["NAME"] = np->getEventName(); args["DATE"] = np->getEventDateStr(); LLNotifications::instance().add("EventNotification", args, LLSD(), boost::bind(&LLEventNotification::handleResponse, np, _1, _2)); mEventNotifications.erase(iter++); } else { iter++; } } mNotificationTimer.reset(); } }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // PDT/PDS is totally irrelevant static const LLCachedControl<bool> use_local_time("RtyChatUsesLocalTime"); if(use_local_time) { // use local time timep = std::localtime(&utc_time); } else { // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); } static const LLCachedControl<bool> show_seconds("SecondsInChatAndIMs"); static const LLCachedControl<std::string> format_long("LongTimeFormat"); static const LLCachedControl<std::string> format_short("ShortTimeFormat"); std::string format = show_seconds ? format_long : format_short; std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
std::string LLLogChat::timestamp(bool withdate) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); static LLCachedControl<bool> withseconds("SecondsInLog"); std::string text; if (withdate) if (withseconds) text = llformat("[%d-%02d-%02d %02d:%02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min, timep->tm_sec); else text = llformat("[%d/%02d/%02d %02d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min); else if (withseconds) text = llformat("[%02d:%02d:%02d] ", timep->tm_hour, timep->tm_min, timep->tm_sec); else text = llformat("[%02d:%02d] ", timep->tm_hour, timep->tm_min); return text; }
LLUUID LLLocalInventory::addItem(std::string name, int type, LLUUID asset_id) { LLUUID item_id; item_id.generate(); LLPermissions* perms = new LLPermissions(); perms->set(LLPermissions::DEFAULT); perms->setOwnerAndGroup(LLUUID::null, LLUUID::null, LLUUID::null, false); perms->setMaskBase(0); perms->setMaskEveryone(0); perms->setMaskGroup(0); perms->setMaskNext(0); perms->setMaskOwner(0); LLViewerInventoryItem* item = new LLViewerInventoryItem( item_id, gSystemFolderAssets, *perms, asset_id, (LLAssetType::EType)type, (LLInventoryType::EType)type, name, "", LLSaleInfo::DEFAULT, 0, time_corrected()); addItem(item); return item_id; }
void LLFloaterTeleportHistory::addPendingEntry(std::string regionName, S16 x, S16 y, S16 z) { // [RLVa:KB] if(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) return; // [/RLVa:KB] // Set pending entry timestamp struct tm* internal_time = utc_to_pacific_time(time_corrected(), gPacificDaylightTime); timeStructToFormattedString(internal_time, gSavedSettings.getString("ShortDateFormat") + gSavedSettings.getString("LongTimeFormat"), mPendingTimeString); // check if we are in daylight savings time mPendingTimeString += gPacificDaylightTime ? " PDT" : " PST"; // Set pending region name mPendingRegionName = regionName; // Set pending position mPendingPosition = llformat("%d, %d, %d", x, y, z); LLSLURL slurl(regionName, LLVector3(x, y, z)); // prepare simstring for later parsing mPendingSimString = LLWeb::escapeURL(slurl.getLocationString()); // Prepare the SLURL mPendingSLURL = slurl.getSLURLString(); }
//static void LLFloaterBlacklist::addEntry(LLUUID key, LLSD data) { if(key.notNull()) { if(!data.has("entry_type")) LL_WARNS("FloaterBlacklistAdd") << "addEntry called with no entry type, specify LLAssetType::Etype" << LL_ENDL; else if(!data.has("entry_name")) LL_WARNS("FloaterBlacklistAdd") << "addEntry called with no entry name, specify the name that should appear in the listing for this entry." << LL_ENDL; else { if(!data.has("entry_date")) { LLDate* curdate = new LLDate(time_corrected()); std::string input_date = curdate->asString(); input_date.replace(input_date.find("T"),1," "); input_date.resize(input_date.size() - 1); data["entry_date"] = input_date; } if(data["entry_type"].asString() == "1") { //remove sounds LLUUID sound_id=LLUUID(key); gVFS->removeFile(sound_id,LLAssetType::AT_SOUND); std::string wav_path= gDirUtilp->getExpandedFilename(LL_PATH_CACHE,sound_id.asString()) + ".dsf"; if(LLAPRFile::isExist(wav_path, LL_APR_RPB)) LLAPRFile::remove(wav_path); gAudiop->removeAudioData(sound_id); } blacklist_entries.insert(std::pair<LLUUID,LLSD>(key,data)); updateBlacklists(); } } else LL_WARNS("FloaterBlacklistAdd") << "addEntry called with a null entry key, please specify LLUUID of asset." << LL_ENDL; }
void LLEventNotifier::update() { if (mNotificationTimer.getElapsedTimeF32() > 30.f) { // Check our notifications again and send out updates // if they happen. U32 alert_time = time_corrected() + 5 * 60; en_map::iterator iter; for (iter = mEventNotifications.begin(); iter != mEventNotifications.end();) { LLEventNotification *np = iter->second; if (np->getEventDate() < (alert_time)) { LLString::format_map_t args; args["[NAME]"] = np->getEventName(); args["[DATE]"] = np->getEventDateStr(); LLNotifyBox::showXml("EventNotification", args, notifyCallback, np); mEventNotifications.erase(iter++); } else { iter++; } } mNotificationTimer.reset(); } }
std::string LLLogChat::timestamp(bool withdate) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string format = ""; if (withdate) format = gSavedSettings.getString("ShortDateFormat") + " "; if (gSavedSettings.getBOOL("SecondsInChatAndIMs")) { format += gSavedSettings.getString("LongTimeFormat"); } else { format += gSavedSettings.getString("ShortTimeFormat"); } std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; return text; }
// <edit> void temp_upload_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; if(result >= 0) { LLUUID item_id; item_id.generate(); LLPermissions* perms = new LLPermissions(); perms->set(LLPermissions::DEFAULT); perms->setOwnerAndGroup(gAgentID, gAgentID, gAgentID, false); perms->setMaskBase(PERM_ALL); perms->setMaskOwner(PERM_ALL); perms->setMaskEveryone(PERM_ALL); perms->setMaskGroup(PERM_ALL); perms->setMaskNext(PERM_ALL); LLUUID destination = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE); BOOL bUseSystemInventory = (gSavedSettings.getBOOL("AscentUseSystemFolder") && gSavedSettings.getBOOL("AscentSystemTemporary")); if (bUseSystemInventory) { destination = gSystemFolderAssets; } LLViewerInventoryItem* item = new LLViewerInventoryItem( item_id, destination, *perms, uuid, (LLAssetType::EType)data->mAssetInfo.mType, (LLInventoryType::EType)data->mInventoryType, data->mAssetInfo.getName(), data->mAssetInfo.getDescription(), LLSaleInfo::DEFAULT, 0, time_corrected()); if (bUseSystemInventory) { LLLocalInventory::addItem(item); } else { item->updateServer(TRUE); gInventory.updateItem(item); gInventory.notifyObservers(); } } else { LLSD args; args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotificationsUtil::add("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; }
// static void LLPanelContents::onClickNewScript(void *userdata) { const BOOL children_ok = TRUE; LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { // [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c) | Modified: RLVa-1.0.5a if (rlv_handler_t::isEnabled()) // Fallback code [see LLPanelContents::getState()] { if (gRlvAttachmentLocks.isLockedAttachment(object->getRootEdit())) { return; // Disallow creating new scripts in a locked attachment } else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { if ( (isAgentAvatarValid()) && (gAgentAvatarp->isSitting()) && (gAgentAvatarp->getRoot() == object->getRootEdit()) ) return; // .. or in a linkset the avie is sitting on under @unsit=n/@sittp=n } } // [/RLVa:KB] LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); // Parameters are base, owner, everyone, group, next perm.initMasks( PERM_ALL, PERM_ALL, LLFloaterPerms::getEveryonePerms("Scripts"), LLFloaterPerms::getGroupPerms("Scripts"), PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Scripts")); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem( LLUUID::null, LLUUID::null, perm, LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, "New Script", desc, LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, time_corrected()); object->saveScript(new_item, TRUE, true); std::string name = new_item->getName(); // *NOTE: In order to resolve SL-22177, we needed to create // the script first, and then you have to click it in // inventory to edit it. // *TODO: The script creation should round-trip back to the // viewer so the viewer can auto-open the script and start // editing ASAP. } }
// static void LLPanelContents::onClickNewScript(void *userdata) { const BOOL children_ok = TRUE; LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); perm.initMasks( PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); std::string desc; LLAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem( LLUUID::null, LLUUID::null, perm, LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, std::string("New Script"), desc, LLSaleInfo::DEFAULT, LLViewerInventoryItem::II_FLAGS_NONE, time_corrected()); object->saveScript(new_item, TRUE, true); // *NOTE: In order to resolve SL-22177, we needed to create // the script first, and then you have to click it in // inventory to edit it. // *TODO: The script creation should round-trip back to the // viewer so the viewer can auto-open the script and start // editing ASAP. #if 0 S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("PreviewScriptRect"); rect.translate( left - rect.mLeft, top - rect.mTop ); LLLiveLSLEditor* editor; editor = new LLLiveLSLEditor("script ed", rect, "Script: New Script", object->mID, LLUUID::null); editor->open(); /*Flawfinder: ignore*/ // keep onscreen gFloaterView->adjustToFitScreen(editor, FALSE); #endif } }
// <edit> //static void LLFloaterTexturePicker::onBtnCpToInv(void* userdata) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; LLUUID mUUID = self->mImageAssetID; LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE; LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE; const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type)); if(folder_id.notNull()) { std::string name; std::string desc; name.assign("temp."); desc.assign(mUUID.asString()); name.append(mUUID.asString()); LLUUID item_id; item_id.generate(); LLPermissions perm; perm.init(gAgentID, gAgentID, LLUUID::null, LLUUID::null); U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER; perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE,PERM_NONE, next_owner_perm); S32 creation_date_now = time_corrected(); LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(item_id, folder_id, perm, mUUID, asset_type, inv_type, name, desc, LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, creation_date_now); item->updateServer(TRUE); gInventory.updateItem(item); gInventory.notifyObservers(); LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (active_panel) { active_panel->openSelected(); LLFocusableElement* focus = gFocusMgr.getKeyboardFocus(); gFocusMgr.setKeyboardFocus(focus); } } else { llwarns << "Can't find a folder to put it in" << llendl; } }
void FSWSAssetBlacklist::addNewItemToBlacklist(LLUUID id, std::string name, std::string region, LLAssetType::EType type, bool save) { LLDate curdate = LLDate(time_corrected()); std::string input_date = curdate.asString(); input_date.replace(input_date.find("T"),1," "); input_date.resize(input_date.size() - 1); LLSD data; data["asset_name"] = name; data["asset_region"] = region; data["asset_type"] = type; data["asset_date"] = input_date; addNewItemToBlacklistData(LLUUID::generateNewID(id.asString() + "hash"), data, save); }
void LLSidepanelInventory::onToggleInboxBtn() { LLButton* inboxButton = getChild<LLButton>(INBOX_BUTTON_NAME); LLLayoutPanel* inboxPanel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME); LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME); const bool inbox_expanded = inboxButton->getToggleState(); // Expand/collapse the indicated panel inv_stack->collapsePanel(inboxPanel, !inbox_expanded); if (inbox_expanded && inboxPanel->isInVisibleChain()) { gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); std::string timeStr ="[["+ LLTrans::getString("TimeHour")+"]:[" +LLTrans::getString("TimeMin")+"]] "; LLSD substitution; substitution["datetime"] = (S32) utc_time; LLStringUtil::format (timeStr, substitution); appendText(timeStr, prepend_newline, LLStyle::Params().color(LLColor4::grey)); blockUndo(); return timeStr; }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
std::string appendTime() { time_t utc_time; utc_time = time_corrected(); std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" +LLTrans::getString("TimeMin")+"]"; if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps")) { timeStr += ":[" +LLTrans::getString("TimeSec")+"]"; } LLSD substitution; substitution["datetime"] = (S32) utc_time; LLStringUtil::format (timeStr, substitution); return timeStr; }
// static void LLPanelContents::onClickNewScript(void *userdata) { const BOOL children_ok = TRUE; LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if(object) { LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); perm.initMasks( PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); std::string desc; LLViewerAssetType::generateDescriptionFor(LLAssetType::AT_LSL_TEXT, desc); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem( LLUUID::null, LLUUID::null, perm, LLUUID::null, LLAssetType::AT_LSL_TEXT, LLInventoryType::IT_LSL, LLTrans::getString("PanelContentsNewScript"), desc, LLSaleInfo::DEFAULT, LLViewerInventoryItem::II_FLAGS_NONE, time_corrected()); object->saveScript(new_item, TRUE, true); // *NOTE: In order to resolve SL-22177, we needed to create // the script first, and then you have to click it in // inventory to edit it. // *TODO: The script creation should round-trip back to the // viewer so the viewer can auto-open the script and start // editing ASAP. #if 0 LLFloaterReg::showInstance("preview_scriptedit", LLSD(inv_item->getUUID()), TAKE_FOCUS_YES); #endif } }
void LLPanelDirEvents::setDay(S32 day) { mDay = day; // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string date; timeStructToFormattedString(internal_time, "%m-%d", date); childSetValue("date_text", date); }
void FSWSAssetBlacklist::addNewItemToBlacklist(const LLUUID& id, const std::string& name, const std::string& region, LLAssetType::EType type, bool save) { if (isBlacklisted(id, type)) { return; } LLDate curdate = LLDate(time_corrected()); std::string input_date = curdate.asString(); input_date.replace(input_date.find("T"), 1, " "); input_date.resize(input_date.size() - 1); LLSD data; data["asset_name"] = name; data["asset_region"] = region; data["asset_type"] = type; data["asset_date"] = input_date; addNewItemToBlacklistData(id, data, save); }
void LLSidepanelInventory::onOpen(const LLSD& key) { LLFirstUse::newInventory(false); #if AUTO_EXPAND_INBOX // Expand the inbox if we have fresh items LLPanelMarketplaceInbox * inbox = findChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL); if (inbox && (inbox->getFreshItemCount() > 0)) { getChild<LLButton>(INBOX_BUTTON_NAME)->setToggleState(true); onToggleInboxBtn(); } #else if (mInboxEnabled && getChild<LLButton>(INBOX_BUTTON_NAME)->getToggleState()) { gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } #endif if(key.size() == 0) return; mItemPanel->reset(); if (key.has("id")) { mItemPanel->setItemID(key["id"].asUUID()); if (key.has("object")) { mItemPanel->setObjectID(key["object"].asUUID()); } showItemInfoPanel(); } if (key.has("task")) { if (mTaskPanel) mTaskPanel->setObjectSelection(LLSelectMgr::getInstance()->getSelection()); showTaskInfoPanel(); } }
void LLPanelDirEvents::setDay(S32 day) { mDay = day; // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string buffer = llformat("%d/%d", 1 + internal_time->tm_mon, // Jan = 0 internal_time->tm_mday); // 2001 = 101 childSetValue("date_text", buffer); }
void LLFloaterTeleportHistory::addPendingEntry(std::string regionName, S16 x, S16 y, S16 z) { // [RLVa:KB] if(gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) return; // [/RLVa:KB] // Set pending entry timestamp U32 utc_time; utc_time = time_corrected(); struct tm* internal_time; internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); // check if we are in daylight savings time std::string timeZone = " PST"; if (gPacificDaylightTime) { timeZone = " PDT"; } #ifdef LOCALIZED_TIME timeStructToFormattedString(internal_time, gSavedSettings.getString("LongTimeFormat"), mPendingTimeString); mPendingTimeString += timeZone; #else mPendingTimeString = llformat("%02d:%02d:%02d", internal_time->tm_hour, internal_time->tm_min, internal_time->tm_sec) + timeZone; #endif // Set pending region name mPendingRegionName = regionName; // Set pending position mPendingPosition = llformat("%d, %d, %d", x, y, z); // prepare simstring for later parsing mPendingSimString = regionName + llformat("/%d/%d/%d", x, y, z); mPendingSimString = LLWeb::escapeURL(mPendingSimString); // Prepare the SLURL mPendingSLURL = LLURLDispatcher::buildSLURL(regionName, x, y, z); }
LLUUID LLLocalInventory::addItem(std::string name, int type, LLUUID asset_id) { LLUUID item_id; item_id.generate(); LLPermissions new_perms; new_perms.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); new_perms.initMasks(PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL, PERM_ALL); LLViewerInventoryItem* item = new LLViewerInventoryItem( item_id, gSystemFolderAssets, new_perms, asset_id, (LLAssetType::EType)type, (LLInventoryType::EType)type, name, "", LLSaleInfo::DEFAULT, 0, time_corrected()); addItem(item); return item_id; }
void on_new_single_inventory_upload_complete( LLAssetType::EType asset_type, LLInventoryType::EType inventory_type, const std::string inventory_type_string, const LLUUID& item_folder_id, const std::string& item_name, const std::string& item_description, const LLSD& server_response, S32 upload_price) { bool success = false; if ( upload_price > 0 ) { // this upload costed us L$, update our balance // and display something saying that it cost L$ LLStatusBar::sendMoneyBalanceRequest(); std::string type_currency = LLGridManager::getInstance()->getCurrency(); LLSD args; args["AMOUNT"] = llformat("%d", upload_price); args["CUR"] = type_currency; LLNotificationsUtil::add("UploadPayment", args); } if( item_folder_id.notNull() ) { U32 everyone_perms = PERM_NONE; U32 group_perms = PERM_NONE; U32 next_owner_perms = PERM_ALL; if( server_response.has("new_next_owner_mask") ) { // The server provided creation perms so use them. // Do not assume we got the perms we asked for in // since the server may not have granted them all. everyone_perms = server_response["new_everyone_mask"].asInteger(); group_perms = server_response["new_group_mask"].asInteger(); next_owner_perms = server_response["new_next_owner_mask"].asInteger(); } else { // The server doesn't provide creation perms // so use old assumption-based perms. if( inventory_type_string != "snapshot") { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } } LLPermissions new_perms; new_perms.init( gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); new_perms.initMasks( PERM_ALL, PERM_ALL, everyone_perms, group_perms, next_owner_perms); U32 inventory_item_flags = 0; if (server_response.has("inventory_flags")) { inventory_item_flags = (U32) server_response["inventory_flags"].asInteger(); if (inventory_item_flags != 0) { llinfos << "inventory_item_flags " << inventory_item_flags << llendl; } } S32 creation_date_now = time_corrected(); LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem( server_response["new_inventory_item"].asUUID(), item_folder_id, new_perms, server_response["new_asset"].asUUID(), asset_type, inventory_type, item_name, item_description, LLSaleInfo::DEFAULT, inventory_item_flags, creation_date_now); gInventory.updateItem(item); gInventory.notifyObservers(); success = true; // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel(); if ( panel ) { LLFocusableElement* focus = gFocusMgr.getKeyboardFocus(); panel->setSelection( server_response["new_inventory_item"].asUUID(), TAKE_FOCUS_NO); // restore keyboard focus gFocusMgr.setKeyboardFocus(focus); } } else { llwarns << "Can't find a folder to put it in" << llendl; } // remove the "Uploading..." message LLUploadDialog::modalUploadFinished(); // Let the Snapshot floater know we have finished uploading a snapshot to inventory. LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot"); if (asset_type == LLAssetType::AT_TEXTURE && floater_snapshot) { floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory"))); } }
void LLPanelDirEvents::performQueryOrDelete(U32 event_id) { S32 relative_day = mDay; // Update the date field to show the date IN THE SERVER'S // TIME ZONE, as that is what will be displayed in each event // Get time UTC time_t utc_time = time_corrected(); // Correct for offset utc_time += relative_day * 24 * 60 * 60; // There's only one internal tm buffer. struct tm* internal_time; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string date; timeStructToFormattedString(internal_time, "%m-%d", date); childSetValue("date_text", date); // Record the relative day so back and forward buttons // offset from this day. mDay = relative_day; mDoneQuery = TRUE; U32 scope = DFQ_DATE_EVENTS; if ( gAgent.wantsPGOnly()) scope |= DFQ_PG_SIMS_ONLY; if ( childGetValue("incpg").asBoolean() ) scope |= DFQ_INC_PG; if ( childGetValue("incmature").asBoolean() ) scope |= DFQ_INC_MATURE; if ( childGetValue("incadult").asBoolean() ) scope |= DFQ_INC_ADULT; if (childGetValue("filter_gaming").asBoolean()) scope |= DFQ_FILTER_GAMING; // Add old query flags in case we are talking to an old server if ( childGetValue("incpg").asBoolean() && !childGetValue("incmature").asBoolean()) { scope |= DFQ_PG_EVENTS_ONLY; } if ( !( scope & (DFQ_INC_PG | DFQ_INC_MATURE | DFQ_INC_ADULT ))) { LLNotificationsUtil::add("NoContentToSearch"); return; } setupNewSearch(); std::ostringstream params; // Date mode for the search if ("current" == childGetValue("date_mode").asString()) { params << "u|"; } else { params << mDay << "|"; } // Categories are stored in the database in table indra.event_category // XML must match. U32 cat_id = childGetValue("category combo").asInteger(); params << cat_id << "|"; params << childGetValue("event_search_text").asString(); // send the message if (0 == event_id) { sendDirFindQuery(gMessageSystem, mSearchID, params.str(), scope, mSearchStart); } else { // This delete will also perform a query. LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_EventGodDelete); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_EventData); msg->addU32Fast(_PREHASH_EventID, event_id); msg->nextBlockFast(_PREHASH_QueryData); msg->addUUIDFast(_PREHASH_QueryID, mSearchID); msg->addStringFast(_PREHASH_QueryText, params.str()); msg->addU32Fast(_PREHASH_QueryFlags, scope); msg->addS32Fast(_PREHASH_QueryStart, mSearchStart); gAgent.sendReliableMessage(); } }
//virtual void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) { lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; //std::ostringstream llsdxml; //LLSDSerialize::toXML(content, llsdxml); //llinfos << "upload complete content:\n " << llsdxml.str() << llendl; LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // Update L$ and ownership credit information // since it probably changed on the server if (asset_type == LLAssetType::AT_TEXTURE || asset_type == LLAssetType::AT_SOUND || asset_type == LLAssetType::AT_ANIMATION) { LLStatusBar::sendMoneyBalanceRequest(); LLSD args; args["AMOUNT"] = llformat("%d", expected_upload_cost); LLNotifications::instance().add("UploadPayment", args); } // Actually add the upload to viewer inventory llinfos << "Adding " << content["new_inventory_item"].asUUID() << " " << content["new_asset"].asUUID() << " to inventory." << llendl; if(mPostData["folder_id"].asUUID().notNull()) { //std::ostringstream out; //LLSDXMLFormatter *formatter = new LLSDXMLFormatter; //formatter->format(mPostData, out, LLSDFormatter::OPTIONS_PRETTY); //llinfos << "Post Data: " << out.str() << llendl; U32 everyone_perms = PERM_NONE; U32 group_perms = PERM_NONE; U32 next_owner_perms = PERM_ALL; if(content.has("new_next_owner_mask")) { // This is a new sim that provides creation perms so use them. // Do not assume we got the perms we asked for in mPostData // since the sim may not have granted them all. everyone_perms = content["new_everyone_mask"].asInteger(); group_perms = content["new_group_mask"].asInteger(); next_owner_perms = content["new_next_owner_mask"].asInteger(); } else { // This old sim doesn't provide creation perms so use old assumption-based perms. if(mPostData["inventory_type"].asString() != "snapshot") { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } } LLPermissions new_perms; new_perms.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); new_perms.initMasks(PERM_ALL, PERM_ALL, everyone_perms, group_perms, next_owner_perms); S32 creation_date_now = time_corrected(); LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(content["new_inventory_item"].asUUID(), mPostData["folder_id"].asUUID(), new_perms, content["new_asset"].asUUID(), asset_type, inventory_type, mPostData["name"].asString(), mPostData["description"].asString(), LLSaleInfo::DEFAULT, LLInventoryItem::II_FLAGS_NONE, creation_date_now); gInventory.updateItem(item); gInventory.notifyObservers(); // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. LLInventoryView* view = LLInventoryView::getActiveInventory(); if(view) { LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); view->getPanel()->setSelection(content["new_inventory_item"].asUUID(), TAKE_FOCUS_NO); if((LLAssetType::AT_TEXTURE == asset_type || LLAssetType::AT_SOUND == asset_type) && LLFilePicker::instance().getFileCount() <= FILE_COUNT_DISPLAY_THRESHOLD) { view->getPanel()->openSelected(); } //LLInventoryView::dumpSelectionInformation((void*)view); // restore keyboard focus gFocusMgr.setKeyboardFocus(focus_ctrl); } } else { llwarns << "Can't find a folder to put it in" << llendl; } // remove the "Uploading..." message LLUploadDialog::modalUploadFinished(); // *FIX: This is a pretty big hack. What this does is check the // file picker if there are any more pending uploads. If so, // upload that file. std::string next_file = LLFilePicker::instance().getNextFile(); if(!next_file.empty()) { std::string name = gDirUtilp->getBaseFileName(next_file, true); std::string asset_name = name; LLStringUtil::replaceNonstandardASCII( asset_name, '?' ); LLStringUtil::replaceChar(asset_name, '|', '?'); LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); // Continuing the horrible hack above, we need to extract the originally requested permissions data, if any, // and use them for each next file to be uploaded. Note the requested perms are not the same as the // granted ones found in the given "content" structure but can still be found in mPostData. -MG U32 everyone_perms = mPostData.has("everyone_mask") ? mPostData.get("everyone_mask" ).asInteger() : PERM_NONE; U32 group_perms = mPostData.has("group_mask") ? mPostData.get("group_mask" ).asInteger() : PERM_NONE; U32 next_owner_perms = mPostData.has("next_owner_mask") ? mPostData.get("next_owner_mask").asInteger() : PERM_NONE; std::string display_name = LLStringUtil::null; LLAssetStorage::LLStoreAssetCallback callback = NULL; void *userdata = NULL; upload_new_resource(next_file, asset_name, asset_name, 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, next_owner_perms, group_perms, everyone_perms, display_name, callback, expected_upload_cost, userdata); } }
void temp_upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLResourceData* data = (LLResourceData*)user_data; if(result >= 0) { LLAssetType::EType dest_loc = (data->mPreferredLocation == LLAssetType::AT_NONE) ? data->mAssetInfo.mType : data->mPreferredLocation; LLUUID folder_id(gInventory.findCategoryUUIDForType(dest_loc)); LLUUID item_id; item_id.generate(); LLPermissions perm; perm.init(gAgentID, gAgentID, gAgentID, gAgentID); perm.setMaskBase(PERM_ALL); perm.setMaskOwner(PERM_ALL); perm.setMaskEveryone(PERM_ALL); perm.setMaskGroup(PERM_ALL); LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(item_id, folder_id, perm, data->mAssetInfo.mTransactionID.makeAssetID(gAgent.getSecureSessionID()), data->mAssetInfo.mType, data->mInventoryType, data->mAssetInfo.getName(), "", LLSaleInfo::DEFAULT, LLInventoryItem::II_FLAGS_NONE, time_corrected()); item->updateServer(TRUE); gInventory.updateItem(item); gInventory.notifyObservers(); }else // if(result >= 0) { LLSD args; args["FILE"] = LLInventoryType::lookupHumanReadable(data->mInventoryType); args["REASON"] = std::string(LLAssetStorage::getErrorString(result)); LLNotifications::instance().add("CannotUploadReason", args); } LLUploadDialog::modalUploadFinished(); delete data; }
virtual void uploadComplete(const LLSD& content) { llinfos << "Adding " << content["new_inventory_item"].asUUID() << " " << content["new_asset"].asUUID() << " to inventory." << llendl; //LLPointer<LLInventoryCallback> cb = new LLImportTransferCallback(mData); if(mPostData["folder_id"].asUUID().notNull()) { LLPermissions perm; U32 everyone_perms = PERM_NONE; U32 group_perms = PERM_NONE; U32 next_owner_perms = PERM_ALL; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); if(content.has("new_next_owner_mask")) { // This is a new sim that provides creation perms so use them. // Do not assume we got the perms we asked for in mPostData // since the sim may not have granted them all. everyone_perms = content["new_everyone_mask"].asInteger(); group_perms = content["new_group_mask"].asInteger(); next_owner_perms = content["new_next_owner_mask"].asInteger(); } else { // This old sim doesn't provide creation perms so use old assumption-based perms. if(mPostData["inventory_type"].asString() != "snapshot") { next_owner_perms = PERM_MOVE | PERM_TRANSFER; } } perm.initMasks(PERM_ALL, PERM_ALL, everyone_perms, group_perms, next_owner_perms); S32 creation_date_now = time_corrected(); LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem(content["new_inventory_item"].asUUID(), mPostData["folder_id"].asUUID(), perm, content["new_asset"].asUUID(), mData->type, mData->inv_type, mPostData["name"].asString(), mPostData["description"].asString(), LLSaleInfo::DEFAULT, LLInventoryItemFlags::II_FLAGS_NONE, creation_date_now); gInventory.updateItem(item); gInventory.notifyObservers(); LLXmlImport::sTextureReplace[mData->oldassetid] = content["new_asset"].asUUID(); } LLXmlImport::sUploadedAssets++; if(!LLXmlImport::sImportInProgress) return; LLFloaterImportProgress::update(); if(LLXmlImport::sUploadedAssets < LLXmlImport::sTotalAssets) { LLImportAssetData* data = LLXmlImport::sXmlImportOptions->mAssets[LLXmlImport::sUploadedAssets]; data->folderid = mData->folderid; std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory"); if(!url.empty()) { LLPointer<LLImageJ2C> integrity_test = new LLImageJ2C; if( !integrity_test->loadAndValidate( data->filename ) ) { llinfos << "Image: " << data->filename << " is corrupt." << llendl; } S32 file_size; LLAPRFile infile ; infile.open(data->filename, LL_APR_RB, LLAPRFile::short_lived, &file_size); if (infile.getFileHandle()) { LLVFile file(gVFS, data->assetid, data->type, LLVFile::WRITE); file.setMaxSize(file_size); const S32 buf_size = 65536; U8 copy_buf[buf_size]; while ((file_size = infile.read(copy_buf, buf_size))) { file.write(copy_buf, file_size); } LLSD body; body["folder_id"] = data->folderid; body["asset_type"] = LLAssetType::lookup(data->type); body["inventory_type"] = LLInventoryType::lookup(data->inv_type); body["name"] = data->name; body["description"] = data->description; body["next_owner_mask"] = LLSD::Integer(U32_MAX); body["group_mask"] = LLSD::Integer(U32_MAX); body["everyone_mask"] = LLSD::Integer(U32_MAX); body["expected_upload_cost"] = LLSD::Integer(LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()); LLHTTPClient::post(url, body, new LLImportInventoryResponder(body, data->assetid, data->type,data)); } } else llinfos << "NewFileAgentInventory does not exist!!!!" << llendl; } else LLXmlImport::finish_init(); }