diff --git a/include/znc/Chan.h b/include/znc/Chan.h index d4127eeb..0a0c1079 100644 --- a/include/znc/Chan.h +++ b/include/znc/Chan.h @@ -91,7 +91,7 @@ public: const CBuffer& GetBuffer() const { return m_Buffer; } unsigned int GetBufferCount() const { return m_Buffer.GetLineCount(); } bool SetBufferCount(unsigned int u, bool bForce = false) { return m_Buffer.SetLineCount(u, bForce); }; - int AddBuffer(const CString& sFormat, const CString& sText = "") { return m_Buffer.AddLine(sFormat, sText); } + int AddBuffer(const CString& sFormat, const CString& sText = "", time_t tm = 0) { return m_Buffer.AddLine(sFormat, sText, tm); } void ClearBuffer() { m_Buffer.Clear(); } void SendBuffer(CClient* pClient); // !Buffer diff --git a/modules/savebuff.cpp b/modules/savebuff.cpp index 106501b4..cd0bfa15 100644 --- a/modules/savebuff.cpp +++ b/modules/savebuff.cpp @@ -116,8 +116,23 @@ public: for (it = vsLines.begin(); it != vsLines.end(); ++it) { CString sLine(*it); sLine.Trim(); - // FIXME: Deserialize other CBufLine attributes. - pChan->AddBuffer(sLine); + if (sLine[0] == '@' && it+1 != vsLines.end()) + { + CString sTimestamp = sLine.Token(0); + sTimestamp.TrimLeft("@"); + time_t tm = sTimestamp.ToLongLong(); + + CString sFormat = sLine.Token(1, true); + + CString sText(*++it); + sText.Trim(); + + pChan->AddBuffer(sFormat, sText, tm); + } else + { + // Old format, escape the line and use as is. + pChan->AddBuffer(_NAMEDFMT(sLine)); + } } } else { @@ -152,8 +167,10 @@ public: unsigned int uSize = Buffer.Size(); for (unsigned int uIdx = 0; uIdx < uSize; uIdx++) { const CBufLine& Line = Buffer.GetBufLine(uIdx); - // FIXME: Serialize other CBufLine attributes. - sFile += Line.GetFormat() + "\n"; + sFile += + "@" + CString(Line.GetTime()) + " " + + Line.GetFormat() + "\n" + + Line.GetText() + "\n"; } CBlowfish c(m_sPassword, BF_ENCRYPT);