mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Working savebuff saving and loading.
It's even backwards compatible!
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user