Fix for bug 76789. Resole redundant symbols in mailnews in preparion of dll merging. R=varada, SR=sspitzer
This commit is contained in:
Родитель
8934f3f48a
Коммит
50ce025076
|
@ -29,7 +29,6 @@
|
|||
#include "nsXPIDLString.h"
|
||||
#include "nsIFolder.h"
|
||||
#include "prmem.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
|
||||
#include "rdf.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
@ -38,7 +37,8 @@
|
|||
#include "nsIRDFResource.h"
|
||||
#include "nsIRDFLiteral.h"
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
#include "nsMsgUtf7Utils.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsSubscribableServer)
|
||||
|
@ -131,52 +131,6 @@ nsSubscribableServer::SetAsSubscribed(const char *path)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// copied code, this needs to be put in msgbaseutil.
|
||||
nsresult
|
||||
CreateUnicodeStringFromUtf7(const char *aSourceString, PRUnichar **aUnicodeStr)
|
||||
{
|
||||
if (!aUnicodeStr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRUnichar *convertedString = NULL;
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager, ccm, kCharsetConverterManagerCID, &res);
|
||||
|
||||
if(NS_SUCCEEDED(res) && (nsnull != ccm))
|
||||
{
|
||||
nsString aCharset; aCharset.AssignWithConversion("x-imap4-modified-utf7");
|
||||
PRUnichar *unichars = nsnull;
|
||||
PRInt32 unicharLength;
|
||||
|
||||
// convert utf7 to unicode
|
||||
nsIUnicodeDecoder* decoder = nsnull;
|
||||
|
||||
res = ccm->GetUnicodeDecoder(&aCharset, &decoder);
|
||||
if(NS_SUCCEEDED(res) && (nsnull != decoder))
|
||||
{
|
||||
PRInt32 srcLen = PL_strlen(aSourceString);
|
||||
res = decoder->GetMaxLength(aSourceString, srcLen, &unicharLength);
|
||||
// temporary buffer to hold unicode string
|
||||
unichars = new PRUnichar[unicharLength + 1];
|
||||
if (unichars == nsnull)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = decoder->Convert(aSourceString, &srcLen, unichars, &unicharLength);
|
||||
unichars[unicharLength] = 0;
|
||||
}
|
||||
NS_IF_RELEASE(decoder);
|
||||
nsString unicodeStr(unichars);
|
||||
convertedString = unicodeStr.ToNewUnicode();
|
||||
delete [] unichars;
|
||||
}
|
||||
}
|
||||
*aUnicodeStr = convertedString;
|
||||
return (convertedString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::AddTo(const char *aName, PRBool addAsSubscribed, PRBool changeIfExists)
|
||||
{
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:mailnews directory
|
||||
#
|
||||
|
||||
nsMsgLineBuffer.h
|
||||
nsMsgGroupRecord.h
|
||||
nsUInt32Array.h
|
||||
nsMsgKeySet.h
|
||||
nsMsgKeyArray.h
|
||||
nsMsgFolder.h
|
||||
nsMsgDBFolder.h
|
||||
nsLocalFolderSummarySpec.h
|
||||
nsMsgIdentity.h
|
||||
nsMsgIncomingServer.h
|
||||
nsNewsSummarySpec.h
|
||||
nsMsgUtils.h
|
||||
nsMsgProtocol.h
|
||||
nsMsgTxn.h
|
||||
nsMsgMailNewsUrl.h
|
||||
nsMsgI18N.h
|
||||
|
|
@ -49,6 +49,7 @@ CPPSRCS = \
|
|||
nsMsgMailNewsUrl.cpp \
|
||||
nsMsgTxn.cpp \
|
||||
nsMsgI18N.cpp \
|
||||
nsMsgUtf7Utils.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
@ -69,6 +70,7 @@ EXPORTS = \
|
|||
nsMsgMailNewsUrl.h \
|
||||
nsMsgTxn.h \
|
||||
nsMsgI18N.h \
|
||||
nsMsgUtf7Utils.h \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
|
|
Двоичные данные
mailnews/base/util/macbuild/msgUtil.mcp
Двоичные данные
mailnews/base/util/macbuild/msgUtil.mcp
Двоичный файл не отображается.
|
@ -45,6 +45,7 @@ EXPORTS= \
|
|||
nsMsgMailNewsUrl.h \
|
||||
nsMsgTxn.h \
|
||||
nsMsgI18N.h \
|
||||
nsMsgUtf7Utils.h \
|
||||
$(NULL)
|
||||
|
||||
################################################################################
|
||||
|
@ -78,6 +79,7 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsMsgMailNewsUrl.obj \
|
||||
.\$(OBJDIR)\nsMsgTxn.obj \
|
||||
.\$(OBJDIR)\nsMsgI18N.obj \
|
||||
.\$(OBJDIR)\nsMsgUtf7Utils.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= \
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgImapCID.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "xp_str.h"
|
||||
|
||||
static NS_DEFINE_CID(kImapUrlCID, NS_IMAPURL_CID);
|
||||
static NS_DEFINE_CID(kCMailboxUrl, NS_MAILBOXURL_CID);
|
||||
|
@ -349,7 +348,7 @@ PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP)
|
|||
|
||||
AGAIN:
|
||||
|
||||
while (s < s_end && XP_IS_SPACE(*s))
|
||||
while (s < s_end && IS_SPACE(*s))
|
||||
s++;
|
||||
|
||||
if (s < (s_end-2) &&
|
||||
|
@ -367,7 +366,7 @@ PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP)
|
|||
const char *s2 = s+3; /* Skip over "Re[" */
|
||||
|
||||
/* Skip forward over digits after the "[". */
|
||||
while (s2 < (s_end-2) && XP_IS_DIGIT(*s2))
|
||||
while (s2 < (s_end-2) && IS_DIGIT(*s2))
|
||||
s2++;
|
||||
|
||||
/* Now ensure that the following thing is "]:"
|
||||
|
@ -390,3 +389,51 @@ PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Very similar to strdup except it free's too
|
||||
*/
|
||||
char * NS_MsgSACopy (char **destination, const char *source)
|
||||
{
|
||||
if(*destination)
|
||||
{
|
||||
PR_Free(*destination);
|
||||
*destination = 0;
|
||||
}
|
||||
if (! source)
|
||||
*destination = nsnull;
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (PL_strlen(source) + 1);
|
||||
if (*destination == nsnull)
|
||||
return(nsnull);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
/* Again like strdup but it concatinates and free's and uses Realloc
|
||||
*/
|
||||
char * NS_MsgSACat (char **destination, const char *source)
|
||||
{
|
||||
if (source && *source)
|
||||
if (*destination)
|
||||
{
|
||||
int length = PL_strlen (*destination);
|
||||
*destination = (char *) PR_Realloc (*destination, length + PL_strlen(source) + 1);
|
||||
if (*destination == nsnull)
|
||||
return(nsnull);
|
||||
|
||||
PL_strcpy (*destination + length, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (PL_strlen(source) + 1);
|
||||
if (*destination == nsnull)
|
||||
return(nsnull);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,5 +54,9 @@ NS_MSG_BASE nsresult NS_MsgCreatePathStringFromFolderURI(const char *folderURI,
|
|||
|
||||
NS_MSG_BASE PRBool NS_MsgStripRE(const char **stringP, PRUint32 *lengthP);
|
||||
|
||||
NS_MSG_BASE char * NS_MsgSACopy(char **destination, const char *source);
|
||||
|
||||
NS_MSG_BASE char * NS_MsgSACat(char **destination, const char *source);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,9 +40,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsMsgPrompts.h"
|
||||
|
||||
/* for StrAllocCat */
|
||||
#include "xp_str.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
|
@ -1133,19 +1131,19 @@ RFC2231ParmFolding(const char *parmName, const char *charset,
|
|||
foldedParm = PL_strdup(parmName);
|
||||
if (needEscape)
|
||||
{
|
||||
StrAllocCat(foldedParm, "*=");
|
||||
NS_MsgSACat(&foldedParm, "*=");
|
||||
if (charsetLen)
|
||||
StrAllocCat(foldedParm, charset);
|
||||
StrAllocCat(foldedParm, "'");
|
||||
NS_MsgSACat(&foldedParm, charset);
|
||||
NS_MsgSACat(&foldedParm, "'");
|
||||
if (languageLen)
|
||||
StrAllocCat(foldedParm, language);
|
||||
StrAllocCat(foldedParm, "'");
|
||||
NS_MsgSACat(&foldedParm, language);
|
||||
NS_MsgSACat(&foldedParm, "'");
|
||||
}
|
||||
else
|
||||
StrAllocCat(foldedParm, "=\"");
|
||||
StrAllocCat(foldedParm, dupParm);
|
||||
NS_MsgSACat(&foldedParm, "=\"");
|
||||
NS_MsgSACat(&foldedParm, dupParm);
|
||||
if (!needEscape)
|
||||
StrAllocCat(foldedParm, "\"");
|
||||
NS_MsgSACat(&foldedParm, "\"");
|
||||
goto done;
|
||||
}
|
||||
else
|
||||
|
@ -1166,32 +1164,32 @@ RFC2231ParmFolding(const char *parmName, const char *charset,
|
|||
}
|
||||
else {
|
||||
if (needEscape)
|
||||
StrAllocCat(foldedParm, "\r\n ");
|
||||
NS_MsgSACat(&foldedParm, "\r\n ");
|
||||
else
|
||||
StrAllocCat(foldedParm, ";\r\n ");
|
||||
StrAllocCat(foldedParm, parmName);
|
||||
NS_MsgSACat(&foldedParm, ";\r\n ");
|
||||
NS_MsgSACat(&foldedParm, parmName);
|
||||
}
|
||||
PR_snprintf(digits, sizeof(digits), "*%d", counter);
|
||||
StrAllocCat(foldedParm, digits);
|
||||
NS_MsgSACat(&foldedParm, digits);
|
||||
curLineLen += PL_strlen(digits);
|
||||
if (needEscape)
|
||||
{
|
||||
StrAllocCat(foldedParm, "*=");
|
||||
NS_MsgSACat(&foldedParm, "*=");
|
||||
if (counter == 0)
|
||||
{
|
||||
if (charsetLen)
|
||||
StrAllocCat(foldedParm, charset);
|
||||
StrAllocCat(foldedParm, "'");
|
||||
NS_MsgSACat(&foldedParm, charset);
|
||||
NS_MsgSACat(&foldedParm, "'");
|
||||
if (languageLen)
|
||||
StrAllocCat(foldedParm, language);
|
||||
StrAllocCat (foldedParm, "'");
|
||||
NS_MsgSACat(&foldedParm, language);
|
||||
NS_MsgSACat(&foldedParm, "'");
|
||||
curLineLen += charsetLen;
|
||||
curLineLen += languageLen;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StrAllocCat(foldedParm, "=\"");
|
||||
NS_MsgSACat(&foldedParm, "=\"");
|
||||
}
|
||||
counter++;
|
||||
curLineLen += parmNameLen;
|
||||
|
@ -1225,9 +1223,9 @@ RFC2231ParmFolding(const char *parmName, const char *charset,
|
|||
{
|
||||
tmp = *end; *end = nsnull;
|
||||
}
|
||||
StrAllocCat(foldedParm, start);
|
||||
NS_MsgSACat(&foldedParm, start);
|
||||
if (!needEscape)
|
||||
StrAllocCat(foldedParm, "\"");
|
||||
NS_MsgSACat(&foldedParm, "\"");
|
||||
|
||||
parmValueLen -= (end-start);
|
||||
if (tmp)
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "prprf.h"
|
||||
#include "plbase64.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#include "nsISSLSocketControl.h"
|
||||
/* sigh, cmtcmn.h, included from nsIPSMSocketInfo.h, includes windows.h, which includes winuser.h,
|
||||
|
@ -71,12 +72,6 @@ static PRLogModuleInfo *SMTPLogModule = nsnull;
|
|||
|
||||
static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
|
||||
extern "C"
|
||||
{
|
||||
char * NET_SACopy (char **destination, const char *source);
|
||||
char * NET_SACat (char **destination, const char *source);
|
||||
}
|
||||
|
||||
/* the output_buffer_size must be larger than the largest possible line
|
||||
* 2000 seems good for news
|
||||
*
|
||||
|
@ -91,12 +86,6 @@ extern "C"
|
|||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// TEMPORARY HARD CODED FUNCTIONS
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (XP_WIN) || defined(XP_OS2)
|
||||
char *XP_AppCodeName = "Mozilla";
|
||||
#else
|
||||
const char *XP_AppCodeName = "Mozilla";
|
||||
#endif
|
||||
#define NET_IS_SPACE(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isspace(x))
|
||||
|
||||
/* based on in NET_ExplainErrorDetails in mkmessag.c */
|
||||
nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, int code, ...)
|
||||
|
@ -143,55 +132,6 @@ nsresult nsExplainErrorDetails(nsISmtpUrl * aSmtpUrl, int code, ...)
|
|||
return rv;
|
||||
}
|
||||
|
||||
char * NET_SACopy (char **destination, const char *source)
|
||||
{
|
||||
if(*destination)
|
||||
{
|
||||
PR_Free(*destination);
|
||||
*destination = 0;
|
||||
}
|
||||
if (! source)
|
||||
{
|
||||
*destination = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (PL_strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
/* Again like strdup but it concatinates and free's and uses Realloc
|
||||
*/
|
||||
char * NET_SACat (char **destination, const char *source)
|
||||
{
|
||||
if (source && *source)
|
||||
{
|
||||
if (*destination)
|
||||
{
|
||||
int length = PL_strlen (*destination);
|
||||
*destination = (char *) PR_Realloc (*destination, length + PL_strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination + length, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (PL_strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
/* RFC 1891 -- extended smtp value encoding scheme
|
||||
|
||||
5. Additional parameters for RCPT and MAIL commands
|
||||
|
@ -1185,7 +1125,7 @@ PRInt32 nsSmtpProtocol::SendDataResponse()
|
|||
{
|
||||
char buffer[512];
|
||||
PR_snprintf(buffer, sizeof(buffer), "Sender: %.256s" CRLF, real_name);
|
||||
NET_SACat(command, buffer);
|
||||
NS_MsgSACat(command, buffer);
|
||||
if(!command)
|
||||
{
|
||||
m_urlErrorState = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsIImapService.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsMsgUtf7Utils.h"
|
||||
#include "nsAutoLock.h"
|
||||
#include "nsIImapMockChannel.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsAutoLock.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsMsgUtf7Utils.h"
|
||||
// for the memory cache...
|
||||
#include "nsICacheEntryDescriptor.h"
|
||||
#include "nsICacheSession.h"
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "nsMsgUtils.h"
|
||||
#include "nsICacheService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsMsgUtf7Utils.h"
|
||||
|
||||
#define PREF_MAIL_ROOT_IMAP "mail.root.imap"
|
||||
|
||||
|
@ -2682,7 +2683,7 @@ char *CreateImapManageMailAccountUrl(const char *imapHost)
|
|||
static const char *formatString = "netscape";
|
||||
|
||||
char *returnString = createStartOfIMAPurl(imapHost, nsCRT::strlen(formatString) + 1);
|
||||
StrAllocCat(returnString, formatString);;
|
||||
NS_MsgSACat(&returnString, formatString);;
|
||||
|
||||
return returnString;
|
||||
}
|
||||
|
|
|
@ -35,11 +35,9 @@
|
|||
#include "nsImapCore.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIImapFlagAndUidState.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
nsresult
|
||||
|
@ -398,181 +396,6 @@ void AllocateImapUidString(PRUint32 *msgUids, PRUint32 msgCount, nsCString &retu
|
|||
}
|
||||
}
|
||||
|
||||
// convert back and forth between imap utf7 and unicode.
|
||||
char*
|
||||
CreateUtf7ConvertedString(const char * aSourceString,
|
||||
PRBool aConvertToUtf7Imap)
|
||||
{
|
||||
nsresult res;
|
||||
char *dstPtr = nsnull;
|
||||
PRInt32 dstLength = 0;
|
||||
char *convertedString = NULL;
|
||||
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager, ccm, kCharsetConverterManagerCID, &res);
|
||||
|
||||
if(NS_SUCCEEDED(res) && (nsnull != ccm))
|
||||
{
|
||||
nsString aCharset; aCharset.AssignWithConversion("x-imap4-modified-utf7");
|
||||
PRUnichar *unichars = nsnull;
|
||||
PRInt32 unicharLength;
|
||||
|
||||
if (!aConvertToUtf7Imap)
|
||||
{
|
||||
// convert utf7 to unicode
|
||||
nsIUnicodeDecoder* decoder = nsnull;
|
||||
|
||||
res = ccm->GetUnicodeDecoder(&aCharset, &decoder);
|
||||
if(NS_SUCCEEDED(res) && (nsnull != decoder))
|
||||
{
|
||||
PRInt32 srcLen = PL_strlen(aSourceString);
|
||||
res = decoder->GetMaxLength(aSourceString, srcLen, &unicharLength);
|
||||
// temporary buffer to hold unicode string
|
||||
unichars = new PRUnichar[unicharLength + 1];
|
||||
if (unichars == nsnull)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = decoder->Convert(aSourceString, &srcLen, unichars, &unicharLength);
|
||||
unichars[unicharLength] = 0;
|
||||
}
|
||||
NS_IF_RELEASE(decoder);
|
||||
// convert the unicode to 8 bit ascii.
|
||||
nsString unicodeStr(unichars);
|
||||
convertedString = (char *) PR_Malloc(unicharLength + 1);
|
||||
if (convertedString)
|
||||
unicodeStr.ToCString(convertedString, unicharLength + 1, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// convert from 8 bit ascii string to modified utf7
|
||||
nsString unicodeStr; unicodeStr.AssignWithConversion(aSourceString);
|
||||
nsIUnicodeEncoder* encoder = nsnull;
|
||||
aCharset.AssignWithConversion("x-imap4-modified-utf7");
|
||||
res = ccm->GetUnicodeEncoder(&aCharset, &encoder);
|
||||
if(NS_SUCCEEDED(res) && (nsnull != encoder))
|
||||
{
|
||||
res = encoder->GetMaxLength(unicodeStr.GetUnicode(), unicodeStr.Length(), &dstLength);
|
||||
// allocale an output buffer
|
||||
dstPtr = (char *) PR_CALLOC(dstLength + 1);
|
||||
unicharLength = unicodeStr.Length();
|
||||
if (dstPtr == nsnull)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = encoder->Convert(unicodeStr.GetUnicode(), &unicharLength, dstPtr, &dstLength);
|
||||
dstPtr[dstLength] = 0;
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(encoder);
|
||||
nsString unicodeStr2; unicodeStr2.AssignWithConversion(dstPtr);
|
||||
convertedString = (char *) PR_Malloc(dstLength + 1);
|
||||
if (convertedString)
|
||||
unicodeStr2.ToCString(convertedString, dstLength + 1, 0);
|
||||
}
|
||||
delete [] unichars;
|
||||
}
|
||||
PR_FREEIF(dstPtr);
|
||||
return convertedString;
|
||||
}
|
||||
|
||||
// convert back and forth between imap utf7 and unicode.
|
||||
char*
|
||||
CreateUtf7ConvertedStringFromUnicode(const PRUnichar * aSourceString)
|
||||
{
|
||||
nsresult res;
|
||||
char *dstPtr = nsnull;
|
||||
PRInt32 dstLength = 0;
|
||||
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager, ccm, kCharsetConverterManagerCID, &res);
|
||||
|
||||
if(NS_SUCCEEDED(res) && (nsnull != ccm))
|
||||
{
|
||||
nsString aCharset; aCharset.AssignWithConversion("x-imap4-modified-utf7");
|
||||
PRInt32 unicharLength;
|
||||
|
||||
// convert from 8 bit ascii string to modified utf7
|
||||
nsString unicodeStr(aSourceString);
|
||||
nsIUnicodeEncoder* encoder = nsnull;
|
||||
aCharset.AssignWithConversion("x-imap4-modified-utf7");
|
||||
res = ccm->GetUnicodeEncoder(&aCharset, &encoder);
|
||||
if(NS_SUCCEEDED(res) && (nsnull != encoder))
|
||||
{
|
||||
res = encoder->GetMaxLength(unicodeStr.GetUnicode(), unicodeStr.Length(), &dstLength);
|
||||
// allocale an output buffer
|
||||
dstPtr = (char *) PR_CALLOC(dstLength + 1);
|
||||
unicharLength = unicodeStr.Length();
|
||||
if (dstPtr == nsnull)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this should be enough of a finish buffer - utf7 isn't changing, and it'll always be '-'
|
||||
char finishBuffer[20];
|
||||
PRInt32 finishSize = sizeof(finishBuffer);
|
||||
|
||||
res = encoder->Convert(unicodeStr.GetUnicode(), &unicharLength, dstPtr, &dstLength);
|
||||
encoder->Finish(finishBuffer, &finishSize);
|
||||
finishBuffer[finishSize] = '\0';
|
||||
dstPtr[dstLength] = 0;
|
||||
strcat(dstPtr, finishBuffer);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(encoder);
|
||||
}
|
||||
return dstPtr;
|
||||
}
|
||||
|
||||
|
||||
nsresult CreateUnicodeStringFromUtf7(const char *aSourceString, PRUnichar **aUnicodeStr)
|
||||
{
|
||||
if (!aUnicodeStr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRUnichar *convertedString = NULL;
|
||||
nsresult res;
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager, ccm, kCharsetConverterManagerCID, &res);
|
||||
|
||||
if(NS_SUCCEEDED(res) && (nsnull != ccm))
|
||||
{
|
||||
nsString aCharset; aCharset.AssignWithConversion("x-imap4-modified-utf7");
|
||||
PRUnichar *unichars = nsnull;
|
||||
PRInt32 unicharLength;
|
||||
|
||||
// convert utf7 to unicode
|
||||
nsIUnicodeDecoder* decoder = nsnull;
|
||||
|
||||
res = ccm->GetUnicodeDecoder(&aCharset, &decoder);
|
||||
if(NS_SUCCEEDED(res) && (nsnull != decoder))
|
||||
{
|
||||
PRInt32 srcLen = PL_strlen(aSourceString);
|
||||
res = decoder->GetMaxLength(aSourceString, srcLen, &unicharLength);
|
||||
// temporary buffer to hold unicode string
|
||||
unichars = new PRUnichar[unicharLength + 1];
|
||||
if (unichars == nsnull)
|
||||
{
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = decoder->Convert(aSourceString, &srcLen, unichars, &unicharLength);
|
||||
unichars[unicharLength] = 0;
|
||||
}
|
||||
NS_IF_RELEASE(decoder);
|
||||
nsString unicodeStr(unichars);
|
||||
convertedString = unicodeStr.ToNewUnicode();
|
||||
delete [] unichars;
|
||||
}
|
||||
}
|
||||
*aUnicodeStr = convertedString;
|
||||
return (convertedString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRBool WeAreOffline()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
|
|
@ -49,15 +49,6 @@ nsCreateImapBaseMessageURI(const char *baseURI, char **baseMessageURI);
|
|||
|
||||
void AllocateImapUidString(PRUint32 *msgUids, PRUint32 msgCount, nsCString &returnString);
|
||||
|
||||
char*
|
||||
CreateUtf7ConvertedString(const char * aSourceString,
|
||||
PRBool aConvertToUtf7Imap);
|
||||
|
||||
nsresult CreateUnicodeStringFromUtf7(const char *aSourceString, PRUnichar **result);
|
||||
|
||||
char *
|
||||
CreateUtf7ConvertedStringFromUnicode(const PRUnichar *aSourceString);
|
||||
|
||||
PRBool WeAreOffline();
|
||||
|
||||
#endif //NS_IMAPUTILS_H
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
#include "xp_str.h"
|
||||
#include "msgCore.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsParseMailbox.h"
|
||||
|
@ -381,7 +380,7 @@ PRInt32 nsMsgMailboxParser::HandleLine(char *line, PRUint32 lineLength)
|
|||
looks like a mail file. */
|
||||
const char *s = line;
|
||||
const char *end = s + lineLength;
|
||||
while (s < end && XP_IS_SPACE(*s))
|
||||
while (s < end && IS_SPACE(*s))
|
||||
s++;
|
||||
if ((end - s) < 20 || !IsEnvelopeLine(s, end - s))
|
||||
{
|
||||
|
@ -613,11 +612,11 @@ nsParseMailMessageState::IsEnvelopeLine(const char *buf, PRInt32 buf_size)
|
|||
date++;
|
||||
|
||||
/* If at the end, it doesn't match. */
|
||||
if (XP_IS_SPACE(*date) || date == end)
|
||||
if (IS_SPACE(*date) || date == end)
|
||||
return PR_FALSE;
|
||||
|
||||
/* Skip over user name. */
|
||||
while (!XP_IS_SPACE(*date) && date < end)
|
||||
while (!IS_SPACE(*date) && date < end)
|
||||
date++;
|
||||
|
||||
/* Skip horizontal whitespace between user name and date. */
|
||||
|
@ -914,11 +913,11 @@ int nsParseMailMessageState::ParseHeaders ()
|
|||
{
|
||||
/* More const short-circuitry... */
|
||||
/* strip leading whitespace */
|
||||
while (XP_IS_SPACE (*header->value))
|
||||
while (IS_SPACE (*header->value))
|
||||
header->value++, header->length--;
|
||||
/* strip trailing whitespace */
|
||||
while (header->length > 0 &&
|
||||
XP_IS_SPACE (header->value [header->length - 1]))
|
||||
IS_SPACE (header->value [header->length - 1]))
|
||||
((char *) header->value) [--header->length] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -934,18 +933,18 @@ int nsParseMailMessageState::ParseEnvelope (const char *line, PRUint32 line_size
|
|||
end = m_envelope.GetBuffer() + line_size;
|
||||
s = m_envelope.GetBuffer() + 5;
|
||||
|
||||
while (s < end && XP_IS_SPACE (*s))
|
||||
while (s < end && IS_SPACE (*s))
|
||||
s++;
|
||||
m_envelope_from.value = s;
|
||||
while (s < end && !XP_IS_SPACE (*s))
|
||||
while (s < end && !IS_SPACE (*s))
|
||||
s++;
|
||||
m_envelope_from.length = s - m_envelope_from.value;
|
||||
|
||||
while (s < end && XP_IS_SPACE (*s))
|
||||
while (s < end && IS_SPACE (*s))
|
||||
s++;
|
||||
m_envelope_date.value = s;
|
||||
m_envelope_date.length = (PRUint16) (line_size - (s - m_envelope.GetBuffer()));
|
||||
while (XP_IS_SPACE (m_envelope_date.value [m_envelope_date.length - 1]))
|
||||
while (IS_SPACE (m_envelope_date.value [m_envelope_date.length - 1]))
|
||||
m_envelope_date.length--;
|
||||
|
||||
/* #### short-circuit const */
|
||||
|
@ -1297,11 +1296,11 @@ int nsParseMailMessageState::FinalizeHeaders()
|
|||
{
|
||||
charset++;
|
||||
/* strip leading whitespace and double-quote */
|
||||
while (*charset && (XP_IS_SPACE (*charset) || '\"' == *charset))
|
||||
while (*charset && (IS_SPACE (*charset) || '\"' == *charset))
|
||||
charset++;
|
||||
/* strip trailing whitespace and double-quote */
|
||||
char *end = charset;
|
||||
while (*end && !XP_IS_SPACE (*end) && '\"' != *end && ';' != *end)
|
||||
while (*end && !IS_SPACE (*end) && '\"' != *end && ';' != *end)
|
||||
end++;
|
||||
if (*charset)
|
||||
{
|
||||
|
|
|
@ -2633,9 +2633,9 @@ nsresult nsPop3Protocol::ProcessProtocolState(nsIURI * url, nsIInputStream * aIn
|
|||
: XP_GetString(XP_NO_ANSWER)),
|
||||
net_pop3_username, host);
|
||||
#if defined(CookiesAndSignons)
|
||||
StrAllocCopy(usernameAndHost, net_pop3_username);
|
||||
StrAllocCat(usernameAndHost, "@");
|
||||
StrAllocCat(usernameAndHost, host);
|
||||
NS_MsgSACopy(&usernameAndHost, net_pop3_username);
|
||||
NS_MsgSACat(&usernameAndHost, "@");
|
||||
NS_MsgSACat(&usernameAndHost, host);
|
||||
PR_FREEIF (host);
|
||||
|
||||
password = SI_PromptPassword
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
// String bundles...
|
||||
#ifndef XP_MAC
|
||||
nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
||||
static nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
||||
#endif
|
||||
|
||||
/* This is the next generation string retrieval call */
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIPref.h"
|
||||
|
@ -50,7 +51,7 @@
|
|||
|
||||
// String bundles...
|
||||
#ifndef XP_MAC
|
||||
nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
||||
static nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
||||
#endif
|
||||
|
||||
static int MimeInlineTextVCard_parse_line (char *, PRInt32, MimeObject *);
|
||||
|
@ -154,7 +155,7 @@ MimeInlineTextVCard_parse_begin (MimeObject *obj)
|
|||
|
||||
clazz = ((MimeInlineTextVCardClass *) obj->clazz);
|
||||
/* initialize vcard string to empty; */
|
||||
vCard_SACopy(&(clazz->vCardString), "");
|
||||
NS_MsgSACopy(&(clazz->vCardString), "");
|
||||
|
||||
obj->options->state->separator_suppressed_p = PR_TRUE;
|
||||
return 0;
|
||||
|
@ -187,7 +188,7 @@ MimeInlineTextVCard_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
|||
if (linestring)
|
||||
{
|
||||
strcpySafe((char *)linestring, line, length + 1);
|
||||
vCard_SACat (&clazz->vCardString, linestring);
|
||||
NS_MsgSACat (&clazz->vCardString, linestring);
|
||||
PR_Free (linestring);
|
||||
}
|
||||
|
||||
|
@ -598,8 +599,8 @@ static int OutputBasicVcard(MimeObject *obj, VObject *v)
|
|||
}
|
||||
else
|
||||
{
|
||||
htmlLine = vCard_SACat (&htmlLine, htmlLine1);
|
||||
htmlLine = vCard_SACat (&htmlLine, htmlLine2);
|
||||
htmlLine = NS_MsgSACat (&htmlLine, htmlLine1);
|
||||
htmlLine = NS_MsgSACat (&htmlLine, htmlLine2);
|
||||
}
|
||||
|
||||
PR_FREEIF (htmlLine1);
|
||||
|
@ -1289,8 +1290,8 @@ static void GetAddressProperties (VObject* o, char ** attribName)
|
|||
|
||||
if (tString)
|
||||
{
|
||||
vCard_SACat (&(*attribName), " ");
|
||||
vCard_SACat (&(*attribName), tString);
|
||||
NS_MsgSACat (&(*attribName), " ");
|
||||
NS_MsgSACat (&(*attribName), tString);
|
||||
PR_FREEIF(tString);
|
||||
}
|
||||
}
|
||||
|
@ -1339,8 +1340,8 @@ static void GetTelephoneProperties (VObject* o, char ** attribName)
|
|||
|
||||
if (tString)
|
||||
{
|
||||
vCard_SACat (&(*attribName), " ");
|
||||
vCard_SACat (&(*attribName), tString);
|
||||
NS_MsgSACat (&(*attribName), " ");
|
||||
NS_MsgSACat (&(*attribName), tString);
|
||||
PR_FREEIF(tString);
|
||||
}
|
||||
}
|
||||
|
@ -1413,8 +1414,8 @@ static void GetEmailProperties (VObject* o, char ** attribName)
|
|||
|
||||
if (tString)
|
||||
{
|
||||
vCard_SACat (&(*attribName), " ");
|
||||
vCard_SACat (&(*attribName), tString);
|
||||
NS_MsgSACat (&(*attribName), " ");
|
||||
NS_MsgSACat (&(*attribName), tString);
|
||||
PR_FREEIF(tString);
|
||||
}
|
||||
}
|
||||
|
@ -1434,7 +1435,7 @@ static int WriteOutEachVCardPhoneProperty (MimeObject *obj, VObject* o)
|
|||
GetTelephoneProperties(o, &attribName);
|
||||
if (!attribName)
|
||||
attribName = VCardGetStringByID(VCARD_LDAP_PHONE_NUMBER);
|
||||
attribName = vCard_SACat(&attribName, ": ");
|
||||
attribName = NS_MsgSACat(&attribName, ": ");
|
||||
value = fakeCString (vObjectUStringZValue(o));
|
||||
if (value)
|
||||
{
|
||||
|
@ -1843,98 +1844,6 @@ static int WriteValue (MimeObject *obj, const char *value)
|
|||
return status;
|
||||
}
|
||||
|
||||
/* Strip CR+LF+<whitespace> runs within (original).
|
||||
Since the string at (original) can only shrink,
|
||||
this conversion is done in place. (original)
|
||||
is returned. */
|
||||
extern "C" char *
|
||||
MIME_StripContinuations(char *original)
|
||||
{
|
||||
char *p1, *p2;
|
||||
|
||||
/* If we were given a null string, return it as is */
|
||||
if (!original) return NULL;
|
||||
|
||||
/* Start source and dest pointers at the beginning */
|
||||
p1 = p2 = original;
|
||||
|
||||
while(*p2)
|
||||
{
|
||||
/* p2 runs ahead at (CR and/or LF) + <space> */
|
||||
if ((p2[0] == nsCRT::CR) || (p2[0] == nsCRT::LF))
|
||||
{
|
||||
/* move past (CR and/or LF) + whitespace following */
|
||||
do
|
||||
{
|
||||
p2++;
|
||||
}
|
||||
while((*p2 == nsCRT::CR) || (*p2 == nsCRT::LF) || IS_SPACE(*p2));
|
||||
|
||||
if (*p2 == '\0') continue; /* drop out of loop at end of string*/
|
||||
}
|
||||
|
||||
/* Copy the next non-linebreaking char */
|
||||
*p1 = *p2;
|
||||
p1++; p2++;
|
||||
}
|
||||
*p1 = '\0';
|
||||
|
||||
return original;
|
||||
}
|
||||
|
||||
/* Very similar to strdup except it free's too
|
||||
*/
|
||||
extern "C" char *
|
||||
vCard_SACopy (char **destination, const char *source)
|
||||
{
|
||||
if(*destination)
|
||||
{
|
||||
PR_Free(*destination);
|
||||
*destination = 0;
|
||||
}
|
||||
if (! source)
|
||||
{
|
||||
*destination = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (nsCRT::strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
/* Again like strdup but it concatinates and free's and uses Realloc
|
||||
*/
|
||||
extern "C" char *
|
||||
vCard_SACat (char **destination, const char *source)
|
||||
{
|
||||
if (source && *source)
|
||||
{
|
||||
if (*destination)
|
||||
{
|
||||
int length = nsCRT::strlen (*destination);
|
||||
*destination = (char *) PR_Realloc (*destination, length + nsCRT::strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination + length, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (nsCRT::strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
//
|
||||
// This is the next generation string retrieval call
|
||||
//
|
||||
|
|
|
@ -45,14 +45,6 @@ struct MimeInlineTextVCard {
|
|||
MimeInlineText text;
|
||||
};
|
||||
|
||||
/* Very similar to strdup except it free's too
|
||||
*/
|
||||
extern "C" char *
|
||||
vCard_SACopy (char **destination, const char *source);
|
||||
|
||||
extern "C" char *
|
||||
vCard_SACat (char **destination, const char *source);
|
||||
|
||||
extern "C" char *
|
||||
VCardGetStringByID(PRInt32 aMsgId);
|
||||
|
||||
|
|
|
@ -83,55 +83,3 @@ EmitThisHeaderForPrefSetting(PRInt32 dispType, const char *header)
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Hopefully, someone will write and XP call like this eventually!
|
||||
//
|
||||
#define TPATH_LEN 1024
|
||||
|
||||
//
|
||||
// Create a file spec for the a unique temp file
|
||||
// on the local machine. Caller must free memory
|
||||
//
|
||||
nsFileSpec *
|
||||
nsMsgCreateTempFileSpec(char *tFileName)
|
||||
{
|
||||
if ((!tFileName) || (!*tFileName))
|
||||
tFileName = "emitter.tmp";
|
||||
|
||||
nsFileSpec *tmpSpec = new nsFileSpec(nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_TemporaryDirectory));
|
||||
if (!tmpSpec)
|
||||
return nsnull;
|
||||
|
||||
*tmpSpec += tFileName;
|
||||
tmpSpec->MakeUnique();
|
||||
|
||||
return tmpSpec;
|
||||
}
|
||||
|
||||
//
|
||||
// Create a file spec for the a unique temp file
|
||||
// on the local machine. Caller must free memory
|
||||
// returned
|
||||
//
|
||||
char *
|
||||
nsMsgCreateTempFileName(char *tFileName)
|
||||
{
|
||||
if ((!tFileName) || (!*tFileName))
|
||||
tFileName = "nsmail.tmp";
|
||||
|
||||
nsFileSpec *tmpSpec = new nsFileSpec(nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_TemporaryDirectory));
|
||||
|
||||
// Age old question, where to store temp files....ugh!
|
||||
if (!tmpSpec)
|
||||
return "mozmail.tmp"; // No need to I18N
|
||||
|
||||
*tmpSpec += tFileName;
|
||||
tmpSpec->MakeUnique();
|
||||
|
||||
char *tString = (char *)nsCRT::strdup(tmpSpec->GetNativePathCString());
|
||||
delete tmpSpec;
|
||||
if (!tString)
|
||||
return nsCRT::strdup("mozmail.tmp"); // No need to I18N
|
||||
else
|
||||
return tString;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,5 @@
|
|||
|
||||
extern "C" PRBool EmitThisHeaderForPrefSetting(PRInt32 dispType, const char *header);
|
||||
|
||||
//
|
||||
// Create a file spec or file name using the name passed
|
||||
// in as a template
|
||||
//
|
||||
nsFileSpec *nsMsgCreateTempFileSpec(char *tFileName);
|
||||
char *nsMsgCreateTempFileName(char *tFileName);
|
||||
|
||||
#endif // _nsEmitterUtils_h_
|
||||
|
||||
|
|
|
@ -262,56 +262,3 @@ mime_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Very similar to strdup except it free's too
|
||||
*/
|
||||
extern "C" char *
|
||||
mime_SACopy (char **destination, const char *source)
|
||||
{
|
||||
if(*destination)
|
||||
{
|
||||
PR_Free(*destination);
|
||||
*destination = 0;
|
||||
}
|
||||
if (! source)
|
||||
{
|
||||
*destination = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (nsCRT::strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
/* Again like strdup but it concatinates and free's and uses Realloc
|
||||
*/
|
||||
extern "C" char *
|
||||
mime_SACat (char **destination, const char *source)
|
||||
{
|
||||
if (source && *source)
|
||||
{
|
||||
if (*destination)
|
||||
{
|
||||
int length = nsCRT::strlen (*destination);
|
||||
*destination = (char *) PR_Realloc (*destination, length + nsCRT::strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination + length, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (nsCRT::strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
|
|
@ -29,14 +29,6 @@
|
|||
#ifndef _MIMEBUF_H_
|
||||
#define _MIMEBUF_H_
|
||||
|
||||
/* Very similar to strdup except it free's too
|
||||
*/
|
||||
extern "C" char *
|
||||
mime_SACopy (char **destination, const char *source);
|
||||
|
||||
extern "C" char *
|
||||
mime_SACat (char **destination, const char *source);
|
||||
|
||||
extern "C" int mime_GrowBuffer (PRUint32 desired_size,
|
||||
PRUint32 element_size, PRUint32 quantum,
|
||||
char **buffer, PRInt32 *size);
|
||||
|
|
|
@ -464,7 +464,7 @@ mime_draft_process_attachments(mime_draft_data *mdd)
|
|||
if (tmpFile->type)
|
||||
{
|
||||
if (nsCRT::strcasecmp ( tmpFile->type, "text/x-vcard") == 0)
|
||||
mime_SACopy (&(tmp->real_name), tmpFile->description);
|
||||
NS_MsgSACopy (&(tmp->real_name), tmpFile->description);
|
||||
}
|
||||
|
||||
if ( tmpFile->orig_url )
|
||||
|
@ -485,33 +485,33 @@ mime_draft_process_attachments(mime_draft_data *mdd)
|
|||
|
||||
NS_ADDREF(tmp->url);
|
||||
if (!tmp->real_name)
|
||||
mime_SACopy ( &(tmp->real_name), tmpSpec );
|
||||
NS_MsgSACopy ( &(tmp->real_name), tmpSpec );
|
||||
}
|
||||
|
||||
if ( tmpFile->type )
|
||||
{
|
||||
mime_SACopy ( &(tmp->desired_type), tmpFile->type );
|
||||
mime_SACopy ( &(tmp->real_type), tmpFile->type );
|
||||
NS_MsgSACopy ( &(tmp->desired_type), tmpFile->type );
|
||||
NS_MsgSACopy ( &(tmp->real_type), tmpFile->type );
|
||||
}
|
||||
|
||||
if ( tmpFile->encoding )
|
||||
{
|
||||
mime_SACopy ( &(tmp->real_encoding), tmpFile->encoding );
|
||||
NS_MsgSACopy ( &(tmp->real_encoding), tmpFile->encoding );
|
||||
}
|
||||
|
||||
if ( tmpFile->description )
|
||||
{
|
||||
mime_SACopy ( &(tmp->description), tmpFile->description );
|
||||
NS_MsgSACopy ( &(tmp->description), tmpFile->description );
|
||||
}
|
||||
|
||||
if ( tmpFile->x_mac_type )
|
||||
{
|
||||
mime_SACopy ( &(tmp->x_mac_type), tmpFile->x_mac_type );
|
||||
NS_MsgSACopy ( &(tmp->x_mac_type), tmpFile->x_mac_type );
|
||||
}
|
||||
|
||||
if ( tmpFile->x_mac_creator )
|
||||
{
|
||||
mime_SACopy ( &(tmp->x_mac_creator), tmpFile->x_mac_creator );
|
||||
NS_MsgSACopy ( &(tmp->x_mac_creator), tmpFile->x_mac_creator );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,34 +588,34 @@ mime_intl_insert_message_header_1(char **body,
|
|||
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACat(body, HEADER_START_JUNK);
|
||||
NS_MsgSACat(body, HEADER_START_JUNK);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACat(body, MSG_LINEBREAK);
|
||||
NS_MsgSACat(body, MSG_LINEBREAK);
|
||||
}
|
||||
if (!html_hdr_str)
|
||||
html_hdr_str = hdr_str;
|
||||
mime_SACat(body, html_hdr_str);
|
||||
NS_MsgSACat(body, html_hdr_str);
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACat(body, HEADER_MIDDLE_JUNK);
|
||||
NS_MsgSACat(body, HEADER_MIDDLE_JUNK);
|
||||
}
|
||||
else
|
||||
mime_SACat(body, ": ");
|
||||
NS_MsgSACat(body, ": ");
|
||||
|
||||
// MIME decode header
|
||||
char* utf8 = MIME_DecodeMimeHeader(*hdr_value, mailcharset, PR_FALSE,
|
||||
PR_TRUE);
|
||||
if (NULL != utf8) {
|
||||
mime_SACat(body, utf8);
|
||||
NS_MsgSACat(body, utf8);
|
||||
PR_Free(utf8);
|
||||
} else {
|
||||
mime_SACat(body, *hdr_value); // raw MIME encoded string
|
||||
NS_MsgSACat(body, *hdr_value); // raw MIME encoded string
|
||||
}
|
||||
|
||||
if (htmlEdit)
|
||||
mime_SACat(body, HEADER_END_JUNK);
|
||||
NS_MsgSACat(body, HEADER_END_JUNK);
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -654,20 +654,20 @@ mime_insert_all_headers(char **body,
|
|||
if (html_tag)
|
||||
{
|
||||
*html_tag = 0;
|
||||
mime_SACopy(&(newBody), *body);
|
||||
NS_MsgSACopy(&(newBody), *body);
|
||||
*html_tag = '<';
|
||||
mime_SACat(&newBody, "<HTML> <BR><BR>");
|
||||
NS_MsgSACat(&newBody, "<HTML> <BR><BR>");
|
||||
}
|
||||
else
|
||||
mime_SACopy(&(newBody), "<HTML> <BR><BR>");
|
||||
NS_MsgSACopy(&(newBody), "<HTML> <BR><BR>");
|
||||
|
||||
mime_SACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
mime_SACat(&newBody, MIME_HEADER_TABLE);
|
||||
NS_MsgSACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
NS_MsgSACat(&newBody, MIME_HEADER_TABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACopy(&(newBody), MSG_LINEBREAK MSG_LINEBREAK);
|
||||
mime_SACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
NS_MsgSACopy(&(newBody), MSG_LINEBREAK MSG_LINEBREAK);
|
||||
NS_MsgSACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
}
|
||||
|
||||
for (i = 0; i < headers->heads_size; i++)
|
||||
|
@ -742,17 +742,17 @@ mime_insert_all_headers(char **body,
|
|||
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACat(&newBody, "</TABLE>");
|
||||
mime_SACat(&newBody, MSG_LINEBREAK "<BR><BR>");
|
||||
NS_MsgSACat(&newBody, "</TABLE>");
|
||||
NS_MsgSACat(&newBody, MSG_LINEBREAK "<BR><BR>");
|
||||
if (html_tag)
|
||||
mime_SACat(&newBody, html_tag+6);
|
||||
NS_MsgSACat(&newBody, html_tag+6);
|
||||
else
|
||||
mime_SACat(&newBody, *body);
|
||||
NS_MsgSACat(&newBody, *body);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACat(&newBody, MSG_LINEBREAK MSG_LINEBREAK);
|
||||
mime_SACat(&newBody, *body);
|
||||
NS_MsgSACat(&newBody, MSG_LINEBREAK MSG_LINEBREAK);
|
||||
NS_MsgSACat(&newBody, *body);
|
||||
}
|
||||
|
||||
if (newBody)
|
||||
|
@ -801,14 +801,14 @@ mime_insert_normal_headers(char **body,
|
|||
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACopy(&(newBody), "<HTML> <BR><BR>");
|
||||
mime_SACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
mime_SACat(&newBody, MIME_HEADER_TABLE);
|
||||
NS_MsgSACopy(&(newBody), "<HTML> <BR><BR>");
|
||||
NS_MsgSACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
NS_MsgSACat(&newBody, MIME_HEADER_TABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACopy(&(newBody), MSG_LINEBREAK MSG_LINEBREAK);
|
||||
mime_SACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
NS_MsgSACopy(&(newBody), MSG_LINEBREAK MSG_LINEBREAK);
|
||||
NS_MsgSACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
}
|
||||
if (subject)
|
||||
mime_intl_insert_message_header_1(&newBody, &subject, HEADER_SUBJECT,
|
||||
|
@ -911,17 +911,17 @@ mime_insert_normal_headers(char **body,
|
|||
}
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACat(&newBody, "</TABLE>");
|
||||
mime_SACat(&newBody, MSG_LINEBREAK "<BR><BR>");
|
||||
NS_MsgSACat(&newBody, "</TABLE>");
|
||||
NS_MsgSACat(&newBody, MSG_LINEBREAK "<BR><BR>");
|
||||
if (html_tag)
|
||||
mime_SACat(&newBody, html_tag+6);
|
||||
NS_MsgSACat(&newBody, html_tag+6);
|
||||
else
|
||||
mime_SACat(&newBody, *body);
|
||||
NS_MsgSACat(&newBody, *body);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACat(&newBody, MSG_LINEBREAK MSG_LINEBREAK);
|
||||
mime_SACat(&newBody, *body);
|
||||
NS_MsgSACat(&newBody, MSG_LINEBREAK MSG_LINEBREAK);
|
||||
NS_MsgSACat(&newBody, *body);
|
||||
}
|
||||
if (newBody)
|
||||
{
|
||||
|
@ -974,14 +974,14 @@ mime_insert_micro_headers(char **body,
|
|||
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACopy(&(newBody), "<HTML> <BR><BR>");
|
||||
mime_SACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
mime_SACat(&newBody, MIME_HEADER_TABLE);
|
||||
NS_MsgSACopy(&(newBody), "<HTML> <BR><BR>");
|
||||
NS_MsgSACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
NS_MsgSACat(&newBody, MIME_HEADER_TABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACopy(&(newBody), MSG_LINEBREAK MSG_LINEBREAK);
|
||||
mime_SACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
NS_MsgSACopy(&(newBody), MSG_LINEBREAK MSG_LINEBREAK);
|
||||
NS_MsgSACat(&newBody, MimeGetNamedString(MIME_FORWARDED_MESSAGE_HTML_USER_WROTE));
|
||||
}
|
||||
|
||||
if (from)
|
||||
|
@ -1034,17 +1034,17 @@ mime_insert_micro_headers(char **body,
|
|||
mailcharset, htmlEdit);
|
||||
if (htmlEdit)
|
||||
{
|
||||
mime_SACat(&newBody, "</TABLE>");
|
||||
mime_SACat(&newBody, MSG_LINEBREAK "<BR><BR>");
|
||||
NS_MsgSACat(&newBody, "</TABLE>");
|
||||
NS_MsgSACat(&newBody, MSG_LINEBREAK "<BR><BR>");
|
||||
if (html_tag)
|
||||
mime_SACat(&newBody, html_tag+6);
|
||||
NS_MsgSACat(&newBody, html_tag+6);
|
||||
else
|
||||
mime_SACat(&newBody, *body);
|
||||
NS_MsgSACat(&newBody, *body);
|
||||
}
|
||||
else
|
||||
{
|
||||
mime_SACat(&newBody, MSG_LINEBREAK MSG_LINEBREAK);
|
||||
mime_SACat(&newBody, *body);
|
||||
NS_MsgSACat(&newBody, MSG_LINEBREAK MSG_LINEBREAK);
|
||||
NS_MsgSACat(&newBody, *body);
|
||||
}
|
||||
if (newBody)
|
||||
{
|
||||
|
@ -1590,7 +1590,7 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
|
|||
if (mdd->curAttachment) {
|
||||
char *ct = MimeHeaders_get(headers, HEADER_CONTENT_TYPE, PR_TRUE, PR_FALSE);
|
||||
if (ct)
|
||||
mime_SACopy(&(mdd->curAttachment->type), ct);
|
||||
NS_MsgSACopy(&(mdd->curAttachment->type), ct);
|
||||
PR_FREEIF(ct);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1687,7 +1687,7 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
|
|||
if (boundary)
|
||||
tmp_value = PR_smprintf("; boundary=\"%s\"", boundary);
|
||||
if (tmp_value)
|
||||
mime_SACat(&(newAttachment->type), tmp_value);
|
||||
NS_MsgSACat(&(newAttachment->type), tmp_value);
|
||||
newAttachment->x_mac_type = MimeHeaders_get_parameter(parm_value, "x-mac-type", NULL, NULL);
|
||||
newAttachment->x_mac_creator = MimeHeaders_get_parameter(parm_value, "x-mac-creator", NULL, NULL);
|
||||
PR_FREEIF(parm_value);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "xp_str.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "msgCore.h"
|
||||
#include "mimei.h"
|
||||
|
@ -614,7 +613,7 @@ MimeHeaders_get_parameter (const char *header_value, const char *parm_name,
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (XP_IS_DIGIT(*cp))
|
||||
else if (IS_DIGIT(*cp))
|
||||
{
|
||||
PRInt32 len = 0;
|
||||
char *ns = NULL;
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsMimeStringResources.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#define IMAP_EXTERNAL_CONTENT_HEADER "X-Mozilla-IMAP-Part"
|
||||
|
||||
|
@ -582,7 +583,7 @@ mime_create (const char *content_type, MimeHeaders *hdrs,
|
|||
to make it appear inline. One example is a vcard which has a content
|
||||
disposition of an "attachment;" */
|
||||
if (force_inline_display(content_type))
|
||||
mime_SACopy(&content_disposition, "inline");
|
||||
NS_MsgSACopy(&content_disposition, "inline");
|
||||
else
|
||||
content_disposition = (hdrs
|
||||
? MimeHeaders_get(hdrs, HEADER_CONTENT_DISPOSITION, PR_TRUE, PR_FALSE)
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#include "mimeebod.h"
|
||||
|
||||
|
@ -84,7 +85,7 @@ static PRBool MIME_WrapLongLines;
|
|||
static PRBool MIME_VariableWidthPlaintext;
|
||||
|
||||
// For string bundle access routines...
|
||||
nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
||||
static nsCOMPtr<nsIStringBundle> stringBundle = nsnull;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Attachment handling routines
|
||||
|
@ -227,7 +228,7 @@ ValidateRealName(nsMsgAttachmentData *aAttach, MimeHeaders *aHdrs)
|
|||
aAttach->real_name = PR_smprintf("%s.eml", aHdrs->munged_subject);
|
||||
}
|
||||
else
|
||||
mime_SACopy(&(aAttach->real_name), "ForwardedMessage.eml");
|
||||
NS_MsgSACopy(&(aAttach->real_name), "ForwardedMessage.eml");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
#include "nsFileStream.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "mimebuf.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
//
|
||||
// External Defines...
|
||||
|
@ -386,7 +387,7 @@ MakeAbsoluteURL(char *base_url, char *relative_url)
|
|||
if (!relative_url)
|
||||
return nsnull;
|
||||
|
||||
mime_SACopy(&retString, relative_url);
|
||||
NS_MsgSACopy(&retString, relative_url);
|
||||
return retString;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "nsMsgKeySet.h"
|
||||
|
||||
#include "nsNewsUtils.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
|
@ -148,14 +149,6 @@ protected:
|
|||
PRUint32 mLength;
|
||||
};
|
||||
|
||||
// todo: get rid of this
|
||||
extern "C"
|
||||
{
|
||||
char * NET_SACopy (char **destination, const char *source);
|
||||
char * NET_SACat (char **destination, const char *source);
|
||||
|
||||
}
|
||||
|
||||
static NS_DEFINE_CID(kIStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
|
||||
static NS_DEFINE_CID(kCHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
static NS_DEFINE_CID(kNNTPArticleListCID, NS_NNTPARTICLELIST_CID);
|
||||
|
@ -309,61 +302,12 @@ char *stateLabels[] = {
|
|||
// TEMPORARY HARD CODED FUNCTIONS
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef XP_WIN
|
||||
char *XP_AppCodeName = "Mozilla";
|
||||
static char *XP_AppCodeName = "Mozilla";
|
||||
#else
|
||||
const char *XP_AppCodeName = "Mozilla";
|
||||
static const char *XP_AppCodeName = "Mozilla";
|
||||
#endif
|
||||
#define NET_IS_SPACE(x) ((x)==' ' || (x)=='\t')
|
||||
|
||||
char * NET_SACopy (char **destination, const char *source)
|
||||
{
|
||||
if(*destination)
|
||||
{
|
||||
PR_Free(*destination);
|
||||
*destination = 0;
|
||||
}
|
||||
if (! source)
|
||||
{
|
||||
*destination = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (PL_strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
/* Again like strdup but it concatinates and free's and uses Realloc
|
||||
*/
|
||||
char * NET_SACat (char **destination, const char *source)
|
||||
{
|
||||
if (source && *source)
|
||||
{
|
||||
if (*destination)
|
||||
{
|
||||
int length = PL_strlen (*destination);
|
||||
*destination = (char *) PR_Realloc (*destination, length + PL_strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination + length, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
*destination = (char *) PR_Malloc (PL_strlen(source) + 1);
|
||||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
PL_strcpy (*destination, source);
|
||||
}
|
||||
}
|
||||
return *destination;
|
||||
}
|
||||
|
||||
char *MSG_UnEscapeSearchUrl (const char *commandSpecificData)
|
||||
{
|
||||
char *result = (char*) PR_Malloc (PL_strlen(commandSpecificData) + 1);
|
||||
|
@ -999,7 +943,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
cancel = PR_TRUE;
|
||||
}
|
||||
|
||||
NET_SACopy(&m_path, m_messageID);
|
||||
NS_MsgSACopy(&m_path, m_messageID);
|
||||
|
||||
/* We are posting a user-written message
|
||||
if and only if this message has a message to post
|
||||
|
@ -1009,7 +953,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
if (NS_SUCCEEDED(rv) && message)
|
||||
{
|
||||
m_typeWanted = NEWS_POST;
|
||||
NET_SACopy(&m_path, "");
|
||||
NS_MsgSACopy(&m_path, "");
|
||||
}
|
||||
else
|
||||
if (m_messageID || (m_key != nsMsgKey_None))
|
||||
|
@ -1504,7 +1448,7 @@ PRInt32 nsNNTPProtocol::NewsResponse(nsIInputStream * inputStream, PRUint32 leng
|
|||
#endif
|
||||
}
|
||||
|
||||
NET_SACopy(&m_responseText, line+4);
|
||||
NS_MsgSACopy(&m_responseText, line+4);
|
||||
|
||||
m_previousResponseCode = m_responseCode;
|
||||
|
||||
|
@ -1933,7 +1877,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
|
||||
if(m_typeWanted == NEWS_POST)
|
||||
{ /* posting to the news group */
|
||||
NET_SACopy(&command, "POST");
|
||||
NS_MsgSACopy(&command, "POST");
|
||||
}
|
||||
else if(m_typeWanted == READ_NEWS_RC)
|
||||
{
|
||||
|
@ -1980,7 +1924,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
PR_FormatTimeUSEnglish(small_buf, sizeof(small_buf),
|
||||
"NEWGROUPS %y%m%d %H%M%S", &expandedTime);
|
||||
|
||||
NET_SACopy(&command, small_buf);
|
||||
NS_MsgSACopy(&command, small_buf);
|
||||
|
||||
}
|
||||
else if(m_typeWanted == LIST_WANTED)
|
||||
|
@ -2017,12 +1961,12 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
rv = m_nntpServer->QueryExtension("XACTIVE",&xactive);
|
||||
if (NS_SUCCEEDED(rv) && xactive)
|
||||
{
|
||||
NET_SACopy(&command, "LIST XACTIVE");
|
||||
NS_MsgSACopy(&command, "LIST XACTIVE");
|
||||
SetFlag(NNTP_USE_FANCY_NEWSGROUP);
|
||||
}
|
||||
else
|
||||
{
|
||||
NET_SACopy(&command, "LIST");
|
||||
NS_MsgSACopy(&command, "LIST");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2041,8 +1985,8 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
m_firstArticle = 0;
|
||||
m_lastArticle = 0;
|
||||
|
||||
NET_SACopy(&command, "GROUP ");
|
||||
NET_SACat(&command, (const char *)group_name);
|
||||
NS_MsgSACopy(&command, "GROUP ");
|
||||
NS_MsgSACat(&command, (const char *)group_name);
|
||||
}
|
||||
else if (m_typeWanted == SEARCH_WANTED)
|
||||
{
|
||||
|
@ -2062,7 +2006,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
char *allocatedCommand = MSG_UnEscapeSearchUrl (slash + 1);
|
||||
if (allocatedCommand)
|
||||
{
|
||||
NET_SACopy (&command, allocatedCommand);
|
||||
NS_MsgSACopy (&command, allocatedCommand);
|
||||
PR_Free(allocatedCommand);
|
||||
}
|
||||
}
|
||||
|
@ -2082,8 +2026,8 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
rv = m_newsFolder->GetAsciiName(getter_Copies(group_name));
|
||||
if (NS_FAILED(rv)) return -1;
|
||||
|
||||
NET_SACopy(&command, "GROUP ");
|
||||
NET_SACat (&command, group_name);
|
||||
NS_MsgSACopy(&command, "GROUP ");
|
||||
NS_MsgSACat (&command, group_name);
|
||||
|
||||
// force a GROUP next time
|
||||
m_currentGroup = "";
|
||||
|
@ -2115,7 +2059,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
char *allocatedCommand = MSG_UnEscapeSearchUrl (slash + 1);
|
||||
if (allocatedCommand)
|
||||
{
|
||||
NET_SACopy(&command, allocatedCommand);
|
||||
NS_MsgSACopy(&command, allocatedCommand);
|
||||
PR_Free(allocatedCommand);
|
||||
}
|
||||
}
|
||||
|
@ -2138,23 +2082,23 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
|
|||
if (!m_path) return -1;
|
||||
|
||||
if (m_typeWanted == CANCEL_WANTED) {
|
||||
NET_SACopy(&command, "HEAD ");
|
||||
NS_MsgSACopy(&command, "HEAD ");
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(m_typeWanted == ARTICLE_WANTED, "not cancel, and not article");
|
||||
NET_SACopy(&command, "ARTICLE ");
|
||||
NS_MsgSACopy(&command, "ARTICLE ");
|
||||
}
|
||||
|
||||
if (*m_path != '<')
|
||||
NET_SACat(&command,"<");
|
||||
NS_MsgSACat(&command,"<");
|
||||
|
||||
NET_SACat(&command, m_path);
|
||||
NS_MsgSACat(&command, m_path);
|
||||
|
||||
if (PL_strchr(command+8, '>')==0)
|
||||
NET_SACat(&command,">");
|
||||
NS_MsgSACat(&command,">");
|
||||
}
|
||||
|
||||
NET_SACat(&command, CRLF);
|
||||
NS_MsgSACat(&command, CRLF);
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
|
||||
if (mailnewsurl)
|
||||
status = SendData(mailnewsurl, command);
|
||||
|
@ -2755,16 +2699,16 @@ PRInt32 nsNNTPProtocol::BeginAuthorization()
|
|||
return(MK_NNTP_AUTH_FAILED);
|
||||
}
|
||||
|
||||
NET_SACopy(&command, "AUTHINFO user ");
|
||||
NS_MsgSACopy(&command, "AUTHINFO user ");
|
||||
if (cachedUsername) {
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the username",(const char *)cachedUsername));
|
||||
NET_SACat(&command, (const char *)cachedUsername);
|
||||
NS_MsgSACat(&command, (const char *)cachedUsername);
|
||||
}
|
||||
else {
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the username",(const char *)username));
|
||||
NET_SACat(&command, (const char *)username);
|
||||
NS_MsgSACat(&command, (const char *)username);
|
||||
}
|
||||
NET_SACat(&command, CRLF);
|
||||
NS_MsgSACat(&command, CRLF);
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
|
||||
if (mailnewsurl)
|
||||
|
@ -2864,16 +2808,16 @@ PRInt32 nsNNTPProtocol::AuthorizationResponse()
|
|||
return(MK_NNTP_AUTH_FAILED);
|
||||
}
|
||||
|
||||
NET_SACopy(&command, "AUTHINFO pass ");
|
||||
NS_MsgSACopy(&command, "AUTHINFO pass ");
|
||||
if (cachedPassword) {
|
||||
PR_LOG(NNTP,PR_LOG_ALWAYS,("use cached password"));
|
||||
NET_SACat(&command, (const char *)cachedPassword);
|
||||
NS_MsgSACat(&command, (const char *)cachedPassword);
|
||||
}
|
||||
else {
|
||||
// *don't log the password!* PR_LOG(NNTP,PR_LOG_ALWAYS,("use %s as the password",(const char *)password));
|
||||
NET_SACat(&command, (const char *)password);
|
||||
NS_MsgSACat(&command, (const char *)password);
|
||||
}
|
||||
NET_SACat(&command, CRLF);
|
||||
NS_MsgSACat(&command, CRLF);
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
|
||||
if (mailnewsurl)
|
||||
|
@ -4424,11 +4368,11 @@ PRInt32 nsNNTPProtocol::XPATSend()
|
|||
char *command = NULL;
|
||||
char *unescapedCommand = NULL;
|
||||
char *endOfTerm = NULL;
|
||||
NET_SACopy (&command, ++thisTerm);
|
||||
NS_MsgSACopy (&command, ++thisTerm);
|
||||
endOfTerm = PL_strchr(command, '/');
|
||||
if (endOfTerm)
|
||||
*endOfTerm = '\0';
|
||||
NET_SACat(&command, CRLF);
|
||||
NS_MsgSACat(&command, CRLF);
|
||||
|
||||
unescapedCommand = MSG_UnEscapeSearchUrl(command);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче