Bug 39562: remove ',,x,y,z' from hostinfo.dat lines; r=Mnyromyr, Pidgeot18
Bug 39562: remove ',,x,y,z' from hostinfo.dat lines; r=Mnyromyr, Pidgeot18
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -64,17 +64,17 @@
#include "nsUnicharUtils.h"
#include "nsISupportsObsolete.h"
#include "nsILineInputStream.h"
#include "nsNetUtil.h"
#include "nsISimpleEnumerator.h"
#include "nsMsgUtils.h"
#define INVALID_VERSION 0
-#define VALID_VERSION 1
+#define VALID_VERSION 2
#define NEW_NEWS_DIR_NAME "News"
#define PREF_MAIL_NEWSRC_ROOT "mail.newsrc_root"
#define PREF_MAIL_NEWSRC_ROOT_REL "mail.newsrc_root-rel"
#define PREF_MAILNEWS_VIEW_DEFAULT_CHARSET "mailnews.view_default_charset"
#define HOSTINFO_FILE_NAME "hostinfo.dat"
#define NEWS_DELIMITER '.'
@@ -806,19 +806,18 @@ writeGroupToHostInfoFile(nsCString &aEle
nsIOutputStream *stream;
stream = (nsIOutputStream *)aData;
NS_ASSERTION(stream, "no stream");
if (!stream) {
// stop, something is bad.
return PR_FALSE;
}
PRUint32 bytesWritten;
- // XXX todo ",,1,0,0" is a temporary hack, fix it
stream->Write(aElement.get(), aElement.Length(), &bytesWritten);
- stream->Write(",,1,0,0"MSG_LINEBREAK, 7 + MSG_LINEBREAK_LEN, &bytesWritten);
+ stream->Write(MSG_LINEBREAK, MSG_LINEBREAK_LEN, &bytesWritten);
return PR_TRUE;
}
void nsNntpIncomingServer::WriteLine(nsIOutputStream *stream, nsCString &str)
{
PRUint32 bytesWritten;
str.Append(MSG_LINEBREAK);
stream->Write(str.get(), str.Length(), &bytesWritten);
@@ -1257,16 +1256,18 @@ nsNntpIncomingServer::HandleLine(const c
NS_ASSERTION(line, "line is null");
if (!line) return 0;
// skip blank lines and comments
if (line[0] == '#' || line[0] == '\0') return 0;
// ###TODO - make this truly const, maybe pass in an nsCString &
if (mHasSeenBeginGroups) {
+ // v1 hostinfo files had additional data fields delimited by commas.
+ // with v2 hostinfo files, the additional data fields are removed.
char *commaPos = (char *) PL_strchr(line,',');
if (commaPos) *commaPos = 0;
// newsrc entries are all in UTF-8
#ifdef DEBUG_jungshik
NS_ASSERTION(MsgIsUTF8(nsDependentCString(line)), "newsrc line is not utf-8");
#endif
nsresult rv = AddTo(nsDependentCString(line), PR_FALSE, PR_TRUE, PR_TRUE);