summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-05-23 19:44:30 +0100
committerAimee Linden <aimee@lindenlab.com>2010-05-23 19:44:30 +0100
commit08e610adfa8124fa7b990f952ad3053b955b62d3 (patch)
treeb8a6b110edc190eadcebfe35de82954d3850fff4 /indra/newview
parent1cb14cd52bdd7b795f081043fb4444e0a196f82b (diff)
EXT-7335 WIP Parse Vivox voice font expiry timestamps into ISO 8601 standard dates.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloatervoiceeffect.cpp10
-rw-r--r--indra/newview/llvoicevivox.cpp40
-rw-r--r--indra/newview/llvoicevivox.h8
3 files changed, 46 insertions, 12 deletions
diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp
index 49dd6fa4d9..38c419ab24 100644
--- a/indra/newview/llfloatervoiceeffect.cpp
+++ b/indra/newview/llfloatervoiceeffect.cpp
@@ -161,7 +161,7 @@ void LLFloaterVoiceEffect::refreshEffectList()
effect_name += " " + getString("active_voice_effect");
}
- std::string expiry_date = effect_properties["expiry_date"].asString();
+ LLDate expiry_date = effect_properties["expiry_date"].asDate();
bool is_template_only = effect_properties["template_only"].asBoolean();
bool is_new = effect_properties["is_new"].asBoolean();
@@ -184,7 +184,13 @@ void LLFloaterVoiceEffect::refreshEffectList()
element["columns"][1]["font"]["style"] = font_style;
element["columns"][2]["column"] = "expires";
- element["columns"][2]["value"] = !is_template_only ? expiry_date : "";
+ if (!is_template_only)
+ {
+ element["columns"][2]["value"] = expiry_date;
+ }
+ else {
+ element["columns"][2]["value"] = "";
+ }
element["columns"][2]["font"]["name"] = "SANSSERIF";
element["columns"][2]["font"]["style"] = font_style;
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index e00b94b421..304321b361 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -6508,7 +6508,7 @@ const voice_effect_list_t& LLVivoxVoiceClient::getVoiceEffectTemplateList() cons
void LLVivoxVoiceClient::addVoiceFont(const S32 font_index,
const std::string &name,
const std::string &description,
- const std::string &expiration_date,
+ const LLDate &expiration_date,
const bool has_expired,
const S32 font_type,
const S32 font_status,
@@ -7112,7 +7112,7 @@ void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
id = 0;
nameString.clear();
descriptionString.clear();
- expirationDateString.clear();
+ expirationDate = LLDate();
hasExpired = false;
fontType = 0;
fontStatus = 0;
@@ -7122,7 +7122,7 @@ void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
id = 0;
nameString.clear();
descriptionString.clear();
- expirationDateString.clear();
+ expirationDate = LLDate();
hasExpired = false;
fontType = 0;
fontStatus = 0;
@@ -7278,11 +7278,11 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
subscriptionType = string;
else if (!stricmp("SessionFont", tag))
{
- LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDateString, hasExpired, fontType, fontStatus, false);
+ LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDate, hasExpired, fontType, fontStatus, false);
}
else if (!stricmp("TemplateFont", tag))
{
- LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDateString, hasExpired, fontType, fontStatus, true);
+ LLVivoxVoiceClient::getInstance()->addVoiceFont(id, nameString, descriptionString, expirationDate, hasExpired, fontType, fontStatus, true);
}
else if (!stricmp("ID", tag))
{
@@ -7294,7 +7294,7 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
}
else if (!stricmp("ExpirationDate", tag))
{
- expirationDateString = string;
+ expirationDate = vivoxTimeStampToLLDate(string);
}
else if (!stricmp("Expired", tag))
{
@@ -7341,6 +7341,34 @@ void LLVivoxProtocolParser::CharData(const char *buffer, int length)
// --------------------------------------------------------------------------------
+LLDate LLVivoxProtocolParser::vivoxTimeStampToLLDate(const std::string& vivox_ts)
+{
+ // First check to see if it actually already is a proper ISO8601 date,
+ // in case the format miraculously changes in future ;)
+ LLDate ts(vivox_ts);
+ if (ts.notNull())
+ {
+ return ts;
+ }
+
+ std::string time_stamp = vivox_ts;
+
+ // Vivox's format is missing a T from being standard ISO 8601,
+ // so add it. It is the only space in their result.
+ LLStringUtil::replaceChar(time_stamp, ' ', 'T');
+
+ //also need to remove the hours away from GMT to be compatible
+ //with LLDate as well as the fractions of seconds
+ time_stamp = time_stamp.substr(0, time_stamp.length() - 5);
+
+ //it also needs a 'Z' at the end
+ time_stamp += "Z";
+
+ return LLDate(time_stamp);
+}
+
+// --------------------------------------------------------------------------------
+
void LLVivoxProtocolParser::processResponse(std::string tag)
{
LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index f67798c207..130fdac146 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -664,7 +664,7 @@ protected:
void addVoiceFont(const S32 id,
const std::string &name,
const std::string &description,
- const std::string &expiration_date,
+ const LLDate &expiration_date,
const bool has_expired,
const S32 font_type,
const S32 font_status,
@@ -893,7 +893,7 @@ private:
LLUUID mID;
S32 mFontIndex;
std::string mName;
- std::string mExpirationDate;
+ LLDate mExpirationDate;
bool mHasExpired;
S32 mFontType;
S32 mFontStatus;
@@ -1016,7 +1016,7 @@ protected:
std::string subscriptionType;
S32 id;
std::string descriptionString;
- std::string expirationDateString;
+ LLDate expirationDate;
bool hasExpired;
S32 fontType;
S32 fontStatus;
@@ -1037,7 +1037,7 @@ protected:
void StartTag(const char *tag, const char **attr);
void EndTag(const char *tag);
void CharData(const char *buffer, int length);
-
+ LLDate vivoxTimeStampToLLDate(const std::string& vivox_ts);
};