Backout part of blake's changes that he didn't mean to check in to fix speedracer bustage. (These changes were part of a different patch.)

This commit is contained in:
dbaron%fas.harvard.edu 2000-11-16 01:08:24 +00:00
Родитель e77209ef6b
Коммит cffc0f8f5d
1 изменённых файлов: 42 добавлений и 26 удалений

Просмотреть файл

@ -858,7 +858,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
*/
m_currentGroup.Assign(group);
if (m_currentGroup.FindChar(PRUnichar('*')) != kNotFound) {
if (PL_strchr ((const char *)m_currentGroup, '*')) {
m_typeWanted = LIST_WANTED;
}
else {
@ -878,11 +878,11 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
PRBool containsGroup = PR_TRUE;
NS_ASSERTION(m_nntpServer,"no nntp server");
if (m_nntpServer) {
rv = m_nntpServer->ContainsNewsgroup(m_currentGroup,&containsGroup);
rv = m_nntpServer->ContainsNewsgroup((const char *)m_currentGroup,&containsGroup);
if (NS_FAILED(rv)) return rv;
if (!containsGroup) {
rv = m_nntpServer->SubscribeToNewsgroup(m_currentGroup);
rv = m_nntpServer->SubscribeToNewsgroup((const char *)m_currentGroup);
if (NS_FAILED(rv)) return rv;
}
}
@ -2944,7 +2944,9 @@ PRInt32 nsNNTPProtocol::ReadNewsList(nsIInputStream * inputStream, PRUint32 leng
nsAutoString bytesStr; bytesStr.AppendInt(mBytesReceived);
const PRUnichar *formatStrings[] = { bytesStr.GetUnicode() };
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("bytesReceived"),
NS_NAMED_LITERAL_STRING(literalPropertyTag, "bytesReceived");
const PRUnichar *propertyTag = literalPropertyTag.get();
rv = bundle->FormatStringFromName(propertyTag,
formatStrings, 1,
getter_Copies(statusString));
@ -3395,7 +3397,7 @@ PRInt32 nsNNTPProtocol::ReadNewsgroupBody(nsIInputStream * inputStream, PRUint32
nsresult nsNNTPProtocol::GetNewsStringByID(PRInt32 stringID, PRUnichar **aString)
{
nsresult res;
nsAutoString resultString(NS_LITERAL_STRING("???"));
nsAutoString resultString; resultString.AssignWithConversion("???");
if (!m_stringBundle)
{
char* propertyURL = NEWS_MSGS_URL;
@ -3414,9 +3416,9 @@ nsresult nsNNTPProtocol::GetNewsStringByID(PRInt32 stringID, PRUnichar **aString
if (NS_FAILED(res))
{
resultString.Assign(NS_LITERAL_STRING("[StringID"));
resultString.AssignWithConversion("[StringID");
resultString.AppendInt(stringID, 10);
resultString.Append(NS_LITERAL_STRING("?]"));
resultString.AppendWithConversion("?]");
*aString = resultString.ToNewUnicode();
}
else
@ -3435,7 +3437,7 @@ nsresult nsNNTPProtocol::GetNewsStringByID(PRInt32 stringID, PRUnichar **aString
nsresult nsNNTPProtocol::GetNewsStringByName(const char *aName, PRUnichar **aString)
{
nsresult res;
nsAutoString resultString(NS_LITERAL_STRING("???"));
nsAutoString resultString; resultString.AssignWithConversion("???");
if (!m_stringBundle)
{
char* propertyURL = NEWS_MSGS_URL;
@ -3457,9 +3459,9 @@ nsresult nsNNTPProtocol::GetNewsStringByName(const char *aName, PRUnichar **aStr
if (NS_FAILED(res))
{
resultString.Assign(NS_LITERAL_STRING("[StringName"));
resultString.AssignWithConversion("[StringName");
resultString.AppendWithConversion(aName);
resultString.Append(NS_LITERAL_STRING("?]"));
resultString.AppendWithConversion("?]");
*aString = resultString.ToNewUnicode();
}
else
@ -3673,16 +3675,22 @@ PRInt32 nsNNTPProtocol::DisplayNewsRC()
nsXPIDLString name;
rv = currFolder->GetName(getter_Copies(name));
if (NS_FAILED(rv))
return -1;
if (!name)
return -1;
m_currentGroup.AssignWithConversion(name);
// do I need asciiName?
nsCAutoString asciiName; asciiName.AssignWithConversion(name);
m_currentGroup = (const char *)asciiName;
if(NS_SUCCEEDED(rv) && (m_currentGroup))
{
if(NS_SUCCEEDED(rv) && ((const char *)m_currentGroup))
{
/* send group command to server
*/
char outputBuffer[OUTPUT_BUFFER_SIZE];
PR_snprintf(outputBuffer, OUTPUT_BUFFER_SIZE, "GROUP %.512s" CRLF, m_currentGroup.GetBuffer());
PR_snprintf(outputBuffer, OUTPUT_BUFFER_SIZE, "GROUP %.512s" CRLF, (const char *)m_currentGroup);
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
if (mailnewsurl)
status = SendData(mailnewsurl, outputBuffer);
@ -3708,12 +3716,14 @@ PRInt32 nsNNTPProtocol::DisplayNewsRC()
const PRUnichar *formatStrings[] = { thisGroupStr.GetUnicode(),totalGroupStr.GetUnicode() };
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("checkingForNewNews"),
NS_NAMED_LITERAL_STRING(literalPropertyTag, "checkingForNewNews");
const PRUnichar *propertyTag = literalPropertyTag.get();
rv = bundle->FormatStringFromName(propertyTag,
formatStrings, 2,
getter_Copies(statusString));
NS_ENSURE_SUCCESS(rv, rv);
rv = SetProgressStatus(statusString);
rv = SetProgressStatus((const PRUnichar *)statusString);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -3722,7 +3732,7 @@ PRInt32 nsNNTPProtocol::DisplayNewsRC()
SetFlag(NNTP_PAUSE_FOR_READ);
m_nextState = NNTP_RESPONSE;
m_nextStateAfterResponse = NEWS_DISPLAY_NEWS_RC_RESPONSE;
}
}
else
{
if (m_newsRCListCount)
@ -3803,7 +3813,7 @@ PRInt32 nsNNTPProtocol::DisplayNewsRCResponse()
}
else if (m_responseCode == MK_NNTP_RESPONSE_GROUP_NO_GROUP)
{
m_newsHost->GroupNotFound(m_currentGroup, PR_FALSE);
m_newsHost->GroupNotFound((const char *)m_currentGroup, PR_FALSE);
}
/* it turns out subscribe ui depends on getting this displaysubscribedgroup call,
even if there was an error.
@ -4084,7 +4094,7 @@ PRInt32 nsNNTPProtocol::DoCancel()
if (status < 0) {
nsCAutoString errorText;
errorText.AppendInt(status);
AlertError(MK_TCP_WRITE_ERROR, errorText);
AlertError(MK_TCP_WRITE_ERROR,(const char *)errorText);
failure = PR_TRUE;
goto FAIL;
}
@ -4255,7 +4265,7 @@ PRInt32 nsNNTPProtocol::ListPrettyNames()
PR_snprintf(outputBuffer,
OUTPUT_BUFFER_SIZE,
"LIST PRETTYNAMES %.512s" CRLF,
NS_SUCCEEDED(rv) ? (const char*)group_name : "");
NS_SUCCEEDED(rv) ? (const char *) group_name : "");
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
if (mailnewsurl)
@ -5190,10 +5200,15 @@ NS_IMETHODIMP nsNNTPProtocol::GetContentType(char * *aContentType)
// otherwise do what we did before...
if (m_typeWanted != ARTICLE_WANTED && !m_currentGroup.IsEmpty() &&
// if it is an article url, it has a @ or %40 in it.
m_currentGroup.Find("@") == kNotFound && m_currentGroup.Find("%40") == kNotFound) {
*aContentType = nsCRT::strdup("x-application-newsgroup");
if ((const char *)m_currentGroup && nsCRT::strlen((const char *)m_currentGroup)) {
// if it is an article url, it has a @ or %40 in it.
if (PL_strchr((const char *)m_currentGroup,'@') || PL_strstr((const char *)m_currentGroup,"%40")
|| m_typeWanted == ARTICLE_WANTED) {
*aContentType = nsCRT::strdup("message/rfc822");
}
else {
*aContentType = nsCRT::strdup("x-application-newsgroup");
}
}
else {
*aContentType = nsCRT::strdup("message/rfc822");
@ -5219,8 +5234,9 @@ nsNNTPProtocol::AlertError(PRInt32 errorCode, const char *text)
rv = GetNewsStringByID(errorCode, getter_Copies(newsString));
if (NS_FAILED(rv)) return rv;
nsAutoString alertText(NS_LITERAL_STRING("NEWS ERROR: "));
alertText.Append(newsString);
nsAutoString alertText;
alertText.AssignWithConversion("NEWS ERROR: ");
alertText.Append((const PRUnichar *)newsString);
if (text)
alertText.AppendWithConversion(text);