зеркало из https://github.com/mozilla/gecko-dev.git
more fixes to the 4.x uri -> 5.0 uri (copies and folders) code, for windows and mac.
#14951. r=mscott
This commit is contained in:
Родитель
fff994fd79
Коммит
6bef9f859a
|
@ -1478,6 +1478,8 @@ nsMsgAccountManager::Convert4XUri(const char *old_uri, const char *default_folde
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *folderPath;
|
||||||
|
|
||||||
// mail_directory_value is already in UNIX style at this point...
|
// mail_directory_value is already in UNIX style at this point...
|
||||||
if (PL_strncasecmp(MAILBOX_SCHEMA,old_uri,MAILBOX_SCHEMA_LENGTH) == 0) {
|
if (PL_strncasecmp(MAILBOX_SCHEMA,old_uri,MAILBOX_SCHEMA_LENGTH) == 0) {
|
||||||
#ifdef DEBUG_ACCOUNTMANAGER
|
#ifdef DEBUG_ACCOUNTMANAGER
|
||||||
|
@ -1485,13 +1487,28 @@ nsMsgAccountManager::Convert4XUri(const char *old_uri, const char *default_folde
|
||||||
#endif
|
#endif
|
||||||
// the extra -1 is because in 4.x, we had this:
|
// the extra -1 is because in 4.x, we had this:
|
||||||
// mailbox:<PATH> instead of mailbox:/<PATH>
|
// mailbox:<PATH> instead of mailbox:/<PATH>
|
||||||
*new_uri = PR_smprintf("%s/%s/%s",MAILBOX_SCHEMA,usernameAtHostname,old_uri + MAILBOX_SCHEMA_LENGTH + PL_strlen(mail_directory_value) -1);
|
folderPath = old_uri + MAILBOX_SCHEMA_LENGTH + PL_strlen(mail_directory_value) -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef DEBUG_ACCOUNTMANAGER
|
#ifdef DEBUG_ACCOUNTMANAGER
|
||||||
printf("turn %s into %s/%s/(%s - %s)\n",old_uri,MAILBOX_SCHEMA,usernameAtHostname,old_uri,mail_directory_value);
|
printf("turn %s into %s/%s/(%s - %s)\n",old_uri,MAILBOX_SCHEMA,usernameAtHostname,old_uri,mail_directory_value);
|
||||||
#endif
|
#endif
|
||||||
*new_uri = PR_smprintf("%s/%s/%s",MAILBOX_SCHEMA,usernameAtHostname,old_uri + PL_strlen(mail_directory_value));
|
folderPath = old_uri + PL_strlen(mail_directory_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if folder path is "", then the URI was mailbox:/<foobar>
|
||||||
|
// and the directory pref was <foobar>
|
||||||
|
// this meant it was reall <foobar>/<default folder name>
|
||||||
|
// this insanity only happened on mac and windows.
|
||||||
|
if (!folderPath || (PL_strlen(folderPath) == 0)) {
|
||||||
|
*new_uri = PR_smprintf("%s/%s/%s",MAILBOX_SCHEMA,usernameAtHostname, default_folder_name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// if the folder path starts with a /, we don't need to add one.
|
||||||
|
// the reason for this is on UNIX, we store mail.directory as "/home/sspitzer/nsmail"
|
||||||
|
// but on windows, its "C:\foo\bar\mail"
|
||||||
|
*new_uri = PR_smprintf("%s/%s%s%s",MAILBOX_SCHEMA,usernameAtHostname,(folderPath[0] == '/')?"":"/",folderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*new_uri) {
|
if (!*new_uri) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче