зеркало из https://github.com/mozilla/pjs.git
Родитель
0462b4bf61
Коммит
ae8bec0901
|
@ -112,7 +112,7 @@ interface nsIMessenger : nsISupports {
|
|||
[array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray,
|
||||
[array, size_is(count)] in string messageUriArray, in boolean saveFirst);
|
||||
// saveAttachmentToFolder is used by the drag and drop code to drop an attachment to a destination folder
|
||||
// we need to return the actual file path (including the filename).
|
||||
// we need to return the actual file path (including the filename).
|
||||
nsILocalFile saveAttachmentToFolder(in string contentType, in string url, in string displayName, in string messageUri, in nsILocalFile aDestFolder);
|
||||
|
||||
attribute boolean sendingUnsentMsgs;
|
||||
|
|
|
@ -48,14 +48,14 @@
|
|||
* mail.account.<account>.identities
|
||||
*/
|
||||
|
||||
[scriptable, uuid(da368bd0-e624-11d2-b7fc-00805f05ffa5)]
|
||||
[scriptable, uuid(3FE5B45D-ACF8-4348-8951-757D21E983F2)]
|
||||
interface nsIMsgAccount : nsISupports {
|
||||
|
||||
/* init function */
|
||||
void init();
|
||||
|
||||
/* internal key identifying itself */
|
||||
attribute string key;
|
||||
attribute ACString key;
|
||||
|
||||
/* incoming server stuff */
|
||||
attribute nsIMsgIncomingServer incomingServer;
|
||||
|
@ -77,5 +77,5 @@ interface nsIMsgAccount : nsISupports {
|
|||
void clearAllValues();
|
||||
|
||||
/* name in javascript */
|
||||
wstring toString();
|
||||
AString toString();
|
||||
};
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -64,26 +63,21 @@ nsMsgAccount::~nsMsgAccount()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccount::Init()
|
||||
{
|
||||
NS_ASSERTION(!m_identities, "don't call Init twice!");
|
||||
if (m_identities) return NS_ERROR_FAILURE;
|
||||
|
||||
return createIdentities();
|
||||
NS_ASSERTION(!m_identities, "don't call Init twice!");
|
||||
return m_identities ? NS_ERROR_FAILURE : createIdentities();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAccount::getPrefService()
|
||||
nsMsgAccount::getPrefService()
|
||||
{
|
||||
if (m_prefs)
|
||||
if (m_prefs)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
m_prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
m_prefs = nsnull;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -98,7 +92,7 @@ nsMsgAccount::GetIncomingServer(nsIMsgIncomingServer * *aIncomingServer)
|
|||
nsresult rv = createIncomingServer();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't lazily create the server\n");
|
||||
}
|
||||
|
||||
|
||||
NS_IF_ADDREF(*aIncomingServer = m_incomingServer);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -107,7 +101,9 @@ nsMsgAccount::GetIncomingServer(nsIMsgIncomingServer * *aIncomingServer)
|
|||
nsresult
|
||||
nsMsgAccount::createIncomingServer()
|
||||
{
|
||||
if (!(const char*)m_accountKey) return NS_ERROR_NOT_INITIALIZED;
|
||||
if (m_accountKey.IsEmpty())
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// from here, load mail.account.myaccount.server
|
||||
// Load the incoming server
|
||||
//
|
||||
|
@ -120,23 +116,19 @@ nsMsgAccount::createIncomingServer()
|
|||
nsCAutoString serverKeyPref("mail.account.");
|
||||
serverKeyPref += m_accountKey;
|
||||
serverKeyPref += ".server";
|
||||
nsXPIDLCString serverKey;
|
||||
nsCString serverKey;
|
||||
rv = m_prefs->GetCharPref(serverKeyPref.get(), getter_Copies(serverKey));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef DEBUG_alecf
|
||||
printf("\t%s's server: %s\n", (const char*)m_accountKey, (const char*)serverKey);
|
||||
#endif
|
||||
|
||||
// get the server from the account manager
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
rv = accountManager->GetIncomingServer(serverKey, getter_AddRefs(server));
|
||||
rv = accountManager->GetIncomingServer(serverKey.get(), getter_AddRefs(server));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
// store the server in this structure
|
||||
m_incomingServer = server;
|
||||
accountManager->NotifyServerLoaded(server);
|
||||
|
@ -149,29 +141,28 @@ NS_IMETHODIMP
|
|||
nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer * aIncomingServer)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsXPIDLCString key;
|
||||
|
||||
nsCString key;
|
||||
rv = aIncomingServer->GetKey(getter_Copies(key));
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCAutoString serverPrefName("mail.account.");
|
||||
serverPrefName.Append(m_accountKey);
|
||||
serverPrefName.Append(".server");
|
||||
m_prefs->SetCharPref(serverPrefName.get(), key);
|
||||
serverPrefName.AppendLiteral(".server");
|
||||
m_prefs->SetCharPref(serverPrefName.get(), key.get());
|
||||
}
|
||||
|
||||
m_incomingServer = aIncomingServer;
|
||||
|
||||
PRBool serverValid;
|
||||
(void) aIncomingServer->GetValid(&serverValid);
|
||||
// only notify server loaded if server is valid so
|
||||
// only notify server loaded if server is valid so
|
||||
// account manager only gets told about finished accounts.
|
||||
if (serverValid)
|
||||
if (serverValid)
|
||||
{
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
accountManager->NotifyServerLoaded(aIncomingServer);
|
||||
accountManager->NotifyServerLoaded(aIncomingServer);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -180,14 +171,10 @@ nsMsgAccount::SetIncomingServer(nsIMsgIncomingServer * aIncomingServer)
|
|||
NS_IMETHODIMP
|
||||
nsMsgAccount::GetIdentities(nsISupportsArray **_retval)
|
||||
{
|
||||
if (!_retval) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
NS_ASSERTION(m_identities,"you never called Init()");
|
||||
if (!m_identities) return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = m_identities;
|
||||
NS_ADDREF(*_retval);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
NS_ENSURE_TRUE(m_identities, NS_ERROR_FAILURE);
|
||||
|
||||
NS_IF_ADDREF(*_retval = m_identities);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -198,11 +185,10 @@ nsMsgAccount::GetIdentities(nsISupportsArray **_retval)
|
|||
nsresult
|
||||
nsMsgAccount::createIdentities()
|
||||
{
|
||||
NS_ASSERTION(!m_identities, "only call createIdentities() once!");
|
||||
if (m_identities) return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_TRUE(!m_accountKey.IsEmpty(), NS_ERROR_NOT_INITIALIZED);
|
||||
if (m_identities)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ENSURE_TRUE((const char*)m_accountKey, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
NS_NewISupportsArray(getter_AddRefs(m_identities));
|
||||
|
||||
// get the pref
|
||||
|
@ -210,28 +196,19 @@ nsMsgAccount::createIdentities()
|
|||
nsCAutoString identitiesKeyPref("mail.account.");
|
||||
identitiesKeyPref.Append(m_accountKey);
|
||||
identitiesKeyPref.Append(".identities");
|
||||
|
||||
nsXPIDLCString identityKey;
|
||||
|
||||
nsCString identityKey;
|
||||
nsresult rv;
|
||||
rv = getPrefService();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = m_prefs->GetCharPref(identitiesKeyPref.get(), getter_Copies(identityKey));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (identityKey.IsEmpty()) // not an error if no identities, but
|
||||
m_prefs->GetCharPref(identitiesKeyPref.get(), getter_Copies(identityKey));
|
||||
if (identityKey.IsEmpty()) // not an error if no identities, but
|
||||
return NS_OK; // nsCRT::strtok will be unhappy
|
||||
|
||||
#ifdef DEBUG_alecf
|
||||
printf("%s's identities: %s\n",
|
||||
(const char*)m_accountKey,
|
||||
(const char*)identityKey);
|
||||
#endif
|
||||
|
||||
// get the server from the account manager
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// const-casting because nsCRT::strtok whacks the string,
|
||||
// but safe because identityKey is a copy
|
||||
|
@ -247,7 +224,7 @@ nsMsgAccount::createIdentities()
|
|||
while (token) {
|
||||
key = token;
|
||||
key.StripWhitespace();
|
||||
|
||||
|
||||
// create the account
|
||||
rv = accountManager->GetIdentity(key.get(), getter_AddRefs(identity));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -259,31 +236,26 @@ nsMsgAccount::createIdentities()
|
|||
// advance to next key, if any
|
||||
token = nsCRT::strtok(newStr, ",", &newStr);
|
||||
}
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/* attribute nsIMsgIdentity defaultIdentity; */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccount::GetDefaultIdentity(nsIMsgIdentity * *aDefaultIdentity)
|
||||
nsMsgAccount::GetDefaultIdentity(nsIMsgIdentity **aDefaultIdentity)
|
||||
{
|
||||
if (!aDefaultIdentity) return NS_ERROR_NULL_POINTER;
|
||||
NS_ENSURE_ARG_POINTER(aDefaultIdentity);
|
||||
nsresult rv;
|
||||
if (!m_identities) {
|
||||
rv = Init();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
nsISupports* idsupports;
|
||||
rv = m_identities->GetElementAt(0, &idsupports);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (idsupports) {
|
||||
rv = idsupports->QueryInterface(NS_GET_IID(nsIMsgIdentity),
|
||||
(void **)aDefaultIdentity);
|
||||
NS_RELEASE(idsupports);
|
||||
if (!m_identities)
|
||||
{
|
||||
rv = Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMsgIdentity> identity( do_QueryElementAt(m_identities, 0));
|
||||
identity.swap(*aDefaultIdentity);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -291,13 +263,12 @@ nsMsgAccount::GetDefaultIdentity(nsIMsgIdentity * *aDefaultIdentity)
|
|||
NS_IMETHODIMP
|
||||
nsMsgAccount::SetDefaultIdentity(nsIMsgIdentity * aDefaultIdentity)
|
||||
{
|
||||
NS_ASSERTION(m_identities,"you never called Init()");
|
||||
if (!m_identities) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ENSURE_TRUE(m_identities, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ASSERTION(m_identities->IndexOf(aDefaultIdentity) != -1, "Where did that identity come from?!");
|
||||
if (m_identities->IndexOf(aDefaultIdentity) == -1)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
||||
m_defaultIdentity = aDefaultIdentity;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -308,13 +279,10 @@ nsMsgAccount::SetDefaultIdentity(nsIMsgIdentity * aDefaultIdentity)
|
|||
nsresult
|
||||
nsMsgAccount::addIdentityInternal(nsIMsgIdentity *identity)
|
||||
{
|
||||
NS_ASSERTION(m_identities,"you never called Init()");
|
||||
if (!m_identities) return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ENSURE_TRUE(m_identities, NS_ERROR_FAILURE);
|
||||
return m_identities->AppendElement(identity);
|
||||
}
|
||||
|
||||
|
||||
/* void addIdentity (in nsIMsgIdentity identity); */
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccount::AddIdentity(nsIMsgIdentity *identity)
|
||||
|
@ -323,7 +291,7 @@ nsMsgAccount::AddIdentity(nsIMsgIdentity *identity)
|
|||
// for now just treat this as a Setxxx accessor
|
||||
// when this is actually implemented, don't refcount the default identity
|
||||
nsresult rv;
|
||||
|
||||
|
||||
nsCString key;
|
||||
rv = identity->GetKey(key);
|
||||
|
||||
|
@ -332,25 +300,25 @@ nsMsgAccount::AddIdentity(nsIMsgIdentity *identity)
|
|||
nsCAutoString identitiesKeyPref("mail.account.");
|
||||
identitiesKeyPref.Append(m_accountKey);
|
||||
identitiesKeyPref.Append(".identities");
|
||||
|
||||
|
||||
nsXPIDLCString identityList;
|
||||
m_prefs->GetCharPref(identitiesKeyPref.get(),
|
||||
getter_Copies(identityList));
|
||||
|
||||
nsCAutoString newIdentityList(identityList);
|
||||
|
||||
|
||||
nsCAutoString testKey; // temporary to strip whitespace
|
||||
PRBool foundIdentity = PR_FALSE; // if the input identity is found
|
||||
|
||||
// nsCRT::strtok will be unhappy with an empty string
|
||||
if (!identityList.IsEmpty()) {
|
||||
|
||||
|
||||
// const-casting because nsCRT::strtok whacks the string,
|
||||
// but safe because identityList is a copy
|
||||
char *newStr;
|
||||
char *rest = identityList.BeginWriting();
|
||||
char *token = nsCRT::strtok(rest, ",", &newStr);
|
||||
|
||||
|
||||
// look for the identity key that we're adding
|
||||
while (token) {
|
||||
testKey = token;
|
||||
|
@ -372,16 +340,16 @@ nsMsgAccount::AddIdentity(nsIMsgIdentity *identity)
|
|||
newIdentityList.Append(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_prefs->SetCharPref(identitiesKeyPref.get(), newIdentityList.get());
|
||||
}
|
||||
|
||||
// now add it to the in-memory list
|
||||
rv = addIdentityInternal(identity);
|
||||
|
||||
|
||||
if (!m_defaultIdentity)
|
||||
SetDefaultIdentity(identity);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -389,8 +357,8 @@ nsMsgAccount::AddIdentity(nsIMsgIdentity *identity)
|
|||
NS_IMETHODIMP
|
||||
nsMsgAccount::RemoveIdentity(nsIMsgIdentity * aIdentity)
|
||||
{
|
||||
NS_ENSURE_TRUE(m_identities, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_ARG_POINTER(aIdentity);
|
||||
NS_ENSURE_TRUE(m_identities, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 count =0;
|
||||
m_identities->Count(&count);
|
||||
|
@ -415,7 +383,7 @@ nsMsgAccount::RemoveIdentity(nsIMsgIdentity * aIdentity)
|
|||
nsCAutoString identitiesKeyPref("mail.account.");
|
||||
identitiesKeyPref.Append(m_accountKey);
|
||||
identitiesKeyPref.Append(".identities");
|
||||
|
||||
|
||||
nsCAutoString newIdentityList;
|
||||
|
||||
// iterate over the remaining identities
|
||||
|
@ -437,60 +405,57 @@ nsMsgAccount::RemoveIdentity(nsIMsgIdentity * aIdentity)
|
|||
}
|
||||
|
||||
m_prefs->SetCharPref(identitiesKeyPref.get(), newIdentityList.get());
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMPL_GETTER_STR(nsMsgAccount::GetKey, m_accountKey)
|
||||
|
||||
nsresult
|
||||
nsMsgAccount::SetKey(const char *accountKey)
|
||||
NS_IMETHODIMP nsMsgAccount::GetKey(nsACString& accountKey)
|
||||
{
|
||||
if (!accountKey) return NS_ERROR_NULL_POINTER;
|
||||
accountKey = m_accountKey;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccount::SetKey(const nsACString& accountKey)
|
||||
{
|
||||
// need the prefs service to do anything
|
||||
nsresult rv = getPrefService();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
m_accountKey.Assign(accountKey);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
m_accountKey = accountKey;
|
||||
return Init();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccount::ToString(PRUnichar **aResult)
|
||||
nsMsgAccount::ToString(nsAString& aResult)
|
||||
{
|
||||
nsAutoString val;
|
||||
val.AssignLiteral("[nsIMsgAccount: ");
|
||||
AppendASCIItoUTF16(m_accountKey, val);
|
||||
val.Append(']');
|
||||
*aResult = ToNewUnicode(val);
|
||||
aResult.AssignLiteral("[nsIMsgAccount: ");
|
||||
aResult.Append(NS_ConvertASCIItoUTF16(m_accountKey));
|
||||
aResult.AppendLiteral("]");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgAccount::ClearAllValues()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString rootPref("mail.account.");
|
||||
rootPref += m_accountKey;
|
||||
rootPref += '.';
|
||||
nsresult rv;
|
||||
nsCAutoString rootPref("mail.account.");
|
||||
rootPref += m_accountKey;
|
||||
rootPref += '.';
|
||||
|
||||
rv = getPrefService();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = getPrefService();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRUint32 cntChild, i;
|
||||
char **childArray;
|
||||
|
||||
rv = m_prefs->GetChildList(rootPref.get(), &cntChild, &childArray);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
for (i = 0; i < cntChild; i++)
|
||||
m_prefs->ClearUserPref(childArray[i]);
|
||||
PRUint32 cntChild, i;
|
||||
char **childArray;
|
||||
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(cntChild, childArray);
|
||||
}
|
||||
rv = m_prefs->GetChildList(rootPref.get(), &cntChild, &childArray);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
for (i = 0; i < cntChild; i++)
|
||||
m_prefs->ClearUserPref(childArray[i]);
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(cntChild, childArray);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -38,20 +38,20 @@
|
|||
#include "nscore.h"
|
||||
#include "nsIMsgAccount.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsMsgAccount : public nsIMsgAccount
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
nsMsgAccount();
|
||||
virtual ~nsMsgAccount();
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIMSGACCOUNT
|
||||
|
||||
|
||||
private:
|
||||
nsXPIDLCString m_accountKey;
|
||||
nsCString m_accountKey;
|
||||
nsCOMPtr<nsIPrefBranch> m_prefs;
|
||||
nsCOMPtr<nsIMsgIncomingServer> m_incomingServer;
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -131,7 +131,7 @@ nsMsgIncomingServer::SetKey(const char * serverKey)
|
|||
rv = prefs->GetBranch("mail.server.default.", getter_AddRefs(mDefPrefBranch));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::SetRootFolder(nsIMsgFolder * aRootFolder)
|
||||
{
|
||||
|
@ -149,8 +149,8 @@ nsMsgIncomingServer::GetRootFolder(nsIMsgFolder * *aRootFolder)
|
|||
{
|
||||
*aRootFolder = m_rootFolder;
|
||||
NS_ADDREF(*aRootFolder);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
nsresult rv = CreateRootFolder();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -186,17 +186,17 @@ nsMsgIncomingServer::PerformExpand(nsIMsgWindow *aMsgWindow)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::PerformBiff(nsIMsgWindow* aMsgWindow)
|
||||
{
|
||||
//This has to be implemented in the derived class, but in case someone doesn't implement it
|
||||
//just return not implemented.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetNewMessages(nsIMsgFolder *aFolder, nsIMsgWindow *aMsgWindow,
|
||||
nsMsgIncomingServer::GetNewMessages(nsIMsgFolder *aFolder, nsIMsgWindow *aMsgWindow,
|
||||
nsIUrlListener *aUrlListener)
|
||||
{
|
||||
return aFolder->GetNewMessages(aMsgWindow, aUrlListener);
|
||||
|
@ -236,7 +236,7 @@ nsMsgIncomingServer::Shutdown()
|
|||
mFilterPlugin = nsnull;
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (mFilterList)
|
||||
if (mFilterList)
|
||||
{
|
||||
// close the filter log stream
|
||||
rv = mFilterList->SetLogStream(nsnull);
|
||||
|
@ -244,7 +244,7 @@ nsMsgIncomingServer::Shutdown()
|
|||
mFilterList = nsnull;
|
||||
}
|
||||
|
||||
if (mSpamSettings)
|
||||
if (mSpamSettings)
|
||||
{
|
||||
// close the spam log stream
|
||||
rv = mSpamSettings->SetLogStream(nsnull);
|
||||
|
@ -353,7 +353,7 @@ nsMsgIncomingServer::GetServerURI(char* *aResult)
|
|||
*((char **)getter_Copies(escapedUsername)) =
|
||||
nsEscape(username, url_XAlphas);
|
||||
// nsEscape(username, url_Path);
|
||||
// not all servers have a username
|
||||
// not all servers have a username
|
||||
uri.Append(escapedUsername);
|
||||
uri += '@';
|
||||
}
|
||||
|
@ -378,11 +378,11 @@ nsMsgIncomingServer::GetServerURI(char* *aResult)
|
|||
nsresult
|
||||
nsMsgIncomingServer::CreateLocalFolder(nsIFile *path, const char *folderName)
|
||||
{
|
||||
(void) path->SetNativeLeafName(nsDependentCString(folderName));
|
||||
(void) path->SetNativeLeafName(nsDependentCString(folderName));
|
||||
PRBool exists;
|
||||
nsresult rv = path->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!exists)
|
||||
if (!exists)
|
||||
rv = path->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
|
||||
return rv;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ nsMsgIncomingServer::CreateRootFolder()
|
|||
rv = rdf->GetResource(serverUri, getter_AddRefs(serverResource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// make incoming server know about its root server folder so we
|
||||
// make incoming server know about its root server folder so we
|
||||
// can find sub-folders given an incoming server.
|
||||
m_rootFolder = do_QueryInterface(serverResource, &rv);
|
||||
return rv;
|
||||
|
@ -458,7 +458,7 @@ nsMsgIncomingServer::GetFileValue(const char* aRelPrefName,
|
|||
const char* aAbsPrefName,
|
||||
nsILocalFile** aLocalFile)
|
||||
{
|
||||
// Get the relative first
|
||||
// Get the relative first
|
||||
nsCOMPtr<nsIRelativeFilePref> relFilePref;
|
||||
nsresult rv = mPrefBranch->GetComplexValue(aRelPrefName,
|
||||
NS_GET_IID(nsIRelativeFilePref),
|
||||
|
@ -511,12 +511,12 @@ nsMsgIncomingServer::SetIntValue(const char *prefname,
|
|||
{
|
||||
PRInt32 defaultVal;
|
||||
nsresult rv = mDefPrefBranch->GetIntPref(prefname, &defaultVal);
|
||||
|
||||
|
||||
if (NS_SUCCEEDED(rv) && defaultVal == val)
|
||||
mPrefBranch->ClearUserPref(prefname);
|
||||
else
|
||||
rv = mPrefBranch->SetIntPref(prefname, val);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ nsMsgIncomingServer::GetPrettyName(PRUnichar **retval) {
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// if there's no name, then just return the hostname
|
||||
if (val.IsEmpty())
|
||||
if (val.IsEmpty())
|
||||
return GetConstructedPrettyName(retval);
|
||||
|
||||
*retval = nsCRT::strdup(val);
|
||||
|
@ -623,7 +623,7 @@ NS_IMETHODIMP
|
|||
nsMsgIncomingServer::SetPrettyName(const PRUnichar *value)
|
||||
{
|
||||
SetUnicharValue("name", value);
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> rootFolder;
|
||||
GetRootFolder(getter_AddRefs(rootFolder));
|
||||
|
||||
|
@ -637,9 +637,9 @@ nsMsgIncomingServer::SetPrettyName(const PRUnichar *value)
|
|||
// construct the pretty name to show to the user if they haven't
|
||||
// specified one. This should be overridden for news and mail.
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetConstructedPrettyName(PRUnichar **retval)
|
||||
nsMsgIncomingServer::GetConstructedPrettyName(PRUnichar **retval)
|
||||
{
|
||||
|
||||
|
||||
nsXPIDLCString username;
|
||||
nsAutoString prettyName;
|
||||
nsresult rv = GetUsername(getter_Copies(username));
|
||||
|
@ -649,7 +649,7 @@ nsMsgIncomingServer::GetConstructedPrettyName(PRUnichar **retval)
|
|||
prettyName.AssignWithConversion(username);
|
||||
prettyName.AppendLiteral(" on ");
|
||||
}
|
||||
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
rv = GetHostName(getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -658,7 +658,7 @@ nsMsgIncomingServer::GetConstructedPrettyName(PRUnichar **retval)
|
|||
prettyName.AppendWithConversion(hostname);
|
||||
|
||||
*retval = ToNewUnicode(prettyName);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -670,24 +670,24 @@ nsMsgIncomingServer::ToString(PRUnichar** aResult) {
|
|||
NS_ASSERTION(*aResult, "no server name!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgIncomingServer::SetPassword(const char * aPassword)
|
||||
{
|
||||
m_password = aPassword;
|
||||
|
||||
|
||||
nsresult rv;
|
||||
PRBool rememberPassword = PR_FALSE;
|
||||
|
||||
|
||||
rv = GetRememberPassword(&rememberPassword);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (rememberPassword)
|
||||
|
||||
if (rememberPassword)
|
||||
{
|
||||
rv = StorePassword();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -707,24 +707,24 @@ NS_IMETHODIMP nsMsgIncomingServer::GetServerRequiresPasswordForBiff(PRBool *aSer
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
||||
PRUnichar *aPromptTitle,
|
||||
PRUnichar *aPromptTitle,
|
||||
nsIMsgWindow* aMsgWindow,
|
||||
PRBool *okayValue,
|
||||
char **aPassword)
|
||||
char **aPassword)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aPassword);
|
||||
NS_ENSURE_ARG_POINTER(okayValue);
|
||||
|
||||
if (m_password.IsEmpty())
|
||||
|
||||
if (m_password.IsEmpty())
|
||||
{
|
||||
// let's see if we have the password in the password manager and
|
||||
// let's see if we have the password in the password manager and
|
||||
// can avoid this prompting thing. This makes it easier to get embedders
|
||||
// to get up and running w/o a password prompting UI. We already depend on
|
||||
// nsIPasswordManagerInternal so this doesn't introduce a new dependency.
|
||||
nsCOMPtr <nsIPasswordManagerInternal> passwordMgrInt = do_GetService(NS_PASSWORDMANAGER_CONTRACTID, &rv);
|
||||
if(passwordMgrInt)
|
||||
if(passwordMgrInt)
|
||||
{
|
||||
|
||||
// Get the current server URI
|
||||
|
@ -758,7 +758,7 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
nsCOMPtr<nsIDocShell> docShell;
|
||||
rv = aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
dialog = do_GetInterface(docShell, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
@ -780,27 +780,27 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
|
|||
uniPassword = ToNewUnicode(NS_ConvertASCIItoUTF16(*aPassword));
|
||||
|
||||
PRUint32 savePasswordType = PasswordProtectLocalCache() ? nsIAuthPrompt::SAVE_PASSWORD_FOR_SESSION : nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY;
|
||||
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage,
|
||||
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage,
|
||||
NS_ConvertASCIItoUTF16(serverUri).get(), savePasswordType,
|
||||
&uniPassword, okayValue);
|
||||
nsAutoString uniPasswordAdopted;
|
||||
uniPasswordAdopted.Adopt(uniPassword);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
if (!*okayValue) // if the user pressed cancel, just return NULL;
|
||||
{
|
||||
*aPassword = nsnull;
|
||||
return NS_MSG_PASSWORD_PROMPT_CANCELLED;
|
||||
}
|
||||
|
||||
|
||||
// we got a password back...so remember it
|
||||
nsCString aCStr;
|
||||
aCStr.AssignWithConversion(uniPasswordAdopted);
|
||||
nsCString aCStr;
|
||||
aCStr.AssignWithConversion(uniPasswordAdopted);
|
||||
rv = SetPassword(aCStr.get());
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
} // if we got a prompt dialog
|
||||
} // if the password is empty
|
||||
|
||||
|
||||
return GetPassword(aPassword);
|
||||
}
|
||||
|
||||
|
@ -810,7 +810,7 @@ nsMsgIncomingServer::StorePassword()
|
|||
nsresult rv;
|
||||
|
||||
// we only need to store this if we're password protecting the local cache.
|
||||
// Otherwise, the password manager handles storing the password if the user
|
||||
// Otherwise, the password manager handles storing the password if the user
|
||||
// checks the "remember password" box.
|
||||
if (!PasswordProtectLocalCache())
|
||||
return NS_OK;
|
||||
|
@ -826,7 +826,7 @@ nsMsgIncomingServer::StorePassword()
|
|||
rv = GetServerURI(getter_Copies(serverSpec));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// We're password protecting the local cache, we're going to munge the uri in the password mgr to
|
||||
// We're password protecting the local cache, we're going to munge the uri in the password mgr to
|
||||
// start with 'x', so that we can remember the password in order to challenge the user, w/o having the
|
||||
// password mgr automatically use the password.
|
||||
serverSpec.Insert('x', 0);
|
||||
|
@ -895,7 +895,7 @@ nsMsgIncomingServer::GetLocalPath(nsILocalFile **aLocalPath)
|
|||
// if the local path has already been set, use it
|
||||
rv = GetFileValue("directory-rel", "directory", aLocalPath);
|
||||
if (NS_SUCCEEDED(rv) && *aLocalPath) return rv;
|
||||
|
||||
|
||||
// otherwise, create the path using the protocol info.
|
||||
// note we are using the
|
||||
// hostname, unless that directory exists.
|
||||
|
@ -903,12 +903,12 @@ nsMsgIncomingServer::GetLocalPath(nsILocalFile **aLocalPath)
|
|||
nsCOMPtr<nsIMsgProtocolInfo> protocolInfo;
|
||||
rv = getProtocolInfo(getter_AddRefs(protocolInfo));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsILocalFile> localPath;
|
||||
rv = protocolInfo->GetDefaultLocalPath(getter_AddRefs(localPath));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
localPath->Create(nsIFile::DIRECTORY_TYPE, 0755);
|
||||
|
||||
|
||||
nsXPIDLCString hostname;
|
||||
rv = GetHostName(getter_Copies(hostname));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -938,7 +938,7 @@ nsMsgIncomingServer::SetRememberPassword(PRBool value)
|
|||
{
|
||||
if (!value)
|
||||
ForgetPassword();
|
||||
else
|
||||
else
|
||||
StorePassword();
|
||||
return SetBoolValue("remember_password", value);
|
||||
}
|
||||
|
@ -1021,7 +1021,7 @@ nsMsgIncomingServer::RemoveFiles()
|
|||
// IMPORTANT, see bug #77652
|
||||
// don't turn this code on yet. we don't inform the user that
|
||||
// we are going to be deleting the directory, and they might have
|
||||
// tweaked their localPath pref for this server to point to
|
||||
// tweaked their localPath pref for this server to point to
|
||||
// somewhere they didn't want deleted.
|
||||
// until we tell them, we shouldn't do the delete.
|
||||
#if 0
|
||||
|
@ -1029,9 +1029,9 @@ nsMsgIncomingServer::RemoveFiles()
|
|||
nsCOMPtr <nsIFileSpec> localPath;
|
||||
rv = GetLocalPath(getter_AddRefs(localPath));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
if (!localPath) return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
PRBool exists = PR_FALSE;
|
||||
rv = localPath->Exists(&exists);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1062,7 +1062,7 @@ nsMsgIncomingServer::SetFilterList(nsIMsgFilterList *aFilterList)
|
|||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult)
|
||||
{
|
||||
if (!mFilterList)
|
||||
if (!mFilterList)
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder;
|
||||
// use GetRootFolder so for deferred pop3 accounts, we'll get the filters
|
||||
|
@ -1070,7 +1070,7 @@ nsMsgIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **
|
|||
// so that filters will still be per-server.
|
||||
nsresult rv = GetRootFolder(getter_AddRefs(msgFolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
nsCOMPtr<nsILocalFile> thisFolder;
|
||||
rv = msgFolder->GetFilePath(getter_AddRefs(thisFolder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1081,7 +1081,7 @@ nsMsgIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mFilterFile->AppendNative(NS_LITERAL_CSTRING("msgFilterRules.dat"));
|
||||
|
||||
|
||||
PRBool fileExists;
|
||||
mFilterFile->Exists(&fileExists);
|
||||
if (!fileExists)
|
||||
|
@ -1091,7 +1091,7 @@ nsMsgIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **
|
|||
rv = oldFilterFile->InitWithFile(thisFolder);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
oldFilterFile->AppendNative(NS_LITERAL_CSTRING("rules.dat"));
|
||||
|
||||
|
||||
oldFilterFile->Exists(&fileExists);
|
||||
if (fileExists) //copy rules.dat --> msgFilterRules.dat
|
||||
{
|
||||
|
@ -1102,16 +1102,16 @@ nsMsgIncomingServer::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **
|
|||
nsCOMPtr<nsIMsgFilterService> filterService =
|
||||
do_GetService(NS_MSGFILTERSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
rv = filterService->OpenFilterList(mFilterFile, msgFolder, aMsgWindow, getter_AddRefs(mFilterList));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aResult = mFilterList);
|
||||
return NS_OK;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// If the hostname contains ':' (like hostname:1431)
|
||||
// then parse and set the port number.
|
||||
nsresult
|
||||
|
@ -1122,16 +1122,16 @@ nsMsgIncomingServer::InternalSetHostName(const char *aHostname, const char *pref
|
|||
{
|
||||
nsCAutoString newHostname(aHostname);
|
||||
PRInt32 colonPos = newHostname.FindChar(':');
|
||||
|
||||
|
||||
nsCAutoString portString;
|
||||
newHostname.Right(portString, newHostname.Length() - colonPos);
|
||||
|
||||
|
||||
newHostname.Truncate(colonPos);
|
||||
|
||||
|
||||
PRInt32 err;
|
||||
PRInt32 port = portString.ToInteger(&err);
|
||||
if (!err) SetPort(port);
|
||||
|
||||
|
||||
rv = SetCharValue(prefName, newHostname.get());
|
||||
}
|
||||
else
|
||||
|
@ -1201,7 +1201,7 @@ nsMsgIncomingServer::GetHostName(char **aResult)
|
|||
{
|
||||
nsresult rv;
|
||||
rv = GetCharValue("hostname", aResult);
|
||||
if (PL_strchr(*aResult, ':'))
|
||||
if (PL_strchr(*aResult, ':'))
|
||||
{
|
||||
// gack, we need to reformat the hostname - SetHostName will do that
|
||||
SetHostName(*aResult);
|
||||
|
@ -1262,7 +1262,7 @@ nsMsgIncomingServer::GetDoBiff(PRBool *aDoBiff)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aDoBiff);
|
||||
nsresult rv;
|
||||
|
||||
|
||||
rv = mPrefBranch->GetBoolPref(BIFF_PREF_NAME, aDoBiff);
|
||||
if (NS_SUCCEEDED(rv)) return rv;
|
||||
|
||||
|
@ -1297,10 +1297,10 @@ nsMsgIncomingServer::GetPort(PRInt32 *aPort)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aPort);
|
||||
nsresult rv;
|
||||
|
||||
|
||||
rv = GetIntValue("port", aPort);
|
||||
if (*aPort != PORT_NOT_SET) return rv;
|
||||
|
||||
|
||||
// if the port isn't set, use the default
|
||||
// port based on the protocol
|
||||
nsCOMPtr<nsIMsgProtocolInfo> protocolInfo;
|
||||
|
@ -1318,7 +1318,7 @@ NS_IMETHODIMP
|
|||
nsMsgIncomingServer::SetPort(PRInt32 aPort)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgProtocolInfo> protocolInfo;
|
||||
rv = getProtocolInfo(getter_AddRefs(protocolInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1389,7 +1389,7 @@ NS_IMETHODIMP nsMsgIncomingServer::GetRetentionSettings(nsIMsgRetentionSettings
|
|||
}
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
// Create an empty retention settings object,
|
||||
// Create an empty retention settings object,
|
||||
// get the settings from the server prefs, and init the object from the prefs.
|
||||
}
|
||||
*settings = m_retentionSettings;
|
||||
|
@ -1419,7 +1419,7 @@ NS_IMETHODIMP nsMsgIncomingServer::SetRetentionSettings(nsIMsgRetentionSettings
|
|||
rv = SetBoolValue("cleanupBodies", cleanupBodiesByDays);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetDisplayStartupPage(PRBool *displayStartupPage)
|
||||
{
|
||||
|
@ -1457,7 +1457,7 @@ NS_IMETHODIMP nsMsgIncomingServer::GetDownloadSettings(nsIMsgDownloadSettings **
|
|||
}
|
||||
else
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
// Create an empty download settings object,
|
||||
// Create an empty download settings object,
|
||||
// get the settings from the server prefs, and init the object from the prefs.
|
||||
}
|
||||
*settings = m_downloadSettings;
|
||||
|
@ -1493,10 +1493,10 @@ nsMsgIncomingServer::GetOfflineSupportLevel(PRInt32 *aSupportLevel)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aSupportLevel);
|
||||
nsresult rv;
|
||||
|
||||
|
||||
rv = GetIntValue("offline_support_level", aSupportLevel);
|
||||
if (*aSupportLevel != OFFLINE_SUPPORT_LEVEL_UNDEFINED) return rv;
|
||||
|
||||
|
||||
// set default value
|
||||
*aSupportLevel = OFFLINE_SUPPORT_LEVEL_NONE;
|
||||
return NS_OK;
|
||||
|
@ -1540,7 +1540,7 @@ NS_IMETHODIMP nsMsgIncomingServer::DisplayOfflineMsg(nsIMsgWindow *aMsgWindow)
|
|||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GeneratePrettyNameForMigration(PRUnichar **aPrettyName)
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* 4.x had provisions for multiple imap servers to be maintained under
|
||||
* single identity. So, when migrated each of those server accounts need
|
||||
* to be represented by unique account name. nsImapIncomingServer will
|
||||
|
@ -1593,7 +1593,7 @@ NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, UseSecAuth, "useSecAuth")
|
|||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, LogonFallback, "logon_fallback")
|
||||
NS_IMPL_SERVERPREF_INT(nsMsgIncomingServer, BiffMinutes, "check_time")
|
||||
NS_IMPL_SERVERPREF_STR(nsMsgIncomingServer, Type, "type")
|
||||
// in 4.x, this was "mail.pop3_gets_new_mail" for pop and
|
||||
// in 4.x, this was "mail.pop3_gets_new_mail" for pop and
|
||||
// "mail.imap.new_mail_get_headers" for imap (it was global)
|
||||
// in 5.0, this will be per server, and it will be "download_on_biff"
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, DownloadOnBiff, "download_on_biff")
|
||||
|
@ -1603,16 +1603,16 @@ NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, EmptyTrashOnExit,
|
|||
"empty_trash_on_exit")
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, CanDelete, "canDelete")
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer, LoginAtStartUp, "login_at_startup")
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
DefaultCopiesAndFoldersPrefsToServer,
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
DefaultCopiesAndFoldersPrefsToServer,
|
||||
"allows_specialfolders_usage")
|
||||
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
CanCreateFoldersOnServer,
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
CanCreateFoldersOnServer,
|
||||
"canCreateFolders")
|
||||
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
CanFileMessagesOnServer,
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
CanFileMessagesOnServer,
|
||||
"canFileMessages")
|
||||
|
||||
NS_IMPL_SERVERPREF_BOOL(nsMsgIncomingServer,
|
||||
|
@ -1687,7 +1687,7 @@ NS_IMETHODIMP nsMsgIncomingServer::GetSocketType(PRInt32 *aSocketType)
|
|||
}
|
||||
}
|
||||
return rv;
|
||||
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgIncomingServer::SetSocketType(PRInt32 aSocketType)
|
||||
|
@ -1695,9 +1695,9 @@ NS_IMETHODIMP nsMsgIncomingServer::SetSocketType(PRInt32 aSocketType)
|
|||
return mPrefBranch->SetIntPref("socketType", aSocketType);
|
||||
}
|
||||
|
||||
// Check if the password is available and return a boolean indicating whether
|
||||
// Check if the password is available and return a boolean indicating whether
|
||||
// it is being authenticated or not.
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsMsgIncomingServer::GetPasswordPromptRequired(PRBool *aPasswordIsRequired)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1724,7 +1724,7 @@ nsMsgIncomingServer::GetPasswordPromptRequired(PRBool *aPasswordIsRequired)
|
|||
// Get password entry corresponding to the host URI we are passing in.
|
||||
rv = passwordMgrInt->FindPasswordEntry(currServerUri, EmptyString(), EmptyString(),
|
||||
hostFound, userNameFound, passwordFound);
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
*aPasswordIsRequired = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -1732,7 +1732,7 @@ nsMsgIncomingServer::GetPasswordPromptRequired(PRBool *aPasswordIsRequired)
|
|||
|
||||
// If a match is found, password element is filled in. Convert the
|
||||
// obtained password and store it for the session.
|
||||
if (!passwordFound.IsEmpty())
|
||||
if (!passwordFound.IsEmpty())
|
||||
{
|
||||
if (PasswordProtectLocalCache()) // hmm, shouldn't be in here, so remove it.
|
||||
{
|
||||
|
@ -1770,11 +1770,11 @@ nsMsgIncomingServer::ConfigureTemporaryServerSpamFilters(nsIMsgFilterList *filte
|
|||
PRBool useServerFilter;
|
||||
rv = spamSettings->GetUseServerFilter(&useServerFilter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
// if we aren't configured to use server filters, then return early.
|
||||
if (!useServerFilter)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
// For performance reasons, we'll handle clearing of filters if the user turns
|
||||
// off the server-side filters from the junk mail controls, in the junk mail controls.
|
||||
nsCAutoString serverFilterName;
|
||||
|
@ -1813,7 +1813,7 @@ nsMsgIncomingServer::ConfigureTemporaryServerSpamFilters(nsIMsgFilterList *filte
|
|||
|
||||
nsCOMPtr<nsIMsgFilterService> filterService = do_GetService(NS_MSGFILTERSERVICE_CONTRACTID, &rv);
|
||||
nsCOMPtr<nsIMsgFilterList> serverFilterList;
|
||||
|
||||
|
||||
nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(file);
|
||||
rv = filterService->OpenFilterList(localFile, NULL, NULL, getter_AddRefs(serverFilterList));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1880,7 +1880,7 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
|
|||
rv = accountMgr->GetFirstIdentityForServer(this, getter_AddRefs(identity));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// this can return success and a null identity...
|
||||
|
||||
|
||||
PRBool useCustomPrefs = PR_FALSE;
|
||||
PRInt32 incorp = nsIMsgMdnGenerator::eIncorporateInbox;
|
||||
|
||||
|
@ -1921,11 +1921,11 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
|
|||
newFilter->SetEnabled(PR_TRUE);
|
||||
// this internal filter is temporary
|
||||
// and should not show up in the UI or be written to disk
|
||||
newFilter->SetTemporary(PR_TRUE);
|
||||
|
||||
newFilter->SetTemporary(PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIMsgSearchTerm> term;
|
||||
nsCOMPtr<nsIMsgSearchValue> value;
|
||||
|
||||
|
||||
rv = newFilter->CreateTerm(getter_AddRefs(term));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -1936,7 +1936,7 @@ nsMsgIncomingServer::ConfigureTemporaryReturnReceiptsFilter(nsIMsgFilterList *fi
|
|||
// return our custom header.
|
||||
value->SetAttrib(nsMsgSearchAttrib::OtherHeader + 1);
|
||||
value->SetStr(NS_LITERAL_STRING("multipart/report").get());
|
||||
term->SetAttrib(nsMsgSearchAttrib::OtherHeader + 1);
|
||||
term->SetAttrib(nsMsgSearchAttrib::OtherHeader + 1);
|
||||
term->SetOp(nsMsgSearchOp::Contains);
|
||||
term->SetBooleanAnd(PR_TRUE);
|
||||
term->SetArbitraryHeader("Content-Type");
|
||||
|
@ -2001,9 +2001,9 @@ nsMsgIncomingServer::GetMsgFolderFromURI(nsIMsgFolder *aFolderResource, const ch
|
|||
|
||||
nsCOMPtr <nsIMsgFolder> msgFolder;
|
||||
rv = rootMsgFolder->GetChildWithURI(aURI, PR_TRUE, PR_TRUE /*caseInsensitive*/, getter_AddRefs(msgFolder));
|
||||
if (NS_FAILED(rv) || !msgFolder)
|
||||
if (NS_FAILED(rv) || !msgFolder)
|
||||
msgFolder = aFolderResource;
|
||||
|
||||
|
||||
NS_IF_ADDREF(*aFolder = msgFolder);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2037,7 +2037,7 @@ nsMsgIncomingServer::GetSpamFilterPlugin(nsIMsgFilterPlugin **aFilterPlugin)
|
|||
// get the plugin service
|
||||
mFilterPlugin = do_GetService("@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter", &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -2051,7 +2051,7 @@ nsMsgIncomingServer::GetSpamFilterPlugin(nsIMsgFilterPlugin **aFilterPlugin)
|
|||
nsresult nsMsgIncomingServer::GetDeferredServers(nsIMsgIncomingServer *destServer, nsISupportsArray **_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager
|
||||
= do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsISupportsArray> servers;
|
||||
|
@ -2063,8 +2063,8 @@ nsresult nsMsgIncomingServer::GetDeferredServers(nsIMsgIncomingServer *destServe
|
|||
if (thisAccount)
|
||||
{
|
||||
nsCOMPtr <nsISupportsArray> allServers;
|
||||
nsXPIDLCString accountKey;
|
||||
thisAccount->GetKey(getter_Copies(accountKey));
|
||||
nsCString accountKey;
|
||||
thisAccount->GetKey(accountKey);
|
||||
accountManager->GetAllServers(getter_AddRefs(allServers));
|
||||
if (allServers)
|
||||
{
|
||||
|
@ -2075,7 +2075,7 @@ nsresult nsMsgIncomingServer::GetDeferredServers(nsIMsgIncomingServer *destServe
|
|||
nsCOMPtr <nsIMsgIncomingServer> server (do_QueryElementAt(allServers, i));
|
||||
if (server)
|
||||
{
|
||||
nsXPIDLCString deferredToAccount;
|
||||
nsCString deferredToAccount;
|
||||
server->GetCharValue("deferred_to_account", getter_Copies(deferredToAccount));
|
||||
if (deferredToAccount.Equals(accountKey))
|
||||
servers->AppendElement(server);
|
||||
|
@ -2091,7 +2091,7 @@ nsresult nsMsgIncomingServer::GetDeferredServers(nsIMsgIncomingServer *destServe
|
|||
NS_IMETHODIMP nsMsgIncomingServer::GetIsDeferredTo(PRBool *aIsDeferredTo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsDeferredTo);
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager
|
||||
nsCOMPtr<nsIMsgAccountManager> accountManager
|
||||
= do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID);
|
||||
if (accountManager)
|
||||
{
|
||||
|
@ -2100,8 +2100,8 @@ NS_IMETHODIMP nsMsgIncomingServer::GetIsDeferredTo(PRBool *aIsDeferredTo)
|
|||
if (thisAccount)
|
||||
{
|
||||
nsCOMPtr <nsISupportsArray> allServers;
|
||||
nsXPIDLCString accountKey;
|
||||
thisAccount->GetKey(getter_Copies(accountKey));
|
||||
nsCString accountKey;
|
||||
thisAccount->GetKey(accountKey);
|
||||
accountManager->GetAllServers(getter_AddRefs(allServers));
|
||||
if (allServers)
|
||||
{
|
||||
|
@ -2112,7 +2112,7 @@ NS_IMETHODIMP nsMsgIncomingServer::GetIsDeferredTo(PRBool *aIsDeferredTo)
|
|||
nsCOMPtr <nsIMsgIncomingServer> server (do_QueryElementAt(allServers, i));
|
||||
if (server)
|
||||
{
|
||||
nsXPIDLCString deferredToAccount;
|
||||
nsCString deferredToAccount;
|
||||
server->GetCharValue("deferred_to_account", getter_Copies(deferredToAccount));
|
||||
if (deferredToAccount.Equals(accountKey))
|
||||
{
|
||||
|
@ -2140,7 +2140,7 @@ const long kMaxDownloadTableSize = 500;
|
|||
return server->m_downloadedHdrs.Count() > kMaxDownloadTableSize/2;
|
||||
}
|
||||
|
||||
// hash the concatenation of the message-id and subject as the hash table key,
|
||||
// hash the concatenation of the message-id and subject as the hash table key,
|
||||
// and store the arrival index as the value. To limit the size of the hash table,
|
||||
// we just throw out ones with a lower ordinal value than the cut-off point.
|
||||
NS_IMETHODIMP nsMsgIncomingServer::IsNewHdrDuplicate(nsIMsgDBHdr *aNewHdr, PRBool *aResult)
|
||||
|
|
|
@ -153,7 +153,7 @@ NS_IMETHODIMP nsOESettings::SetLocation(nsIFile *location)
|
|||
NS_IMETHODIMP nsOESettings::Import(nsIMsgAccount **localMailAccount, PRBool *_retval)
|
||||
{
|
||||
NS_PRECONDITION( _retval != nsnull, "null ptr");
|
||||
|
||||
|
||||
if (OESettings::DoImport( localMailAccount)) {
|
||||
*_retval = PR_TRUE;
|
||||
IMPORT_LOG0( "Settings import appears successful\n");
|
||||
|
@ -219,8 +219,8 @@ PRBool OESettings::DoImport( nsIMsgAccount **ppAccount)
|
|||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accMgr =
|
||||
|
||||
nsCOMPtr<nsIMsgAccountManager> accMgr =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
IMPORT_LOG0( "*** Failed to create a account manager!\n");
|
||||
|
@ -295,7 +295,7 @@ PRBool OESettings::DoImport( nsIMsgAccount **ppAccount)
|
|||
}
|
||||
nsOERegUtil::FreeValueBytes( pBytes);
|
||||
}
|
||||
|
||||
|
||||
if (anAccount) {
|
||||
// Is this the default account?
|
||||
keyComp = keyName;
|
||||
|
@ -353,7 +353,7 @@ PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
|
|||
rv = in->SetType( "imap");
|
||||
// rv = in->SetHostName( pServerName);
|
||||
// rv = in->SetUsername( (char *)pBytes);
|
||||
|
||||
|
||||
IMPORT_LOG2( "Created IMAP server named: %s, userName: %s\n", pServerName, (char *)pBytes);
|
||||
|
||||
nsString prettyName;
|
||||
|
@ -366,13 +366,13 @@ PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
|
|||
nsCRT::free( pretty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We have a server, create an account.
|
||||
nsCOMPtr<nsIMsgAccount> account;
|
||||
rv = pMgr->CreateAccount( getter_AddRefs( account));
|
||||
if (NS_SUCCEEDED( rv) && account) {
|
||||
rv = account->SetIncomingServer( in);
|
||||
|
||||
rv = account->SetIncomingServer( in);
|
||||
|
||||
IMPORT_LOG0( "Created an account and set the IMAP server as the incoming server\n");
|
||||
|
||||
// Fiddle with the identities
|
||||
|
@ -380,12 +380,12 @@ PRBool OESettings::DoIMAPServer( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
|
|||
result = PR_TRUE;
|
||||
if (ppAccount)
|
||||
account->QueryInterface( NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
result = PR_TRUE;
|
||||
|
||||
|
||||
nsOERegUtil::FreeValueBytes( pBytes);
|
||||
|
||||
return( result);
|
||||
|
@ -431,24 +431,24 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
|
|||
IMPORT_LOG0( "*** Failed to create messenger migrator!\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
rv = messengerMigrator->CreateLocalMailAccount(PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
IMPORT_LOG0( "*** Failed to create Local Folders!\n");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
pMgr->GetLocalFoldersServer(getter_AddRefs(localFoldersServer));
|
||||
|
||||
pMgr->GetLocalFoldersServer(getter_AddRefs(localFoldersServer));
|
||||
}
|
||||
|
||||
// now get the account for this server
|
||||
nsCOMPtr<nsIMsgAccount> localFoldersAccount;
|
||||
pMgr->FindAccountForServer(localFoldersServer, getter_AddRefs(localFoldersAccount));
|
||||
pMgr->FindAccountForServer(localFoldersServer, getter_AddRefs(localFoldersAccount));
|
||||
if (localFoldersAccount)
|
||||
{
|
||||
nsXPIDLCString localFoldersAcctKey;
|
||||
localFoldersAccount->GetKey(getter_Copies(localFoldersAcctKey));
|
||||
pop3Server->SetDeferredToAccount(localFoldersAcctKey.get());
|
||||
nsCString localFoldersAcctKey;
|
||||
localFoldersAccount->GetKey(localFoldersAcctKey);
|
||||
pop3Server->SetDeferredToAccount(localFoldersAcctKey.get());
|
||||
pop3Server->SetDeferGetNewMail(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -465,14 +465,14 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
|
|||
nsCRT::free( pretty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// We have a server, create an account.
|
||||
nsCOMPtr<nsIMsgAccount> account;
|
||||
rv = pMgr->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<nsIPop3IncomingServer> pop3Server = do_QueryInterface(in, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
BYTE *pLeaveOnServer = nsOERegUtil::GetValueBytes( hKey, "Leave Mail On Server");
|
||||
|
@ -487,12 +487,12 @@ PRBool OESettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, char *pS
|
|||
result = PR_TRUE;
|
||||
if (ppAccount)
|
||||
account->QueryInterface( NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
result = PR_TRUE;
|
||||
|
||||
|
||||
nsOERegUtil::FreeValueBytes( pBytes);
|
||||
|
||||
return( result);
|
||||
|
@ -563,7 +563,7 @@ void OESettings::SetIdentities( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
|
|||
id->SetReplyTo(nsCString(pReply));
|
||||
|
||||
// Outlook Express users are used to top style quoting.
|
||||
id->SetReplyOnTop(1);
|
||||
id->SetReplyOnTop(1);
|
||||
pAcc->AddIdentity(id);
|
||||
|
||||
IMPORT_LOG0("Created identity and added to the account\n");
|
||||
|
@ -575,7 +575,7 @@ void OESettings::SetIdentities( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
|
|||
if (!pUserName) {
|
||||
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
|
||||
rv = pAcc->GetIncomingServer(getter_AddRefs(incomingServer));
|
||||
if (NS_SUCCEEDED(rv) && incomingServer)
|
||||
if (NS_SUCCEEDED(rv) && incomingServer)
|
||||
rv = incomingServer->GetUsername(&pUserName);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to get UserName from incomingServer");
|
||||
}
|
||||
|
@ -594,17 +594,17 @@ void OESettings::SetSmtpServer( nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
|
|||
nsresult rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsISmtpService> smtpService(do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv));
|
||||
nsCOMPtr<nsISmtpService> smtpService(do_GetService(NS_SMTPSERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv) && smtpService) {
|
||||
nsCOMPtr<nsISmtpServer> foundServer;
|
||||
|
||||
|
||||
rv = smtpService->FindServer( pUser, pServer, getter_AddRefs( foundServer));
|
||||
if (NS_SUCCEEDED( rv) && foundServer) {
|
||||
IMPORT_LOG1( "SMTP server already exists: %s\n", pServer);
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsISmtpServer> smtpServer;
|
||||
|
||||
|
||||
rv = smtpService->CreateSmtpServer( getter_AddRefs( smtpServer));
|
||||
if (NS_SUCCEEDED( rv) && smtpServer) {
|
||||
smtpServer->SetHostname( pServer);
|
||||
|
|
|
@ -401,8 +401,8 @@ PRBool OutlookSettings::DoPOP3Server( nsIMsgAccountManager *pMgr, HKEY hKey, cha
|
|||
pMgr->FindAccountForServer(localFoldersServer, getter_AddRefs(localFoldersAccount));
|
||||
if (localFoldersAccount)
|
||||
{
|
||||
nsXPIDLCString localFoldersAcctKey;
|
||||
localFoldersAccount->GetKey(getter_Copies(localFoldersAcctKey));
|
||||
nsCString localFoldersAcctKey;
|
||||
localFoldersAccount->GetKey(localFoldersAcctKey);
|
||||
pop3Server->SetDeferredToAccount(localFoldersAcctKey.get());
|
||||
pop3Server->SetDeferGetNewMail(PR_TRUE);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ nsPop3Sink::SetUserAuthenticated(PRBool authed)
|
|||
if (authed)
|
||||
{
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_popServer);
|
||||
if (!server)
|
||||
if (!server)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
return server->StorePassword();
|
||||
}
|
||||
|
@ -127,10 +127,10 @@ nsresult
|
|||
nsPop3Sink::SetSenderAuthedFlag(void* closure, PRBool authed)
|
||||
{
|
||||
m_authed = authed;
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPop3Sink::SetMailAccountURL(const char* urlString)
|
||||
{
|
||||
if (urlString)
|
||||
|
@ -169,7 +169,7 @@ partialRecord::partialRecord() :
|
|||
partialRecord::~partialRecord()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Walk through all the messages in this folder and look for any
|
||||
// PARTIAL messages. For each of those, dig thru the mailbox and
|
||||
// find the Account that the message belongs to. If that Account
|
||||
|
@ -217,8 +217,7 @@ nsPop3Sink::FindPartialMessages(nsILocalFile *folderFile)
|
|||
|
||||
// If we got the uidl, see if this partial message belongs to this
|
||||
// account. Add it to the array if so...
|
||||
if (folderScanState.m_uidl &&
|
||||
!nsCRT::strcasecmp(folderScanState.m_accountKey.get(), m_accountKey))
|
||||
if (folderScanState.m_uidl && m_accountKey.Equals(folderScanState.m_accountKey, nsCaseInsensitiveCStringComparator()))
|
||||
{
|
||||
partialRecord *partialMsg = new partialRecord();
|
||||
if (partialMsg)
|
||||
|
@ -267,7 +266,7 @@ nsPop3Sink::CheckPartialMessages(nsIPop3Protocol *protocol)
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRBool* aBool)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -275,9 +274,9 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
#endif
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_popServer);
|
||||
if (!server)
|
||||
if (!server)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr <nsIMsgAccountManager> acctMgr = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
|
@ -285,7 +284,7 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
acctMgr->FindAccountForServer(server, getter_AddRefs(account));
|
||||
if (account)
|
||||
account->GetKey(getter_Copies(m_accountKey));
|
||||
account->GetKey(m_accountKey);
|
||||
|
||||
PRBool isLocked;
|
||||
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIPop3Sink*, this));
|
||||
|
@ -312,7 +311,7 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
getter_AddRefs(tmpDownloadFile));
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"writing tmp pop3 download file: failed to append filename");
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = tmpDownloadFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600); //need a unique tmp file to prevent dataloss in multiuser environment
|
||||
|
@ -328,15 +327,15 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
rv = MsgGetFileStream(path, getter_AddRefs(m_outFileStream));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
|
||||
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
|
||||
// where for some reason or another we can't write to and lose the messages
|
||||
// See bug 62480
|
||||
if (!m_outFileStream)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
nsCOMPtr <nsISeekableStream> seekableOutStream = do_QueryInterface(m_outFileStream);
|
||||
seekableOutStream->Seek(nsISeekableStream::NS_SEEK_END, 0);
|
||||
|
||||
|
||||
// create a new mail parser
|
||||
m_newMailParser = new nsParseNewMailState;
|
||||
NS_IF_ADDREF(m_newMailParser);
|
||||
|
@ -349,7 +348,7 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr <nsIInputStream> inboxInputStream = do_QueryInterface(m_outFileStream);
|
||||
rv = m_newMailParser->Init(serverFolder, m_folder, (m_downloadingToTempFile) ? m_tmpDownloadFile : path,
|
||||
rv = m_newMailParser->Init(serverFolder, m_folder, (m_downloadingToTempFile) ? m_tmpDownloadFile : path,
|
||||
inboxInputStream, aMsgWindow, m_downloadingToTempFile);
|
||||
// if we failed to initialize the parser, then just don't use it!!!
|
||||
// we can still continue without one...
|
||||
|
@ -359,10 +358,10 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
NS_IF_RELEASE(m_newMailParser);
|
||||
rv = NS_OK;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Share the inbox fileStream so that moz-status-line flags can be set in the Inbox
|
||||
m_newMailParser->SetDBFolderStream(m_outFileStream);
|
||||
// Share the inbox fileStream so that moz-status-line flags can be set in the Inbox
|
||||
m_newMailParser->SetDBFolderStream(m_outFileStream);
|
||||
if (m_downloadingToTempFile)
|
||||
{
|
||||
// Tell the parser to use the offset that will be in the dest folder,
|
||||
|
@ -384,7 +383,7 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, nsIMsgWindow *aMsgWindow, PRB
|
|||
|
||||
#ifdef DEBUG
|
||||
printf("Begin mail message delivery.\n");
|
||||
#endif
|
||||
#endif
|
||||
if (aBool)
|
||||
*aBool = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -422,7 +421,7 @@ nsPop3Sink::EndMailDelivery(nsIPop3Protocol *protocol)
|
|||
PRBool filtersRun;
|
||||
m_folder->CallFilterPlugins(nsnull, &filtersRun); // ??? do we need msgWindow?
|
||||
PRInt32 numNewMessagesInFolder;
|
||||
// if filters have marked msgs read or deleted, the num new messages count
|
||||
// if filters have marked msgs read or deleted, the num new messages count
|
||||
// will go negative by the number of messages marked read or deleted,
|
||||
// so if we add that number to the number of msgs downloaded, that will give
|
||||
// us the number of actual new messages.
|
||||
|
@ -445,10 +444,10 @@ nsPop3Sink::EndMailDelivery(nsIPop3Protocol *protocol)
|
|||
if (localFolder)
|
||||
(void) localFolder->RefreshSizeOnDisk();
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_popServer);
|
||||
if (server)
|
||||
if (server)
|
||||
{
|
||||
nsCOMPtr <nsIMsgFilterList> filterList;
|
||||
rv = server->GetFilterList(nsnull, getter_AddRefs(filterList));
|
||||
rv = server->GetFilterList(nsnull, getter_AddRefs(filterList));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (filterList)
|
||||
|
@ -459,7 +458,7 @@ nsPop3Sink::EndMailDelivery(nsIPop3Protocol *protocol)
|
|||
// we should update the summary totals for the folder (inbox)
|
||||
// in case it's not the open folder
|
||||
m_folder->UpdateSummaryTotals(PR_TRUE);
|
||||
|
||||
|
||||
// check if the folder open in this window is not the current folder, and if it has new
|
||||
// message, in which case we need to try to run the filter plugin.
|
||||
if (m_newMailParser)
|
||||
|
@ -498,15 +497,15 @@ nsPop3Sink::EndMailDelivery(nsIPop3Protocol *protocol)
|
|||
}
|
||||
#ifdef DEBUG
|
||||
printf("End mail message delivery.\n");
|
||||
#endif
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPop3Sink::ReleaseFolderLock()
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (!m_folder)
|
||||
if (!m_folder)
|
||||
return result;
|
||||
PRBool haveSemaphore;
|
||||
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIPop3Sink*, this));
|
||||
|
@ -516,7 +515,7 @@ nsPop3Sink::ReleaseFolderLock()
|
|||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsresult
|
||||
nsPop3Sink::AbortMailDelivery(nsIPop3Protocol *protocol)
|
||||
{
|
||||
CheckPartialMessages(protocol);
|
||||
|
@ -545,7 +544,7 @@ nsPop3Sink::AbortMailDelivery(nsIPop3Protocol *protocol)
|
|||
|
||||
#ifdef DEBUG
|
||||
printf("Abort mail message delivery.\n");
|
||||
#endif
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -559,34 +558,36 @@ nsPop3Sink::IncorporateBegin(const char* uidlString,
|
|||
printf("Incorporate message begin:\n");
|
||||
if (uidlString)
|
||||
printf("uidl string: %s\n", uidlString);
|
||||
#endif
|
||||
#endif
|
||||
if (closure)
|
||||
*closure = (void*) this;
|
||||
nsCOMPtr <nsISeekableStream> seekableStream = do_QueryInterface(m_outFileStream);
|
||||
PRInt64 filePos;
|
||||
seekableStream->Tell(&filePos);
|
||||
m_msgOffset = (PRUint32) filePos;
|
||||
|
||||
|
||||
char *dummyEnvelope = GetDummyEnvelope();
|
||||
|
||||
|
||||
nsresult rv = WriteLineToMailbox(dummyEnvelope);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// write out account-key before UIDL so the code that looks for
|
||||
// write out account-key before UIDL so the code that looks for
|
||||
// UIDL will find the account first and know it can stop looking
|
||||
// once it finds the UIDL line.
|
||||
if (!m_accountKey.IsEmpty())
|
||||
{
|
||||
nsCAutoString outputString(NS_LITERAL_CSTRING(HEADER_X_MOZILLA_ACCOUNT_KEY ": ") + m_accountKey
|
||||
+ NS_LITERAL_CSTRING(MSG_LINEBREAK));
|
||||
nsCAutoString outputString;
|
||||
outputString.AssignLiteral(HEADER_X_MOZILLA_ACCOUNT_KEY ": ");
|
||||
outputString.Append(m_accountKey);
|
||||
outputString.AppendLiteral(MSG_LINEBREAK);
|
||||
WriteLineToMailbox(outputString.get());
|
||||
}
|
||||
if (uidlString)
|
||||
{
|
||||
nsCAutoString uidlCString("X-UIDL: ");
|
||||
uidlCString += uidlString;
|
||||
uidlCString += MSG_LINEBREAK;
|
||||
rv = WriteLineToMailbox(NS_CONST_CAST(char*, uidlCString.get()));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCAutoString uidlCString("X-UIDL: ");
|
||||
uidlCString += uidlString;
|
||||
uidlCString += MSG_LINEBREAK;
|
||||
rv = WriteLineToMailbox(NS_CONST_CAST(char*, uidlCString.get()));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
// WriteLineToMailbox("X-Mozilla-Status: 8000" MSG_LINEBREAK);
|
||||
char *statusLine = PR_smprintf(X_MOZILLA_STATUS_FORMAT MSG_LINEBREAK, flags);
|
||||
|
@ -606,7 +607,7 @@ nsPop3Sink::SetPopServer(nsIPop3IncomingServer *server)
|
|||
NS_IF_RELEASE(m_popServer);
|
||||
m_popServer=server;
|
||||
NS_ADDREF(m_popServer);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -631,14 +632,14 @@ nsresult nsPop3Sink::SetFolder(nsIMsgFolder * folder)
|
|||
NS_IF_RELEASE(m_folder);
|
||||
m_folder=folder;
|
||||
NS_IF_ADDREF(m_folder);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPop3Sink::GetServerFolder(nsIMsgFolder **aFolder)
|
||||
{
|
||||
if (!aFolder)
|
||||
if (!aFolder)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (m_popServer)
|
||||
{
|
||||
|
@ -688,7 +689,7 @@ nsPop3Sink::IncorporateWrite(const char* block,
|
|||
m_outputBuffer = (char*) PR_MALLOC(length+1);
|
||||
else
|
||||
m_outputBuffer = (char*) PR_REALLOC(m_outputBuffer, length+1);
|
||||
|
||||
|
||||
m_outputBufferSize = length;
|
||||
}
|
||||
if (m_outputBuffer)
|
||||
|
@ -705,18 +706,18 @@ nsPop3Sink::IncorporateWrite(const char* block,
|
|||
|
||||
nsresult nsPop3Sink::WriteLineToMailbox(const char *buffer)
|
||||
{
|
||||
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
PRInt32 bufferLen = PL_strlen(buffer);
|
||||
if (m_newMailParser) // HandleLine should really take a const char *...
|
||||
m_newMailParser->HandleLine((char *) buffer, bufferLen);
|
||||
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
|
||||
// The following (!m_outFileStream etc) was added to make sure that we don't write somewhere
|
||||
// where for some reason or another we can't write to and lose the messages
|
||||
// See bug 62480
|
||||
if (!m_outFileStream)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
// seek to the end in case someone else has seeked elsewhere in our stream.
|
||||
nsCOMPtr <nsISeekableStream> seekableOutStream = do_QueryInterface(m_outFileStream);
|
||||
seekableOutStream->Seek(nsISeekableStream::NS_SEEK_END, 0);
|
||||
|
@ -770,12 +771,12 @@ nsresult nsPop3Sink::HandleTempDownloadFailed(nsIMsgWindow *msgWindow)
|
|||
NS_IMETHODIMP
|
||||
nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
||||
{
|
||||
if (m_buildMessageUri && m_baseMessageUri)
|
||||
if (m_buildMessageUri && !m_baseMessageUri.IsEmpty())
|
||||
{
|
||||
PRUint32 msgKey;
|
||||
m_newMailParser->GetEnvelopePos(&msgKey);
|
||||
m_messageUri.SetLength(0);
|
||||
nsBuildLocalMessageURI(m_baseMessageUri, msgKey, m_messageUri);
|
||||
PRUint32 msgKey;
|
||||
m_newMailParser->GetEnvelopePos(&msgKey);
|
||||
m_messageUri.SetLength(0);
|
||||
nsBuildLocalMessageURI(m_baseMessageUri.get(), msgKey, m_messageUri);
|
||||
}
|
||||
|
||||
nsresult rv = WriteLineToMailbox(MSG_LINEBREAK);
|
||||
|
@ -785,7 +786,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
NS_ASSERTION(m_newMailParser, "could not get m_newMailParser");
|
||||
if (m_newMailParser)
|
||||
{
|
||||
// PublishMsgHdr clears m_newMsgHdr, so we need a comptr to
|
||||
// PublishMsgHdr clears m_newMsgHdr, so we need a comptr to
|
||||
// hold onto it.
|
||||
nsCOMPtr <nsIMsgDBHdr> hdr = m_newMailParser->m_newMsgHdr;
|
||||
nsCOMPtr<nsIMsgLocalMailFolder> localFolder = do_QueryInterface(m_folder);
|
||||
|
@ -807,7 +808,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
PRBool exists;
|
||||
m_tmpDownloadFile->Exists(&exists);
|
||||
if (!exists)
|
||||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
|
||||
nsCOMPtr <nsIInputStream> inboxInputStream = do_QueryInterface(m_outFileStream);
|
||||
rv = MsgReopenFileStream(m_tmpDownloadFile, inboxInputStream);
|
||||
|
@ -816,7 +817,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
hdr->GetMessageKey(&saveMsgKey);
|
||||
// this is the offset in the temp file, which we need to be correct
|
||||
// when applying filters;
|
||||
hdr->SetMessageKey(0);
|
||||
hdr->SetMessageKey(0);
|
||||
m_newMailParser->ApplyFilters(&moved, aMsgWindow, 0);
|
||||
// restore the msg key so that we don't confuse the msg hdr
|
||||
// use cache, which requires the hdr to have the same msg key when put
|
||||
|
@ -837,13 +838,13 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
hdr->GetMessageSize(&msgSize);
|
||||
hdr->SetMessageKey(newMsgPos);
|
||||
m_tmpDownloadFile->GetFileSize(&tmpDownloadFileSize);
|
||||
|
||||
|
||||
if (msgSize > tmpDownloadFileSize)
|
||||
rv = NS_MSG_ERROR_WRITING_MAIL_FOLDER;
|
||||
rv = NS_MSG_ERROR_WRITING_MAIL_FOLDER;
|
||||
else
|
||||
rv = m_newMailParser->AppendMsgFromFile(inboxInputStream, 0, msgSize, path);
|
||||
if (NS_FAILED(rv))
|
||||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
|
||||
// if we have made it this far then the message has successfully been written to the new folder
|
||||
// now add the header to the destMailDB.
|
||||
|
@ -867,7 +868,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
}
|
||||
else
|
||||
{
|
||||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
return HandleTempDownloadFailed(aMsgWindow);
|
||||
// need to give an error here.
|
||||
}
|
||||
}
|
||||
|
@ -891,7 +892,7 @@ nsPop3Sink::IncorporateComplete(nsIMsgWindow *aMsgWindow, PRInt32 aSize)
|
|||
rv = MsgReopenFileStream(m_tmpDownloadFile, inboxInputStream);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else
|
||||
m_newMailParser->PublishMsgHeader(aMsgWindow);
|
||||
m_newMailParser->PublishMsgHeader(aMsgWindow);
|
||||
// run any reply/forward filter after we've finished with the
|
||||
// temp quarantine file, and/or moved the message to another folder.
|
||||
m_newMailParser->ApplyForwardAndReplyFilter(aMsgWindow);
|
||||
|
@ -934,7 +935,7 @@ nsPop3Sink::IncorporateAbort(PRBool uidlDownload)
|
|||
}
|
||||
#ifdef DEBUG
|
||||
printf("Incorporate message abort.\n");
|
||||
#endif
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -943,7 +944,7 @@ nsPop3Sink::BiffGetNewMail()
|
|||
{
|
||||
#ifdef DEBUG
|
||||
printf("Biff get new mail.\n");
|
||||
#endif
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -954,7 +955,7 @@ nsPop3Sink::SetBiffStateAndUpdateFE(PRUint32 aBiffState, PRInt32 numNewMessages,
|
|||
if (m_newMailParser)
|
||||
numNewMessages -= m_newMailParser->m_numNotNewMessages;
|
||||
|
||||
if (notify && m_folder && numNewMessages > 0 && numNewMessages != m_numNewMessages
|
||||
if (notify && m_folder && numNewMessages > 0 && numNewMessages != m_numNewMessages
|
||||
&& aBiffState == nsIMsgFolder::nsMsgBiffState_NewMail)
|
||||
{
|
||||
m_folder->SetNumNewMessages(numNewMessages);
|
||||
|
@ -968,51 +969,48 @@ nsPop3Sink::SetBiffStateAndUpdateFE(PRUint32 aBiffState, PRInt32 numNewMessages,
|
|||
NS_IMETHODIMP
|
||||
nsPop3Sink::GetBuildMessageUri(PRBool *bVal)
|
||||
{
|
||||
if (!bVal)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*bVal = m_buildMessageUri;
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(bVal);
|
||||
*bVal = m_buildMessageUri;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Sink::SetBuildMessageUri(PRBool bVal)
|
||||
{
|
||||
m_buildMessageUri = bVal;
|
||||
return NS_OK;
|
||||
m_buildMessageUri = bVal;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Sink::GetMessageUri(char **messageUri)
|
||||
{
|
||||
if (!messageUri || m_messageUri.Length() <= 0)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*messageUri = ToNewCString(m_messageUri);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(messageUri);
|
||||
NS_ENSURE_TRUE(!m_messageUri.IsEmpty(), NS_ERROR_FAILURE);
|
||||
*messageUri = ToNewCString(m_messageUri);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Sink::SetMessageUri(const char *messageUri)
|
||||
{
|
||||
if (!messageUri)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
m_messageUri = messageUri;
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(messageUri);
|
||||
m_messageUri = messageUri;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Sink::GetBaseMessageUri(char **baseMessageUri)
|
||||
nsPop3Sink::GetBaseMessageUri(char ** baseMessageUri)
|
||||
{
|
||||
if (!baseMessageUri || !m_baseMessageUri)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*baseMessageUri = nsCRT::strdup((const char *) m_baseMessageUri);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(baseMessageUri);
|
||||
NS_ENSURE_TRUE(!m_baseMessageUri.IsEmpty(), NS_ERROR_FAILURE);
|
||||
*baseMessageUri = ToNewCString(m_baseMessageUri);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Sink::SetBaseMessageUri(const char *baseMessageUri)
|
||||
{
|
||||
if (!baseMessageUri)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
m_baseMessageUri.Adopt(nsCRT::strdup(baseMessageUri));
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(baseMessageUri);
|
||||
m_baseMessageUri = baseMessageUri;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "plstr.h"
|
||||
#include "prenv.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
class nsParseNewMailState;
|
||||
class nsIMsgFolder;
|
||||
|
@ -59,9 +58,9 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPOP3SINK
|
||||
nsresult GetServerFolder(nsIMsgFolder **aFolder);
|
||||
nsresult FindPartialMessages(nsILocalFile *folderFile);
|
||||
void CheckPartialMessages(nsIPop3Protocol *protocol);
|
||||
nsresult GetServerFolder(nsIMsgFolder **aFolder);
|
||||
nsresult FindPartialMessages(nsILocalFile *folderFile);
|
||||
void CheckPartialMessages(nsIPop3Protocol *protocol);
|
||||
|
||||
static char* GetDummyEnvelope(void);
|
||||
|
||||
|
@ -92,8 +91,8 @@ protected:
|
|||
PRBool m_downloadingToTempFile;
|
||||
nsCOMPtr <nsILocalFile> m_tmpDownloadFile;
|
||||
nsCString m_messageUri;
|
||||
nsXPIDLCString m_baseMessageUri;
|
||||
nsXPIDLCString m_accountKey;
|
||||
nsCString m_baseMessageUri;
|
||||
nsCString m_accountKey;
|
||||
nsVoidArray m_partialMsgsArray;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче