mirror of
https://github.com/znc/znc.git
synced 2026-05-08 06:14:40 +02:00
Working savebuff saving and loading.
It's even backwards compatible!
This commit is contained in:
+21
-4
@@ -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