154000 r=cavin sr=bienvenu fixing imap drag and drop of folders using non-ascii names.

This commit is contained in:
naving%netscape.com 2002-06-27 21:15:56 +00:00
Родитель 425b50233a
Коммит f77e24acb6
2 изменённых файлов: 12 добавлений и 13 удалений

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

@ -321,7 +321,7 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolderWithPath(nsAutoString *name, nsIFile
uri.Append(PRUnichar('/'));
uri.Append(*name);
char* uriStr = nsCRT::strdup(NS_ConvertUCS2toUTF8(uri.get()).get());
char* uriStr = ToNewCString(uri);
if (uriStr == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -6901,7 +6901,11 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg
nsXPIDLString folderName;
rv = msgFolder->GetName(getter_Copies(folderName));
if (folderName.IsEmpty() || NS_FAILED(rv)) return rv;
nsAutoString unicodeLeafName(folderName.get());
nsXPIDLCString utf7LeafName;
utf7LeafName.Adopt(CreateUtf7ConvertedStringFromUnicode(folderName.get()));
nsAutoString unicodeLeafName;
unicodeLeafName.AssignWithConversion(utf7LeafName.get());
rv = AddSubfolderWithPath(&unicodeLeafName, dbFileSpec, getter_AddRefs(child));
@ -6913,9 +6917,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg
GetOnlineName(getter_Copies(onlineName));
nsCAutoString onlineCName(onlineName);
onlineCName.Append(char(hierarchyDelimiter));
char *utf7LeafName = CreateUtf7ConvertedStringFromUnicode(unicodeLeafName.get());
onlineCName.Append(utf7LeafName);
PR_Free(utf7LeafName);
onlineCName.Append(utf7LeafName.get());
if (imapFolder)
{
imapFolder->SetVerifiedAsOnlineFolder(verified);

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

@ -5473,7 +5473,7 @@ PRBool nsImapProtocol::RenameHierarchyByHand(const char *oldParentMailboxName,
renameSucceeded = // rename this, and move subscriptions
RenameMailboxRespectingSubscriptions(oldParentMailboxName,
newParentMailboxName, PR_TRUE);
PRInt32 numberToDelete = m_deletableChildren->Count();
PRInt32 childIndex;
@ -5482,18 +5482,15 @@ PRBool nsImapProtocol::RenameHierarchyByHand(const char *oldParentMailboxName,
{
// the imap parser has already converted to a non UTF7 string in the canonical
// format so convert it back
char *currentName = (char *) m_deletableChildren->ElementAt(childIndex);
char *currentName = (char *) m_deletableChildren->ElementAt(childIndex);
if (currentName)
{
char *serverName = nsnull;
m_runningUrl->AllocateServerPath(currentName,
onlineDirSeparator,
&serverName);
char *convertedName = serverName ?
CreateUtf7ConvertedString(serverName, PR_TRUE) : (char *)NULL;
PR_FREEIF(serverName);
onlineDirSeparator,
&serverName);
PR_FREEIF(currentName);
currentName = convertedName;
currentName = serverName;
}
// calculate the new name and do the rename