From e390e4f2b5a1e8a938e7d66842bc6c29cfd19436 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 13 Apr 2010 11:54:06 -0700 Subject: DEV-47529 Display name expiration time sent from web service --- indra/llmessage/llavatarnamecache.cpp | 82 ++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 40 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index ee57279e1f..1fc6aa4cbd 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -82,7 +82,7 @@ namespace LLAvatarNameCache // Periodically clean out expired entries from the cache LLFrameTimer sEraseExpiredTimer; - void processNameFromService(const LLSD& row, U32 expires); + void processNameFromService(const LLSD& row); void requestNames(); bool isRequestPending(const LLUUID& agent_id); @@ -91,37 +91,41 @@ namespace LLAvatarNameCache } /* Sample response: - - - - agents - - - sl_id - mickbot390.llqabot - display_name - MickBot390 LLQABot - id - 0012809d-7d2d-4c24-9609-af1230a37715 - is_display_name_default - false - seconds_until_display_name_update - - - - sl_id - sardonyx.linden - display_name - Bjork Gudmundsdottir - id - 3941037e-78ab-45f0-b421-bd6e77c1804d - is_display_name_default - true - seconds_until_display_name_update - 46925 - - - + + + + agents + + + seconds_until_display_name_update + + display_name + MickBot390 LLQABot + seconds_until_display_name_expires + + sl_id + mickbot390.llqabot + id + 0012809d-7d2d-4c24-9609-af1230a37715 + is_display_name_default + false + + + seconds_until_display_name_update + + display_name + Bjork Gudmundsdottir + seconds_until_display_name_expires + 3600 + sl_id + sardonyx.linden + id + 3941037e-78ab-45f0-b421-bd6e77c1804d + is_display_name_default + true + + + */ @@ -130,17 +134,12 @@ class LLAvatarNameResponder : public LLHTTPClient::Responder public: /*virtual*/ void result(const LLSD& content) { - // JAMESDEBUG TODO: get expiration from header - const U32 DEFAULT_EXPIRATION = 6 * 60 * 60; // 6 hours - U32 now = (U32)LLFrameTimer::getTotalSeconds(); - U32 expires = now + DEFAULT_EXPIRATION; - LLSD agents = content["agents"]; LLSD::array_const_iterator it = agents.beginArray(); for ( ; it != agents.endArray(); ++it) { const LLSD& entry = *it; - LLAvatarNameCache::processNameFromService(entry, expires); + LLAvatarNameCache::processNameFromService(entry); } } @@ -151,13 +150,16 @@ public: }; // "expires" is seconds-from-epoch -void LLAvatarNameCache::processNameFromService(const LLSD& row, U32 expires) +void LLAvatarNameCache::processNameFromService(const LLSD& row) { LLAvatarName av_name; av_name.mSLID = row["sl_id"].asString(); av_name.mDisplayName = row["display_name"].asString(); //av_name.mIsDisplayNameDefault = row["is_display_name_default"].asBoolean(); - av_name.mExpires = expires; + + U32 now = (U32)LLFrameTimer::getTotalSeconds(); + S32 seconds_until_expires = row["seconds_until_display_name_expires"].asInteger(); + av_name.mExpires = now + seconds_until_expires; // HACK for pretty stars //if (row["last_name"].asString() == "Linden") -- cgit v1.2.3