diff --git a/mailnews/import/eudora/src/nsEudoraMac.cpp b/mailnews/import/eudora/src/nsEudoraMac.cpp index 139865470c85..b50eeb139163 100644 --- a/mailnews/import/eudora/src/nsEudoraMac.cpp +++ b/mailnews/import/eudora/src/nsEudoraMac.cpp @@ -35,6 +35,7 @@ #include "nsSpecialSystemDirectory.h" #include "nsEudoraStringBundle.h" #include "nsEudoraImport.h" +#include "nsIPop3IncomingServer.h" #include "EudoraDebugLog.h" @@ -498,6 +499,14 @@ nsresult nsEudoraMac::FindTOCFile( nsIFileSpec *pMailFile, nsIFileSpec **ppTOCFi #define kFullNameStr 4 #define kLeaveOnServerStr 5 +// resource IDs +#define kSmtpServerID 4 +#define kEmailAddressID 3 +#define kReturnAddressID 5 +#define kFullNameID 77 +#define kLeaveMailOnServerID 18 + + PRBool nsEudoraMac::GetSettingsFromResource( nsIFileSpec *pSettings, short resId, nsCString **pStrs, PRBool *pIMAP) { *pIMAP = PR_FALSE; @@ -523,11 +532,11 @@ PRBool nsEudoraMac::GetSettingsFromResource( nsIFileSpec *pSettings, short resId pStr[i] = (StringPtr) new PRUint8[256]; (pStr[i])[0] = 0; } - GetIndString( pStr[0], resId /* 1000 */, 4); - GetIndString( pStr[1], resId, 3); - GetIndString( pStr[2], resId, 5); - GetIndString( pStr[3], resId, 77); - GetIndString( pStr[4], resId, 18); + GetIndString( pStr[0], resId /* 1000 */, kSmtpServerID); + GetIndString( pStr[1], resId, kEmailAddressID); // user name@pop server + GetIndString( pStr[2], resId, kReturnAddressID); + GetIndString( pStr[3], resId, kFullNameID); + GetIndString( pStr[4], resId, kLeaveMailOnServerID); CloseResFile( resFile); theStr = pStr[0]; @@ -711,7 +720,11 @@ PRBool nsEudoraMac::BuildPOPAccount( nsIMsgAccountManager *accMgr, nsCString **p IMPORT_LOG0( "Created a new account and set the incoming server to the POP3 server.\n"); - // Fiddle with the identities + nsCOMPtr pop3Server = do_QueryInterface(in, &rv); + NS_ENSURE_SUCCESS(rv,rv); + pop3Server->SetLeaveMessagesOnServer(*pStrs[kLeaveOnServerStr])[0] == 'Y' ? PR_TRUE : PR_FALSE); + + // Fiddle with the identities SetIdentities( accMgr, account, pStrs); result = PR_TRUE; if (ppAccount) diff --git a/mailnews/import/eudora/src/nsEudoraWin32.cpp b/mailnews/import/eudora/src/nsEudoraWin32.cpp index 2c7e8545f1d3..dff76cfd9158 100644 --- a/mailnews/import/eudora/src/nsEudoraWin32.cpp +++ b/mailnews/import/eudora/src/nsEudoraWin32.cpp @@ -24,6 +24,7 @@ #include "nsIServiceManager.h" #include "nsIMsgAccountManager.h" #include "nsIMsgAccount.h" +#include "nsIPop3IncomingServer.h" #include "nsMsgBaseCID.h" #include "nsMsgCompCID.h" #include "nsISmtpService.h" @@ -751,9 +752,14 @@ PRBool nsEudoraWin32::BuildPOPAccount( nsIMsgAccountManager *accMgr, const char rv = accMgr->CreateAccount( getter_AddRefs( account)); if (NS_SUCCEEDED( rv) && account) { rv = account->SetIncomingServer( in); - + IMPORT_LOG0( "Created a new account and set the incoming server to the POP3 server.\n"); + nsCOMPtr pop3Server = do_QueryInterface(in, &rv); + NS_ENSURE_SUCCESS(rv,rv); + UINT valInt = ::GetPrivateProfileInt(pSection, "LeaveMailOnServer", 0, pIni); + pop3Server->SetLeaveMessagesOnServer(valInt ? PR_TRUE : PR_FALSE); + // Fiddle with the identities SetIdentities( accMgr, account, pSection, pIni, valBuff); result = PR_TRUE; diff --git a/mailnews/import/oexpress/nsOESettings.cpp b/mailnews/import/oexpress/nsOESettings.cpp index cfb09ba923b0..1fadc712319b 100644 --- a/mailnews/import/oexpress/nsOESettings.cpp +++ b/mailnews/import/oexpress/nsOESettings.cpp @@ -44,6 +44,7 @@ #include "nsISmtpServer.h" #include "nsOEStringBundle.h" #include "OEDebugLog.h" +#include "nsIPop3IncomingServer.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -417,7 +418,16 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS IMPORT_LOG0( "Created a new account and set the incoming server to the POP3 server.\n"); - // Fiddle with the identities + nsCOMPtr pop3Server = do_QueryInterface(in, &rv); + NS_ENSURE_SUCCESS(rv,rv); + BYTE *pLeaveOnServer = nsOERegUtil::GetValueBytes( hKey, "Leave Mail On Server"); + if (pLeaveOnServer) + { + pop3Server->SetLeaveMessagesOnServer(*pLeaveOnServer == 1 ? PR_TRUE : PR_FALSE); + nsOERegUtil::FreeValueBytes(pLeaveOnServer); + } + + // Fiddle with the identities SetIdentities( pMgr, account, hKey); result = PR_TRUE; if (ppAccount) diff --git a/mailnews/import/outlook/src/nsOutlookSettings.cpp b/mailnews/import/outlook/src/nsOutlookSettings.cpp index 363a5f906153..67dc57a67823 100644 --- a/mailnews/import/outlook/src/nsOutlookSettings.cpp +++ b/mailnews/import/outlook/src/nsOutlookSettings.cpp @@ -44,6 +44,7 @@ #include "nsISmtpServer.h" #include "nsOutlookStringBundle.h" #include "OutlookDebugLog.h" +#include "nsIPop3IncomingServer.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -374,7 +375,16 @@ PRBool OutlookSettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, cha IMPORT_LOG0( "Created a new account and set the incoming server to the POP3 server.\n"); - // Fiddle with the identities + nsCOMPtr pop3Server = do_QueryInterface(in, &rv); + NS_ENSURE_SUCCESS(rv,rv); + BYTE *pLeaveOnServer = nsOutlookRegUtil::GetValueBytes( hKey, "Leave Mail On Server"); + if (pLeaveOnServer) + { + pop3Server->SetLeaveMessagesOnServer(*pLeaveOnServer == 1 ? PR_TRUE : PR_FALSE); + nsOutlookRegUtil::FreeValueBytes(pLeaveOnServer); + } + + // Fiddle with the identities SetIdentities( pMgr, account, hKey); result = PR_TRUE; if (ppAccount)