void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, LLDate& tab_date) { const U32 seconds_in_day = 24 * 60 * 60; S32 tabs_cnt = mItemContainers.size(); S32 curr_year = 0, curr_month = 0, curr_day = 0; tab_date = LLDate::now(); tab_date.split(&curr_year, &curr_month, &curr_day); tab_date.fromYMDHMS(curr_year, curr_month, curr_day); // Set hour, min, and sec to 0 tab_date.secondsSinceEpoch(tab_date.secondsSinceEpoch() + seconds_in_day); tab_idx = -1; while (tab_idx < tabs_cnt - 1 && item_date < tab_date) { tab_idx++; if (tab_idx <= tabs_cnt - 4) { // All tabs, except last three, are tabs for one day, so just push tab_date back by one day tab_date.secondsSinceEpoch(tab_date.secondsSinceEpoch() - seconds_in_day); } else if (tab_idx == tabs_cnt - 3) // 6 day and older, low boundary is 1 month { tab_date = LLDate::now(); tab_date.split(&curr_year, &curr_month, &curr_day); curr_month--; if (0 == curr_month) { curr_month = 12; curr_year--; } tab_date.fromYMDHMS(curr_year, curr_month, curr_day); } else if (tab_idx == tabs_cnt - 2) // 1 month and older, low boundary is 6 months { tab_date = LLDate::now(); tab_date.split(&curr_year, &curr_month, &curr_day); if (curr_month > 6) { curr_month -= 6; } else { curr_month += 6; curr_year--; } tab_date.fromYMDHMS(curr_year, curr_month, curr_day); } else // 6 months and older { tab_date.secondsSinceEpoch(0); } } }
bool LLDateUtil::dateFromPDTString(LLDate& date, const std::string& str) { S32 month, day, year; S32 matched = sscanf(str.c_str(), "%d/%d/%d", &month, &day, &year); if (matched != 3) return false; date.fromYMDHMS(year, month, day); F64 secs_since_epoch = date.secondsSinceEpoch(); // Correct for the fact that specified date is in Pacific time, == UTC - 8 secs_since_epoch += 8.0 * 60.0 * 60.0; date.secondsSinceEpoch(secs_since_epoch); return true; }
void LLNotification::init(const std::string& template_name, const LLSD& form_elements) { mTemplatep = LLNotifications::instance().getTemplate(template_name); if (!mTemplatep) return; // add default substitutions // TODO: change this to read from the translatable strings file! mSubstitutions["SECOND_LIFE"] = "Second Life"; mSubstitutions["_URL"] = getURL(); mSubstitutions["_NAME"] = template_name; // TODO: something like this so that a missing alert is sensible: //mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions); mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm)); mForm->append(form_elements); // apply substitution to form labels mForm->formatElements(mSubstitutions); LLDate rightnow = LLDate::now(); if (mTemplatep->mExpireSeconds) { mExpiresAt = LLDate(rightnow.secondsSinceEpoch() + mTemplatep->mExpireSeconds); } if (mPriority == NOTIFICATION_PRIORITY_UNSPECIFIED) { mPriority = mTemplatep->mPriority; } }
void LLTeleportHistoryFlatItem::updateTitle() { static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255)); LLTextUtil::textboxSetHighlightedVal( mTitle, LLStyle::Params().color(sFgColor), mRegionName, mHighlight); // <FS:Ansariel> Extended TP history LLTextUtil::textboxSetHighlightedVal( mLocalPosBox, LLStyle::Params().color(sFgColor), llformat("%.0f, %.0f, %.0f", mLocalPos.mV[VX], mLocalPos.mV[VY], mLocalPos.mV[VZ]), mHighlight); LLSD args; args["datetime"] = mDate.secondsSinceEpoch(); std::string date = getString("DateFmt"); LLStringUtil::format(date, args); LLTextUtil::textboxSetHighlightedVal( mTimeTextBox, LLStyle::Params().color(sFgColor), date, mHighlight); // </FS:Ansariel> }
std::string LLTeleportHistoryFlatItem::getTimestamp() { const LLDate &date = mDate; std::string timestamp = ""; LLDate now = LLDate::now(); S32 now_year, now_month, now_day, now_hour, now_min, now_sec; now.split(&now_year, &now_month, &now_day, &now_hour, &now_min, &now_sec); const S32 seconds_in_day = 24 * 60 * 60; S32 seconds_today = now_hour * 60 * 60 + now_min * 60 + now_sec; S32 time_diff = (S32) now.secondsSinceEpoch() - (S32) date.secondsSinceEpoch(); // Only show timestamp for today and yesterday if(time_diff < seconds_today + seconds_in_day) { timestamp = "[" + LLTrans::getString("TimeHour12")+"]:[" + LLTrans::getString("TimeMin")+"] ["+ LLTrans::getString("TimeAMPM")+"]"; LLSD substitution; substitution["datetime"] = (S32) date.secondsSinceEpoch(); LLStringUtil::format(timestamp, substitution); } return timestamp; }
void LLAvatarName::fromLLSD(const LLSD& sd) { mUsername = sd[USERNAME].asString(); mDisplayName = sd[DISPLAY_NAME].asString(); mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); LLDate expires = sd[DISPLAY_NAME_EXPIRES]; mExpires = expires.secondsSinceEpoch(); LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; mNextUpdate = next_update.secondsSinceEpoch(); }
void LLNotification::init(const std::string& template_name, const LLSD& form_elements) { mTemplatep = LLNotificationTemplates::instance().getTemplate(template_name); if (!mTemplatep) return; const LLStringUtil::format_map_t& default_args = LLTrans::getDefaultArgs(); for (LLStringUtil::format_map_t::const_iterator iter = default_args.begin(); iter != default_args.end(); ++iter) { mSubstitutions[iter->first] = iter->second; } mSubstitutions["_URL"] = getURL(); mSubstitutions["_NAME"] = template_name; // TODO: something like this so that a missing alert is sensible: //mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions); mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm)); mForm->append(form_elements); // apply substitution to form labels mForm->formatElements(mSubstitutions); mIgnored = mForm->getIgnored(); LLDate rightnow = LLDate::now(); if (mTemplatep->mExpireSeconds) { mExpiresAt = LLDate(rightnow.secondsSinceEpoch() + mTemplatep->mExpireSeconds); } if (mPriority == NOTIFICATION_PRIORITY_UNSPECIFIED) { mPriority = mTemplatep->mPriority; } }
void LLNotification::init(const std::string& template_name, const LLSD& form_elements) { mTemplatep = LLNotifications::instance().getTemplate(template_name); if (!mTemplatep) return; // add default substitutions mSubstitutions["[SECOND_LIFE]"] = LLNotifications::instance().getGlobalString("SECOND_LIFE"); mSubstitutions["[VIEWER_NAME]"] = LLNotifications::instance().getGlobalString("VIEWER_NAME"); mSubstitutions["[VIEWER_SITE]"] = LLNotifications::instance().getGlobalString("VIEWER_SITE"); mSubstitutions["[GRID_NAME]"] = gHippoGridManager->getConnectedGrid()->getGridName(); mSubstitutions["[GRID_SITE]"] = gHippoGridManager->getConnectedGrid()->getWebSite(); mSubstitutions["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); mSubstitutions["_URL"] = getURL(); mSubstitutions["_NAME"] = template_name; // TODO: something like this so that a missing alert is sensible: //mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions); mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm)); mForm->append(form_elements); // apply substitution to form labels mForm->formatElements(mSubstitutions); LLDate rightnow = LLDate::now(); if (mTemplatep->mExpireSeconds) { mExpiresAt = LLDate(rightnow.secondsSinceEpoch() + mTemplatep->mExpireSeconds); } if (mPriority == NOTIFICATION_PRIORITY_UNSPECIFIED) { mPriority = mTemplatep->mPriority; } }
void ensure_equals(const char* msg, const LLDate& actual, const LLDate& expected) { ensure_equals(msg, actual.secondsSinceEpoch(), expected.secondsSinceEpoch()); }
LLEventTimer::LLEventTimer(const LLDate& time) : mEventTimer() { mPeriod = (F32)(time.secondsSinceEpoch() - LLDate::now().secondsSinceEpoch()); }
void date_test_object_t::test<2>() { #if LL_DATE_PARSER_CHECKS_BOUNDARY LLDate date; std::string expected_string; bool result; result = date.fromString(INVALID_DATE_24HOUR_BOUNDARY); ensure_equals("INVALID_DATE_24HOUR_BOUNDARY should have failed" , result, false); ensure_equals("INVALID_DATE_24HOUR_BOUNDARY date still set to old value on failure!" , date.secondsSinceEpoch(), 0); result = date.fromString(INVALID_DATE_LEAP); ensure_equals("INVALID_DATE_LEAP should have failed" , result, false); result = date.fromString(INVALID_DATE_HOUR); ensure_equals("INVALID_DATE_HOUR should have failed" , result, false); result = date.fromString(INVALID_DATE_MIN); ensure_equals("INVALID_DATE_MIN should have failed" , result, false); result = date.fromString(INVALID_DATE_SEC); ensure_equals("INVALID_DATE_SEC should have failed" , result, false); result = date.fromString(INVALID_DATE_YEAR); ensure_equals("INVALID_DATE_YEAR should have failed" , result, false); result = date.fromString(INVALID_DATE_MONTH); ensure_equals("INVALID_DATE_MONTH should have failed" , result, false); result = date.fromString(INVALID_DATE_DAY); ensure_equals("INVALID_DATE_DAY should have failed" , result, false); #endif }
LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, const std::string& message, const std::string& from_name, const LLUUID& group_id, const LLUUID& group_insignia, const std::string& group_name, const LLDate& time_stamp, const bool& has_inventory, const std::string& inventory_name, const LLSD& inventory_offer) : LLPanel("groupnotify", LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(NULL) { const S32 VPAD = 2; const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = getRect().getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; time_t timestamp = (time_t)time_stamp.secondsSinceEpoch(); if (!timestamp) time(×tamp); std::string time_buf; timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time_buf); if (mHasInventory) { mInventoryOffer = new LLOfferInfo(inventory_offer); } setFocusRoot(TRUE); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; S32 y = TOP; S32 x = HPAD + HPAD; class NoticeText : public LLTextBox { public: NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) : LLTextBox(name, rect, text, font) { setHAlign(LLFontGL::RIGHT); setFontShadow(LLFontGL::DROP_SHADOW_SOFT); setBorderVisible(FALSE); setColor( gColors.getColor("GroupNotifyTextColor") ); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); } }; // Title addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyGroupNotice"),LLFontGL::getFontSansSerifHuge())); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << LLTrans::getString("GroupNotifySentBy") << " " + from_name << LLTrans::getString(",") + " " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::getFontSansSerif())); y -= (LINE_HEIGHT + VPAD); x = HPAD + HPAD; // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), group_insignia.asString()); } else { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor(std::string("box"), LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, LLStringUtil::null, LLFontGL::getFontSansSerif(), FALSE); static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); text->appendStyledText(subject + "\n",false,false,headerstyle); text->appendStyledText(time_buf,false,false,datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); text->setParseHTML(TRUE); text->appendColoredText(std::string("\n\n") + message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); //text->setTabStop(FALSE); // was interfering with copy-and-paste text->setTabsToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),LLTrans::getString("GroupNotifyAttached"),LLFontGL::getFontSansSerif())); LLUIImagePtr item_icon = LLInventoryIcon::getIcon(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::getFontSansSerif()); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+16, y-16), item_icon->getName()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton(LLTrans::getString("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickNext, this), LLFontGL::getFontSansSerif()); btn->setToolTip(LLTrans::getString("next")); btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton(LLTrans::getString("ok"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickOk,this)); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(LLGroupActions::showTab, mGroupID, "notices_tab")); btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices")); addChild(btn, -1); if (mHasInventory) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = LLTrans::getString("GroupNotifyOpenAttachment"); } else { btn_lbl = LLTrans::getString("GroupNotifySaveAttachment"); } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickSaveInventory,this)); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }
void ensure_equals(const std::string& msg, const LLDate& actual, const LLDate& expected) { ensure_equals(msg, actual.secondsSinceEpoch(), expected.secondsSinceEpoch()); }
// // LLGridManager::addGrid - add a grid to the grid list, populating the needed values // if they're not populated yet. // void LLGridManager::addGrid(GridEntry* grid_entry, AddState state) { if(!grid_entry) { llwarns << "addGrid called with NULL grid_entry. Please send a bug report." << llendl; state = FAIL; } if(!grid_entry->grid.has(GRID_VALUE)) { state = FAIL; } else if(grid_entry->grid[GRID_VALUE].asString().empty()) { state = FAIL; } else if(!grid_entry->grid.isMap()) { state = FAIL; } if ((FETCH == state) ||(FETCHTEMP == state) || (SYSTEM == state)) { std::string grid = utf8str_tolower(grid_entry->grid[GRID_VALUE]); // grid should be in the form of a dns address // but also support localhost:9000 or localhost:9000/login if ( !grid.empty() && grid.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_.:/@% ") != std::string::npos) { printf("grid name: %s", grid.c_str()); if (grid_entry) { state = FAIL; delete grid_entry; grid_entry = NULL; } throw LLInvalidGridName(grid); } size_t find_last_slash = grid.find_last_of("/"); if ( (grid.length()-1) == find_last_slash ) { grid.erase(find_last_slash); grid_entry->grid[GRID_VALUE] = grid; } if (FETCHTEMP == state) { grid_entry->grid["FLAG_TEMPORARY"] = "TRUE"; state = FETCH; } } if ((FETCH == state) || (RETRY == state)) { std::string grid = utf8str_tolower(grid_entry->grid[GRID_VALUE]); std::string match = "://"; size_t find_scheme = grid.find(match); if ( std::string::npos != find_scheme) { // We only support http so just remove anything the user might have chosen grid.erase(0,find_scheme+match.length()); grid_entry->grid[GRID_VALUE] = grid; } std::string uri = "http://"+grid; if (std::string::npos != uri.find("lindenlab.com")) { state = SYSTEM; } else { if ( std::string::npos == uri.find(".") || std::string::npos != uri.find("127.0.0.1") || std::string::npos != uri.find("localhost") ) { state = LOCAL; } grid_entry->grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray(); grid_entry->grid[GRID_LOGIN_URI_VALUE].append(uri); size_t find_last_slash = uri.find_last_of("/"); if ( (uri.length()-1) != find_last_slash ) { uri.append("/"); } uri.append("get_grid_info"); LL_DEBUGS("GridManager") << "get_grid_info uri: " << uri << LL_ENDL; time_t last_modified = 0; if(grid_entry->grid.has("LastModified")) { LLDate saved_value = grid_entry->grid["LastModified"]; last_modified = (time_t)saved_value.secondsSinceEpoch(); } LLHTTPClient::getIfModified(uri, new GridInfoRequestResponder(this, grid_entry, state), last_modified); return; } } if(TRYLEGACY == state) { std::string grid = utf8str_tolower(grid_entry->grid[GRID_VALUE]); std::string uri = "https://" + grid + "/cgi-bin/login.cgi"; llwarns << "No gridinfo found. Trying if legacy login page exists: " << uri << llendl; LLHTTPClient::get(uri, new GridInfoRequestResponder(this, grid_entry, state)); return; } if(FAIL != state) { std::string grid = utf8str_tolower(grid_entry->grid[GRID_VALUE]); // populate the other values if they don't exist if (!grid_entry->grid.has(GRID_LABEL_VALUE)) { grid_entry->grid[GRID_LABEL_VALUE] = grid; llwarns << "No \"gridname\" found in grid info, setting to " << grid_entry->grid[GRID_LABEL_VALUE].asString() << llendl; } if (!grid_entry->grid.has(GRID_NICK_VALUE)) { grid_entry->grid[GRID_NICK_VALUE] = grid; llwarns << "No \"gridnick\" found in grid info, setting to " << grid_entry->grid[GRID_NICK_VALUE].asString() << llendl; } } if (SYSTEM == state) { std::string grid = utf8str_tolower(grid_entry->grid[GRID_VALUE]); // if the grid data doesn't include any of the URIs, then // generate them from the grid if (!grid_entry->grid.has(GRID_LOGIN_URI_VALUE)) { grid_entry->grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray(); grid_entry->grid[GRID_LOGIN_URI_VALUE].append(std::string("https://") + grid + "/cgi-bin/login.cgi"); llwarns << "Adding Legacy Login Service at:" << grid_entry->grid[GRID_LOGIN_URI_VALUE].asString() << llendl; } // Populate to the default values if (!grid_entry->grid.has(GRID_LOGIN_PAGE_VALUE)) { grid_entry->grid[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/"; llwarns << "Adding Legacy Login Screen at:" << grid_entry->grid[GRID_LOGIN_PAGE_VALUE].asString() << llendl; } if (!grid_entry->grid.has(GRID_HELPER_URI_VALUE)) { llwarns << "Adding Legacy Economy at:" << grid_entry->grid[GRID_HELPER_URI_VALUE].asString() << llendl; grid_entry->grid[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/"; } } if(FAIL != state) { std::string grid = utf8str_tolower(grid_entry->grid[GRID_VALUE]); if (!grid_entry->grid.has(GRID_LOGIN_IDENTIFIER_TYPES)) { // non system grids and grids that haven't already been configured with values // get both types of credentials. grid_entry->grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray(); grid_entry->grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT); grid_entry->grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_ACCOUNT); } bool is_current = grid_entry->set_current; grid_entry->set_current = false; if(!grid.empty())// { if (!mGridList.has(grid)) //new grid { //finally add the grid \o/ mGridList[grid] = grid_entry->grid; ++mGridEntries; LL_DEBUGS("GridManager") << "Adding new entry: " << grid << LL_ENDL; } else { LLSD existing_grid = mGridList[grid]; if (!existing_grid.has("LastModified")) { //lack of "LastModified" means existing_grid is from fallback list, // assume its anyway older and override with the new entry mGridList[grid] = grid_entry->grid; //number of mGridEntries doesn't change LL_DEBUGS("GridManager") << "Using custom entry: " << grid << LL_ENDL; } else if (grid_entry->grid.has("LastModified")) { // (time_t)saved_value.secondsSinceEpoch(); LLDate testing_newer = grid_entry->grid["LastModified"]; LLDate existing = existing_grid["LastModified"]; LL_DEBUGS("GridManager") << "testing_newer " << testing_newer << " existing " << existing << LL_ENDL; if(testing_newer.secondsSinceEpoch() > existing.secondsSinceEpoch()) { //existing_grid is older, override. mGridList[grid] = grid_entry->grid; //number of mGridEntries doesn't change LL_DEBUGS("GridManager") << "Updating entry: " << grid << LL_ENDL; } } else { LL_DEBUGS("GridManager") << "Same or newer entry already present: " << grid << LL_ENDL; } } if(is_current) { mGrid = grid; LL_DEBUGS("GridManager") << "Selected grid is " << mGrid << LL_ENDL; setGridChoice(mGrid); } } } // This is only of use if we want to fetch infos of entire gridlists at startup /* if(grid_entry && FINISH == state || FAIL == state) { if((FINISH == state && !mCommandLineDone && 0 == mResponderCount) ||(FAIL == state && grid_entry->set_current) ) { LL_DEBUGS("GridManager") << "init CmdLineGrids" << LL_ENDL; initCmdLineGrids(); } } */ if (grid_entry) { if(!grid_entry->mOnDoneCallback.empty()) { grid_entry->mOnDoneCallback(); } delete grid_entry; grid_entry = NULL; } }