From d6ea42984553b7adb6f26cf2ed094d32e36814d2 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 25 May 2010 11:40:29 -0700 Subject: DEV-50013 Display names load at startup in local chat/IM history Had to change the chat log file format to include agent_id. Code will load viewer 2.0 logs, but viewer 2.0 will just discard data from 2.1 logs, which seems OK. Reviewed with Leyla. --- indra/newview/lllogchat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lllogchat.h') diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 4290e4bbc0..a67b58e55b 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -106,7 +106,7 @@ public: * * @return false if failed to parse mandatory data - message text */ - static bool parse(std::string& raw, LLSD& im); + static bool parse(const std::string& raw, LLSD& im); protected: LLChatLogParser(); -- cgit v1.2.3 From b34eee98d1cd542777a9fc28b1e1d2e3a0de24e5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 2 Jun 2010 15:21:46 -0700 Subject: DEV-50451 Fix names in local chat history loading, again Switch to new serialization format, change filename so old viewers don't get confused if the user switches back. Reviewed with Richard --- indra/newview/lllogchat.h | 47 ++++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) (limited to 'indra/newview/lllogchat.h') diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index a67b58e55b..674f27407e 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -30,10 +30,11 @@ * $/LicenseInfo$ */ - #ifndef LL_LLLOGCHAT_H #define LL_LLLOGCHAT_H +class LLChat; + class LLLogChat { public: @@ -46,48 +47,21 @@ public: }; static std::string timestamp(bool withdate = false); static std::string makeLogFileName(std::string(filename)); + + // Log a single line item to the appropriate chat file + static void saveHistory(const std::string& filename, const LLChat& chat); + + // Prefer the above version - it saves more metadata about the item static void saveHistory(const std::string& filename, const std::string& from, const LLUUID& from_id, const std::string& line); - /** @deprecated @see loadAllHistory() */ - static void loadHistory(const std::string& filename, - void (*callback)(ELogLineType, const LLSD&, void*), - void* userdata); - static void loadAllHistory(const std::string& file_name, std::list& messages); private: static std::string cleanFileName(std::string filename); }; -/** - * Formatter for the plain text chat log files - */ -class LLChatLogFormatter -{ -public: - LLChatLogFormatter(const LLSD& im) : mIM(im) {} - virtual ~LLChatLogFormatter() {}; - - friend std::ostream& operator<<(std::ostream& str, const LLChatLogFormatter& formatter) - { - formatter.format(formatter.mIM, str); - return str; - } - -protected: - - /** - * Format an instant message to a stream - * Timestamps and sender names are required - * New lines of multilined messages are prepended with a space - */ - void format(const LLSD& im, std::ostream& ostr) const; - - LLSD mIM; -}; - /** * Parser for the plain text chat log files */ @@ -113,4 +87,11 @@ protected: virtual ~LLChatLogParser() {}; }; +// LLSD map lookup constants +extern const std::string IM_TIME; //("time"); +extern const std::string IM_TEXT; //("message"); +extern const std::string IM_FROM; //("from"); +extern const std::string IM_FROM_ID; //("from_id"); +extern const std::string IM_SOURCE_TYPE; //("source_type"); + #endif -- cgit v1.2.3 From cb5d8d1a9295076327f23e5f6d6c91fd0d4580ea Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 22 Oct 2010 17:41:06 -0700 Subject: DN-181 Chat & IM logs saved in unreadable .llsd instead of .txt --- indra/newview/lllogchat.h | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'indra/newview/lllogchat.h') diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 8b1cc3484f..6958d56311 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -41,21 +41,48 @@ public: }; static std::string timestamp(bool withdate = false); static std::string makeLogFileName(std::string(filename)); - - // Log a single line item to the appropriate chat file - static void saveHistory(const std::string& filename, const LLChat& chat); - - // Prefer the above version - it saves more metadata about the item static void saveHistory(const std::string& filename, const std::string& from, const LLUUID& from_id, const std::string& line); + /** @deprecated @see loadAllHistory() */ + static void loadHistory(const std::string& filename, + void (*callback)(ELogLineType, const LLSD&, void*), + void* userdata); + static void loadAllHistory(const std::string& file_name, std::list& messages); private: static std::string cleanFileName(std::string filename); }; +/** + * Formatter for the plain text chat log files + */ +class LLChatLogFormatter +{ +public: + LLChatLogFormatter(const LLSD& im) : mIM(im) {} + virtual ~LLChatLogFormatter() {}; + + friend std::ostream& operator<<(std::ostream& str, const LLChatLogFormatter& formatter) + { + formatter.format(formatter.mIM, str); + return str; + } + +protected: + + /** + * Format an instant message to a stream + * Timestamps and sender names are required + * New lines of multilined messages are prepended with a space + */ + void format(const LLSD& im, std::ostream& ostr) const; + + LLSD mIM; +}; + /** * Parser for the plain text chat log files */ @@ -74,7 +101,7 @@ public: * * @return false if failed to parse mandatory data - message text */ - static bool parse(const std::string& raw, LLSD& im); + static bool parse(std::string& raw, LLSD& im); protected: LLChatLogParser(); @@ -86,6 +113,5 @@ extern const std::string IM_TIME; //("time"); extern const std::string IM_TEXT; //("message"); extern const std::string IM_FROM; //("from"); extern const std::string IM_FROM_ID; //("from_id"); -extern const std::string IM_SOURCE_TYPE; //("source_type"); #endif -- cgit v1.2.3