зеркало из https://github.com/mozilla/gecko-dev.git
turn DEBUG_sspitzer into DEBUG_NEWS.
use PR_sscanf instead of sscanf. add more debugging printfs
This commit is contained in:
Родитель
734eb261a9
Коммит
dfeb81ab79
|
@ -44,7 +44,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsFileSpec &newsgroupName, PRBool create, nsI
|
|||
nsNewsSummarySpec summarySpec(newsgroupName);
|
||||
nsresult err = NS_OK;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNewsDatabase::Open(%s, %s, %p, %s) -> %s\n",
|
||||
(const char*)newsgroupName, create ? "TRUE":"FALSE",
|
||||
pMessageDB, upgrading ? "TRUE":"FALSE", (const char *)summarySpec);
|
||||
|
@ -65,7 +65,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsFileSpec &newsgroupName, PRBool create, nsI
|
|||
newsDB = new nsNewsDatabase();
|
||||
|
||||
if (!newsDB) {
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("NS_ERROR_OUT_OF_MEMORY\n");
|
||||
#endif
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -76,7 +76,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsFileSpec &newsgroupName, PRBool create, nsI
|
|||
|
||||
err = newsDB->OpenMDB((const char *) summarySpec, create);
|
||||
if (NS_SUCCEEDED(err)) {
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("newsDB->OpenMDB succeeded!\n");
|
||||
#endif
|
||||
*pMessageDB = newsDB;
|
||||
|
@ -85,7 +85,7 @@ NS_IMETHODIMP nsNewsDatabase::Open(nsFileSpec &newsgroupName, PRBool create, nsI
|
|||
}
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("newsDB->OpenMDB failed!\n");
|
||||
#endif
|
||||
*pMessageDB = nsnull;
|
||||
|
@ -289,7 +289,7 @@ nsresult
|
|||
nsNewsDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgDBHdr* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNewsDatabase::CreateMsgHdr()\n");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -61,7 +61,11 @@ static const char LINEBREAK_START = '\012';
|
|||
static const char LINEBREAK_START = '\015';
|
||||
#endif
|
||||
|
||||
#define PROTOCOL_DEBUG
|
||||
#define PROTOCOL_DEBUG
|
||||
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#define DEBUG_NEWS 1
|
||||
#endif
|
||||
|
||||
class nsNNTPHost : public nsINNTPHost {
|
||||
public:
|
||||
|
@ -562,10 +566,6 @@ nsNNTPHost::CleanUp() {
|
|||
void
|
||||
nsNNTPHost::OpenGroupFile(const PRIntn permissions)
|
||||
{
|
||||
#ifdef PROTOCOL_DEBUG
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
PR_ASSERT(permissions);
|
||||
if (!permissions) return;
|
||||
|
@ -652,7 +652,7 @@ msg_GrowBuffer (PRUint32 desired_size, PRUint32 element_size, PRUint32 quantum,
|
|||
PR_ASSERT(0);
|
||||
return -1;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
#endif /* TESTFORWIN16 */
|
||||
|
||||
new_buf = (*buffer
|
||||
? (char *) PR_Realloc (*buffer, (*size + increment)
|
||||
|
@ -727,7 +727,7 @@ msg_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size,
|
|||
void *closure),
|
||||
void *closure)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("msg_LineBuffer()\n");
|
||||
#endif
|
||||
|
||||
|
@ -841,7 +841,7 @@ nsNNTPHost::LoadNewsrcFileAndCreateNewsgroups(nsFileSpec &newsrcFile)
|
|||
break;
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("%d: %s\n", numread, buffer);
|
||||
#endif
|
||||
status = msg_LineBuffer(buffer, numread,
|
||||
|
@ -871,7 +871,7 @@ nsNNTPHost::LoadNewsrcFileAndCreateNewsgroups(nsFileSpec &newsrcFile)
|
|||
nsresult
|
||||
nsNNTPHost::ProcessLine_s(char* line, PRUint32 line_size, void* closure)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNNTPHost::ProcessLine_s()\n");
|
||||
#endif
|
||||
return ((nsNNTPHost*) closure)->ProcessLine(line, line_size);
|
||||
|
@ -1047,7 +1047,7 @@ nsNNTPHost::MapHostToNewsrcFile(char *newshostname, nsFileSpec &fatFile, nsFileS
|
|||
char is_newsgroup[512];
|
||||
PRBool rv;
|
||||
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("MapHostToNewsrcFile(%s,%s,%s,??)\n",newshostname,(const char *)fatFile, newshostname);
|
||||
#endif
|
||||
lookingFor = PR_smprintf("newsrc-%s",newshostname);
|
||||
|
@ -1066,7 +1066,7 @@ nsNNTPHost::MapHostToNewsrcFile(char *newshostname, nsFileSpec &fatFile, nsFileS
|
|||
|
||||
/* we expect the first line to be NEWSRC_MAP_FILE_COOKIE */
|
||||
rv = inputStream.readline(buffer, sizeof(buffer));
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("buffer = %s\n", buffer);
|
||||
#endif
|
||||
if ((!rv) || (PL_strncmp(buffer, NEWSRC_MAP_FILE_COOKIE, PL_strlen(NEWSRC_MAP_FILE_COOKIE)))) {
|
||||
|
@ -1088,7 +1088,7 @@ nsNNTPHost::MapHostToNewsrcFile(char *newshostname, nsFileSpec &fatFile, nsFileS
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("buffer = %s\n", buffer);
|
||||
#endif
|
||||
|
||||
|
@ -1117,21 +1117,21 @@ nsNNTPHost::MapHostToNewsrcFile(char *newshostname, nsFileSpec &fatFile, nsFileS
|
|||
}
|
||||
|
||||
if(!PL_strncmp(is_newsgroup, "TRUE", 4)) {
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("is_newsgroups_file = TRUE\n");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("is_newsgroups_file = FALSE\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("psuedo_name=%s,filename=%s\n", psuedo_name, filename);
|
||||
#endif
|
||||
if (!PL_strncmp(psuedo_name,lookingFor,PL_strlen(lookingFor))) {
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("found a match for %s\n",lookingFor);
|
||||
#endif
|
||||
newsrcFile = filename;
|
||||
|
@ -1185,7 +1185,7 @@ nsNNTPHost::GetNewsrcFile(char *newshostname, nsFileSpec &path, nsFileSpec &news
|
|||
|
||||
nsresult nsNNTPHost::LoadNewsrc(const char *uri /* , nsIMsgFolder* hostinfo*/)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNNTPHost::LoadNewsrc(%s)\n", uri);
|
||||
#endif
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ nsresult nsNNTPHost::LoadNewsrc(const char *uri /* , nsIMsgFolder* hostinfo*/)
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("newsrc file = %s\n",(const char *)newsrcFile);
|
||||
#endif
|
||||
rv = LoadNewsrcFileAndCreateNewsgroups(newsrcFile);
|
||||
|
@ -2007,7 +2007,7 @@ nsNNTPHost::FindGroup(const char* name, nsINNTPNewsgroup* *retval)
|
|||
if (name == nsnull) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("FindGroup(%s)\n",name);
|
||||
#endif
|
||||
|
||||
|
@ -2023,7 +2023,7 @@ nsNNTPHost::FindGroup(const char* name, nsINNTPNewsgroup* *retval)
|
|||
nsINNTPNewsgroup* info = (nsINNTPNewsgroup*) (*m_groups)[i];
|
||||
rv = info->GetName(&groupname);
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("%d = %s\n",i,groupname?groupname:"null");
|
||||
#endif
|
||||
|
||||
|
@ -2048,7 +2048,7 @@ nsNNTPHost::AddGroup(const char *name,
|
|||
nsMsgGroupRecord *inGroupRecord,
|
||||
nsINNTPNewsgroup **retval)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNNTPHost::AddGroup(%s)\n",name);
|
||||
#endif
|
||||
nsINNTPNewsgroup *newsInfo = NULL;
|
||||
|
@ -3137,7 +3137,7 @@ nsNNTPHost::LoadSingleEntry(nsMsgGroupRecord* parent, char* name,
|
|||
OpenGroupFile();
|
||||
if (!m_groupFile) return NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_NEWS
|
||||
if (parent != m_groupTree) {
|
||||
char* pname = parent->GetFullName();
|
||||
if (pname) {
|
||||
|
@ -3146,7 +3146,7 @@ nsNNTPHost::LoadSingleEntry(nsMsgGroupRecord* parent, char* name,
|
|||
pname = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG_NEWS */
|
||||
|
||||
if (min < m_fileStart) min = m_fileStart;
|
||||
if (max < m_fileStart || max > m_fileSize) max = m_fileSize;
|
||||
|
@ -3179,7 +3179,7 @@ nsNNTPHost::LoadSingleEntry(nsMsgGroupRecord* parent, char* name,
|
|||
return result;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif /* UNREADY_CODE */
|
||||
}
|
||||
|
||||
|
||||
|
@ -3504,7 +3504,7 @@ nsNNTPHost::GetNewsgroupList(const char* name, nsINNTPNewsgroupList **retval)
|
|||
if (name == nsnull) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("GetNewsgroupList(%s)\n",name);
|
||||
#endif
|
||||
|
||||
|
@ -3518,7 +3518,7 @@ nsNNTPHost::GetNewsgroupList(const char* name, nsINNTPNewsgroupList **retval)
|
|||
nsINNTPNewsgroupList* list = (nsINNTPNewsgroupList*) (*m_newsgrouplists)[i];
|
||||
rv = list->GetGroupName(&newsgroupname);
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("%d = %s\n",i,newsgroupname?newsgroupname:"null");
|
||||
#endif
|
||||
|
||||
|
@ -3572,7 +3572,7 @@ nsNNTPHost::AddNewNewsgroup(const char *name,
|
|||
nsMsgGroupRecord *groupRecord = NULL;
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNNTPHost::AddNewNewsgroup(%s,...)\n",name);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -254,14 +254,14 @@ nsNNTPNewsgroupList::GetDatabase(const char *uri, nsIMsgDatabase **db)
|
|||
rv = nsComponentManager::CreateInstance(kCNewsDB, nsnull, nsIMsgDatabase::GetIID(), (void **) &newsDBFactory);
|
||||
if (NS_SUCCEEDED(rv) && newsDBFactory) {
|
||||
newsDBOpen = newsDBFactory->Open(path, PR_TRUE, (nsIMsgDatabase **) db, PR_FALSE);
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
if (NS_SUCCEEDED(newsDBOpen)) {
|
||||
printf ("newsDBFactory->Open() succeeded\n");
|
||||
}
|
||||
else {
|
||||
printf ("newsDBFactory->Open() failed\n");
|
||||
}
|
||||
#endif
|
||||
#endif /* DEBUG_NEWS */
|
||||
NS_RELEASE(newsDBFactory);
|
||||
newsDBFactory = nsnull;
|
||||
return rv;
|
||||
|
|
|
@ -67,6 +67,10 @@
|
|||
|
||||
#define DEFAULT_NEWS_CHUNK_SIZE -1
|
||||
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#define DEBUG_NEWS
|
||||
#endif
|
||||
|
||||
/* #define UNREADY_CODE */ /* mscott: generic flag for hiding access to url struct and active entry which are now gone */
|
||||
|
||||
/*#define CACHE_NEWSGRP_PASSWORD*/
|
||||
|
@ -341,7 +345,7 @@ char *MSG_UnEscapeSearchUrl (const char *commandSpecificData)
|
|||
scratchBuf[1] = (char) *commandSpecificData++;
|
||||
scratchBuf[2] = '\0';
|
||||
int accum = 0;
|
||||
sscanf (scratchBuf, "%X", &accum);
|
||||
PR_sscanf(scratchBuf, "%X", &accum);
|
||||
*resultPtr++ = (char) accum;
|
||||
}
|
||||
else
|
||||
|
@ -883,7 +887,7 @@ PRInt32 nsNNTPProtocol::ParseURL(nsIURL * aURL, char ** aHostAndPort, PRBool * b
|
|||
it wasn't specified.
|
||||
*/
|
||||
s = PL_strchr (hostAndPort, ':');
|
||||
if (s && sscanf (s+1, " %u ", &port) == 1 && HG05998)
|
||||
if (s && PR_sscanf(s+1, " %u ", &port) == 1 && HG05998)
|
||||
*s = 0;
|
||||
|
||||
// I think the path part is just the file part of the nsIURL interface...
|
||||
|
@ -1119,7 +1123,9 @@ PRInt32 nsNNTPProtocol::NewsResponse(nsIInputStream * inputStream, PRUint32 leng
|
|||
PRBool pauseForMoreData = PR_FALSE;
|
||||
line = m_lineStreamBuffer->ReadNextLine(inputStream, status, pauseForMoreData);
|
||||
|
||||
NNTP_LOG_READ(line);
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("read: %s\n",line);
|
||||
#endif
|
||||
|
||||
if(pauseForMoreData)
|
||||
{
|
||||
|
@ -1143,6 +1149,9 @@ PRInt32 nsNNTPProtocol::NewsResponse(nsIInputStream * inputStream, PRUint32 leng
|
|||
/* almost correct */
|
||||
if(status > 1)
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("received %d bytes\n", status);
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
ce->bytes_received += status;
|
||||
FE_GraphProgress(ce->window_id, ce->URL_s, ce->bytes_received, status, ce->URL_s->content_length);
|
||||
|
@ -1153,7 +1162,7 @@ PRInt32 nsNNTPProtocol::NewsResponse(nsIInputStream * inputStream, PRUint32 leng
|
|||
|
||||
m_previousResponseCode = m_responseCode;
|
||||
|
||||
sscanf(line, "%d", &m_responseCode);
|
||||
PR_sscanf(line, "%d", &m_responseCode);
|
||||
|
||||
/* authentication required can come at any time
|
||||
*/
|
||||
|
@ -1748,7 +1757,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURL * url)
|
|||
if (slash)
|
||||
{
|
||||
*slash = '\0';
|
||||
(void) sscanf(slash+1, "%d-%d", &m_firstArticle, &m_lastArticle);
|
||||
(void) PR_sscanf(slash+1, "%d-%d", &m_firstArticle, &m_lastArticle);
|
||||
}
|
||||
|
||||
NET_SACopy (&m_currentGroup, group_name);
|
||||
|
@ -2024,15 +2033,16 @@ PRInt32 nsNNTPProtocol::ReadArticle(nsIInputStream * inputStream, PRUint32 lengt
|
|||
|
||||
PRBool pauseForMoreData = PR_FALSE;
|
||||
line = m_lineStreamBuffer->ReadNextLine(inputStream, status, pauseForMoreData);
|
||||
|
||||
if(pauseForMoreData)
|
||||
if(pauseForMoreData)
|
||||
{
|
||||
SetFlag(NNTP_PAUSE_FOR_READ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(status > 1)
|
||||
{
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("received %d bytes\n", status);
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
ce->bytes_received += status;
|
||||
#endif
|
||||
|
@ -2067,7 +2077,7 @@ PRInt32 nsNNTPProtocol::ReadArticle(nsIInputStream * inputStream, PRUint32 lengt
|
|||
nsFileURL fileURL(filePath);
|
||||
char * article_path_url = PL_strdup(fileURL.GetAsString());
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("load this url to display the message: %s\n", article_path_url);
|
||||
#endif
|
||||
|
||||
|
@ -2547,7 +2557,7 @@ PRInt32 nsNNTPProtocol::ProcessNewsgroups(nsIInputStream * inputStream, PRUint32
|
|||
rv = m_newsHost->FindGroup(groupName, &m_newsgroup);
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
m_nextState = NNTP_LIST_XACTIVE;
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("listing xactive for %s\n", groupName);
|
||||
#endif
|
||||
PR_FREEIF(line);
|
||||
|
@ -2577,6 +2587,9 @@ PRInt32 nsNNTPProtocol::ProcessNewsgroups(nsIInputStream * inputStream, PRUint32
|
|||
*/
|
||||
if(status > 1)
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("received %d bytes\n", status);
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
ce->bytes_received += status;
|
||||
FE_GraphProgress(ce->window_id, ce->URL_s, ce->bytes_received, status, ce->URL_s->content_length);
|
||||
|
@ -2691,6 +2704,9 @@ PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 leng
|
|||
*/
|
||||
if(status > 1)
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("received %d bytes\n", status);
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
ce->bytes_received += status;
|
||||
FE_GraphProgress(ce->window_id, ce->URL_s, ce->bytes_received, status, ce->URL_s->content_length);
|
||||
|
@ -2778,7 +2794,7 @@ PRInt32 nsNNTPProtocol::FigureNextChunk()
|
|||
if (NS_SUCCEEDED(rv))
|
||||
rv = m_newsHost->GetNewsgroupList(groupName, &m_newsgroupList);
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("add to known articles: %d - %d\n", m_firstArticle, m_lastArticle);
|
||||
#endif
|
||||
|
||||
|
@ -2833,7 +2849,7 @@ PRInt32 nsNNTPProtocol::FigureNextChunk()
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("Chunk will be (%d-%d)\n", m_firstArticle, m_lastArticle);
|
||||
#endif
|
||||
|
||||
|
@ -2870,7 +2886,7 @@ PRInt32 nsNNTPProtocol::XoverSend()
|
|||
m_firstArticle,
|
||||
m_lastArticle);
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("XOVER %d-%d\n", m_firstArticle, m_lastArticle);
|
||||
#endif
|
||||
|
||||
|
@ -2968,6 +2984,9 @@ PRInt32 nsNNTPProtocol::ReadXover(nsIInputStream * inputStream, PRUint32 length)
|
|||
*/
|
||||
if(status > 1)
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("received %d bytes\n", status);
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
ce->bytes_received += status;
|
||||
FE_GraphProgress(ce->window_id, ce->URL_s, ce->bytes_received, status,
|
||||
|
@ -3117,9 +3136,9 @@ PRInt32 nsNNTPProtocol::PostMessageInFile(const nsFilePath &filePath)
|
|||
{
|
||||
if (filePath && *filePath)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("post this file: %s\n",(const char *)nsFileSpec(filePath));
|
||||
#endif /* DEBUG_sspitzer */
|
||||
#endif /* DEBUG_NEWS */
|
||||
|
||||
nsInputFileStream * fileStream = new nsInputFileStream(nsFileSpec(filePath), PR_RDONLY, 00700);
|
||||
if (fileStream)
|
||||
|
@ -3231,7 +3250,7 @@ PRInt32 nsNNTPProtocol::PostData()
|
|||
/* returns 0 on done and negative on error
|
||||
* positive if it needs to continue.
|
||||
*/
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNNTPProtocol::PostData()\n");
|
||||
#endif
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -3806,7 +3825,7 @@ PRInt32 nsNNTPProtocol::XPATResponse(nsIInputStream * inputStream, PRUint32 leng
|
|||
if (line[0] != '.')
|
||||
{
|
||||
long articleNumber;
|
||||
sscanf(line, "%ld", &articleNumber);
|
||||
PR_sscanf(line, "%ld", &articleNumber);
|
||||
#ifdef UNREADY_CODE
|
||||
MSG_AddNewsXpatHit (ce->window_id, (PRUint32) articleNumber);
|
||||
#endif
|
||||
|
@ -3847,7 +3866,7 @@ PRInt32 nsNNTPProtocol::ListPrettyNames()
|
|||
NS_SUCCEEDED(rv) ? group_name : "");
|
||||
|
||||
status = SendData(outputBuffer);
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf(outputBuffer);
|
||||
#endif
|
||||
m_nextState = NNTP_RESPONSE;
|
||||
|
@ -3898,7 +3917,7 @@ PRInt32 nsNNTPProtocol::ListPrettyNamesResponse(nsIInputStream * inputStream, PR
|
|||
line[i] = 0; /* terminate group name */
|
||||
if (i > 0)
|
||||
m_newsHost->SetPrettyName(line,prettyName);
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("adding pretty name %s\n", prettyName);
|
||||
#endif
|
||||
}
|
||||
|
@ -3953,18 +3972,21 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
|||
PRBool pauseForMoreData = PR_FALSE;
|
||||
line = m_lineStreamBuffer->ReadNextLine(inputStream, status, pauseForMoreData);
|
||||
|
||||
NNTP_LOG_READ(line);
|
||||
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("NNTPLOG: %s\n", line);
|
||||
#endif
|
||||
if(pauseForMoreData)
|
||||
{
|
||||
SetFlag(NNTP_PAUSE_FOR_READ);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* almost correct
|
||||
*/
|
||||
/* almost correct */
|
||||
if(status > 1)
|
||||
{
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("received %d bytes\n", status);
|
||||
#endif
|
||||
#ifdef UNREADY_CODE
|
||||
ce->bytes_received += status;
|
||||
FE_GraphProgress(ce->window_id, ce->URL_s, ce->bytes_received, status, ce->URL_s->content_length);
|
||||
|
@ -3984,7 +4006,7 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
|||
{
|
||||
char flags[32]; /* ought to be big enough */
|
||||
*s = 0;
|
||||
sscanf(s + 1,
|
||||
PR_sscanf(s + 1,
|
||||
"%d %d %31s",
|
||||
&m_firstPossibleArticle,
|
||||
&m_lastPossibleArticle,
|
||||
|
@ -3996,7 +4018,7 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
|||
/* we're either going to list prettynames first, or list
|
||||
all prettynames every time, so we won't care so much
|
||||
if it gets interrupted. */
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("got xactive for %s of %s\n", line, flags);
|
||||
#endif
|
||||
/* This isn't required, because the extra info is
|
||||
|
@ -4026,7 +4048,7 @@ PRInt32 nsNNTPProtocol::ListXActiveResponse(nsIInputStream * inputStream, PRUint
|
|||
/* make sure we're not stuck on the same group */
|
||||
{
|
||||
NS_RELEASE(old_newsgroup);
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("listing xactive for %s\n", groupName);
|
||||
#endif
|
||||
m_nextState = NNTP_LIST_XACTIVE;
|
||||
|
@ -4109,7 +4131,7 @@ PRInt32 nsNNTPProtocol::ListGroupResponse(nsIInputStream * inputStream, PRUint32
|
|||
{
|
||||
long found_id = nsMsgKey_None;
|
||||
nsresult rv;
|
||||
sscanf(line, "%ld", &found_id);
|
||||
PR_sscanf(line, "%ld", &found_id);
|
||||
|
||||
rv = m_articleList->AddArticleKey(found_id);
|
||||
}
|
||||
|
@ -4248,8 +4270,8 @@ PRInt32 nsNNTPProtocol::ProcessNewsState(nsIURL * url, nsIInputStream * inputStr
|
|||
while(!TestFlag(NNTP_PAUSE_FOR_READ))
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
NNTP_LOG_NOTE(("Next state: %s",stateLabels[m_nextState]));
|
||||
#if DEBUG_NEWS
|
||||
printf("Next state: %s",stateLabels[m_nextState]);
|
||||
#endif
|
||||
// examine our current state and call an appropriate handler for that state.....
|
||||
switch(m_nextState)
|
||||
|
|
|
@ -50,7 +50,7 @@ nsGetNewsRoot(const char *hostname, nsFileSpec &result)
|
|||
// use enumeration function to find the first nntp server
|
||||
nsISupports *serverSupports = hosts->ElementAt(0);
|
||||
|
||||
#ifdef DEBUG_sspitzer_
|
||||
#ifdef DEBUG_NEWS
|
||||
if (hosts->Count() <= 0)
|
||||
fprintf(stderr, "Augh, no nntp server named %s?\n", hostname);
|
||||
if (!serverSupports)
|
||||
|
@ -163,7 +163,7 @@ nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult)
|
|||
|
||||
if (NS_FAILED(rv)) {
|
||||
pathResult = nsnull;
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsGetNewsRoot failed!\n");
|
||||
#endif
|
||||
return rv;
|
||||
|
@ -193,7 +193,7 @@ nsNewsURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult)
|
|||
pathResult += newsgroup;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsGetNewsRoot(%s) = %s\n\tnewsgroup = %s\n",
|
||||
(const char *)nsAutoCString(hostname), (const char*)pathResult,
|
||||
(const char *)nsAutoCString(newsgroup));
|
||||
|
|
|
@ -111,7 +111,7 @@ nsresult nsNntpService::DisplayMessage(const char* aMessageURI, nsISupports * aD
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::DisplayMessage(%s,...)\n",aMessageURI);
|
||||
#endif
|
||||
|
||||
|
@ -157,7 +157,7 @@ nsresult nsNntpService::ConvertNewsMessageURI2NewsURI(const char *messageURI, ns
|
|||
hostname.Truncate(hostEnd);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("ConvertNewsMessageURI2NewsURI(%s,??) -> %s %u\n", messageURI, (const char *)nsAutoCString(folder), key);
|
||||
#endif
|
||||
|
||||
|
@ -192,7 +192,7 @@ nsresult nsNntpService::ConvertNewsMessageURI2NewsURI(const char *messageURI, ns
|
|||
nsString messageId;
|
||||
rv = msgHdr->GetMessageId(messageId);
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
PRUint32 bytes;
|
||||
PRUint32 lines;
|
||||
rv = msgHdr->GetMessageSize(&bytes);
|
||||
|
@ -212,7 +212,7 @@ nsresult nsNntpService::ConvertNewsMessageURI2NewsURI(const char *messageURI, ns
|
|||
newsURI += "/";
|
||||
newsURI += messageId;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("newsURI = %s\n", (const char *)nsAutoCString(newsURI));
|
||||
#endif
|
||||
|
||||
|
@ -232,7 +232,7 @@ nsresult nsNntpService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListen
|
|||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
nsresult nsNntpService::PostMessage(nsFilePath &pathToFile, const char *subject, const char *newsgroupName, nsIUrlListener * aUrlListener, nsIURL ** aURL)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::PostMessage(%s,%s,%s,??,??)\n",(const char *)pathToFile,subject,newsgroupName);
|
||||
#endif
|
||||
|
||||
|
@ -285,7 +285,7 @@ nsresult nsNntpService::PostMessage(nsFilePath &pathToFile, const char *subject,
|
|||
}
|
||||
|
||||
// okay now create a transport to run the url in...
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::RunNewsUrl(): hostname = %s port = %d\n", hostname, port);
|
||||
#endif
|
||||
pNetService->CreateSocketTransport(getter_AddRefs(transport), port, hostname);
|
||||
|
@ -309,7 +309,7 @@ nsresult nsNntpService::PostMessage(nsFilePath &pathToFile, const char *subject,
|
|||
identity->GetEmail(&from);
|
||||
identity->GetOrganization(&org);
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("post message as: %s,%s,%s\n",fullname,from,org);
|
||||
#endif
|
||||
|
||||
|
@ -323,7 +323,7 @@ nsresult nsNntpService::PostMessage(nsFilePath &pathToFile, const char *subject,
|
|||
post->SetSubject((char *)subject);
|
||||
post->SetFrom((char *)from);
|
||||
post->SetOrganization((char *)org);
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("set file to post to %s\n",(const char *)pathToFile);
|
||||
#endif
|
||||
rv = post->SetPostMessageFile(pathToFile);
|
||||
|
@ -369,7 +369,7 @@ nsresult
|
|||
nsNntpService::RunNewsUrl(const nsString& urlString, nsISupports * aConsumer,
|
||||
nsIUrlListener *aUrlListener, nsIURL ** aURL)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::RunNewsUrl(%s,...)\n", (const char *)nsAutoCString(urlString));
|
||||
#endif
|
||||
// for now, assume the url is a news url and load it....
|
||||
|
@ -417,7 +417,7 @@ nsNntpService::RunNewsUrl(const nsString& urlString, nsISupports * aConsumer,
|
|||
nntpUrl->GetHost(&hostname);
|
||||
// okay now create a transport to run the url in...
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::RunNewsUrl(): hostname = %s port = %d\n", hostname, port);
|
||||
#endif
|
||||
pNetService->CreateSocketTransport(getter_AddRefs(transport), port, hostname);
|
||||
|
@ -450,7 +450,7 @@ nsresult nsNntpService::GetNewNews(nsIUrlListener * aUrlListener,
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("nsNntpService::GetNewNews(%s)\n", uri);
|
||||
#endif
|
||||
|
||||
|
@ -469,13 +469,13 @@ nsresult nsNntpService::GetNewNews(nsIUrlListener * aUrlListener,
|
|||
// load up required server information
|
||||
server->GetHostName(&nntpHostName);
|
||||
}
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
else {
|
||||
printf("server == nsnull\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
if (nntpHostName) {
|
||||
printf("get news from news://%s\n", nntpHostName);
|
||||
}
|
||||
|
|
|
@ -724,7 +724,7 @@ nsresult nsNntpUrl::ParseURL(const nsString& aSpec, const nsIURL* aURL)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
printf("protocol='%s' host='%s' file='%s'\n", m_protocol, m_host, m_file);
|
||||
#endif
|
||||
delete [] cSpec;
|
||||
|
@ -845,7 +845,7 @@ nsresult nsNntpUrl::GetSpec(const char* *result) const
|
|||
|
||||
nsresult nsNntpUrl::SetSpec(const char *aNewSpec)
|
||||
{
|
||||
#ifdef DEBUG_sspitzer
|
||||
#ifdef DEBUG_NEWS
|
||||
if (aNewSpec) {
|
||||
printf("nsNntpUrl::SetSpec(%s)\n", aNewSpec);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче