This commit is contained in:
taka%netscape.com 2000-09-22 02:52:11 +00:00
Родитель 443c49960f
Коммит f3e223d871
2 изменённых файлов: 49 добавлений и 22 удалений

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

@ -217,8 +217,16 @@ nsMsgSearchAdapter::GetImapCharsetParam(const PRUnichar *destCharset)
return result;
}
/*
09/21/2000 - taka@netscape.com
This method is bogus. Escape must be done against char * not PRUnichar *
should be rewritten later.
for now, just duplicate the string.
*/
PRUnichar *nsMsgSearchAdapter::EscapeSearchUrl (const PRUnichar *nntpCommand)
{
return nsCRT::strdup(nntpCommand);
#if 0
PRUnichar *result = nsnull;
// max escaped length is two extra characters for every character in the cmd.
PRUnichar *scratchBuf = (PRUnichar*) PR_Malloc(sizeof(PRUnichar) * (3*nsCRT::strlen(nntpCommand) + 1));
@ -246,11 +254,20 @@ PRUnichar *nsMsgSearchAdapter::EscapeSearchUrl (const PRUnichar *nntpCommand)
nsCRT::free (scratchBuf);
}
return result;
#endif
}
/*
09/21/2000 - taka@netscape.com
This method is bogus. Escape must be done against char * not PRUnichar *
should be rewritten later.
for now, just duplicate the string.
*/
PRUnichar *
nsMsgSearchAdapter::EscapeImapSearchProtocol(const PRUnichar *imapCommand)
{
return nsCRT::strdup(imapCommand);
#if 0
PRUnichar *result = nsnull;
// max escaped length is one extra character for every character in the cmd.
PRUnichar *scratchBuf =
@ -276,11 +293,20 @@ nsMsgSearchAdapter::EscapeImapSearchProtocol(const PRUnichar *imapCommand)
nsCRT::free (scratchBuf);
}
return result;
#endif
}
/*
09/21/2000 - taka@netscape.com
This method is bogus. Escape must be done against char * not PRUnichar *
should be rewritten later.
for now, just duplicate the string.
*/
PRUnichar *
nsMsgSearchAdapter::EscapeQuoteImapSearchProtocol(const PRUnichar *imapCommand)
{
return nsCRT::strdup(imapCommand);
#if 0
PRUnichar *result = nsnull;
// max escaped length is one extra character for every character in the cmd.
PRUnichar *scratchBuf =
@ -306,6 +332,7 @@ nsMsgSearchAdapter::EscapeQuoteImapSearchProtocol(const PRUnichar *imapCommand)
nsCRT::free (scratchBuf);
}
return result;
#endif
}
@ -616,15 +643,11 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real
// do all sorts of crazy escaping
convertedValue = reallyDredd ? EscapeSearchUrl (searchTermValue) :
EscapeImapSearchProtocol(searchTermValue);
useQuotes = !reallyDredd ||
(nsAutoString(convertedValue).FindChar((PRUnichar)' ') != -1);
// now convert to char* and escape quoted_specials
value = TryToConvertCharset(convertedValue, destCharset, reallyDredd);
if (value)
{
if (useQuotes)
{
char *oldValue = value;
// max escaped length is one extra character for every character in the cmd.
@ -637,7 +660,7 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real
char ch = *value++;
if (!ch)
break;
if (ch == '"' || ch == '\\')
if ((useQuotes ? ch == '"' : 0) || ch == '\\')
*p++ = '\\';
*p++ = ch;
}
@ -647,7 +670,6 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real
}
nsCRT::free(oldValue);
}
}
nsCRT::free(convertedValue);
valueWasAllocated = PR_TRUE;

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

@ -772,7 +772,12 @@ NS_IMETHODIMP nsImapService::Search(nsIMsgSearchSession *aSearchSession, nsIMsgW
urlSpec.AppendWithConversion(hierarchySeparator);
urlSpec.Append((const char *) folderName);
urlSpec.Append('>');
urlSpec.Append(aSearchUri);
// escape aSearchUri so that IMAP special characters (i.e. '\')
// won't be replaced with '/' in NECKO.
// it will be unescaped in nsImapUrl::ParseUrl().
char *search_cmd = nsEscape((char *)aSearchUri, url_XAlphas);
urlSpec.Append(search_cmd);
nsCRT::free(search_cmd);
rv = mailNewsUrl->SetSpec((char *) urlSpec.GetBuffer());
if (NS_SUCCEEDED(rv))
{