зеркало из https://github.com/mozilla/pjs.git
remove more xpidl strings, 379070, sr=mscott
This commit is contained in:
Родитель
8b851f9773
Коммит
3d0478f569
|
@ -183,7 +183,6 @@ nsMsgDBFolder::nsMsgDBFolder(void)
|
||||||
mHaveParsedURI(PR_FALSE),
|
mHaveParsedURI(PR_FALSE),
|
||||||
mIsServerIsValid(PR_FALSE),
|
mIsServerIsValid(PR_FALSE),
|
||||||
mIsServer(PR_FALSE),
|
mIsServer(PR_FALSE),
|
||||||
mBaseMessageURI(nsnull),
|
|
||||||
mInVFEditSearchScope (PR_FALSE)
|
mInVFEditSearchScope (PR_FALSE)
|
||||||
{
|
{
|
||||||
NS_NewISupportsArray(getter_AddRefs(mSubFolders));
|
NS_NewISupportsArray(getter_AddRefs(mSubFolders));
|
||||||
|
@ -200,8 +199,6 @@ nsMsgDBFolder::nsMsgDBFolder(void)
|
||||||
|
|
||||||
nsMsgDBFolder::~nsMsgDBFolder(void)
|
nsMsgDBFolder::~nsMsgDBFolder(void)
|
||||||
{
|
{
|
||||||
CRTFREEIF(mBaseMessageURI);
|
|
||||||
|
|
||||||
if (--mInstanceCount == 0) {
|
if (--mInstanceCount == 0) {
|
||||||
NS_IF_RELEASE(gCollationKeyGenerator);
|
NS_IF_RELEASE(gCollationKeyGenerator);
|
||||||
CRTFREEIF(kLocalizedInboxName);
|
CRTFREEIF(kLocalizedInboxName);
|
||||||
|
@ -4845,10 +4842,10 @@ NS_IMETHODIMP nsMsgDBFolder::GetBaseMessageURI(char **baseMessageURI)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(baseMessageURI);
|
NS_ENSURE_ARG_POINTER(baseMessageURI);
|
||||||
|
|
||||||
if (!mBaseMessageURI)
|
if (mBaseMessageURI.IsEmpty())
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
*baseMessageURI = nsCRT::strdup(mBaseMessageURI);
|
*baseMessageURI = ToNewCString(mBaseMessageURI);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ protected:
|
||||||
PRBool mIsServer;
|
PRBool mIsServer;
|
||||||
nsString mName;
|
nsString mName;
|
||||||
nsCOMPtr<nsILocalFile> mPath;
|
nsCOMPtr<nsILocalFile> mPath;
|
||||||
char * mBaseMessageURI; //The uri with the message scheme
|
nsCString mBaseMessageURI; //The uri with the message scheme
|
||||||
|
|
||||||
PRBool mInVFEditSearchScope ; // non persistant state used by the virtual folder UI
|
PRBool mInVFEditSearchScope ; // non persistant state used by the virtual folder UI
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ PRInt32 nsIMAPBodyShell::Generate(char *partNum)
|
||||||
PRUint32 messageSize = m_protocolConnection->GetMessageSize(GetUID().get(), PR_TRUE);
|
PRUint32 messageSize = m_protocolConnection->GetMessageSize(GetUID().get(), PR_TRUE);
|
||||||
m_protocolConnection->SetContentModified(IMAP_CONTENT_NOT_MODIFIED); // So that when we cache it, we know we have the whole message
|
m_protocolConnection->SetContentModified(IMAP_CONTENT_NOT_MODIFIED); // So that when we cache it, we know we have the whole message
|
||||||
if (!DeathSignalReceived())
|
if (!DeathSignalReceived())
|
||||||
m_protocolConnection->FallbackToFetchWholeMsg(GetUID().get(), messageSize);
|
m_protocolConnection->FallbackToFetchWholeMsg(GetUID(), messageSize);
|
||||||
contentLength = (PRInt32) messageSize; // ugh
|
contentLength = (PRInt32) messageSize; // ugh
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -502,7 +502,7 @@ PRInt32 nsIMAPBodypart::GeneratePart(nsIMAPBodyShell *aShell, PRBool stream, PRB
|
||||||
PRBool fetchingSpecificPart = (generatingPart && !PL_strcmp(generatingPart, m_partNumberString));
|
PRBool fetchingSpecificPart = (generatingPart && !PL_strcmp(generatingPart, m_partNumberString));
|
||||||
|
|
||||||
aShell->GetConnection()->Log("SHELL","GENERATE-Part-Inline",m_partNumberString);
|
aShell->GetConnection()->Log("SHELL","GENERATE-Part-Inline",m_partNumberString);
|
||||||
aShell->GetConnection()->FetchTryChunking(aShell->GetUID().get(), kMIMEPart, PR_TRUE, m_partNumberString, m_partLength, !fetchingSpecificPart);
|
aShell->GetConnection()->FetchTryChunking(aShell->GetUID(), kMIMEPart, PR_TRUE, m_partNumberString, m_partLength, !fetchingSpecificPart);
|
||||||
}
|
}
|
||||||
return m_partLength; // the part length has been filled in from the BODYSTRUCTURE response
|
return m_partLength; // the part length has been filled in from the BODYSTRUCTURE response
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
#include "nsMsgFolderFlags.h"
|
#include "nsMsgFolderFlags.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIMsgFolder.h"
|
#include "nsIMsgFolder.h"
|
||||||
#include "nsIMsgWindow.h"
|
#include "nsIMsgWindow.h"
|
||||||
#include "nsIMsgImapMailFolder.h"
|
#include "nsIMsgImapMailFolder.h"
|
||||||
|
@ -158,7 +157,7 @@ NS_IMETHODIMP nsImapIncomingServer::SetKey(const nsACString& aKey) // override
|
||||||
hostSession->SetDeleteIsMoveToTrashForHost(key.get(), deleteModel == nsMsgImapDeleteModels::MoveToTrash);
|
hostSession->SetDeleteIsMoveToTrashForHost(key.get(), deleteModel == nsMsgImapDeleteModels::MoveToTrash);
|
||||||
hostSession->SetShowDeletedMessagesForHost(key.get(), deleteModel == nsMsgImapDeleteModels::IMAPDelete);
|
hostSession->SetShowDeletedMessagesForHost(key.get(), deleteModel == nsMsgImapDeleteModels::IMAPDelete);
|
||||||
|
|
||||||
nsCString onlineDir;
|
nsCAutoString onlineDir;
|
||||||
rv = GetServerDirectory(onlineDir);
|
rv = GetServerDirectory(onlineDir);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (!onlineDir.IsEmpty())
|
if (!onlineDir.IsEmpty())
|
||||||
|
@ -200,9 +199,8 @@ NS_IMETHODIMP nsImapIncomingServer::SetKey(const nsACString& aKey) // override
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapIncomingServer::GetConstructedPrettyName(nsAString& retval)
|
nsImapIncomingServer::GetConstructedPrettyName(nsAString& retval)
|
||||||
{
|
{
|
||||||
|
nsCAutoString username;
|
||||||
nsCString username;
|
nsCAutoString hostName;
|
||||||
nsCString hostName;
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
nsCOMPtr<nsIMsgAccountManager> accountManager =
|
||||||
|
@ -360,7 +358,7 @@ nsImapIncomingServer::GetDeleteModel(PRInt32 *retval)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG(retval);
|
NS_ENSURE_ARG(retval);
|
||||||
|
|
||||||
nsCString redirectorType;
|
nsCAutoString redirectorType;
|
||||||
GetRedirectorType(redirectorType);
|
GetRedirectorType(redirectorType);
|
||||||
if (redirectorType.Equals("aol"))
|
if (redirectorType.Equals("aol"))
|
||||||
{
|
{
|
||||||
|
@ -696,7 +694,7 @@ nsImapIncomingServer::GetImapConnection(nsIEventTarget *aEventTarget,
|
||||||
nsCOMPtr<nsIImapProtocol> freeConnection;
|
nsCOMPtr<nsIImapProtocol> freeConnection;
|
||||||
PRBool isBusy = PR_FALSE;
|
PRBool isBusy = PR_FALSE;
|
||||||
PRBool isInboxConnection = PR_FALSE;
|
PRBool isInboxConnection = PR_FALSE;
|
||||||
nsCString redirectorType;
|
nsCAutoString redirectorType;
|
||||||
|
|
||||||
PR_CEnterMonitor(this);
|
PR_CEnterMonitor(this);
|
||||||
|
|
||||||
|
@ -740,7 +738,7 @@ nsImapIncomingServer::GetImapConnection(nsIEventTarget *aEventTarget,
|
||||||
{
|
{
|
||||||
rv = connection->CanHandleUrl(aImapUrl, &canRunUrlImmediately, &canRunButBusy);
|
rv = connection->CanHandleUrl(aImapUrl, &canRunUrlImmediately, &canRunButBusy);
|
||||||
#ifdef DEBUG_bienvenu
|
#ifdef DEBUG_bienvenu
|
||||||
nsXPIDLCString curSelectedFolderName;
|
nsCAutoString curSelectedFolderName;
|
||||||
if (connection)
|
if (connection)
|
||||||
connection->GetSelectedMailboxName(getter_Copies(curSelectedFolderName));
|
connection->GetSelectedMailboxName(getter_Copies(curSelectedFolderName));
|
||||||
// check that no other connection is in the same selected state.
|
// check that no other connection is in the same selected state.
|
||||||
|
@ -753,7 +751,7 @@ nsImapIncomingServer::GetImapConnection(nsIEventTarget *aEventTarget,
|
||||||
nsCOMPtr<nsIImapProtocol> otherConnection = do_QueryElementAt(m_connectionCache, j);
|
nsCOMPtr<nsIImapProtocol> otherConnection = do_QueryElementAt(m_connectionCache, j);
|
||||||
if (otherConnection)
|
if (otherConnection)
|
||||||
{
|
{
|
||||||
nsXPIDLCString otherSelectedFolderName;
|
nsCAutoString otherSelectedFolderName;
|
||||||
otherConnection->GetSelectedMailboxName(getter_Copies(otherSelectedFolderName));
|
otherConnection->GetSelectedMailboxName(getter_Copies(otherSelectedFolderName));
|
||||||
NS_ASSERTION(!curSelectedFolderName.Equals(otherSelectedFolderName), "two connections selected on same folder");
|
NS_ASSERTION(!curSelectedFolderName.Equals(otherSelectedFolderName), "two connections selected on same folder");
|
||||||
}
|
}
|
||||||
|
@ -785,7 +783,7 @@ nsImapIncomingServer::GetImapConnection(nsIEventTarget *aEventTarget,
|
||||||
freeConnection = connection;
|
freeConnection = connection;
|
||||||
else // check which is the better free connection to use.
|
else // check which is the better free connection to use.
|
||||||
{ // We prefer one not in the selected state.
|
{ // We prefer one not in the selected state.
|
||||||
nsCString selectedFolderName;
|
nsCAutoString selectedFolderName;
|
||||||
connection->GetSelectedMailboxName(getter_Copies(selectedFolderName));
|
connection->GetSelectedMailboxName(getter_Copies(selectedFolderName));
|
||||||
if (selectedFolderName.IsEmpty())
|
if (selectedFolderName.IsEmpty())
|
||||||
freeConnection = connection;
|
freeConnection = connection;
|
||||||
|
@ -1041,7 +1039,7 @@ void nsImapIncomingServer::GetPFCName(nsACString& aPfcname)
|
||||||
{
|
{
|
||||||
if(NS_SUCCEEDED(GetStringBundle()))
|
if(NS_SUCCEEDED(GetStringBundle()))
|
||||||
{
|
{
|
||||||
nsString pfcName;
|
nsAutoString pfcName;
|
||||||
nsresult res = m_stringBundle->GetStringFromID(IMAP_PERSONAL_FILING_CABINET, getter_Copies(pfcName));
|
nsresult res = m_stringBundle->GetStringFromID(IMAP_PERSONAL_FILING_CABINET, getter_Copies(pfcName));
|
||||||
if (NS_SUCCEEDED(res))
|
if (NS_SUCCEEDED(res))
|
||||||
CopyUTF16toUTF8(pfcName, m_pfcName);
|
CopyUTF16toUTF8(pfcName, m_pfcName);
|
||||||
|
@ -1083,12 +1081,12 @@ nsresult nsImapIncomingServer::GetPFCForStringId(PRBool createIfMissing, PRInt32
|
||||||
|
|
||||||
nsresult rv = GetPFC(createIfMissing, getter_AddRefs(pfcParent));
|
nsresult rv = GetPFC(createIfMissing, getter_AddRefs(pfcParent));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsXPIDLCString pfcURI;
|
nsCString pfcURI;
|
||||||
pfcParent->GetURI(getter_Copies(pfcURI));
|
pfcParent->GetURI(getter_Copies(pfcURI));
|
||||||
|
|
||||||
rv = GetStringBundle();
|
rv = GetStringBundle();
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsString pfcName;
|
nsAutoString pfcName;
|
||||||
rv = m_stringBundle->GetStringFromID(stringId, getter_Copies(pfcName));
|
rv = m_stringBundle->GetStringFromID(stringId, getter_Copies(pfcName));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCAutoString pfcMailUri(pfcURI);
|
nsCAutoString pfcMailUri(pfcURI);
|
||||||
|
@ -1228,7 +1226,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
parentUri.Append('/');
|
parentUri.Append('/');
|
||||||
parentUri.Append(parentName);
|
parentUri.Append(parentName);
|
||||||
}
|
}
|
||||||
if (folderPath.LowerCaseEqualsLiteral("INBOX") &&
|
if (folderPath.LowerCaseEqualsLiteral("inbox") &&
|
||||||
hierarchyDelimiter == kOnlineHierarchySeparatorNil)
|
hierarchyDelimiter == kOnlineHierarchySeparatorNil)
|
||||||
{
|
{
|
||||||
hierarchyDelimiter = '/'; // set to default in this case (as in 4.x)
|
hierarchyDelimiter = '/'; // set to default in this case (as in 4.x)
|
||||||
|
@ -1246,7 +1244,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
// nsCString possibleName(aSpec->allocatedPathName);
|
// nsCString possibleName(aSpec->allocatedPathName);
|
||||||
uri.Append('/');
|
uri.Append('/');
|
||||||
uri.Append(dupFolderPath);
|
uri.Append(dupFolderPath);
|
||||||
PRBool caseInsensitive = dupFolderPath.LowerCaseEqualsLiteral("INBOX");
|
PRBool caseInsensitive = dupFolderPath.LowerCaseEqualsLiteral("inbox");
|
||||||
a_nsIFolder->GetChildWithURI(uri.get(), PR_TRUE, caseInsensitive, getter_AddRefs(child));
|
a_nsIFolder->GetChildWithURI(uri.get(), PR_TRUE, caseInsensitive, getter_AddRefs(child));
|
||||||
// if we couldn't find this folder by URI, tell the imap code it's a new folder to us
|
// if we couldn't find this folder by URI, tell the imap code it's a new folder to us
|
||||||
*aNewFolder = !child;
|
*aNewFolder = !child;
|
||||||
|
@ -1259,7 +1257,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
{
|
{
|
||||||
nsCOMPtr <nsIMsgFolder> parent;
|
nsCOMPtr <nsIMsgFolder> parent;
|
||||||
PRBool parentIsNew;
|
PRBool parentIsNew;
|
||||||
caseInsensitive = parentName.LowerCaseEqualsLiteral("INBOX");
|
caseInsensitive = parentName.LowerCaseEqualsLiteral("inbox");
|
||||||
a_nsIFolder->GetChildWithURI(parentUri.get(), PR_TRUE, caseInsensitive, getter_AddRefs(parent));
|
a_nsIFolder->GetChildWithURI(parentUri.get(), PR_TRUE, caseInsensitive, getter_AddRefs(parent));
|
||||||
if (!parent /* || parentFolder->GetFolderNeedsAdded()*/)
|
if (!parent /* || parentFolder->GetFolderNeedsAdded()*/)
|
||||||
{
|
{
|
||||||
|
@ -1269,7 +1267,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hostFolder->CreateClientSubfolderInfo(dupFolderPath.get(), hierarchyDelimiter,boxFlags, PR_FALSE);
|
hostFolder->CreateClientSubfolderInfo(dupFolderPath.get(), hierarchyDelimiter,boxFlags, PR_FALSE);
|
||||||
caseInsensitive = dupFolderPath.LowerCaseEqualsLiteral("INBOX");
|
caseInsensitive = dupFolderPath.LowerCaseEqualsLiteral("inbox");
|
||||||
a_nsIFolder->GetChildWithURI(uri.get(), PR_TRUE, caseInsensitive, getter_AddRefs(child));
|
a_nsIFolder->GetChildWithURI(uri.get(), PR_TRUE, caseInsensitive, getter_AddRefs(child));
|
||||||
}
|
}
|
||||||
if (child)
|
if (child)
|
||||||
|
@ -1281,8 +1279,8 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
|
|
||||||
GetIsAOLServer(&isAOLServer);
|
GetIsAOLServer(&isAOLServer);
|
||||||
|
|
||||||
nsXPIDLCString onlineName;
|
nsCAutoString onlineName;
|
||||||
nsXPIDLString unicodeName;
|
nsAutoString unicodeName;
|
||||||
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);
|
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);
|
||||||
imapFolder->SetHierarchyDelimiter(hierarchyDelimiter);
|
imapFolder->SetHierarchyDelimiter(hierarchyDelimiter);
|
||||||
if (boxFlags & kImapTrash)
|
if (boxFlags & kImapTrash)
|
||||||
|
@ -1314,12 +1312,12 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
if (hierarchyDelimiter != '/')
|
if (hierarchyDelimiter != '/')
|
||||||
nsImapUrl::UnescapeSlashes(folderName.BeginWriting());
|
nsImapUrl::UnescapeSlashes(folderName.BeginWriting());
|
||||||
if (NS_SUCCEEDED(CopyMUTF7toUTF16(folderName, unicodeName)))
|
if (NS_SUCCEEDED(CopyMUTF7toUTF16(folderName, unicodeName)))
|
||||||
child->SetPrettyName(unicodeName);
|
child->SetPrettyName(unicodeName.get());
|
||||||
// Call ConvertFolderName() and HideFolderName() to do special folder name
|
// Call ConvertFolderName() and HideFolderName() to do special folder name
|
||||||
// mapping and hiding, if configured to do so. For example, need to hide AOL's
|
// mapping and hiding, if configured to do so. For example, need to hide AOL's
|
||||||
// 'RECYCLE_OUT' & convert a few AOL folder names. Regular imap accounts
|
// 'RECYCLE_OUT' & convert a few AOL folder names. Regular imap accounts
|
||||||
// will do no-op in the calls.
|
// will do no-op in the calls.
|
||||||
nsString convertedName;
|
nsAutoString convertedName;
|
||||||
PRBool hideFolder;
|
PRBool hideFolder;
|
||||||
rv = HideFolderName(onlineName, &hideFolder);
|
rv = HideFolderName(onlineName, &hideFolder);
|
||||||
if (hideFolder)
|
if (hideFolder)
|
||||||
|
@ -1331,7 +1329,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const nsACString& folder
|
||||||
{
|
{
|
||||||
rv = ConvertFolderName(onlineName, convertedName);
|
rv = ConvertFolderName(onlineName, convertedName);
|
||||||
//make sure rv value is not crunched, it is used to SetPrettyName
|
//make sure rv value is not crunched, it is used to SetPrettyName
|
||||||
nsCString redirectorType;
|
nsCAutoString redirectorType;
|
||||||
GetRedirectorType(redirectorType); //Sent mail folder as per aol/netscape webmail
|
GetRedirectorType(redirectorType); //Sent mail folder as per aol/netscape webmail
|
||||||
if ((redirectorType.EqualsLiteral("aol") && onlineName.EqualsLiteral("Sent Items"))
|
if ((redirectorType.EqualsLiteral("aol") && onlineName.EqualsLiteral("Sent Items"))
|
||||||
|| (redirectorType.EqualsLiteral("netscape") && onlineName.EqualsLiteral("Sent")))
|
|| (redirectorType.EqualsLiteral("netscape") && onlineName.EqualsLiteral("Sent")))
|
||||||
|
@ -1438,7 +1436,7 @@ NS_IMETHODIMP nsImapIncomingServer::GetRedirectorType(nsACString& redirectorType
|
||||||
// redirectory type
|
// redirectory type
|
||||||
if (redirectorType.LowerCaseEqualsLiteral("aol"))
|
if (redirectorType.LowerCaseEqualsLiteral("aol"))
|
||||||
{
|
{
|
||||||
nsCString hostName;
|
nsCAutoString hostName;
|
||||||
GetHostName(hostName);
|
GetHostName(hostName);
|
||||||
if (hostName.LowerCaseEqualsLiteral("imap.mail.netcenter.com"))
|
if (hostName.LowerCaseEqualsLiteral("imap.mail.netcenter.com"))
|
||||||
SetRedirectorType(NS_LITERAL_CSTRING("netscape"));
|
SetRedirectorType(NS_LITERAL_CSTRING("netscape"));
|
||||||
|
@ -1454,7 +1452,7 @@ NS_IMETHODIMP nsImapIncomingServer::GetRedirectorType(nsACString& redirectorType
|
||||||
rv = CreateHostSpecificPrefName("default_redirector_type", prefName);
|
rv = CreateHostSpecificPrefName("default_redirector_type", prefName);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
nsCString defaultRedirectorType;
|
nsCAutoString defaultRedirectorType;
|
||||||
nsCOMPtr <nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
nsCOMPtr <nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
|
@ -1537,7 +1535,7 @@ NS_IMETHODIMP nsImapIncomingServer::ConvertFolderName(const nsACString& original
|
||||||
// Get string bundle based on redirector type and convert folder name.
|
// Get string bundle based on redirector type and convert folder name.
|
||||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||||
nsCAutoString propertyURL;
|
nsCAutoString propertyURL;
|
||||||
nsCString redirectorType;
|
nsCAutoString redirectorType;
|
||||||
GetRedirectorType(redirectorType);
|
GetRedirectorType(redirectorType);
|
||||||
if (redirectorType.IsEmpty())
|
if (redirectorType.IsEmpty())
|
||||||
return NS_ERROR_FAILURE; // return if no redirector type
|
return NS_ERROR_FAILURE; // return if no redirector type
|
||||||
|
@ -1748,7 +1746,7 @@ NS_IMETHODIMP nsImapIncomingServer::DiscoveryDone()
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && numFolders > 1)
|
if (NS_SUCCEEDED(rv) && numFolders > 1)
|
||||||
{
|
{
|
||||||
nsString trashName;
|
nsAutoString trashName;
|
||||||
if (NS_SUCCEEDED(GetTrashFolderName(trashName)))
|
if (NS_SUCCEEDED(GetTrashFolderName(trashName)))
|
||||||
{
|
{
|
||||||
nsIMsgFolder *trashFolders[2];
|
nsIMsgFolder *trashFolders[2];
|
||||||
|
@ -1757,7 +1755,7 @@ NS_IMETHODIMP nsImapIncomingServer::DiscoveryDone()
|
||||||
{
|
{
|
||||||
for (PRUint32 i = 0; i < numFolders; i++)
|
for (PRUint32 i = 0; i < numFolders; i++)
|
||||||
{
|
{
|
||||||
nsString folderName;
|
nsAutoString folderName;
|
||||||
if (NS_SUCCEEDED(trashFolders[i]->GetName(getter_Copies(folderName))))
|
if (NS_SUCCEEDED(trashFolders[i]->GetName(getter_Copies(folderName))))
|
||||||
{
|
{
|
||||||
if (!folderName.Equals(trashName))
|
if (!folderName.Equals(trashName))
|
||||||
|
@ -2097,7 +2095,7 @@ NS_IMETHODIMP nsImapIncomingServer::FormatStringWithHostNameByID(PRInt32 aMsgId
|
||||||
GetStringBundle();
|
GetStringBundle();
|
||||||
if (m_stringBundle)
|
if (m_stringBundle)
|
||||||
{
|
{
|
||||||
nsCString hostName;
|
nsCAutoString hostName;
|
||||||
res = GetRealHostName(hostName);
|
res = GetRealHostName(hostName);
|
||||||
if (NS_SUCCEEDED(res))
|
if (NS_SUCCEEDED(res))
|
||||||
{
|
{
|
||||||
|
@ -2408,8 +2406,7 @@ nsresult nsImapIncomingServer::RequestOverrideInfo(nsIMsgWindow *aMsgWindow)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
nsCAutoString contractID(NS_MSGLOGONREDIRECTORSERVICE_CONTRACTID);
|
||||||
nsCString redirectorType;
|
nsCAutoString redirectorType;
|
||||||
|
|
||||||
GetRedirectorType(redirectorType);
|
GetRedirectorType(redirectorType);
|
||||||
contractID.Append('/');
|
contractID.Append('/');
|
||||||
contractID.Append(redirectorType);
|
contractID.Append(redirectorType);
|
||||||
|
@ -2420,12 +2417,11 @@ nsresult nsImapIncomingServer::RequestOverrideInfo(nsIMsgWindow *aMsgWindow)
|
||||||
rv = QueryInterface(NS_GET_IID(nsIMsgLogonRedirectionRequester), getter_AddRefs(logonRedirectorRequester));
|
rv = QueryInterface(NS_GET_IID(nsIMsgLogonRedirectionRequester), getter_AddRefs(logonRedirectorRequester));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCString password;
|
nsCAutoString password;
|
||||||
nsCString userName;
|
nsCAutoString userName;
|
||||||
PRBool requiresPassword = PR_TRUE;
|
PRBool requiresPassword = PR_TRUE;
|
||||||
GetRealUsername(userName);
|
GetRealUsername(userName);
|
||||||
m_logonRedirector->RequiresPassword(userName.get(), redirectorType.get(), &requiresPassword);
|
m_logonRedirector->RequiresPassword(userName.get(), redirectorType.get(), &requiresPassword);
|
||||||
|
|
||||||
if (requiresPassword)
|
if (requiresPassword)
|
||||||
{
|
{
|
||||||
GetPassword(password);
|
GetPassword(password);
|
||||||
|
@ -2759,10 +2755,8 @@ nsImapIncomingServer::AddTo(const nsACString &aName, PRBool addAsSubscribed,
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsImapIncomingServer::StopPopulating(nsIMsgWindow *aMsgWindow)
|
nsImapIncomingServer::StopPopulating(nsIMsgWindow *aMsgWindow)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISubscribeListener> listener;
|
nsCOMPtr<nsISubscribeListener> listener;
|
||||||
rv = GetSubscribeListener(getter_AddRefs(listener));
|
nsresult rv = GetSubscribeListener(getter_AddRefs(listener));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = listener->OnDonePopulating();
|
rv = listener->OnDonePopulating();
|
||||||
|
@ -3025,7 +3019,7 @@ nsImapIncomingServer::CreateHostSpecificPrefName(const char *prefPrefix, nsCAuto
|
||||||
|
|
||||||
prefName = prefPrefix;
|
prefName = prefPrefix;
|
||||||
prefName.Append('.');
|
prefName.Append('.');
|
||||||
prefName.Append(hostName.get());
|
prefName.Append(hostName);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3431,7 +3425,7 @@ nsImapIncomingServer::OnUserOrHostNameChanged(const nsACString& oldName, const n
|
||||||
// reloaded (ie, DiscoverMailboxList() will be invoked in nsImapProtocol).
|
// reloaded (ie, DiscoverMailboxList() will be invoked in nsImapProtocol).
|
||||||
nsCOMPtr<nsIImapHostSessionList> hostSessionList = do_GetService(kCImapHostSessionListCID, &rv);
|
nsCOMPtr<nsIImapHostSessionList> hostSessionList = do_GetService(kCImapHostSessionListCID, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCString serverKey;
|
nsCAutoString serverKey;
|
||||||
rv = GetKey(serverKey);
|
rv = GetKey(serverKey);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
hostSessionList->SetHaveWeEverDiscoveredFoldersForHost(serverKey.get(), PR_FALSE);
|
hostSessionList->SetHaveWeEverDiscoveredFoldersForHost(serverKey.get(), PR_FALSE);
|
||||||
|
@ -3448,10 +3442,9 @@ nsImapIncomingServer::GetUriWithNamespacePrefixIfNecessary(PRInt32 namespaceType
|
||||||
nsACString& convertedUri)
|
nsACString& convertedUri)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCString serverKey;
|
nsCAutoString serverKey;
|
||||||
rv = GetKey(serverKey);
|
rv = GetKey(serverKey);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIImapHostSessionList> hostSessionList = do_GetService(kCImapHostSessionListCID, &rv);
|
nsCOMPtr<nsIImapHostSessionList> hostSessionList = do_GetService(kCImapHostSessionListCID, &rv);
|
||||||
nsIMAPNamespace *ns = nsnull;
|
nsIMAPNamespace *ns = nsnull;
|
||||||
rv = hostSessionList->GetDefaultNamespaceOfTypeForHost(serverKey.get(), (EIMAPNamespaceType)namespaceType, ns);
|
rv = hostSessionList->GetDefaultNamespaceOfTypeForHost(serverKey.get(), (EIMAPNamespaceType)namespaceType, ns);
|
||||||
|
@ -3461,7 +3454,7 @@ nsImapIncomingServer::GetUriWithNamespacePrefixIfNecessary(PRInt32 namespaceType
|
||||||
if (!namespacePrefix.IsEmpty())
|
if (!namespacePrefix.IsEmpty())
|
||||||
{
|
{
|
||||||
// check if namespacePrefix is the same as the online directory; if so, ignore it.
|
// check if namespacePrefix is the same as the online directory; if so, ignore it.
|
||||||
nsCString onlineDir;
|
nsCAutoString onlineDir;
|
||||||
rv = GetServerDirectory(onlineDir);
|
rv = GetServerDirectory(onlineDir);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (!onlineDir.IsEmpty())
|
if (!onlineDir.IsEmpty())
|
||||||
|
@ -3501,7 +3494,7 @@ NS_IMETHODIMP nsImapIncomingServer::GetTrashFolderName(nsAString& retval)
|
||||||
NS_IMETHODIMP nsImapIncomingServer::SetTrashFolderName(const nsAString& chvalue)
|
NS_IMETHODIMP nsImapIncomingServer::SetTrashFolderName(const nsAString& chvalue)
|
||||||
{
|
{
|
||||||
// clear trash flag from the old pref
|
// clear trash flag from the old pref
|
||||||
nsString oldTrashName;
|
nsAutoString oldTrashName;
|
||||||
nsresult rv = GetTrashFolderName(oldTrashName);
|
nsresult rv = GetTrashFolderName(oldTrashName);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
|
|
|
@ -7602,7 +7602,7 @@ NS_IMETHODIMP nsImapMailFolder::MatchName(nsString *name, PRBool *matches)
|
||||||
|
|
||||||
nsresult nsImapMailFolder::CreateBaseMessageURI(const char *aURI)
|
nsresult nsImapMailFolder::CreateBaseMessageURI(const char *aURI)
|
||||||
{
|
{
|
||||||
return nsCreateImapBaseMessageURI(aURI, &mBaseMessageURI);
|
return nsCreateImapBaseMessageURI(aURI, mBaseMessageURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapMailFolder::GetFolderURL(char **aFolderURL)
|
NS_IMETHODIMP nsImapMailFolder::GetFolderURL(char **aFolderURL)
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "nsImapOfflineSync.h"
|
#include "nsImapOfflineSync.h"
|
||||||
#include "nsImapMailFolder.h"
|
#include "nsImapMailFolder.h"
|
||||||
#include "nsMsgFolderFlags.h"
|
#include "nsMsgFolderFlags.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIRDFService.h"
|
#include "nsIRDFService.h"
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsRDFCID.h"
|
#include "nsRDFCID.h"
|
||||||
|
@ -302,7 +301,7 @@ void nsImapOfflineSync::ProcessKeywordOperation(nsIMsgOfflineImapOperation *op)
|
||||||
nsMsgKeyArray matchingKeywordKeys;
|
nsMsgKeyArray matchingKeywordKeys;
|
||||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||||
|
|
||||||
nsXPIDLCString keywords;
|
nsCAutoString keywords;
|
||||||
if (mCurrentPlaybackOpType == nsIMsgOfflineImapOperation::kAddKeywords)
|
if (mCurrentPlaybackOpType == nsIMsgOfflineImapOperation::kAddKeywords)
|
||||||
currentOp->GetKeywordsToAdd(getter_Copies(keywords));
|
currentOp->GetKeywordsToAdd(getter_Copies(keywords));
|
||||||
else
|
else
|
||||||
|
@ -323,7 +322,7 @@ void nsImapOfflineSync::ProcessKeywordOperation(nsIMsgOfflineImapOperation *op)
|
||||||
getter_AddRefs(currentOp));
|
getter_AddRefs(currentOp));
|
||||||
if (currentOp)
|
if (currentOp)
|
||||||
{
|
{
|
||||||
nsXPIDLCString curOpKeywords;
|
nsCAutoString curOpKeywords;
|
||||||
nsOfflineImapOperationType operation;
|
nsOfflineImapOperationType operation;
|
||||||
currentOp->GetOperation(&operation);
|
currentOp->GetOperation(&operation);
|
||||||
if (mCurrentPlaybackOpType == nsIMsgOfflineImapOperation::kAddKeywords)
|
if (mCurrentPlaybackOpType == nsIMsgOfflineImapOperation::kAddKeywords)
|
||||||
|
@ -394,7 +393,7 @@ nsImapOfflineSync::ProcessAppendMsgOperation(nsIMsgOfflineImapOperation *current
|
||||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), tmpFile, PR_WRONLY | PR_CREATE_FILE, 00600);
|
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), tmpFile, PR_WRONLY | PR_CREATE_FILE, 00600);
|
||||||
if (NS_SUCCEEDED(rv) && outputStream)
|
if (NS_SUCCEEDED(rv) && outputStream)
|
||||||
{
|
{
|
||||||
nsXPIDLCString moveDestination;
|
nsCString moveDestination;
|
||||||
currentOp->GetDestinationFolderURI(getter_Copies(moveDestination));
|
currentOp->GetDestinationFolderURI(getter_Copies(moveDestination));
|
||||||
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
|
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
|
||||||
nsCOMPtr<nsIRDFResource> res;
|
nsCOMPtr<nsIRDFResource> res;
|
||||||
|
@ -477,7 +476,7 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
||||||
{
|
{
|
||||||
nsMsgKeyArray matchingFlagKeys ;
|
nsMsgKeyArray matchingFlagKeys ;
|
||||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||||
nsXPIDLCString moveDestination;
|
nsCString moveDestination;
|
||||||
op->GetDestinationFolderURI(getter_Copies(moveDestination));
|
op->GetDestinationFolderURI(getter_Copies(moveDestination));
|
||||||
PRBool moveMatches = PR_TRUE;
|
PRBool moveMatches = PR_TRUE;
|
||||||
nsCOMPtr <nsIMsgOfflineImapOperation> currentOp = op;
|
nsCOMPtr <nsIMsgOfflineImapOperation> currentOp = op;
|
||||||
|
@ -494,7 +493,7 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
||||||
|
|
||||||
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
||||||
{
|
{
|
||||||
nsXPIDLCString nextDestination;
|
nsCString nextDestination;
|
||||||
nsresult rv = m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE, getter_AddRefs(currentOp));
|
nsresult rv = m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE, getter_AddRefs(currentOp));
|
||||||
moveMatches = PR_FALSE;
|
moveMatches = PR_FALSE;
|
||||||
if (NS_SUCCEEDED(rv) && currentOp)
|
if (NS_SUCCEEDED(rv) && currentOp)
|
||||||
|
@ -504,7 +503,7 @@ void nsImapOfflineSync::ProcessMoveOperation(nsIMsgOfflineImapOperation *op)
|
||||||
if (opType & nsIMsgOfflineImapOperation::kMsgMoved)
|
if (opType & nsIMsgOfflineImapOperation::kMsgMoved)
|
||||||
{
|
{
|
||||||
currentOp->GetDestinationFolderURI(getter_Copies(nextDestination));
|
currentOp->GetDestinationFolderURI(getter_Copies(nextDestination));
|
||||||
moveMatches = nsCRT::strcmp(moveDestination, nextDestination) == 0;
|
moveMatches = moveDestination.Equals(nextDestination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,7 +590,7 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
||||||
{
|
{
|
||||||
nsMsgKeyArray matchingFlagKeys;
|
nsMsgKeyArray matchingFlagKeys;
|
||||||
PRUint32 currentKeyIndex = m_KeyIndex;
|
PRUint32 currentKeyIndex = m_KeyIndex;
|
||||||
nsXPIDLCString copyDestination;
|
nsCString copyDestination;
|
||||||
currentOp->GetCopyDestination(0, getter_Copies(copyDestination));
|
currentOp->GetCopyDestination(0, getter_Copies(copyDestination));
|
||||||
PRBool copyMatches = PR_TRUE;
|
PRBool copyMatches = PR_TRUE;
|
||||||
|
|
||||||
|
@ -607,7 +606,7 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
||||||
|
|
||||||
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
if (++currentKeyIndex < m_CurrentKeys.GetSize())
|
||||||
{
|
{
|
||||||
nsXPIDLCString nextDestination;
|
nsCString nextDestination;
|
||||||
nsresult rv = m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE, ¤tOp);
|
nsresult rv = m_currentDB->GetOfflineOpForKey(m_CurrentKeys[currentKeyIndex], PR_FALSE, ¤tOp);
|
||||||
copyMatches = PR_FALSE;
|
copyMatches = PR_FALSE;
|
||||||
if (NS_SUCCEEDED(rv) && currentOp)
|
if (NS_SUCCEEDED(rv) && currentOp)
|
||||||
|
@ -617,7 +616,7 @@ void nsImapOfflineSync::ProcessCopyOperation(nsIMsgOfflineImapOperation *current
|
||||||
if (opType & nsIMsgOfflineImapOperation::kMsgCopy)
|
if (opType & nsIMsgOfflineImapOperation::kMsgCopy)
|
||||||
{
|
{
|
||||||
currentOp->GetCopyDestination(0, getter_Copies(nextDestination));
|
currentOp->GetCopyDestination(0, getter_Copies(nextDestination));
|
||||||
copyMatches = nsCRT::strcmp(copyDestination, nextDestination) == 0;
|
copyMatches = copyDestination.Equals(nextDestination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -702,7 +701,7 @@ PRBool nsImapOfflineSync::CreateOfflineFolder(nsIMsgFolder *folder)
|
||||||
|
|
||||||
nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(parent);
|
nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(parent);
|
||||||
nsCOMPtr <nsIURI> createFolderURI;
|
nsCOMPtr <nsIURI> createFolderURI;
|
||||||
nsXPIDLCString onlineName;
|
nsCString onlineName;
|
||||||
imapFolder->GetOnlineName(getter_Copies(onlineName));
|
imapFolder->GetOnlineName(getter_Copies(onlineName));
|
||||||
|
|
||||||
NS_ConvertASCIItoUTF16 folderName(onlineName);
|
NS_ConvertASCIItoUTF16 folderName(onlineName);
|
||||||
|
|
|
@ -70,7 +70,6 @@
|
||||||
#include "nsIStreamListenerTee.h"
|
#include "nsIStreamListenerTee.h"
|
||||||
#include "nsXPCOMCIDInternal.h"
|
#include "nsXPCOMCIDInternal.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsIPipe.h"
|
#include "nsIPipe.h"
|
||||||
#include "nsIMsgFolder.h"
|
#include "nsIMsgFolder.h"
|
||||||
|
@ -343,9 +342,9 @@ nsresult nsImapProtocol::GlobalInitialization()
|
||||||
prefBranch->GetBoolPref("mail.imap.expunge_after_delete", &gExpungeAfterDelete);
|
prefBranch->GetBoolPref("mail.imap.expunge_after_delete", &gExpungeAfterDelete);
|
||||||
prefBranch->GetBoolPref("mail.imap.check_deleted_before_expunge", &gCheckDeletedBeforeExpunge);
|
prefBranch->GetBoolPref("mail.imap.check_deleted_before_expunge", &gCheckDeletedBeforeExpunge);
|
||||||
prefBranch->GetIntPref("mailnews.tcptimeout", &gResponseTimeout);
|
prefBranch->GetIntPref("mailnews.tcptimeout", &gResponseTimeout);
|
||||||
nsXPIDLCString customDBHeaders;
|
nsCString customDBHeaders;
|
||||||
prefBranch->GetCharPref("mailnews.customDBHeaders", getter_Copies(customDBHeaders));
|
prefBranch->GetCharPref("mailnews.customDBHeaders", getter_Copies(customDBHeaders));
|
||||||
gCustomDBHeaders.ParseString(customDBHeaders, " ");
|
gCustomDBHeaders.ParseString(customDBHeaders.get(), " ");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,8 +725,7 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer)
|
||||||
&& socketType == nsIMsgIncomingServer::useSSL)
|
&& socketType == nsIMsgIncomingServer::useSSL)
|
||||||
? SECURE_IMAP_PORT :IMAP_PORT;
|
? SECURE_IMAP_PORT :IMAP_PORT;
|
||||||
}
|
}
|
||||||
|
nsCAutoString hostName;
|
||||||
nsCString hostName;
|
|
||||||
nsCOMPtr<nsISocketTransportService> socketService =
|
nsCOMPtr<nsISocketTransportService> socketService =
|
||||||
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
|
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv) && aURL)
|
if (NS_SUCCEEDED(rv) && aURL)
|
||||||
|
@ -1949,7 +1947,7 @@ char *nsImapProtocol::GetServerCommandTag()
|
||||||
|
|
||||||
void nsImapProtocol::ProcessSelectedStateURL()
|
void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
{
|
{
|
||||||
nsXPIDLCString mailboxName;
|
nsCString mailboxName;
|
||||||
PRBool bMessageIdsAreUids = PR_TRUE;
|
PRBool bMessageIdsAreUids = PR_TRUE;
|
||||||
imapMessageFlagsType msgFlags = 0;
|
imapMessageFlagsType msgFlags = 0;
|
||||||
nsCString urlHost;
|
nsCString urlHost;
|
||||||
|
@ -1973,20 +1971,20 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
{
|
{
|
||||||
if (GetServerStateParser().GetSelectedMailboxName() &&
|
if (GetServerStateParser().GetSelectedMailboxName() &&
|
||||||
PL_strcmp(GetServerStateParser().GetSelectedMailboxName(),
|
PL_strcmp(GetServerStateParser().GetSelectedMailboxName(),
|
||||||
mailboxName))
|
mailboxName.get()))
|
||||||
{ // we are selected in another folder
|
{ // we are selected in another folder
|
||||||
if (m_closeNeededBeforeSelect)
|
if (m_closeNeededBeforeSelect)
|
||||||
Close();
|
Close();
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
{
|
{
|
||||||
selectIssued = PR_TRUE;
|
selectIssued = PR_TRUE;
|
||||||
AutoSubscribeToMailboxIfNecessary(mailboxName);
|
AutoSubscribeToMailboxIfNecessary(mailboxName.get());
|
||||||
SelectMailbox(mailboxName);
|
SelectMailbox(mailboxName.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!GetServerStateParser().GetSelectedMailboxName())
|
else if (!GetServerStateParser().GetSelectedMailboxName())
|
||||||
{ // why are we in the selected state with no box name?
|
{ // why are we in the selected state with no box name?
|
||||||
SelectMailbox(mailboxName);
|
SelectMailbox(mailboxName.get());
|
||||||
selectIssued = PR_TRUE;
|
selectIssued = PR_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2007,13 +2005,13 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// go to selected state
|
// go to selected state
|
||||||
AutoSubscribeToMailboxIfNecessary(mailboxName);
|
AutoSubscribeToMailboxIfNecessary(mailboxName.get());
|
||||||
SelectMailbox(mailboxName);
|
SelectMailbox(mailboxName.get());
|
||||||
selectIssued = GetServerStateParser().LastCommandSuccessful();
|
selectIssued = GetServerStateParser().LastCommandSuccessful();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectIssued)
|
if (selectIssued)
|
||||||
RefreshACLForFolderIfNecessary(mailboxName);
|
RefreshACLForFolderIfNecessary(mailboxName.get());
|
||||||
|
|
||||||
PRBool uidValidityOk = PR_TRUE;
|
PRBool uidValidityOk = PR_TRUE;
|
||||||
if (GetServerStateParser().LastCommandSuccessful() && selectIssued &&
|
if (GetServerStateParser().LastCommandSuccessful() && selectIssued &&
|
||||||
|
@ -2083,7 +2081,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
case nsIImapUrl::nsImapMsgDownloadForOffline:
|
case nsIImapUrl::nsImapMsgDownloadForOffline:
|
||||||
case nsIImapUrl::nsImapMsgPreview:
|
case nsIImapUrl::nsImapMsgPreview:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
// we don't want to send the flags back in a group
|
// we don't want to send the flags back in a group
|
||||||
// GetServerStateParser().ResetFlagInfo(0);
|
// GetServerStateParser().ResetFlagInfo(0);
|
||||||
|
@ -2094,7 +2092,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
SetProgressString(IMAP_FOLDER_RECEIVING_MESSAGE_OF);
|
SetProgressString(IMAP_FOLDER_RECEIVING_MESSAGE_OF);
|
||||||
|
|
||||||
m_progressIndex = 0;
|
m_progressIndex = 0;
|
||||||
m_progressCount = CountMessagesInIdString(messageIdString);
|
m_progressCount = CountMessagesInIdString(messageIdString.get());
|
||||||
|
|
||||||
// we need to set this so we'll get the msg from the memory cache.
|
// we need to set this so we'll get the msg from the memory cache.
|
||||||
if (m_imapAction == nsIImapUrl::nsImapMsgFetchPeek)
|
if (m_imapAction == nsIImapUrl::nsImapMsgFetchPeek)
|
||||||
|
@ -2130,7 +2128,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
|
|
||||||
nsIMAPBodyShell *foundShell = nsnull;
|
nsIMAPBodyShell *foundShell = nsnull;
|
||||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
||||||
GetServerStateParser().GetSelectedMailboxName(), messageIdString, modType, &foundShell);
|
GetServerStateParser().GetSelectedMailboxName(), messageIdString.get(), modType, &foundShell);
|
||||||
if (!foundShell)
|
if (!foundShell)
|
||||||
{
|
{
|
||||||
// The shell wasn't in the cache. Deal with this case later.
|
// The shell wasn't in the cache. Deal with this case later.
|
||||||
|
@ -2148,7 +2146,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
foundShell->SetConnection(this);
|
foundShell->SetConnection(this);
|
||||||
GetServerStateParser().UseCachedShell(foundShell);
|
GetServerStateParser().UseCachedShell(foundShell);
|
||||||
//Set the current uid in server state parser (in case it was used for new mail msgs earlier).
|
//Set the current uid in server state parser (in case it was used for new mail msgs earlier).
|
||||||
GetServerStateParser().SetCurrentResponseUID((PRUint32)atoi(messageIdString));
|
GetServerStateParser().SetCurrentResponseUID((PRUint32)atoi(messageIdString.get()));
|
||||||
foundShell->Generate(imappart);
|
foundShell->Generate(imappart);
|
||||||
GetServerStateParser().UseCachedShell(NULL);
|
GetServerStateParser().UseCachedShell(NULL);
|
||||||
}
|
}
|
||||||
|
@ -2163,7 +2161,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// downloading a single message: try to do it by bodystructure, and/or do it by chunks
|
// downloading a single message: try to do it by bodystructure, and/or do it by chunks
|
||||||
PRUint32 messageSize = GetMessageSize(messageIdString, bMessageIdsAreUids);
|
PRUint32 messageSize = GetMessageSize(messageIdString.get(), bMessageIdsAreUids);
|
||||||
// We need to check the format_out bits to see if we are allowed to leave out parts,
|
// We need to check the format_out bits to see if we are allowed to leave out parts,
|
||||||
// or if we are required to get the whole thing. Some instances where we are allowed
|
// or if we are required to get the whole thing. Some instances where we are allowed
|
||||||
// to do it by parts: when viewing a message, replying to a message, or viewing its source
|
// to do it by parts: when viewing a message, replying to a message, or viewing its source
|
||||||
|
@ -2206,7 +2204,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
if (bMessageIdsAreUids)
|
if (bMessageIdsAreUids)
|
||||||
{
|
{
|
||||||
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
|
||||||
GetServerStateParser().GetSelectedMailboxName(), messageIdString, modType, &foundShell);
|
GetServerStateParser().GetSelectedMailboxName(), messageIdString.get(), modType, &foundShell);
|
||||||
if (foundShell)
|
if (foundShell)
|
||||||
{
|
{
|
||||||
Log("SHELL",NULL,"Loading message, using cached shell.");
|
Log("SHELL",NULL,"Loading message, using cached shell.");
|
||||||
|
@ -2214,7 +2212,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
foundShell->SetConnection(this);
|
foundShell->SetConnection(this);
|
||||||
GetServerStateParser().UseCachedShell(foundShell);
|
GetServerStateParser().UseCachedShell(foundShell);
|
||||||
//Set the current uid in server state parser (in case it was used for new mail msgs earlier).
|
//Set the current uid in server state parser (in case it was used for new mail msgs earlier).
|
||||||
GetServerStateParser().SetCurrentResponseUID((PRUint32)atoi(messageIdString));
|
GetServerStateParser().SetCurrentResponseUID((PRUint32)atoi(messageIdString.get()));
|
||||||
foundShell->Generate(NULL);
|
foundShell->Generate(NULL);
|
||||||
GetServerStateParser().UseCachedShell(NULL);
|
GetServerStateParser().UseCachedShell(NULL);
|
||||||
}
|
}
|
||||||
|
@ -2236,7 +2234,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
&& m_imapAction != nsIImapUrl::nsImapMsgPreview
|
&& m_imapAction != nsIImapUrl::nsImapMsgPreview
|
||||||
&& m_imapAction != nsIImapUrl::nsImapMsgFetchPeek)
|
&& m_imapAction != nsIImapUrl::nsImapMsgFetchPeek)
|
||||||
{
|
{
|
||||||
PRUint32 uid = atoi(messageIdString);
|
PRUint32 uid = atoi(messageIdString.get());
|
||||||
PRInt32 index;
|
PRInt32 index;
|
||||||
PRBool foundIt;
|
PRBool foundIt;
|
||||||
imapMessageFlagsType flags = m_flagState->GetMessageFlagsFromUID(uid, &foundIt, &index);
|
imapMessageFlagsType flags = m_flagState->GetMessageFlagsFromUID(uid, &foundIt, &index);
|
||||||
|
@ -2259,7 +2257,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapMsgHeader:
|
case nsIImapUrl::nsImapMsgHeader:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIds;
|
nsCString messageIds;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIds));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIds));
|
||||||
|
|
||||||
// we don't want to send the flags back in a group
|
// we don't want to send the flags back in a group
|
||||||
|
@ -2275,26 +2273,26 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapSearch:
|
case nsIImapUrl::nsImapSearch:
|
||||||
{
|
{
|
||||||
nsXPIDLCString searchCriteriaString;
|
nsCAutoString searchCriteriaString;
|
||||||
m_runningUrl->CreateSearchCriteriaString(getter_Copies(searchCriteriaString));
|
m_runningUrl->CreateSearchCriteriaString(getter_Copies(searchCriteriaString));
|
||||||
Search(searchCriteriaString, bMessageIdsAreUids);
|
Search(searchCriteriaString.get(), bMessageIdsAreUids);
|
||||||
// drop the results on the floor for now
|
// drop the results on the floor for now
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapUserDefinedMsgCommand:
|
case nsIImapUrl::nsImapUserDefinedMsgCommand:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
nsXPIDLCString command;
|
nsCString command;
|
||||||
|
|
||||||
m_runningUrl->GetCommand(getter_Copies(command));
|
m_runningUrl->GetCommand(getter_Copies(command));
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
IssueUserDefinedMsgCommand(command, messageIdString);
|
IssueUserDefinedMsgCommand(command.get(), messageIdString.get());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapUserDefinedFetchAttribute:
|
case nsIImapUrl::nsImapUserDefinedFetchAttribute:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
nsXPIDLCString attribute;
|
nsCString attribute;
|
||||||
|
|
||||||
m_runningUrl->GetCustomAttributeToFetch(getter_Copies(attribute));
|
m_runningUrl->GetCustomAttributeToFetch(getter_Copies(attribute));
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
@ -2308,9 +2306,9 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
GetSupportedUserFlags(&userFlags);
|
GetSupportedUserFlags(&userFlags);
|
||||||
if (! (userFlags & kImapMsgSupportUserFlag))
|
if (! (userFlags & kImapMsgSupportUserFlag))
|
||||||
break;
|
break;
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
nsXPIDLCString addFlags;
|
nsCString addFlags;
|
||||||
nsXPIDLCString subtractFlags;
|
nsCString subtractFlags;
|
||||||
|
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
m_runningUrl->GetCustomAddFlags(getter_Copies(addFlags));
|
m_runningUrl->GetCustomAddFlags(getter_Copies(addFlags));
|
||||||
|
@ -2333,13 +2331,11 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapDeleteMsg:
|
case nsIImapUrl::nsImapDeleteMsg:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
|
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
if (HandlingMultipleMessages(messageIdString))
|
|
||||||
ProgressEventFunctionUsingId (IMAP_DELETING_MESSAGES);
|
ProgressEventFunctionUsingId (HandlingMultipleMessages(messageIdString) ?
|
||||||
else
|
IMAP_DELETING_MESSAGES :IMAP_DELETING_MESSAGE);
|
||||||
ProgressEventFunctionUsingId(IMAP_DELETING_MESSAGE);
|
|
||||||
|
|
||||||
Store(messageIdString, "+FLAGS (\\Deleted)", bMessageIdsAreUids);
|
Store(messageIdString, "+FLAGS (\\Deleted)", bMessageIdsAreUids);
|
||||||
|
|
||||||
|
@ -2360,7 +2356,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_imapMessageSink)
|
if (m_imapMessageSink)
|
||||||
m_imapMessageSink->NotifyMessageDeleted(canonicalName, PR_FALSE, messageIdString);
|
m_imapMessageSink->NotifyMessageDeleted(canonicalName, PR_FALSE, messageIdString.get());
|
||||||
// notice we don't wait for this to finish...
|
// notice we don't wait for this to finish...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2368,15 +2364,14 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapDeleteFolderAndMsgs:
|
case nsIImapUrl::nsImapDeleteFolderAndMsgs:
|
||||||
DeleteFolderAndMsgs(mailboxName);
|
DeleteFolderAndMsgs(mailboxName.get());
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapDeleteAllMsgs:
|
case nsIImapUrl::nsImapDeleteAllMsgs:
|
||||||
{
|
{
|
||||||
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
uint32 numberOfMessages = GetServerStateParser().NumberOfMessages();
|
||||||
if (numberOfMessages)
|
if (numberOfMessages)
|
||||||
{
|
{
|
||||||
|
Store(NS_LITERAL_CSTRING("1:*"), "+FLAGS.SILENT (\\Deleted)",
|
||||||
Store("1:*", "+FLAGS.SILENT (\\Deleted)",
|
|
||||||
PR_FALSE); // use sequence #'s
|
PR_FALSE); // use sequence #'s
|
||||||
|
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
|
@ -2402,7 +2397,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
|
|
||||||
}
|
}
|
||||||
PRBool deleteSelf = PR_FALSE;
|
PRBool deleteSelf = PR_FALSE;
|
||||||
DeleteSubFolders(mailboxName, deleteSelf); // don't delete self
|
DeleteSubFolders(mailboxName.get(), deleteSelf); // don't delete self
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapAppendDraftFromFile:
|
case nsIImapUrl::nsImapAppendDraftFromFile:
|
||||||
|
@ -2412,7 +2407,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapAddMsgFlags:
|
case nsIImapUrl::nsImapAddMsgFlags:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
|
||||||
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
||||||
|
@ -2421,7 +2416,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapSubtractMsgFlags:
|
case nsIImapUrl::nsImapSubtractMsgFlags:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
|
||||||
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
||||||
|
@ -2430,7 +2425,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapSetMsgFlags:
|
case nsIImapUrl::nsImapSetMsgFlags:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
|
|
||||||
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
ProcessStoreFlags(messageIdString, bMessageIdsAreUids,
|
||||||
|
@ -2445,7 +2440,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
case nsIImapUrl::nsImapOnlineCopy:
|
case nsIImapUrl::nsImapOnlineCopy:
|
||||||
case nsIImapUrl::nsImapOnlineMove:
|
case nsIImapUrl::nsImapOnlineMove:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
char *destinationMailbox = OnCreateServerDestinationFolderPathString();
|
char *destinationMailbox = OnCreateServerDestinationFolderPathString();
|
||||||
|
|
||||||
|
@ -2464,8 +2459,7 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
else
|
else
|
||||||
ProgressEventFunctionUsingIdWithString (IMAP_COPYING_MESSAGE_TO, destinationMailbox);
|
ProgressEventFunctionUsingIdWithString (IMAP_COPYING_MESSAGE_TO, destinationMailbox);
|
||||||
}
|
}
|
||||||
|
Copy(messageIdString.get(), destinationMailbox, bMessageIdsAreUids);
|
||||||
Copy(messageIdString, destinationMailbox, bMessageIdsAreUids);
|
|
||||||
PR_FREEIF( destinationMailbox);
|
PR_FREEIF( destinationMailbox);
|
||||||
ImapOnlineCopyState copyState;
|
ImapOnlineCopyState copyState;
|
||||||
if (DeathSignalReceived())
|
if (DeathSignalReceived())
|
||||||
|
@ -2504,26 +2498,23 @@ void nsImapProtocol::ProcessSelectedStateURL()
|
||||||
case nsIImapUrl::nsImapOnlineToOfflineCopy:
|
case nsIImapUrl::nsImapOnlineToOfflineCopy:
|
||||||
case nsIImapUrl::nsImapOnlineToOfflineMove:
|
case nsIImapUrl::nsImapOnlineToOfflineMove:
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
nsresult rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
nsresult rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
SetProgressString(IMAP_FOLDER_RECEIVING_MESSAGE_OF);
|
SetProgressString(IMAP_FOLDER_RECEIVING_MESSAGE_OF);
|
||||||
m_progressIndex = 0;
|
m_progressIndex = 0;
|
||||||
m_progressCount = CountMessagesInIdString(messageIdString);
|
m_progressCount = CountMessagesInIdString(messageIdString.get());
|
||||||
|
|
||||||
FetchMessage(messageIdString,
|
FetchMessage(messageIdString, kEveryThingRFC822Peek, bMessageIdsAreUids);
|
||||||
kEveryThingRFC822Peek,
|
|
||||||
bMessageIdsAreUids);
|
|
||||||
|
|
||||||
SetProgressString(0);
|
SetProgressString(0);
|
||||||
if (m_imapMailFolderSink)
|
if (m_imapMailFolderSink)
|
||||||
{
|
{
|
||||||
ImapOnlineCopyState copyStatus;
|
ImapOnlineCopyState copyStatus;
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
copyStatus = GetServerStateParser().LastCommandSuccessful() ?
|
||||||
copyStatus = ImapOnlineCopyStateType::kSuccessfulCopy;
|
ImapOnlineCopyStateType::kSuccessfulCopy : ImapOnlineCopyStateType::kFailedCopy;
|
||||||
else
|
|
||||||
copyStatus = ImapOnlineCopyStateType::kFailedCopy;
|
|
||||||
m_imapMailFolderSink->OnlineCopyCompleted(this, copyStatus);
|
m_imapMailFolderSink->OnlineCopyCompleted(this, copyStatus);
|
||||||
if (GetServerStateParser().LastCommandSuccessful() &&
|
if (GetServerStateParser().LastCommandSuccessful() &&
|
||||||
(m_imapAction == nsIImapUrl::nsImapOnlineToOfflineMove))
|
(m_imapAction == nsIImapUrl::nsImapOnlineToOfflineMove))
|
||||||
|
@ -2772,7 +2763,7 @@ void nsImapProtocol::SelectMailbox(const char *mailboxName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please call only with a single message ID
|
// Please call only with a single message ID
|
||||||
void nsImapProtocol::Bodystructure(const char *messageId, PRBool idIsUid)
|
void nsImapProtocol::Bodystructure(const nsCString &messageId, PRBool idIsUid)
|
||||||
{
|
{
|
||||||
IncrementCommandTagNumber();
|
IncrementCommandTagNumber();
|
||||||
|
|
||||||
|
@ -2855,7 +2846,7 @@ void nsImapProtocol::PipelinedFetchMessageParts(const char *uid, nsIMAPMessagePa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nsImapProtocol::FetchMsgAttribute(const char * messageIds, const char *attribute)
|
void nsImapProtocol::FetchMsgAttribute(const nsCString &messageIds, const nsCString &attribute)
|
||||||
{
|
{
|
||||||
IncrementCommandTagNumber();
|
IncrementCommandTagNumber();
|
||||||
|
|
||||||
|
@ -2876,7 +2867,7 @@ void nsImapProtocol::FetchMsgAttribute(const char * messageIds, const char *attr
|
||||||
// this routine is used to fetch a message or messages, or headers for a
|
// this routine is used to fetch a message or messages, or headers for a
|
||||||
// message...
|
// message...
|
||||||
|
|
||||||
void nsImapProtocol::FallbackToFetchWholeMsg(const char *messageId, PRUint32 messageSize)
|
void nsImapProtocol::FallbackToFetchWholeMsg(const nsCString &messageId, PRUint32 messageSize)
|
||||||
{
|
{
|
||||||
if (m_imapMessageSink && m_runningUrl)
|
if (m_imapMessageSink && m_runningUrl)
|
||||||
{
|
{
|
||||||
|
@ -2889,7 +2880,7 @@ void nsImapProtocol::FallbackToFetchWholeMsg(const char *messageId, PRUint32 mes
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImapProtocol::FetchMessage(const char * messageIds,
|
nsImapProtocol::FetchMessage(const nsCString &messageIds,
|
||||||
nsIMAPeFetchFields whatToFetch,
|
nsIMAPeFetchFields whatToFetch,
|
||||||
PRBool idIsUid,
|
PRBool idIsUid,
|
||||||
PRUint32 startByte, PRUint32 endByte,
|
PRUint32 startByte, PRUint32 endByte,
|
||||||
|
@ -2989,7 +2980,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
char *headersToDL = nsnull;
|
char *headersToDL = nsnull;
|
||||||
char *what = nsnull;
|
char *what = nsnull;
|
||||||
const char *dbHeaders = (gUseEnvelopeCmd) ? IMAP_DB_HEADERS : IMAP_ENV_AND_DB_HEADERS;
|
const char *dbHeaders = (gUseEnvelopeCmd) ? IMAP_DB_HEADERS : IMAP_ENV_AND_DB_HEADERS;
|
||||||
nsXPIDLCString arbitraryHeaders;
|
nsCString arbitraryHeaders;
|
||||||
GetArbitraryHeadersToDownload(getter_Copies(arbitraryHeaders));
|
GetArbitraryHeadersToDownload(getter_Copies(arbitraryHeaders));
|
||||||
for (PRInt32 i = 0; i < gCustomDBHeaders.Count(); i++)
|
for (PRInt32 i = 0; i < gCustomDBHeaders.Count(); i++)
|
||||||
{
|
{
|
||||||
|
@ -3001,7 +2992,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arbitraryHeaders.IsEmpty())
|
if (arbitraryHeaders.IsEmpty())
|
||||||
headersToDL = nsCRT::strdup(dbHeaders);
|
headersToDL = strdup(dbHeaders);
|
||||||
else
|
else
|
||||||
headersToDL = PR_smprintf("%s %s",dbHeaders, arbitraryHeaders.get());
|
headersToDL = PR_smprintf("%s %s",dbHeaders, arbitraryHeaders.get());
|
||||||
|
|
||||||
|
@ -3099,7 +3090,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
|
|
||||||
// since messageIds can be infinitely long, use a dynamic buffer rather than the fixed one
|
// since messageIds can be infinitely long, use a dynamic buffer rather than the fixed one
|
||||||
const char *commandTag = GetServerCommandTag();
|
const char *commandTag = GetServerCommandTag();
|
||||||
int protocolStringSize = commandString.Length() + strlen(messageIds) + PL_strlen(commandTag) + 1 +
|
int protocolStringSize = commandString.Length() + messageIds.Length() + PL_strlen(commandTag) + 1 +
|
||||||
(part ? PL_strlen(part) : 0);
|
(part ? PL_strlen(part) : 0);
|
||||||
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
||||||
|
|
||||||
|
@ -3113,7 +3104,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
protocolStringSize, // max size
|
protocolStringSize, // max size
|
||||||
cCommandStr, // format string
|
cCommandStr, // format string
|
||||||
commandTag, // command tag
|
commandTag, // command tag
|
||||||
messageIds,
|
messageIds.get(),
|
||||||
part);
|
part);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3122,7 +3113,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
protocolStringSize, // max size
|
protocolStringSize, // max size
|
||||||
cCommandStr, // format string
|
cCommandStr, // format string
|
||||||
commandTag, // command tag
|
commandTag, // command tag
|
||||||
messageIds);
|
messageIds.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = SendData(protocolString);
|
nsresult rv = SendData(protocolString);
|
||||||
|
@ -3140,7 +3131,7 @@ nsImapProtocol::FetchMessage(const char * messageIds,
|
||||||
HandleMemoryFailure();
|
HandleMemoryFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::FetchTryChunking(const char * messageIds,
|
void nsImapProtocol::FetchTryChunking(const nsCString &messageIds,
|
||||||
nsIMAPeFetchFields whatToFetch,
|
nsIMAPeFetchFields whatToFetch,
|
||||||
PRBool idIsUid,
|
PRBool idIsUid,
|
||||||
char *part,
|
char *part,
|
||||||
|
@ -3602,7 +3593,7 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
|
||||||
if (handlePossibleUndo)
|
if (handlePossibleUndo)
|
||||||
{
|
{
|
||||||
// undo any delete flags we may have asked to
|
// undo any delete flags we may have asked to
|
||||||
nsXPIDLCString undoIdsStr;
|
nsCString undoIdsStr;
|
||||||
nsCAutoString undoIds;
|
nsCAutoString undoIds;
|
||||||
|
|
||||||
GetCurrentUrl()->CreateListOfMessageIdsString(getter_Copies(undoIdsStr));
|
GetCurrentUrl()->CreateListOfMessageIdsString(getter_Copies(undoIdsStr));
|
||||||
|
@ -3614,9 +3605,9 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
|
||||||
// if this string started with a '-', then this is an undo of a delete
|
// if this string started with a '-', then this is an undo of a delete
|
||||||
// if its a '+' its a redo
|
// if its a '+' its a redo
|
||||||
if (firstChar == '-')
|
if (firstChar == '-')
|
||||||
Store(undoIds.get(), "-FLAGS (\\Deleted)", PR_TRUE); // most servers will fail silently on a failure, deal with it?
|
Store(undoIds, "-FLAGS (\\Deleted)", PR_TRUE); // most servers will fail silently on a failure, deal with it?
|
||||||
else if (firstChar == '+')
|
else if (firstChar == '+')
|
||||||
Store(undoIds.get(), "+FLAGS (\\Deleted)", PR_TRUE); // most servers will fail silently on a failure, deal with it?
|
Store(undoIds, "+FLAGS (\\Deleted)", PR_TRUE); // most servers will fail silently on a failure, deal with it?
|
||||||
else
|
else
|
||||||
NS_ASSERTION(PR_FALSE, "bogus undo Id's");
|
NS_ASSERTION(PR_FALSE, "bogus undo Id's");
|
||||||
}
|
}
|
||||||
|
@ -3632,7 +3623,7 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
|
||||||
if (!added || (added == deleted))
|
if (!added || (added == deleted))
|
||||||
{
|
{
|
||||||
nsCString idsToFetch("1:*");
|
nsCString idsToFetch("1:*");
|
||||||
FetchMessage(idsToFetch.get(), kFlags, PR_TRUE); // id string shows uids
|
FetchMessage(idsToFetch, kFlags, PR_TRUE); // id string shows uids
|
||||||
// lets see if we should expunge during a full sync of flags.
|
// lets see if we should expunge during a full sync of flags.
|
||||||
if (!DeathSignalReceived()) // only expunge if not reading messages manually and before fetching new
|
if (!DeathSignalReceived()) // only expunge if not reading messages manually and before fetching new
|
||||||
{
|
{
|
||||||
|
@ -3650,7 +3641,7 @@ void nsImapProtocol::ProcessMailboxUpdate(PRBool handlePossibleUndo)
|
||||||
fetchStr.Append(":*");
|
fetchStr.Append(":*");
|
||||||
|
|
||||||
// sprintf(fetchStr, "%ld:*", GetServerStateParser().HighestRecordedUID() + 1);
|
// sprintf(fetchStr, "%ld:*", GetServerStateParser().HighestRecordedUID() + 1);
|
||||||
FetchMessage(fetchStr.get(), kFlags, PR_TRUE); // only new messages please
|
FetchMessage(fetchStr, kFlags, PR_TRUE); // only new messages please
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!DeathSignalReceived())
|
else if (!DeathSignalReceived())
|
||||||
|
@ -3849,7 +3840,7 @@ void nsImapProtocol::FolderMsgDumpLoop(PRUint32 *msgUids, PRUint32 msgCount, nsI
|
||||||
PRUint32 msgsToDownload = msgCountLeft;
|
PRUint32 msgsToDownload = msgCountLeft;
|
||||||
AllocateImapUidString(msgUids + msgsDownloaded, msgsToDownload, m_flagState, idString); // 20 * 200
|
AllocateImapUidString(msgUids + msgsDownloaded, msgsToDownload, m_flagState, idString); // 20 * 200
|
||||||
|
|
||||||
FetchMessage(idString.get(), fields, PR_TRUE); // msg ids are uids
|
FetchMessage(idString, fields, PR_TRUE); // msg ids are uids
|
||||||
|
|
||||||
msgsDownloaded += msgsToDownload;
|
msgsDownloaded += msgsToDownload;
|
||||||
msgCountLeft -= msgsToDownload;
|
msgCountLeft -= msgsToDownload;
|
||||||
|
@ -3900,8 +3891,7 @@ void nsImapProtocol::PeriodicBiff()
|
||||||
//sprintf(fetchStr, "%ld:%ld", id, id + GetServerStateParser().NumberOfMessages() - fFlagState->GetNumberOfMessages());
|
//sprintf(fetchStr, "%ld:%ld", id, id + GetServerStateParser().NumberOfMessages() - fFlagState->GetNumberOfMessages());
|
||||||
fetchStr.AppendInt(id);
|
fetchStr.AppendInt(id);
|
||||||
fetchStr.Append(":*");
|
fetchStr.Append(":*");
|
||||||
FetchMessage(fetchStr.get(), kFlags, PR_TRUE);
|
FetchMessage(fetchStr, kFlags, PR_TRUE);
|
||||||
|
|
||||||
if (((PRUint32) m_flagState->GetHighestNonDeletedUID() >= id) && m_flagState->IsLastMessageUnseen())
|
if (((PRUint32) m_flagState->GetHighestNonDeletedUID() >= id) && m_flagState->IsLastMessageUnseen())
|
||||||
m_currentBiffState = nsIMsgFolder::nsMsgBiffState_NewMail;
|
m_currentBiffState = nsIMsgFolder::nsMsgBiffState_NewMail;
|
||||||
else
|
else
|
||||||
|
@ -4009,9 +3999,9 @@ void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extraInfo)
|
if (extraInfo)
|
||||||
PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s:%s:%s: %.400s", this,hostName,stateName,logSubName,extraInfo,logDataToLog));
|
PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s:%s:%s: %.400s", this,hostName.get(),stateName,logSubName,extraInfo,logDataToLog));
|
||||||
else
|
else
|
||||||
PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s:%s: %.400s",this,hostName,stateName,logSubName,logDataToLog));
|
PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s:%s: %.400s",this,hostName.get(),stateName,logSubName,logDataToLog));
|
||||||
|
|
||||||
// dump the rest of the string in < 400 byte chunks
|
// dump the rest of the string in < 400 byte chunks
|
||||||
while (logDataLen > kLogDataChunkSize)
|
while (logDataLen > kLogDataChunkSize)
|
||||||
|
@ -4075,10 +4065,9 @@ PRUint32 nsImapProtocol::GetMessageSize(const char * messageId,
|
||||||
}
|
}
|
||||||
|
|
||||||
// message id string utility functions
|
// message id string utility functions
|
||||||
/* static */PRBool nsImapProtocol::HandlingMultipleMessages(const char *messageIdString)
|
/* static */PRBool nsImapProtocol::HandlingMultipleMessages(const nsCString & messageIdString)
|
||||||
{
|
{
|
||||||
return (PL_strchr(messageIdString,',') != nsnull ||
|
return (messageIdString.FindCharInSet(",:") != kNotFound);
|
||||||
PL_strchr(messageIdString,':') != nsnull);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32 nsImapProtocol::CountMessagesInIdString(const char *idString)
|
PRUint32 nsImapProtocol::CountMessagesInIdString(const char *idString)
|
||||||
|
@ -4715,16 +4704,14 @@ nsImapProtocol::ShowProgress()
|
||||||
PRUnichar *progressString = NULL;
|
PRUnichar *progressString = NULL;
|
||||||
nsCAutoString cProgressString; cProgressString.AssignWithConversion(m_progressString);
|
nsCAutoString cProgressString; cProgressString.AssignWithConversion(m_progressString);
|
||||||
const char *mailboxName = GetServerStateParser().GetSelectedMailboxName();
|
const char *mailboxName = GetServerStateParser().GetSelectedMailboxName();
|
||||||
|
nsString unicodeMailboxName;
|
||||||
nsXPIDLString unicodeMailboxName;
|
|
||||||
|
|
||||||
nsresult rv = CopyMUTF7toUTF16(nsDependentCString(mailboxName),
|
nsresult rv = CopyMUTF7toUTF16(nsDependentCString(mailboxName),
|
||||||
unicodeMailboxName);
|
unicodeMailboxName);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
// ### should convert mailboxName to PRUnichar and change %s to %S in msg text
|
// ### should convert mailboxName to PRUnichar and change %s to %S in msg text
|
||||||
progressString = nsTextFormatter::smprintf(m_progressString.get(), (const PRUnichar *) unicodeMailboxName,
|
progressString = nsTextFormatter::smprintf(m_progressString.get(),
|
||||||
++m_progressIndex, m_progressCount);
|
unicodeMailboxName.get(), ++m_progressIndex, m_progressCount);
|
||||||
if (progressString)
|
if (progressString)
|
||||||
{
|
{
|
||||||
PercentProgressUpdateEvent(progressString, m_progressIndex, m_progressCount);
|
PercentProgressUpdateEvent(progressString, m_progressIndex, m_progressCount);
|
||||||
|
@ -4751,10 +4738,10 @@ nsImapProtocol::ProgressEventFunctionUsingIdWithString(PRUint32 aMsgId, const
|
||||||
{
|
{
|
||||||
if (m_imapMailFolderSink)
|
if (m_imapMailFolderSink)
|
||||||
{
|
{
|
||||||
nsXPIDLString unicodeStr;
|
nsString unicodeStr;
|
||||||
nsresult rv = CopyMUTF7toUTF16(nsDependentCString(aExtraInfo), unicodeStr);
|
nsresult rv = CopyMUTF7toUTF16(nsDependentCString(aExtraInfo), unicodeStr);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
m_imapMailFolderSink->ProgressStatus(this, aMsgId, unicodeStr);
|
m_imapMailFolderSink->ProgressStatus(this, aMsgId, unicodeStr.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4794,7 +4781,7 @@ nsImapProtocol::PercentProgressUpdateEvent(PRUnichar *message, PRInt32 currentPr
|
||||||
|
|
||||||
// imap commands issued by the parser
|
// imap commands issued by the parser
|
||||||
void
|
void
|
||||||
nsImapProtocol::Store(const char * messageList, const char * messageData,
|
nsImapProtocol::Store(const nsCString &messageList, const char * messageData,
|
||||||
PRBool idsAreUid)
|
PRBool idsAreUid)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -4803,7 +4790,7 @@ nsImapProtocol::Store(const char * messageList, const char * messageData,
|
||||||
nsCString messageIdList;
|
nsCString messageIdList;
|
||||||
nsMsgKeyArray msgKeys;
|
nsMsgKeyArray msgKeys;
|
||||||
if (idsAreUid)
|
if (idsAreUid)
|
||||||
ParseUidString(messageList, msgKeys);
|
ParseUidString(messageList.get(), msgKeys);
|
||||||
|
|
||||||
PRInt32 msgCountLeft = msgKeys.GetSize();
|
PRInt32 msgCountLeft = msgKeys.GetSize();
|
||||||
PRUint32 msgsHandled = 0;
|
PRUint32 msgsHandled = 0;
|
||||||
|
@ -4834,7 +4821,7 @@ nsImapProtocol::Store(const char * messageList, const char * messageData,
|
||||||
|
|
||||||
const char *commandTag = GetServerCommandTag();
|
const char *commandTag = GetServerCommandTag();
|
||||||
int protocolStringSize = PL_strlen(formatString) +
|
int protocolStringSize = PL_strlen(formatString) +
|
||||||
PL_strlen(messageList) + PL_strlen(messageData) +
|
messageList.Length() + PL_strlen(messageData) +
|
||||||
PL_strlen(commandTag) + 1;
|
PL_strlen(commandTag) + 1;
|
||||||
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
char *protocolString = (char *) PR_CALLOC( protocolStringSize );
|
||||||
|
|
||||||
|
@ -4897,7 +4884,7 @@ nsImapProtocol::IssueUserDefinedMsgCommand(const char *command, const char * mes
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImapProtocol::UidExpunge(const char* messageSet)
|
nsImapProtocol::UidExpunge(const nsCString &messageSet)
|
||||||
{
|
{
|
||||||
IncrementCommandTagNumber();
|
IncrementCommandTagNumber();
|
||||||
nsCString command(GetServerCommandTag());
|
nsCString command(GetServerCommandTag());
|
||||||
|
@ -5069,7 +5056,7 @@ void nsImapProtocol::EscapeUserNamePasswordString(const char *strToEscape, nsCSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::InsecureLogin(const char *userName, const char *password)
|
void nsImapProtocol::InsecureLogin(const char *userName, const nsCString &password)
|
||||||
{
|
{
|
||||||
ProgressEventFunctionUsingId (IMAP_STATUS_SENDING_LOGIN);
|
ProgressEventFunctionUsingId (IMAP_STATUS_SENDING_LOGIN);
|
||||||
IncrementCommandTagNumber();
|
IncrementCommandTagNumber();
|
||||||
|
@ -5083,7 +5070,7 @@ void nsImapProtocol::InsecureLogin(const char *userName, const char *password)
|
||||||
// if the password contains a \, login will fail
|
// if the password contains a \, login will fail
|
||||||
// turn foo\bar into foo\\bar
|
// turn foo\bar into foo\\bar
|
||||||
nsCAutoString correctedPassword;
|
nsCAutoString correctedPassword;
|
||||||
EscapeUserNamePasswordString(password, &correctedPassword);
|
EscapeUserNamePasswordString(password.get(), &correctedPassword);
|
||||||
command.Append(correctedPassword);
|
command.Append(correctedPassword);
|
||||||
command.Append("\""CRLF);
|
command.Append("\""CRLF);
|
||||||
|
|
||||||
|
@ -5093,7 +5080,7 @@ void nsImapProtocol::InsecureLogin(const char *userName, const char *password)
|
||||||
ParseIMAPandCheckForNewMail();
|
ParseIMAPandCheckForNewMail();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsImapProtocol::AuthLogin(const char *userName, const char *password, eIMAPCapabilityFlag flag)
|
nsresult nsImapProtocol::AuthLogin(const char *userName, const nsCString &password, eIMAPCapabilityFlag flag)
|
||||||
{
|
{
|
||||||
ProgressEventFunctionUsingId (IMAP_STATUS_SENDING_AUTH_LOGIN);
|
ProgressEventFunctionUsingId (IMAP_STATUS_SENDING_AUTH_LOGIN);
|
||||||
IncrementCommandTagNumber();
|
IncrementCommandTagNumber();
|
||||||
|
@ -5115,7 +5102,7 @@ nsresult nsImapProtocol::AuthLogin(const char *userName, const char *password, e
|
||||||
char * decodedChallenge = PL_Base64Decode(cramDigest,
|
char * decodedChallenge = PL_Base64Decode(cramDigest,
|
||||||
strlen(cramDigest), nsnull);
|
strlen(cramDigest), nsnull);
|
||||||
if (m_imapServerSink)
|
if (m_imapServerSink)
|
||||||
rv = m_imapServerSink->CramMD5Hash(decodedChallenge, password, &digest);
|
rv = m_imapServerSink->CramMD5Hash(decodedChallenge, password.get(), &digest);
|
||||||
|
|
||||||
PR_Free(decodedChallenge);
|
PR_Free(decodedChallenge);
|
||||||
if (NS_SUCCEEDED(rv) && digest)
|
if (NS_SUCCEEDED(rv) && digest)
|
||||||
|
@ -5203,7 +5190,7 @@ nsresult nsImapProtocol::AuthLogin(const char *userName, const char *password, e
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
{
|
{
|
||||||
nsCAutoString cmd;
|
nsCAutoString cmd;
|
||||||
rv = DoNtlmStep1(userName, password, cmd);
|
rv = DoNtlmStep1(userName, password.get(), cmd);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
cmd += CRLF;
|
cmd += CRLF;
|
||||||
|
@ -5244,9 +5231,8 @@ nsresult nsImapProtocol::AuthLogin(const char *userName, const char *password, e
|
||||||
PR_snprintf(&plainstr[1], 510, "%s", userName);
|
PR_snprintf(&plainstr[1], 510, "%s", userName);
|
||||||
len += PL_strlen(userName);
|
len += PL_strlen(userName);
|
||||||
len++; // count for second <NUL> char
|
len++; // count for second <NUL> char
|
||||||
PR_snprintf(&plainstr[len], 511-len, "%s", password);
|
PR_snprintf(&plainstr[len], 511-len, "%s", password.get());
|
||||||
len += PL_strlen(password);
|
len += password.Length();
|
||||||
|
|
||||||
char *base64Str = PL_Base64Encode(plainstr, len, nsnull);
|
char *base64Str = PL_Base64Encode(plainstr, len, nsnull);
|
||||||
if (base64Str)
|
if (base64Str)
|
||||||
{
|
{
|
||||||
|
@ -5285,7 +5271,7 @@ nsresult nsImapProtocol::AuthLogin(const char *userName, const char *password, e
|
||||||
}
|
}
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
{
|
{
|
||||||
base64Str = PL_Base64Encode((char*)password, PL_strlen(password), nsnull);
|
base64Str = PL_Base64Encode(password.get(), password.Length(), nsnull);
|
||||||
PR_snprintf(m_dataOutputBuf, OUTPUT_BUFFER_SIZE, "%s" CRLF, base64Str);
|
PR_snprintf(m_dataOutputBuf, OUTPUT_BUFFER_SIZE, "%s" CRLF, base64Str);
|
||||||
PR_Free(base64Str);
|
PR_Free(base64Str);
|
||||||
rv = SendData(m_dataOutputBuf, PR_TRUE /* suppress logging */);
|
rv = SendData(m_dataOutputBuf, PR_TRUE /* suppress logging */);
|
||||||
|
@ -5346,7 +5332,7 @@ void nsImapProtocol::OnAppendMsgFromFile()
|
||||||
imapMessageFlagsType flagsToSet = 0;
|
imapMessageFlagsType flagsToSet = 0;
|
||||||
PRUint32 msgFlags = 0;
|
PRUint32 msgFlags = 0;
|
||||||
PRTime date = 0;
|
PRTime date = 0;
|
||||||
nsXPIDLCString keywords;
|
nsCString keywords;
|
||||||
if (m_imapMessageSink)
|
if (m_imapMessageSink)
|
||||||
m_imapMessageSink->GetCurMoveCopyMessageInfo(m_runningUrl, &date,
|
m_imapMessageSink->GetCurMoveCopyMessageInfo(m_runningUrl, &date,
|
||||||
getter_Copies(keywords), &msgFlags);
|
getter_Copies(keywords), &msgFlags);
|
||||||
|
@ -5510,7 +5496,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFile* file,
|
||||||
if (FolderIsSelected(mailboxName))
|
if (FolderIsSelected(mailboxName))
|
||||||
Noop();
|
Noop();
|
||||||
|
|
||||||
nsXPIDLCString oldMsgId;
|
nsCString oldMsgId;
|
||||||
rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(oldMsgId));
|
rv = m_runningUrl->CreateListOfMessageIdsString(getter_Copies(oldMsgId));
|
||||||
if (NS_SUCCEEDED(rv) && !oldMsgId.IsEmpty())
|
if (NS_SUCCEEDED(rv) && !oldMsgId.IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -5673,7 +5659,7 @@ void nsImapProtocol::OnEnsureExistsFolder(const char * aSourceMailbox)
|
||||||
aSourceMailbox, nsForMailbox);
|
aSourceMailbox, nsForMailbox);
|
||||||
// NS_ASSERTION (nsForMailbox, "Oops .. null nsForMailbox\n");
|
// NS_ASSERTION (nsForMailbox, "Oops .. null nsForMailbox\n");
|
||||||
|
|
||||||
nsXPIDLCString name;
|
nsCString name;
|
||||||
|
|
||||||
if (nsForMailbox)
|
if (nsForMailbox)
|
||||||
m_runningUrl->AllocateCanonicalPath(aSourceMailbox,
|
m_runningUrl->AllocateCanonicalPath(aSourceMailbox,
|
||||||
|
@ -5784,7 +5770,7 @@ void nsImapProtocol::RefreshACLForFolder(const char *mailboxName)
|
||||||
|
|
||||||
void nsImapProtocol::RefreshFolderACLView(const char *mailboxName, nsIMAPNamespace *nsForMailbox)
|
void nsImapProtocol::RefreshFolderACLView(const char *mailboxName, nsIMAPNamespace *nsForMailbox)
|
||||||
{
|
{
|
||||||
nsXPIDLCString canonicalMailboxName;
|
nsCString canonicalMailboxName;
|
||||||
|
|
||||||
if (nsForMailbox)
|
if (nsForMailbox)
|
||||||
m_runningUrl->AllocateCanonicalPath(mailboxName, nsForMailbox->GetDelimiter(), getter_Copies(canonicalMailboxName));
|
m_runningUrl->AllocateCanonicalPath(mailboxName, nsForMailbox->GetDelimiter(), getter_Copies(canonicalMailboxName));
|
||||||
|
@ -6443,7 +6429,7 @@ void nsImapProtocol::RemoveMsgsAndExpunge()
|
||||||
if (numberOfMessages)
|
if (numberOfMessages)
|
||||||
{
|
{
|
||||||
// Remove all msgs and expunge the folder (ie, compact it).
|
// Remove all msgs and expunge the folder (ie, compact it).
|
||||||
Store("1:*", "+FLAGS.SILENT (\\Deleted)", PR_FALSE); // use sequence #'s
|
Store(NS_LITERAL_CSTRING("1:*"), "+FLAGS.SILENT (\\Deleted)", PR_FALSE); // use sequence #'s
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
Expunge();
|
Expunge();
|
||||||
}
|
}
|
||||||
|
@ -7005,7 +6991,7 @@ const char * nsImapProtocol::GetTrashFolderName()
|
||||||
nsCOMPtr<nsIImapIncomingServer> server = do_QueryReferent(m_server);
|
nsCOMPtr<nsIImapIncomingServer> server = do_QueryReferent(m_server);
|
||||||
if (server)
|
if (server)
|
||||||
{
|
{
|
||||||
nsString trashFolderName;
|
nsAutoString trashFolderName;
|
||||||
if (NS_SUCCEEDED(server->GetTrashFolderName(trashFolderName)))
|
if (NS_SUCCEEDED(server->GetTrashFolderName(trashFolderName)))
|
||||||
CopyUTF16toMUTF7(trashFolderName, m_trashFolderName);
|
CopyUTF16toMUTF7(trashFolderName, m_trashFolderName);
|
||||||
}
|
}
|
||||||
|
@ -7456,7 +7442,7 @@ void nsImapProtocol::SetupMessageFlagsString(nsCString& flagString,
|
||||||
flagString.SetLength(flagString.Length()-1);
|
flagString.SetLength(flagString.Length()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsImapProtocol::ProcessStoreFlags(const char * messageIdsString,
|
void nsImapProtocol::ProcessStoreFlags(const nsCString &messageIdsString,
|
||||||
PRBool idsAreUids,
|
PRBool idsAreUids,
|
||||||
imapMessageFlagsType flags,
|
imapMessageFlagsType flags,
|
||||||
PRBool addFlags)
|
PRBool addFlags)
|
||||||
|
@ -7608,8 +7594,8 @@ PRBool nsImapProtocol::TryToLogon()
|
||||||
PRInt32 logonTries = 0;
|
PRInt32 logonTries = 0;
|
||||||
PRBool loginSucceeded = PR_FALSE;
|
PRBool loginSucceeded = PR_FALSE;
|
||||||
PRBool clientSucceeded = PR_TRUE;
|
PRBool clientSucceeded = PR_TRUE;
|
||||||
nsCString password;
|
nsCAutoString password;
|
||||||
nsCString userName;
|
nsCAutoString userName;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
// get the password and user name for the current incoming server...
|
// get the password and user name for the current incoming server...
|
||||||
|
@ -7687,38 +7673,38 @@ PRBool nsImapProtocol::TryToLogon()
|
||||||
// all subsequent login attempts to fail (bug 231303, bug 227560)
|
// all subsequent login attempts to fail (bug 231303, bug 227560)
|
||||||
if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasAuthGssApiCapability)
|
if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasAuthGssApiCapability)
|
||||||
{
|
{
|
||||||
clientSucceeded = NS_SUCCEEDED(AuthLogin(userName.get(), password.get(), kHasAuthGssApiCapability));
|
clientSucceeded = NS_SUCCEEDED(AuthLogin(userName.get(), password, kHasAuthGssApiCapability));
|
||||||
}
|
}
|
||||||
else if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasCRAMCapability)
|
else if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasCRAMCapability)
|
||||||
{
|
{
|
||||||
AuthLogin (userName.get(), password.get(), kHasCRAMCapability);
|
AuthLogin (userName.get(), password, kHasCRAMCapability);
|
||||||
logonTries++;
|
logonTries++;
|
||||||
}
|
}
|
||||||
else if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasAuthNTLMCapability)
|
else if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasAuthNTLMCapability)
|
||||||
{
|
{
|
||||||
AuthLogin (userName.get(), password.get(), kHasAuthNTLMCapability);
|
AuthLogin (userName.get(), password, kHasAuthNTLMCapability);
|
||||||
logonTries++;
|
logonTries++;
|
||||||
}
|
}
|
||||||
else if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasAuthMSNCapability)
|
else if (m_useSecAuth && GetServerStateParser().GetCapabilityFlag() & kHasAuthMSNCapability)
|
||||||
{
|
{
|
||||||
AuthLogin (userName.get(), password.get(), kHasAuthMSNCapability);
|
AuthLogin (userName.get(), password, kHasAuthMSNCapability);
|
||||||
logonTries++;
|
logonTries++;
|
||||||
}
|
}
|
||||||
else if (GetServerStateParser().GetCapabilityFlag() & kHasAuthPlainCapability)
|
else if (GetServerStateParser().GetCapabilityFlag() & kHasAuthPlainCapability)
|
||||||
{
|
{
|
||||||
AuthLogin (userName.get(), password.get(), kHasAuthPlainCapability);
|
AuthLogin (userName.get(), password, kHasAuthPlainCapability);
|
||||||
logonTries++;
|
logonTries++;
|
||||||
}
|
}
|
||||||
else if (GetServerStateParser().GetCapabilityFlag() & kHasAuthLoginCapability)
|
else if (GetServerStateParser().GetCapabilityFlag() & kHasAuthLoginCapability)
|
||||||
{
|
{
|
||||||
AuthLogin (userName.get(), password.get(), kHasAuthLoginCapability);
|
AuthLogin (userName.get(), password, kHasAuthLoginCapability);
|
||||||
logonTries++; // This counts as a logon try for most servers
|
logonTries++; // This counts as a logon try for most servers
|
||||||
}
|
}
|
||||||
else if (! (GetServerStateParser().GetCapabilityFlag() & kLoginDisabled))
|
else if (! (GetServerStateParser().GetCapabilityFlag() & kLoginDisabled))
|
||||||
InsecureLogin(userName.get(), password.get());
|
InsecureLogin(userName.get(), password);
|
||||||
}
|
}
|
||||||
else if (! (GetServerStateParser().GetCapabilityFlag() & kLoginDisabled))
|
else if (! (GetServerStateParser().GetCapabilityFlag() & kLoginDisabled))
|
||||||
InsecureLogin(userName.get(), password.get());
|
InsecureLogin(userName.get(), password);
|
||||||
|
|
||||||
if (!clientSucceeded || !GetServerStateParser().LastCommandSuccessful())
|
if (!clientSucceeded || !GetServerStateParser().LastCommandSuccessful())
|
||||||
{
|
{
|
||||||
|
@ -7815,7 +7801,7 @@ void nsImapProtocol::GetQuotaDataIfSupported(const char *aBoxName)
|
||||||
nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryReferent(m_server, &rv);
|
nsCOMPtr<nsIImapIncomingServer> imapServer = do_QueryReferent(m_server, &rv);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return;
|
return;
|
||||||
nsCString redirectorType;
|
nsCAutoString redirectorType;
|
||||||
imapServer->GetRedirectorType(redirectorType);
|
imapServer->GetRedirectorType(redirectorType);
|
||||||
if (redirectorType.EqualsLiteral("aol") && PL_strcasecmp("Inbox", aBoxName))
|
if (redirectorType.EqualsLiteral("aol") && PL_strcasecmp("Inbox", aBoxName))
|
||||||
return;
|
return;
|
||||||
|
@ -8312,9 +8298,9 @@ nsresult nsImapMockChannel::ReadFromMemCache(nsICacheEntryDescriptor *entry)
|
||||||
NS_ENSURE_ARG(entry);
|
NS_ENSURE_ARG(entry);
|
||||||
|
|
||||||
PRUint32 annotationLength = 0;
|
PRUint32 annotationLength = 0;
|
||||||
nsXPIDLCString annotation;
|
nsCString annotation;
|
||||||
nsCAutoString entryKey;
|
nsCAutoString entryKey;
|
||||||
nsXPIDLCString contentType;
|
nsCAutoString contentType;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
PRBool shouldUseCacheEntry = PR_FALSE;
|
PRBool shouldUseCacheEntry = PR_FALSE;
|
||||||
|
|
||||||
|
@ -8331,12 +8317,9 @@ nsresult nsImapMockChannel::ReadFromMemCache(nsICacheEntryDescriptor *entry)
|
||||||
{
|
{
|
||||||
// otherwise, we have the whole msg, and we should make sure the content isn't modified.
|
// otherwise, we have the whole msg, and we should make sure the content isn't modified.
|
||||||
rv = entry->GetMetaDataElement("ContentModified", getter_Copies(annotation));
|
rv = entry->GetMetaDataElement("ContentModified", getter_Copies(annotation));
|
||||||
if (NS_SUCCEEDED(rv) && (annotation.get()))
|
if (NS_SUCCEEDED(rv) && !annotation.IsEmpty())
|
||||||
{
|
shouldUseCacheEntry = annotation.EqualsLiteral("Not Modified");
|
||||||
annotationLength = strlen(annotation.get());
|
|
||||||
if (annotationLength == strlen("Not Modified") && !nsCRT::strncmp(annotation, "Not Modified", annotationLength))
|
|
||||||
shouldUseCacheEntry = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (shouldUseCacheEntry)
|
if (shouldUseCacheEntry)
|
||||||
{
|
{
|
||||||
|
@ -8423,7 +8406,7 @@ PRBool nsImapMockChannel::ReadFromLocalCache()
|
||||||
mailnewsUrl->GetMsgIsInLocalCache(&useLocalCache);
|
mailnewsUrl->GetMsgIsInLocalCache(&useLocalCache);
|
||||||
if (useLocalCache)
|
if (useLocalCache)
|
||||||
{
|
{
|
||||||
nsXPIDLCString messageIdString;
|
nsCAutoString messageIdString;
|
||||||
|
|
||||||
SetupPartExtractorListener(imapUrl, m_channelListener);
|
SetupPartExtractorListener(imapUrl, m_channelListener);
|
||||||
|
|
||||||
|
@ -8434,7 +8417,7 @@ PRBool nsImapMockChannel::ReadFromLocalCache()
|
||||||
{
|
{
|
||||||
// we want to create a file channel and read the msg from there.
|
// we want to create a file channel and read the msg from there.
|
||||||
nsCOMPtr<nsIInputStream> fileStream;
|
nsCOMPtr<nsIInputStream> fileStream;
|
||||||
nsMsgKey msgKey = atoi(messageIdString);
|
nsMsgKey msgKey = atoi(messageIdString.get());
|
||||||
PRUint32 size, offset;
|
PRUint32 size, offset;
|
||||||
rv = folder->GetOfflineFileStream(msgKey, &offset, &size, getter_AddRefs(fileStream));
|
rv = folder->GetOfflineFileStream(msgKey, &offset, &size, getter_AddRefs(fileStream));
|
||||||
// get the file channel from the folder, somehow (through the message or
|
// get the file channel from the folder, somehow (through the message or
|
||||||
|
|
|
@ -78,7 +78,6 @@
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIImapIncomingServer.h"
|
#include "nsIImapIncomingServer.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIMsgWindow.h"
|
#include "nsIMsgWindow.h"
|
||||||
#include "nsIMsgLogonRedirector.h"
|
#include "nsIMsgLogonRedirector.h"
|
||||||
#include "nsICacheListener.h"
|
#include "nsICacheListener.h"
|
||||||
|
@ -175,8 +174,7 @@ public:
|
||||||
|
|
||||||
// message id string utilities.
|
// message id string utilities.
|
||||||
PRUint32 CountMessagesInIdString(const char *idString);
|
PRUint32 CountMessagesInIdString(const char *idString);
|
||||||
static PRBool HandlingMultipleMessages(const char *messageIdString);
|
static PRBool HandlingMultipleMessages(const nsCString &messageIdString);
|
||||||
|
|
||||||
// escape slashes and double quotes in username/passwords for insecure login.
|
// escape slashes and double quotes in username/passwords for insecure login.
|
||||||
static void EscapeUserNamePasswordString(const char *strToEscape, nsCString *resultStr);
|
static void EscapeUserNamePasswordString(const char *strToEscape, nsCString *resultStr);
|
||||||
|
|
||||||
|
@ -184,20 +182,19 @@ public:
|
||||||
void GetShouldDownloadAllHeaders(PRBool *aResult);
|
void GetShouldDownloadAllHeaders(PRBool *aResult);
|
||||||
void GetArbitraryHeadersToDownload(char **aResult);
|
void GetArbitraryHeadersToDownload(char **aResult);
|
||||||
virtual void AdjustChunkSize();
|
virtual void AdjustChunkSize();
|
||||||
virtual void FetchMessage(const char * messageIds,
|
virtual void FetchMessage(const nsCString &messageIds,
|
||||||
nsIMAPeFetchFields whatToFetch,
|
nsIMAPeFetchFields whatToFetch,
|
||||||
PRBool idAreUid,
|
PRBool idAreUid,
|
||||||
PRUint32 startByte = 0, PRUint32 endByte = 0,
|
PRUint32 startByte = 0, PRUint32 endByte = 0,
|
||||||
char *part = 0);
|
char *part = 0);
|
||||||
void FetchTryChunking(const char * messageIds,
|
void FetchTryChunking(const nsCString &messageIds,
|
||||||
nsIMAPeFetchFields whatToFetch,
|
nsIMAPeFetchFields whatToFetch,
|
||||||
PRBool idIsUid,
|
PRBool idIsUid,
|
||||||
char *part,
|
char *part,
|
||||||
PRUint32 downloadSize,
|
PRUint32 downloadSize,
|
||||||
PRBool tryChunking);
|
PRBool tryChunking);
|
||||||
virtual void PipelinedFetchMessageParts(nsCString &uid, nsIMAPMessagePartIDArray *parts);
|
virtual void PipelinedFetchMessageParts(nsCString &uid, nsIMAPMessagePartIDArray *parts);
|
||||||
void FallbackToFetchWholeMsg(const char *messageId, PRUint32 messageSize);
|
void FallbackToFetchWholeMsg(const nsCString &messageId, PRUint32 messageSize);
|
||||||
|
|
||||||
// used when streaming a message fetch
|
// used when streaming a message fetch
|
||||||
virtual nsresult BeginMessageDownLoad(PRUint32 totalSize, // for user, headers and body
|
virtual nsresult BeginMessageDownLoad(PRUint32 totalSize, // for user, headers and body
|
||||||
const char *contentType); // some downloads are header only
|
const char *contentType); // some downloads are header only
|
||||||
|
@ -266,16 +263,16 @@ public:
|
||||||
void Search(const char * searchCriteria, PRBool useUID,
|
void Search(const char * searchCriteria, PRBool useUID,
|
||||||
PRBool notifyHit = PR_TRUE);
|
PRBool notifyHit = PR_TRUE);
|
||||||
// imap commands issued by the parser
|
// imap commands issued by the parser
|
||||||
void Store(const char * aMessageList, const char * aMessageData, PRBool
|
void Store(const nsCString &aMessageList, const char * aMessageData, PRBool
|
||||||
aIdsAreUid);
|
aIdsAreUid);
|
||||||
void ProcessStoreFlags(const char * messageIds,
|
void ProcessStoreFlags(const nsCString &messageIds,
|
||||||
PRBool idsAreUids,
|
PRBool idsAreUids,
|
||||||
imapMessageFlagsType flags,
|
imapMessageFlagsType flags,
|
||||||
PRBool addFlags);
|
PRBool addFlags);
|
||||||
void IssueUserDefinedMsgCommand(const char *command, const char * messageList);
|
void IssueUserDefinedMsgCommand(const char *command, const char * messageList);
|
||||||
void FetchMsgAttribute(const char * messageIds, const char *attribute);
|
void FetchMsgAttribute(const nsCString &messageIds, const nsCString &attribute);
|
||||||
void Expunge();
|
void Expunge();
|
||||||
void UidExpunge(const char* messageSet);
|
void UidExpunge(const nsCString &messageSet);
|
||||||
void Close(PRBool shuttingDown = PR_FALSE, PRBool waitForResponse = PR_TRUE);
|
void Close(PRBool shuttingDown = PR_FALSE, PRBool waitForResponse = PR_TRUE);
|
||||||
void Check();
|
void Check();
|
||||||
void SelectMailbox(const char *mailboxName);
|
void SelectMailbox(const char *mailboxName);
|
||||||
|
@ -289,7 +286,7 @@ public:
|
||||||
void MailboxData();
|
void MailboxData();
|
||||||
void GetMyRightsForFolder(const char *mailboxName);
|
void GetMyRightsForFolder(const char *mailboxName);
|
||||||
void AutoSubscribeToMailboxIfNecessary(const char *mailboxName);
|
void AutoSubscribeToMailboxIfNecessary(const char *mailboxName);
|
||||||
void Bodystructure(const char *messageId, PRBool idIsUid);
|
void Bodystructure(const nsCString &messageId, PRBool idIsUid);
|
||||||
void PipelinedFetchMessageParts(const char *uid, nsIMAPMessagePartIDArray *parts);
|
void PipelinedFetchMessageParts(const char *uid, nsIMAPMessagePartIDArray *parts);
|
||||||
|
|
||||||
|
|
||||||
|
@ -458,8 +455,8 @@ private:
|
||||||
void Capability(); // query host for capabilities.
|
void Capability(); // query host for capabilities.
|
||||||
void Language(); // set the language on the server if it supports it
|
void Language(); // set the language on the server if it supports it
|
||||||
void Namespace();
|
void Namespace();
|
||||||
void InsecureLogin(const char *userName, const char *password);
|
void InsecureLogin(const char *userName, const nsCString &password);
|
||||||
nsresult AuthLogin(const char *userName, const char *password, eIMAPCapabilityFlag flag);
|
nsresult AuthLogin(const char *userName, const nsCString &password, eIMAPCapabilityFlag flag);
|
||||||
void ProcessAuthenticatedStateURL();
|
void ProcessAuthenticatedStateURL();
|
||||||
void ProcessAfterAuthenticated();
|
void ProcessAfterAuthenticated();
|
||||||
void ProcessSelectedStateURL();
|
void ProcessSelectedStateURL();
|
||||||
|
@ -571,7 +568,7 @@ private:
|
||||||
nsCString m_logonCookie;
|
nsCString m_logonCookie;
|
||||||
PRInt16 m_logonPort;
|
PRInt16 m_logonPort;
|
||||||
|
|
||||||
nsXPIDLString mAcceptLanguages;
|
nsString mAcceptLanguages;
|
||||||
|
|
||||||
// progress stuff
|
// progress stuff
|
||||||
void SetProgressString(PRInt32 stringId);
|
void SetProgressString(PRInt32 stringId);
|
||||||
|
|
|
@ -444,7 +444,7 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
|
||||||
if (!fZeroLengthMessageUidString.IsEmpty())
|
if (!fZeroLengthMessageUidString.IsEmpty())
|
||||||
{
|
{
|
||||||
// "Deleting zero length message");
|
// "Deleting zero length message");
|
||||||
fServerConnection.Store(fZeroLengthMessageUidString.get(), "+Flags (\\Deleted)", PR_TRUE);
|
fServerConnection.Store(fZeroLengthMessageUidString, "+Flags (\\Deleted)", PR_TRUE);
|
||||||
if (LastCommandSuccessful())
|
if (LastCommandSuccessful())
|
||||||
fServerConnection.Expunge();
|
fServerConnection.Expunge();
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ void nsImapServerResponseParser::response_data()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if custom command
|
// check if custom command
|
||||||
nsXPIDLCString customCommand;
|
nsCAutoString customCommand;
|
||||||
fServerConnection.GetCurrentUrl()->GetCommand(getter_Copies(customCommand));
|
fServerConnection.GetCurrentUrl()->GetCommand(getter_Copies(customCommand));
|
||||||
if (customCommand.Equals(fNextToken))
|
if (customCommand.Equals(fNextToken))
|
||||||
{
|
{
|
||||||
|
@ -1298,7 +1298,7 @@ void nsImapServerResponseParser::msg_fetch()
|
||||||
if (!fServerConnection.GetCurrentUrl())
|
if (!fServerConnection.GetCurrentUrl())
|
||||||
return;
|
return;
|
||||||
fServerConnection.GetCurrentUrl()->GetImapAction(&imapAction);
|
fServerConnection.GetCurrentUrl()->GetImapAction(&imapAction);
|
||||||
nsXPIDLCString userDefinedFetchAttribute;
|
nsCAutoString userDefinedFetchAttribute;
|
||||||
fServerConnection.GetCurrentUrl()->GetCustomAttributeToFetch(getter_Copies(userDefinedFetchAttribute));
|
fServerConnection.GetCurrentUrl()->GetCustomAttributeToFetch(getter_Copies(userDefinedFetchAttribute));
|
||||||
if (imapAction == nsIImapUrl::nsImapUserDefinedFetchAttribute && !strcmp(userDefinedFetchAttribute.get(), fNextToken))
|
if (imapAction == nsIImapUrl::nsImapUserDefinedFetchAttribute && !strcmp(userDefinedFetchAttribute.get(), fNextToken))
|
||||||
{
|
{
|
||||||
|
@ -1407,12 +1407,10 @@ void nsImapServerResponseParser::envelope_data()
|
||||||
PRBool headerNonNil = PR_TRUE;
|
PRBool headerNonNil = PR_TRUE;
|
||||||
if (EnvelopeTable[tableIndex].type == envelopeString)
|
if (EnvelopeTable[tableIndex].type == envelopeString)
|
||||||
{
|
{
|
||||||
nsXPIDLCString strValue;
|
nsCAutoString strValue;
|
||||||
strValue.Adopt(CreateNilString());
|
strValue.Adopt(CreateNilString());
|
||||||
if (strValue)
|
if (!strValue.IsEmpty())
|
||||||
{
|
|
||||||
headerLine.Append(strValue);
|
headerLine.Append(strValue);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
headerNonNil = PR_FALSE;
|
headerNonNil = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1444,7 +1442,7 @@ void nsImapServerResponseParser::xaolenvelope_data()
|
||||||
{
|
{
|
||||||
AdvanceToNextToken();
|
AdvanceToNextToken();
|
||||||
fNextToken++; // eat '('
|
fNextToken++; // eat '('
|
||||||
nsXPIDLCString subject;
|
nsCAutoString subject;
|
||||||
subject.Adopt(CreateNilString());
|
subject.Adopt(CreateNilString());
|
||||||
nsCAutoString subjectLine("Subject: ");
|
nsCAutoString subjectLine("Subject: ");
|
||||||
subjectLine += subject;
|
subjectLine += subject;
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocShellLoadInfo.h"
|
#include "nsIDocShellLoadInfo.h"
|
||||||
#include "nsIRDFService.h"
|
#include "nsIRDFService.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsRDFCID.h"
|
#include "nsRDFCID.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
|
@ -166,7 +165,7 @@ nsImapService::GetFolderName(nsIMsgFolder* aImapFolder,
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIMsgImapMailFolder> aFolder(do_QueryInterface(aImapFolder, &rv));
|
nsCOMPtr<nsIMsgImapMailFolder> aFolder(do_QueryInterface(aImapFolder, &rv));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
nsXPIDLCString onlineName;
|
nsCString onlineName;
|
||||||
// online name is in imap utf-7 - leave it that way
|
// online name is in imap utf-7 - leave it that way
|
||||||
rv = aFolder->GetOnlineName(getter_Copies(onlineName));
|
rv = aFolder->GetOnlineName(getter_Copies(onlineName));
|
||||||
|
|
||||||
|
@ -187,15 +186,15 @@ nsImapService::GetFolderName(nsIMsgFolder* aImapFolder,
|
||||||
// otherwise, we do want to escape slashes.
|
// otherwise, we do want to escape slashes.
|
||||||
// we want to escape slashes and '^' first, otherwise, nsEscape will lose them
|
// we want to escape slashes and '^' first, otherwise, nsEscape will lose them
|
||||||
PRBool escapeSlashes = (GetHierarchyDelimiter(aImapFolder) != (PRUnichar) '/');
|
PRBool escapeSlashes = (GetHierarchyDelimiter(aImapFolder) != (PRUnichar) '/');
|
||||||
if (escapeSlashes && (const char *) onlineName)
|
if (escapeSlashes && !onlineName.IsEmpty())
|
||||||
{
|
{
|
||||||
char* escapedOnlineName;
|
char* escapedOnlineName;
|
||||||
rv = nsImapUrl::EscapeSlashes((const char *) onlineName, &escapedOnlineName);
|
rv = nsImapUrl::EscapeSlashes(onlineName.get(), &escapedOnlineName);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
onlineName.Adopt(escapedOnlineName);
|
onlineName.Adopt(escapedOnlineName);
|
||||||
}
|
}
|
||||||
// need to escape everything else
|
// need to escape everything else
|
||||||
*folderName = nsEscape((const char *) onlineName, url_Path);
|
*folderName = nsEscape(onlineName.get(), url_Path);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,11 +243,11 @@ nsImapService::SelectFolder(nsIEventTarget * aClientEventTarget,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append("/select>");
|
urlSpec.Append("/select>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
rv = mailNewsUrl->SetSpec(urlSpec);
|
rv = mailNewsUrl->SetSpec(urlSpec);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = GetImapConnectionAndLoadUrl(aClientEventTarget,
|
rv = GetImapConnectionAndLoadUrl(aClientEventTarget,
|
||||||
|
@ -282,7 +281,7 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL
|
||||||
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
rv = DecomposeImapURI(aMessageURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
rv = DecomposeImapURI(aMessageURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
|
@ -295,7 +294,7 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(imapUrl);
|
nsCOMPtr <nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(imapUrl);
|
||||||
PRBool useLocalCache = PR_FALSE;
|
PRBool useLocalCache = PR_FALSE;
|
||||||
folder->HasMsgOffline(atoi(msgKey), &useLocalCache);
|
folder->HasMsgOffline(atoi(msgKey.get()), &useLocalCache);
|
||||||
mailnewsUrl->SetMsgIsInLocalCache(useLocalCache);
|
mailnewsUrl->SetMsgIsInLocalCache(useLocalCache);
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> url = do_QueryInterface(imapUrl);
|
nsCOMPtr<nsIURI> url = do_QueryInterface(imapUrl);
|
||||||
|
@ -303,9 +302,9 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL
|
||||||
urlSpec.Append("fetch>UID>");
|
urlSpec.Append("fetch>UID>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(folder, getter_Copies(folderName));
|
GetFolderName(folder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(msgKey);
|
urlSpec.Append(msgKey);
|
||||||
rv = url->SetSpec(urlSpec);
|
rv = url->SetSpec(urlSpec);
|
||||||
|
@ -359,8 +358,8 @@ NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
nsXPIDLCString uriMimePart;
|
nsCAutoString uriMimePart;
|
||||||
nsCAutoString folderURI;
|
nsCAutoString folderURI;
|
||||||
nsMsgKey key;
|
nsMsgKey key;
|
||||||
|
|
||||||
|
@ -381,14 +380,14 @@ NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType,
|
||||||
urlSpec.Append("/fetch>UID>");
|
urlSpec.Append("/fetch>UID>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(folder, getter_Copies(folderName));
|
GetFolderName(folder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(msgKey.get());
|
urlSpec.Append(msgKey.get());
|
||||||
urlSpec.Append(uriMimePart.get());
|
urlSpec.Append(uriMimePart.get());
|
||||||
|
|
||||||
if (uriMimePart)
|
if (!uriMimePart.IsEmpty())
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl (do_QueryInterface(imapUrl));
|
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl (do_QueryInterface(imapUrl));
|
||||||
if (mailUrl)
|
if (mailUrl)
|
||||||
|
@ -397,7 +396,7 @@ NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType,
|
||||||
mailUrl->SetFileName(nsDependentCString(aFileName));
|
mailUrl->SetFileName(nsDependentCString(aFileName));
|
||||||
}
|
}
|
||||||
rv = FetchMimePart(imapUrl, nsIImapUrl::nsImapOpenMimePart, folder, imapMessageSink,
|
rv = FetchMimePart(imapUrl, nsIImapUrl::nsImapOpenMimePart, folder, imapMessageSink,
|
||||||
nsnull, aDisplayConsumer, msgKey, uriMimePart);
|
nsnull, aDisplayConsumer, msgKey.get(), uriMimePart.get());
|
||||||
}
|
}
|
||||||
} // if we got a message sink
|
} // if we got a message sink
|
||||||
} // if we parsed the message uri
|
} // if we parsed the message uri
|
||||||
|
@ -409,8 +408,8 @@ NS_IMETHODIMP nsImapService::FetchMimePart(nsIURI *aURI, const char *aMessageURI
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
nsXPIDLCString mimePart;
|
nsCAutoString mimePart;
|
||||||
nsCAutoString folderURI;
|
nsCAutoString folderURI;
|
||||||
nsMsgKey key;
|
nsMsgKey key;
|
||||||
|
|
||||||
|
@ -427,10 +426,10 @@ NS_IMETHODIMP nsImapService::FetchMimePart(nsIURI *aURI, const char *aMessageURI
|
||||||
msgurl->SetMsgWindow(aMsgWindow);
|
msgurl->SetMsgWindow(aMsgWindow);
|
||||||
msgurl->RegisterListener(aUrlListener);
|
msgurl->RegisterListener(aUrlListener);
|
||||||
|
|
||||||
if (mimePart)
|
if (!mimePart.IsEmpty())
|
||||||
{
|
{
|
||||||
return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
||||||
aURL, aDisplayConsumer, msgKey, mimePart);
|
aURL, aDisplayConsumer, msgKey.get(), mimePart.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,8 +445,8 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
nsXPIDLCString mimePart;
|
nsCAutoString mimePart;
|
||||||
nsCAutoString folderURI;
|
nsCAutoString folderURI;
|
||||||
nsMsgKey key;
|
nsMsgKey key;
|
||||||
nsCAutoString messageURI(aMessageURI);
|
nsCAutoString messageURI(aMessageURI);
|
||||||
|
@ -496,10 +495,10 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
||||||
rv = CreateStartOfImapUrl(aMessageURI, getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
rv = CreateStartOfImapUrl(aMessageURI, getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
if (mimePart)
|
if (!mimePart.IsEmpty())
|
||||||
{
|
{
|
||||||
return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
||||||
aURL, aDisplayConsumer, msgKey, mimePart);
|
aURL, aDisplayConsumer, msgKey.get(), mimePart.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgMailNewsUrl> msgurl (do_QueryInterface(imapUrl));
|
nsCOMPtr<nsIMsgMailNewsUrl> msgurl (do_QueryInterface(imapUrl));
|
||||||
|
@ -514,7 +513,7 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
||||||
nsCOMPtr<nsIMsgIncomingServer> aMsgIncomingServer;
|
nsCOMPtr<nsIMsgIncomingServer> aMsgIncomingServer;
|
||||||
|
|
||||||
if (imapMessageSink)
|
if (imapMessageSink)
|
||||||
imapMessageSink->GetMessageSizeFromDB(msgKey, PR_TRUE, &messageSize);
|
imapMessageSink->GetMessageSizeFromDB(msgKey.get(), PR_TRUE, &messageSize);
|
||||||
|
|
||||||
msgurl->SetMsgWindow(aMsgWindow);
|
msgurl->SetMsgWindow(aMsgWindow);
|
||||||
|
|
||||||
|
@ -577,7 +576,7 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
||||||
prefBranch->GetBoolPref("mailnews.mark_message_read.delay", &forcePeek);
|
prefBranch->GetBoolPref("mailnews.mark_message_read.delay", &forcePeek);
|
||||||
|
|
||||||
rv = FetchMessage(imapUrl, forcePeek ? nsIImapUrl::nsImapMsgFetchPeek : nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
rv = FetchMessage(imapUrl, forcePeek ? nsIImapUrl::nsImapMsgFetchPeek : nsIImapUrl::nsImapMsgFetch, folder, imapMessageSink,
|
||||||
aMsgWindow, aDisplayConsumer, msgKey, PR_FALSE, (mPrintingOperation) ? "print" : nsnull, aURL);
|
aMsgWindow, aDisplayConsumer, msgKey.get(), PR_FALSE, (mPrintingOperation) ? "print" : nsnull, aURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -627,9 +626,6 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
|
||||||
if (mPrintingOperation)
|
if (mPrintingOperation)
|
||||||
urlSpec.Append("?header=print");
|
urlSpec.Append("?header=print");
|
||||||
|
|
||||||
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
|
|
||||||
// compiler that is preventing in string parameters from showing up as
|
|
||||||
// const char *. hopefully they will fix it soon.
|
|
||||||
rv = url->SetSpec(urlSpec);
|
rv = url->SetSpec(urlSpec);
|
||||||
|
|
||||||
rv = aImapUrl->SetImapAction(actionToUse /* nsIImapUrl::nsImapMsgFetch */);
|
rv = aImapUrl->SetImapAction(actionToUse /* nsIImapUrl::nsImapMsgFetch */);
|
||||||
|
@ -727,7 +723,7 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
rv = DecomposeImapURI(aSrcMailboxURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
rv = DecomposeImapURI(aSrcMailboxURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
|
@ -738,7 +734,7 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
|
||||||
nsCAutoString urlSpec;
|
nsCAutoString urlSpec;
|
||||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||||
PRBool hasMsgOffline = PR_FALSE;
|
PRBool hasMsgOffline = PR_FALSE;
|
||||||
nsMsgKey key = atoi(msgKey);
|
nsMsgKey key = atoi(msgKey.get());
|
||||||
|
|
||||||
rv = CreateStartOfImapUrl(aSrcMailboxURI, getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
rv = CreateStartOfImapUrl(aSrcMailboxURI, getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
||||||
|
|
||||||
|
@ -753,7 +749,7 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
|
||||||
nsImapAction imapAction = nsIImapUrl::nsImapOnlineToOfflineCopy;
|
nsImapAction imapAction = nsIImapUrl::nsImapOnlineToOfflineCopy;
|
||||||
if (moveMessage)
|
if (moveMessage)
|
||||||
imapAction = nsIImapUrl::nsImapOnlineToOfflineMove;
|
imapAction = nsIImapUrl::nsImapOnlineToOfflineMove;
|
||||||
rv = FetchMessage(imapUrl,imapAction, folder, imapMessageSink,aMsgWindow, streamSupport, msgKey, PR_FALSE, nsnull, aURL);
|
rv = FetchMessage(imapUrl,imapAction, folder, imapMessageSink,aMsgWindow, streamSupport, msgKey.get(), PR_FALSE, nsnull, aURL);
|
||||||
} // if we got an imap message sink
|
} // if we got an imap message sink
|
||||||
} // if we decomposed the imap message
|
} // if we decomposed the imap message
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -771,7 +767,7 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
||||||
if (!streamSupport || NS_FAILED(rv)) return rv;
|
if (!streamSupport || NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> folder = srcFolder;
|
nsCOMPtr<nsIMsgFolder> folder = srcFolder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
|
nsCOMPtr<nsIImapMessageSink> imapMessageSink(do_QueryInterface(folder, &rv));
|
||||||
|
@ -780,7 +776,7 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
||||||
// we generate the uri for the first message so that way on down the line,
|
// we generate the uri for the first message so that way on down the line,
|
||||||
// GetMessage in nsCopyMessageStreamListener will get an unescaped username
|
// GetMessage in nsCopyMessageStreamListener will get an unescaped username
|
||||||
// and be able to find the msg hdr. See bug 259656 for details
|
// and be able to find the msg hdr. See bug 259656 for details
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
srcFolder->GenerateMessageURI(keys->GetAt(0), getter_Copies(uri));
|
srcFolder->GenerateMessageURI(keys->GetAt(0), getter_Copies(uri));
|
||||||
|
|
||||||
nsCString messageIds;
|
nsCString messageIds;
|
||||||
|
@ -789,12 +785,9 @@ nsImapService::CopyMessages(nsMsgKeyArray *keys, nsIMsgFolder *srcFolder, nsIStr
|
||||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||||
nsCAutoString urlSpec;
|
nsCAutoString urlSpec;
|
||||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||||
rv = CreateStartOfImapUrl(uri, getter_AddRefs(imapUrl), folder, aUrlListener, urlSpec, hierarchySeparator);
|
rv = CreateStartOfImapUrl(uri.get(), getter_AddRefs(imapUrl), folder.get(), aUrlListener, urlSpec, hierarchySeparator);
|
||||||
nsImapAction action;
|
nsImapAction action;
|
||||||
if (moveMessage)
|
action = (moveMessage) ? nsIImapUrl::nsImapOnlineToOfflineMove : nsIImapUrl::nsImapOnlineToOfflineCopy;
|
||||||
action = nsIImapUrl::nsImapOnlineToOfflineMove;
|
|
||||||
else
|
|
||||||
action = nsIImapUrl::nsImapOnlineToOfflineCopy;
|
|
||||||
imapUrl->SetCopyState(aMailboxCopy);
|
imapUrl->SetCopyState(aMailboxCopy);
|
||||||
// now try to display the message
|
// now try to display the message
|
||||||
rv = FetchMessage(imapUrl, action, folder, imapMessageSink,
|
rv = FetchMessage(imapUrl, action, folder, imapMessageSink,
|
||||||
|
@ -828,7 +821,7 @@ NS_IMETHODIMP nsImapService::Search(nsIMsgSearchSession *aSearchSession, nsIMsgW
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aMsgFolder, getter_Copies(folderName));
|
GetFolderName(aMsgFolder, getter_Copies(folderName));
|
||||||
|
|
||||||
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
|
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
|
||||||
|
@ -837,7 +830,7 @@ NS_IMETHODIMP nsImapService::Search(nsIMsgSearchSession *aSearchSession, nsIMsgW
|
||||||
|
|
||||||
urlSpec.Append("/search>UID>");
|
urlSpec.Append("/search>UID>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
// escape aSearchUri so that IMAP special characters (i.e. '\')
|
// escape aSearchUri so that IMAP special characters (i.e. '\')
|
||||||
// won't be replaced with '/' in NECKO.
|
// won't be replaced with '/' in NECKO.
|
||||||
|
@ -908,7 +901,7 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
|
|
||||||
rv = DecomposeImapURI(aMessageURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
rv = DecomposeImapURI(aMessageURI, getter_AddRefs(folder), getter_Copies(msgKey));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -916,7 +909,7 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
|
||||||
PRBool hasMsgOffline = PR_FALSE;
|
PRBool hasMsgOffline = PR_FALSE;
|
||||||
|
|
||||||
if (folder)
|
if (folder)
|
||||||
folder->HasMsgOffline(atoi(msgKey), &hasMsgOffline);
|
folder->HasMsgOffline(atoi(msgKey.get()), &hasMsgOffline);
|
||||||
|
|
||||||
nsCAutoString urlSpec;
|
nsCAutoString urlSpec;
|
||||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);
|
||||||
|
@ -938,7 +931,7 @@ NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
|
||||||
nsCOMPtr <nsIStreamListener> saveAsListener;
|
nsCOMPtr <nsIStreamListener> saveAsListener;
|
||||||
mailnewsUrl->GetSaveAsListener(aAddDummyEnvelope, aFile, getter_AddRefs(saveAsListener));
|
mailnewsUrl->GetSaveAsListener(aAddDummyEnvelope, aFile, getter_AddRefs(saveAsListener));
|
||||||
|
|
||||||
return FetchMessage(imapUrl, nsIImapUrl::nsImapSaveMessageToDisk, folder, imapMessageSink, aMsgWindow, saveAsListener, msgKey, PR_FALSE, nsnull, aURL);
|
return FetchMessage(imapUrl, nsIImapUrl::nsImapSaveMessageToDisk, folder, imapMessageSink, aMsgWindow, saveAsListener, msgKey.get(), PR_FALSE, nsnull, aURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1003,9 +996,9 @@ nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
|
||||||
urlSpec.Append("fetch>UID>");
|
urlSpec.Append("fetch>UID>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(messageIdentifierList);
|
urlSpec.Append(messageIdentifierList);
|
||||||
|
|
||||||
|
@ -1101,8 +1094,8 @@ nsImapService::StreamMessage(const char *aMessageURI, nsISupports *aConsumer,
|
||||||
nsIURI **aURL)
|
nsIURI **aURL)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMsgFolder> folder;
|
nsCOMPtr<nsIMsgFolder> folder;
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
nsXPIDLCString mimePart;
|
nsCAutoString mimePart;
|
||||||
nsCAutoString folderURI;
|
nsCAutoString folderURI;
|
||||||
nsMsgKey key;
|
nsMsgKey key;
|
||||||
|
|
||||||
|
@ -1147,7 +1140,7 @@ nsImapService::StreamMessage(const char *aMessageURI, nsISupports *aConsumer,
|
||||||
msgurl->SetMsgIsInLocalCache(PR_TRUE);
|
msgurl->SetMsgIsInLocalCache(PR_TRUE);
|
||||||
|
|
||||||
rv = FetchMessage(imapUrl, nsIImapUrl::nsImapMsgFetchPeek, folder, imapMessageSink,
|
rv = FetchMessage(imapUrl, nsIImapUrl::nsImapMsgFetchPeek, folder, imapMessageSink,
|
||||||
aMsgWindow, aConsumer, msgKey, aConvertData, aAdditionalHeader, aURL);
|
aMsgWindow, aConsumer, msgKey.get(), aConvertData, aAdditionalHeader, aURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1162,8 +1155,8 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
char *hostname = nsnull;
|
char *hostname = nsnull;
|
||||||
nsXPIDLCString username;
|
nsCAutoString username;
|
||||||
nsXPIDLCString escapedUsername;
|
nsCAutoString escapedUsername;
|
||||||
|
|
||||||
rv = aImapMailFolder->GetHostname(&hostname);
|
rv = aImapMailFolder->GetHostname(&hostname);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -1174,8 +1167,8 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((const char*)username) && username[0])
|
if (!username.IsEmpty())
|
||||||
*((char **)getter_Copies(escapedUsername)) = nsEscape(username, url_XAlphas);
|
*((char **)getter_Copies(escapedUsername)) = nsEscape(username.get(), url_XAlphas);
|
||||||
|
|
||||||
PRInt32 port = IMAP_PORT;
|
PRInt32 port = IMAP_PORT;
|
||||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||||
|
@ -1199,7 +1192,7 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
|
||||||
msgurl->SetUri(aImapURI);
|
msgurl->SetUri(aImapURI);
|
||||||
|
|
||||||
urlSpec = "imap://";
|
urlSpec = "imap://";
|
||||||
urlSpec.Append((const char *) escapedUsername);
|
urlSpec.Append(escapedUsername);
|
||||||
urlSpec.Append('@');
|
urlSpec.Append('@');
|
||||||
urlSpec.Append(hostname);
|
urlSpec.Append(hostname);
|
||||||
urlSpec.Append(':');
|
urlSpec.Append(':');
|
||||||
|
@ -1208,9 +1201,6 @@ nsImapService::CreateStartOfImapUrl(const char * aImapURI, nsIImapUrl ** imapUrl
|
||||||
|
|
||||||
// *** jefft - force to parse the urlSpec in order to search for
|
// *** jefft - force to parse the urlSpec in order to search for
|
||||||
// the correct incoming server
|
// the correct incoming server
|
||||||
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
|
|
||||||
// compiler that is preventing in string parameters from showing up as
|
|
||||||
// const char *. hopefully they will fix it soon.
|
|
||||||
rv = mailnewsUrl->SetSpec(urlSpec);
|
rv = mailnewsUrl->SetSpec(urlSpec);
|
||||||
|
|
||||||
hierarchyDelimiter = kOnlineHierarchySeparatorUnknown;
|
hierarchyDelimiter = kOnlineHierarchySeparatorUnknown;
|
||||||
|
@ -1263,10 +1253,10 @@ nsImapService::GetHeaders(nsIEventTarget * aClientEventTarget,
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(char (hierarchySeparator));
|
urlSpec.Append(char (hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(messageIdentifierList);
|
urlSpec.Append(messageIdentifierList);
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
|
@ -1321,10 +1311,10 @@ nsImapService::GetBodyStart(nsIEventTarget * aClientEventTarget,
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(char (hierarchySeparator));
|
urlSpec.Append(char (hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(messageIdentifierList);
|
urlSpec.Append(messageIdentifierList);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
|
@ -1369,10 +1359,10 @@ nsresult nsImapService::FolderCommand(nsIEventTarget * clientEventTarget,
|
||||||
urlSpec.Append(command);
|
urlSpec.Append(command);
|
||||||
urlSpec.Append(char (hierarchySeparator));
|
urlSpec.Append(char (hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
GetFolderName(imapMailFolder, getter_Copies(folderName));
|
GetFolderName(imapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = GetImapConnectionAndLoadUrl(clientEventTarget, imapUrl,
|
rv = GetImapConnectionAndLoadUrl(clientEventTarget, imapUrl,
|
||||||
|
@ -1450,9 +1440,9 @@ nsImapService::Biff(nsIEventTarget * aClientEventTarget,
|
||||||
urlSpec.Append("/Biff>");
|
urlSpec.Append("/Biff>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.AppendInt(uidHighWater);
|
urlSpec.AppendInt(uidHighWater);
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
|
@ -1526,10 +1516,10 @@ nsImapService::DeleteMessages(nsIEventTarget * aClientEventTarget,
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(char (hierarchySeparator));
|
urlSpec.Append(char (hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(messageIdentifierList);
|
urlSpec.Append(messageIdentifierList);
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
|
@ -1632,9 +1622,9 @@ nsresult nsImapService::DiddleFlags(nsIEventTarget * aClientEventTarget,
|
||||||
urlSpec.Append(messageIdsAreUID ? uidString : sequenceString);
|
urlSpec.Append(messageIdsAreUID ? uidString : sequenceString);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
GetFolderName(aImapMailFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(messageIdentifierList);
|
urlSpec.Append(messageIdentifierList);
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
|
@ -1769,60 +1759,57 @@ NS_IMETHODIMP
|
||||||
nsImapService::DiscoverChildren(nsIEventTarget* aClientEventTarget,
|
nsImapService::DiscoverChildren(nsIEventTarget* aClientEventTarget,
|
||||||
nsIMsgFolder* aImapMailFolder,
|
nsIMsgFolder* aImapMailFolder,
|
||||||
nsIUrlListener* aUrlListener,
|
nsIUrlListener* aUrlListener,
|
||||||
const char *folderPath,
|
const char *folderPath,
|
||||||
nsIURI** aURL)
|
nsIURI** aURL)
|
||||||
{
|
{
|
||||||
NS_ASSERTION (aImapMailFolder && aClientEventTarget,
|
NS_ASSERTION (aImapMailFolder && aClientEventTarget,
|
||||||
"Oops ... null aClientEventTarget or aImapMailFolder");
|
"Oops ... null aClientEventTarget or aImapMailFolder");
|
||||||
if (!aImapMailFolder || ! aClientEventTarget)
|
if (!aImapMailFolder || ! aClientEventTarget)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsCOMPtr<nsIImapUrl> aImapUrl;
|
nsCOMPtr<nsIImapUrl> aImapUrl;
|
||||||
nsCAutoString urlSpec;
|
nsCAutoString urlSpec;
|
||||||
|
|
||||||
PRUnichar hierarchySeparator = GetHierarchyDelimiter(aImapMailFolder);
|
PRUnichar hierarchySeparator = GetHierarchyDelimiter(aImapMailFolder);
|
||||||
nsresult rv = CreateStartOfImapUrl(nsnull, getter_AddRefs(aImapUrl),
|
nsresult rv = CreateStartOfImapUrl(nsnull, getter_AddRefs(aImapUrl),
|
||||||
aImapMailFolder,
|
aImapMailFolder,
|
||||||
aUrlListener, urlSpec, hierarchySeparator);
|
aUrlListener, urlSpec, hierarchySeparator);
|
||||||
if (NS_SUCCEEDED (rv))
|
if (NS_SUCCEEDED (rv))
|
||||||
|
{
|
||||||
|
rv = SetImapUrlSink(aImapMailFolder, aImapUrl);
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
rv = SetImapUrlSink(aImapMailFolder, aImapUrl);
|
if (folderPath && *folderPath)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
urlSpec.Append("/discoverchildren>");
|
||||||
{
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
if (folderPath && *folderPath)
|
urlSpec.Append(folderPath);
|
||||||
{
|
rv = uri->SetSpec(urlSpec);
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
|
||||||
|
|
||||||
urlSpec.Append("/discoverchildren>");
|
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
|
||||||
urlSpec.Append(folderPath);
|
|
||||||
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
|
|
||||||
// compiler that is preventing in string parameters from showing up as
|
|
||||||
// const char *. hopefully they will fix it soon.
|
|
||||||
rv = uri->SetSpec(urlSpec);
|
|
||||||
|
|
||||||
// Make sure the uri has the same hierarchy separator as the one in msg folder
|
// Make sure the uri has the same hierarchy separator as the one in msg folder
|
||||||
// obj if it's not kOnlineHierarchySeparatorUnknown (ie, '^').
|
// obj if it's not kOnlineHierarchySeparatorUnknown (ie, '^').
|
||||||
char uriDelimiter;
|
char uriDelimiter;
|
||||||
nsresult rv1 = aImapUrl->GetOnlineSubDirSeparator(&uriDelimiter);
|
nsresult rv1 = aImapUrl->GetOnlineSubDirSeparator(&uriDelimiter);
|
||||||
if (NS_SUCCEEDED (rv1) && hierarchySeparator != kOnlineHierarchySeparatorUnknown &&
|
if (NS_SUCCEEDED (rv1) && hierarchySeparator != kOnlineHierarchySeparatorUnknown &&
|
||||||
uriDelimiter != hierarchySeparator)
|
uriDelimiter != hierarchySeparator)
|
||||||
aImapUrl->SetOnlineSubDirSeparator((char)hierarchySeparator);
|
aImapUrl->SetOnlineSubDirSeparator((char)hierarchySeparator);
|
||||||
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = GetImapConnectionAndLoadUrl(aClientEventTarget,
|
rv = GetImapConnectionAndLoadUrl(aClientEventTarget,
|
||||||
aImapUrl,
|
aImapUrl,
|
||||||
nsnull, aURL);
|
nsnull, aURL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rv;
|
}
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1893,16 +1880,16 @@ nsImapService::OnlineMessageCopy(nsIEventTarget* aClientEventTarget,
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aSrcFolder, getter_Copies(folderName));
|
GetFolderName(aSrcFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
urlSpec.Append(messageIds);
|
urlSpec.Append(messageIds);
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
folderName.Adopt(strdup(""));
|
folderName.Adopt(strdup(""));
|
||||||
GetFolderName(aDstFolder, getter_Copies(folderName));
|
GetFolderName(aDstFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
|
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -1934,11 +1921,11 @@ nsresult nsImapService::OfflineAppendFromFile(nsIFile* aFile,
|
||||||
rv = destDB->GetOfflineOpForKey(fakeKey, PR_TRUE, getter_AddRefs(op));
|
rv = destDB->GetOfflineOpForKey(fakeKey, PR_TRUE, getter_AddRefs(op));
|
||||||
if (NS_SUCCEEDED(rv) && op)
|
if (NS_SUCCEEDED(rv) && op)
|
||||||
{
|
{
|
||||||
nsXPIDLCString destFolderUri;
|
nsCString destFolderUri;
|
||||||
|
|
||||||
aDstFolder->GetURI(getter_Copies(destFolderUri));
|
aDstFolder->GetURI(getter_Copies(destFolderUri));
|
||||||
op->SetOperation(nsIMsgOfflineImapOperation::kAppendDraft); // ### do we care if it's a template?
|
op->SetOperation(nsIMsgOfflineImapOperation::kAppendDraft); // ### do we care if it's a template?
|
||||||
op->SetDestinationFolderURI(destFolderUri);
|
op->SetDestinationFolderURI(destFolderUri.get());
|
||||||
nsCOMPtr <nsIOutputStream> offlineStore;
|
nsCOMPtr <nsIOutputStream> offlineStore;
|
||||||
rv = aDstFolder->GetOfflineStoreOutputStream(getter_AddRefs(offlineStore));
|
rv = aDstFolder->GetOfflineStoreOutputStream(getter_AddRefs(offlineStore));
|
||||||
|
|
||||||
|
@ -2070,7 +2057,7 @@ nsImapService::AppendMessageFromFile(nsIEventTarget* aClientEventTarget,
|
||||||
|
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(aDstFolder, getter_Copies(folderName));
|
GetFolderName(aDstFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append(folderName);
|
urlSpec.Append(folderName);
|
||||||
|
|
||||||
|
@ -2162,20 +2149,19 @@ nsImapService::MoveFolder(nsIEventTarget* eventTarget, nsIMsgFolder* srcFolder,
|
||||||
if (mailNewsUrl)
|
if (mailNewsUrl)
|
||||||
mailNewsUrl->SetMsgWindow(msgWindow);
|
mailNewsUrl->SetMsgWindow(msgWindow);
|
||||||
char hierarchySeparator = kOnlineHierarchySeparatorUnknown;
|
char hierarchySeparator = kOnlineHierarchySeparatorUnknown;
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
||||||
GetFolderName(srcFolder, getter_Copies(folderName));
|
GetFolderName(srcFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append("/movefolderhierarchy>");
|
urlSpec.Append("/movefolderhierarchy>");
|
||||||
urlSpec.Append(hierarchySeparator);
|
urlSpec.Append(hierarchySeparator);
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
folderName.Adopt(strdup(""));
|
|
||||||
GetFolderName(dstFolder, getter_Copies(folderName));
|
GetFolderName(dstFolder, getter_Copies(folderName));
|
||||||
if ( folderName && folderName[0])
|
if (!folderName.IsEmpty())
|
||||||
{
|
{
|
||||||
urlSpec.Append(hierarchySeparator);
|
urlSpec.Append(hierarchySeparator);
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
}
|
}
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -2215,16 +2201,16 @@ nsImapService::RenameLeaf(nsIEventTarget* eventTarget, nsIMsgFolder* srcFolder,
|
||||||
nsCOMPtr<nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
|
nsCOMPtr<nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
|
||||||
if (mailNewsUrl)
|
if (mailNewsUrl)
|
||||||
mailNewsUrl->SetMsgWindow(msgWindow);
|
mailNewsUrl->SetMsgWindow(msgWindow);
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(srcFolder, getter_Copies(folderName));
|
GetFolderName(srcFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append("/rename>");
|
urlSpec.Append("/rename>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append('>');
|
urlSpec.Append('>');
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
|
|
||||||
|
|
||||||
nsCAutoString cStrFolderName(NS_STATIC_CAST(const char *, folderName));
|
nsCAutoString cStrFolderName(folderName);
|
||||||
// Unescape the name before looking for parent path
|
// Unescape the name before looking for parent path
|
||||||
nsUnescape(cStrFolderName.BeginWriting());
|
nsUnescape(cStrFolderName.BeginWriting());
|
||||||
PRInt32 leafNameStart =
|
PRInt32 leafNameStart =
|
||||||
|
@ -2239,11 +2225,11 @@ nsImapService::RenameLeaf(nsIEventTarget* eventTarget, nsIMsgFolder* srcFolder,
|
||||||
CopyUTF16toMUTF7(nsDependentString(newLeafName), utfNewName);
|
CopyUTF16toMUTF7(nsDependentString(newLeafName), utfNewName);
|
||||||
char* escapedNewName = nsEscape(utfNewName.get(), url_Path);
|
char* escapedNewName = nsEscape(utfNewName.get(), url_Path);
|
||||||
if (!escapedNewName) return NS_ERROR_OUT_OF_MEMORY;
|
if (!escapedNewName) return NS_ERROR_OUT_OF_MEMORY;
|
||||||
nsXPIDLCString escapedSlashName;
|
nsCString escapedSlashName;
|
||||||
rv = nsImapUrl::EscapeSlashes(escapedNewName, getter_Copies(escapedSlashName));
|
rv = nsImapUrl::EscapeSlashes(escapedNewName, getter_Copies(escapedSlashName));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsCRT::free(escapedNewName);
|
nsCRT::free(escapedNewName);
|
||||||
urlSpec.Append(escapedSlashName.get());
|
urlSpec.Append(escapedSlashName);
|
||||||
|
|
||||||
rv = uri->SetSpec(urlSpec);
|
rv = uri->SetSpec(urlSpec);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -2279,16 +2265,16 @@ nsImapService::CreateFolder(nsIEventTarget* eventTarget, nsIMsgFolder* parent,
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(parent, getter_Copies(folderName));
|
GetFolderName(parent, getter_Copies(folderName));
|
||||||
urlSpec.Append("/create>");
|
urlSpec.Append("/create>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
if (!folderName.IsEmpty())
|
if (!folderName.IsEmpty())
|
||||||
{
|
{
|
||||||
nsXPIDLCString canonicalName;
|
nsCString canonicalName;
|
||||||
|
|
||||||
nsImapUrl::ConvertToCanonicalFormat(folderName, (char) hierarchySeparator, getter_Copies(canonicalName));
|
nsImapUrl::ConvertToCanonicalFormat(folderName.get(), (char) hierarchySeparator, getter_Copies(canonicalName));
|
||||||
urlSpec.Append((const char *) canonicalName);
|
urlSpec.Append(canonicalName);
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2332,13 +2318,13 @@ nsImapService::EnsureFolderExists(nsIEventTarget* eventTarget, nsIMsgFolder* par
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(parent, getter_Copies(folderName));
|
GetFolderName(parent, getter_Copies(folderName));
|
||||||
urlSpec.Append("/ensureExists>");
|
urlSpec.Append("/ensureExists>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
if (!folderName.IsEmpty())
|
if (!folderName.IsEmpty())
|
||||||
{
|
{
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
}
|
}
|
||||||
nsCAutoString utfNewName;
|
nsCAutoString utfNewName;
|
||||||
|
@ -2431,7 +2417,7 @@ nsresult nsImapService::GetServerFromUrl(nsIImapUrl *aImapUrl, nsIMsgIncomingSer
|
||||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aImapUrl);
|
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aImapUrl);
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
// if we can't get a folder name out of the url then I think this is an error
|
// if we can't get a folder name out of the url then I think this is an error
|
||||||
aImapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
|
aImapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
|
||||||
|
@ -2501,7 +2487,7 @@ NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec,
|
||||||
mailnewsUrl->SetSpec(aSpec);
|
mailnewsUrl->SetSpec(aSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
|
|
||||||
// if we can't get a folder name out of the url then I think this is an error
|
// if we can't get a folder name out of the url then I think this is an error
|
||||||
aImapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
|
aImapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
|
||||||
|
@ -2530,7 +2516,7 @@ NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec,
|
||||||
nsCOMPtr <nsIMsgImapMailFolder> subFolder;
|
nsCOMPtr <nsIMsgImapMailFolder> subFolder;
|
||||||
if (imapRoot)
|
if (imapRoot)
|
||||||
{
|
{
|
||||||
imapRoot->FindOnlineSubFolder(folderName, getter_AddRefs(subFolder));
|
imapRoot->FindOnlineSubFolder(folderName.get(), getter_AddRefs(subFolder));
|
||||||
folder = do_QueryInterface(subFolder, &rv);
|
folder = do_QueryInterface(subFolder, &rv);
|
||||||
}
|
}
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -2540,14 +2526,14 @@ NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec,
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> msgFolder = do_QueryInterface(folder);
|
nsCOMPtr<nsIMsgFolder> msgFolder = do_QueryInterface(folder);
|
||||||
rv = SetImapUrlSink(msgFolder, aImapUrl);
|
rv = SetImapUrlSink(msgFolder, aImapUrl);
|
||||||
nsXPIDLCString msgKey;
|
nsCAutoString msgKey;
|
||||||
|
|
||||||
nsXPIDLCString messageIdString;
|
nsCString messageIdString;
|
||||||
aImapUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
aImapUrl->CreateListOfMessageIdsString(getter_Copies(messageIdString));
|
||||||
if (messageIdString.get())
|
if (!messageIdString.IsEmpty())
|
||||||
{
|
{
|
||||||
PRBool useLocalCache = PR_FALSE;
|
PRBool useLocalCache = PR_FALSE;
|
||||||
msgFolder->HasMsgOffline(atoi(messageIdString), &useLocalCache);
|
msgFolder->HasMsgOffline(atoi(messageIdString.get()), &useLocalCache);
|
||||||
mailnewsUrl->SetMsgIsInLocalCache(useLocalCache);
|
mailnewsUrl->SetMsgIsInLocalCache(useLocalCache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2602,7 +2588,7 @@ NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
||||||
nsCOMPtr <nsIMsgIncomingServer> server;
|
nsCOMPtr <nsIMsgIncomingServer> server;
|
||||||
rv = GetServerFromUrl(imapUrl, getter_AddRefs(server));
|
rv = GetServerFromUrl(imapUrl, getter_AddRefs(server));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
imapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
|
imapUrl->CreateCanonicalSourceFolderPathString(getter_Copies(folderName));
|
||||||
if (folderName.IsEmpty())
|
if (folderName.IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -2620,7 +2606,7 @@ NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
||||||
nsCOMPtr <nsIMsgImapMailFolder> subFolder;
|
nsCOMPtr <nsIMsgImapMailFolder> subFolder;
|
||||||
if (imapRoot)
|
if (imapRoot)
|
||||||
{
|
{
|
||||||
imapRoot->FindOnlineSubFolder(folderName, getter_AddRefs(subFolder));
|
imapRoot->FindOnlineSubFolder(folderName.get(), getter_AddRefs(subFolder));
|
||||||
aFolder = do_QueryInterface(subFolder);
|
aFolder = do_QueryInterface(subFolder);
|
||||||
}
|
}
|
||||||
nsCOMPtr <nsIMsgFolder> parent;
|
nsCOMPtr <nsIMsgFolder> parent;
|
||||||
|
@ -2656,7 +2642,7 @@ NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
wwatch->GetNewPrompter(nsnull, getter_AddRefs(dialog));
|
wwatch->GetNewPrompter(nsnull, getter_AddRefs(dialog));
|
||||||
|
|
||||||
nsXPIDLString statusString, confirmText;
|
nsString statusString, confirmText;
|
||||||
nsCOMPtr<nsIStringBundle> bundle;
|
nsCOMPtr<nsIStringBundle> bundle;
|
||||||
rv = IMAPGetStringBundle(getter_AddRefs(bundle));
|
rv = IMAPGetStringBundle(getter_AddRefs(bundle));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -2672,7 +2658,7 @@ NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
PRBool confirmResult = PR_FALSE;
|
PRBool confirmResult = PR_FALSE;
|
||||||
rv = dialog->Confirm(nsnull, confirmText, &confirmResult);
|
rv = dialog->Confirm(nsnull, confirmText.get(), &confirmResult);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (confirmResult)
|
if (confirmResult)
|
||||||
|
@ -2732,9 +2718,9 @@ NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
|
||||||
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
|
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
|
||||||
if (NS_SUCCEEDED(rv) && msgWindow)
|
if (NS_SUCCEEDED(rv) && msgWindow)
|
||||||
{
|
{
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
rootFolder->GetURI(getter_Copies(uri));
|
rootFolder->GetURI(getter_Copies(uri));
|
||||||
uri.Append('/');
|
uri.Append('/');
|
||||||
uri.Append(fullFolderName);
|
uri.Append(fullFolderName);
|
||||||
nsCOMPtr<nsIMsgWindowCommands> windowCommands;
|
nsCOMPtr<nsIMsgWindowCommands> windowCommands;
|
||||||
msgWindow->GetWindowCommands(getter_AddRefs(windowCommands));
|
msgWindow->GetWindowCommands(getter_AddRefs(windowCommands));
|
||||||
|
@ -3058,7 +3044,7 @@ nsImapService::IssueCommandOnMsgs(nsIEventTarget *aClientEventTarget,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(anImapFolder, getter_Copies(folderName));
|
GetFolderName(anImapFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append("/");
|
urlSpec.Append("/");
|
||||||
urlSpec.Append(aCommand);
|
urlSpec.Append(aCommand);
|
||||||
|
@ -3066,7 +3052,7 @@ nsImapService::IssueCommandOnMsgs(nsIEventTarget *aClientEventTarget,
|
||||||
urlSpec.Append(uidString);
|
urlSpec.Append(uidString);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(uids);
|
urlSpec.Append(uids);
|
||||||
rv = mailNewsUrl->SetSpec(urlSpec);
|
rv = mailNewsUrl->SetSpec(urlSpec);
|
||||||
|
@ -3111,11 +3097,11 @@ nsImapService::FetchCustomMsgAttribute(nsIEventTarget *aClientEventTarget,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(anImapFolder, getter_Copies(folderName));
|
GetFolderName(anImapFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append("/customFetch>UID>");
|
urlSpec.Append("/customFetch>UID>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(uids);
|
urlSpec.Append(uids);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
|
@ -3162,11 +3148,11 @@ nsImapService::StoreCustomKeywords(nsIEventTarget *aClientEventTarget,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderName;
|
nsCString folderName;
|
||||||
GetFolderName(anImapFolder, getter_Copies(folderName));
|
GetFolderName(anImapFolder, getter_Copies(folderName));
|
||||||
urlSpec.Append("/customKeywords>UID>");
|
urlSpec.Append("/customKeywords>UID>");
|
||||||
urlSpec.Append(char(hierarchySeparator));
|
urlSpec.Append(char(hierarchySeparator));
|
||||||
urlSpec.Append((const char *) folderName);
|
urlSpec.Append(folderName);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
urlSpec.Append(uids);
|
urlSpec.Append(uids);
|
||||||
urlSpec.Append(">");
|
urlSpec.Append(">");
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include "nsMsgImapCID.h"
|
#include "nsMsgImapCID.h"
|
||||||
#include "nsIMsgHdr.h"
|
#include "nsIMsgHdr.h"
|
||||||
#include "nsImapUndoTxn.h"
|
#include "nsImapUndoTxn.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIIMAPHostSessionList.h"
|
#include "nsIIMAPHostSessionList.h"
|
||||||
#include "nsIMsgIncomingServer.h"
|
#include "nsIMsgIncomingServer.h"
|
||||||
#include "nsIDBFolderInfo.h"
|
#include "nsIDBFolderInfo.h"
|
||||||
|
@ -69,7 +68,7 @@ nsImapMoveCopyMsgTxn::Init(
|
||||||
m_urlListener = do_QueryInterface(urlListener, &rv);
|
m_urlListener = do_QueryInterface(urlListener, &rv);
|
||||||
m_srcKeyArray.CopyArray(srcKeyArray);
|
m_srcKeyArray.CopyArray(srcKeyArray);
|
||||||
m_dupKeyArray.CopyArray(srcKeyArray);
|
m_dupKeyArray.CopyArray(srcKeyArray);
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
rv = srcFolder->GetURI(getter_Copies(uri));
|
rv = srcFolder->GetURI(getter_Copies(uri));
|
||||||
nsCString protocolType(uri);
|
nsCString protocolType(uri);
|
||||||
protocolType.SetLength(protocolType.FindChar(':'));
|
protocolType.SetLength(protocolType.FindChar(':'));
|
||||||
|
@ -574,18 +573,18 @@ NS_IMETHODIMP nsImapOfflineTxn::RedoTransaction(void)
|
||||||
nsCOMPtr<nsIMsgFolder> dstFolder = do_QueryReferent(m_dstFolder, &rv);
|
nsCOMPtr<nsIMsgFolder> dstFolder = do_QueryReferent(m_dstFolder, &rv);
|
||||||
if (dstFolder)
|
if (dstFolder)
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderURI;
|
nsCString folderURI;
|
||||||
dstFolder->GetURI(getter_Copies(folderURI));
|
dstFolder->GetURI(getter_Copies(folderURI));
|
||||||
|
|
||||||
|
|
||||||
if (m_opType == nsIMsgOfflineImapOperation::kMsgMoved)
|
if (m_opType == nsIMsgOfflineImapOperation::kMsgMoved)
|
||||||
{
|
{
|
||||||
op->SetDestinationFolderURI(folderURI); // offline move
|
op->SetDestinationFolderURI(folderURI.get()); // offline move
|
||||||
}
|
}
|
||||||
if (m_opType == nsIMsgOfflineImapOperation::kMsgCopy)
|
if (m_opType == nsIMsgOfflineImapOperation::kMsgCopy)
|
||||||
{
|
{
|
||||||
op->SetOperation(nsIMsgOfflineImapOperation::kMsgMoved);
|
op->SetOperation(nsIMsgOfflineImapOperation::kMsgMoved);
|
||||||
op->AddMessageCopyOperation(folderURI); // offline copy
|
op->AddMessageCopyOperation(folderURI.get()); // offline copy
|
||||||
}
|
}
|
||||||
dstFolder->SummaryChanged();
|
dstFolder->SummaryChanged();
|
||||||
}
|
}
|
||||||
|
@ -606,9 +605,9 @@ NS_IMETHODIMP nsImapOfflineTxn::RedoTransaction(void)
|
||||||
rv = destDB->GetOfflineOpForKey(hdrKey, PR_TRUE, getter_AddRefs(op));
|
rv = destDB->GetOfflineOpForKey(hdrKey, PR_TRUE, getter_AddRefs(op));
|
||||||
if (NS_SUCCEEDED(rv) && op)
|
if (NS_SUCCEEDED(rv) && op)
|
||||||
{
|
{
|
||||||
nsXPIDLCString folderURI;
|
nsCString folderURI;
|
||||||
srcFolder->GetURI(getter_Copies(folderURI));
|
srcFolder->GetURI(getter_Copies(folderURI));
|
||||||
op->SetSourceFolderURI(folderURI);
|
op->SetSourceFolderURI(folderURI.get());
|
||||||
}
|
}
|
||||||
dstFolder->SummaryChanged();
|
dstFolder->SummaryChanged();
|
||||||
destDB->Close(PR_TRUE);
|
destDB->Close(PR_TRUE);
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
#include "nsIImapIncomingServer.h"
|
#include "nsIImapIncomingServer.h"
|
||||||
#include "nsMsgBaseCID.h"
|
#include "nsMsgBaseCID.h"
|
||||||
#include "nsImapUtils.h"
|
#include "nsImapUtils.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsAutoLock.h"
|
#include "nsAutoLock.h"
|
||||||
#include "nsIMAPNamespace.h"
|
#include "nsIMAPNamespace.h"
|
||||||
|
@ -975,10 +974,10 @@ NS_IMETHODIMP nsImapUrl::AllocateServerPath(const char * canonicalPath, char onl
|
||||||
char *canonicalPath;
|
char *canonicalPath;
|
||||||
if (onlineDelimiter != '/')
|
if (onlineDelimiter != '/')
|
||||||
{
|
{
|
||||||
nsXPIDLCString escapedPath;
|
nsCString escapedPath;
|
||||||
|
|
||||||
EscapeSlashes(folderName, getter_Copies(escapedPath));
|
EscapeSlashes(folderName, getter_Copies(escapedPath));
|
||||||
canonicalPath = ReplaceCharsInCopiedString(escapedPath, onlineDelimiter , '/');
|
canonicalPath = ReplaceCharsInCopiedString(escapedPath.get(), onlineDelimiter , '/');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1283,7 +1282,7 @@ NS_IMETHODIMP nsImapUrl::GetUri(char** aURI)
|
||||||
{
|
{
|
||||||
*aURI = nsnull;
|
*aURI = nsnull;
|
||||||
PRUint32 key = m_listOfMessageIds ? atoi(m_listOfMessageIds) : 0;
|
PRUint32 key = m_listOfMessageIds ? atoi(m_listOfMessageIds) : 0;
|
||||||
nsXPIDLCString canonicalPath;
|
nsCString canonicalPath;
|
||||||
AllocateCanonicalPath(m_sourceCanonicalFolderPathSubString, m_onlineSubDirSeparator, (getter_Copies(canonicalPath)));
|
AllocateCanonicalPath(m_sourceCanonicalFolderPathSubString, m_onlineSubDirSeparator, (getter_Copies(canonicalPath)));
|
||||||
nsCString fullFolderPath("/");
|
nsCString fullFolderPath("/");
|
||||||
fullFolderPath.Append(m_userName);
|
fullFolderPath.Append(m_userName);
|
||||||
|
@ -1294,14 +1293,12 @@ NS_IMETHODIMP nsImapUrl::GetUri(char** aURI)
|
||||||
fullFolderPath.Append('/');
|
fullFolderPath.Append('/');
|
||||||
fullFolderPath.Append(canonicalPath);
|
fullFolderPath.Append(canonicalPath);
|
||||||
|
|
||||||
char * baseMessageURI;
|
nsCString baseMessageURI;
|
||||||
nsCreateImapBaseMessageURI(fullFolderPath.get(), &baseMessageURI);
|
nsCreateImapBaseMessageURI(fullFolderPath.get(), baseMessageURI);
|
||||||
nsCAutoString uriStr;
|
nsCAutoString uriStr;
|
||||||
rv = nsBuildImapMessageURI(baseMessageURI, key, uriStr);
|
rv = nsBuildImapMessageURI(baseMessageURI.get(), key, uriStr);
|
||||||
nsCRT::free(baseMessageURI);
|
|
||||||
*aURI = ToNewCString(uriStr);
|
*aURI = ToNewCString(uriStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1527,12 +1524,12 @@ nsresult nsImapUrl::GetMsgFolder(nsIMsgFolder **msgFolder)
|
||||||
// if we have a RDF URI, then try to get the folder for that URI and then ask the folder
|
// if we have a RDF URI, then try to get the folder for that URI and then ask the folder
|
||||||
// for it's charset....
|
// for it's charset....
|
||||||
|
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
GetUri(getter_Copies(uri));
|
GetUri(getter_Copies(uri));
|
||||||
NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(!uri.IsEmpty(), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsIMsgDBHdr> msg;
|
nsCOMPtr<nsIMsgDBHdr> msg;
|
||||||
GetMsgDBHdrFromURI(uri, getter_AddRefs(msg));
|
GetMsgDBHdrFromURI(uri.get(), getter_AddRefs(msg));
|
||||||
NS_ENSURE_TRUE(msg, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(msg, NS_ERROR_FAILURE);
|
||||||
nsresult rv = msg->GetFolder(msgFolder);
|
nsresult rv = msg->GetFolder(msgFolder);
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
@ -1591,7 +1588,7 @@ NS_IMETHODIMP nsImapUrl::SetShouldStoreMsgOffline(PRBool aShouldStoreMsgOffline)
|
||||||
|
|
||||||
NS_IMETHODIMP nsImapUrl::GetMessageHeader(nsIMsgDBHdr ** aMsgHdr)
|
NS_IMETHODIMP nsImapUrl::GetMessageHeader(nsIMsgDBHdr ** aMsgHdr)
|
||||||
{
|
{
|
||||||
nsXPIDLCString uri;
|
nsCString uri;
|
||||||
nsresult rv = GetUri(getter_Copies(uri));
|
nsresult rv = GetUri(getter_Copies(uri));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
return GetMsgDBHdrFromURI(uri.get(), aMsgHdr);
|
return GetMsgDBHdrFromURI(uri.get(), aMsgHdr);
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "nsIImapMessageSink.h"
|
#include "nsIImapMessageSink.h"
|
||||||
|
|
||||||
#include "nsWeakPtr.h"
|
#include "nsWeakPtr.h"
|
||||||
#include "nsXPIDLString.h"
|
|
||||||
#include "nsIFile.h"
|
#include "nsIFile.h"
|
||||||
|
|
||||||
class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
|
class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
|
||||||
|
|
|
@ -219,23 +219,16 @@ nsresult nsBuildImapMessageURI(const char *baseURI, PRUint32 key, nsCString& uri
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCreateImapBaseMessageURI(const char *baseURI, char **baseMessageURI)
|
nsresult nsCreateImapBaseMessageURI(const char *baseURI, nsCString &baseMessageURI)
|
||||||
{
|
{
|
||||||
if(!baseMessageURI)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsCAutoString tailURI(baseURI);
|
nsCAutoString tailURI(baseURI);
|
||||||
|
|
||||||
// chop off mailbox:/
|
// chop off imap:/
|
||||||
if (tailURI.Find(kImapRootURI) == 0)
|
if (tailURI.Find(kImapRootURI) == 0)
|
||||||
tailURI.Cut(0, PL_strlen(kImapRootURI));
|
tailURI.Cut(0, PL_strlen(kImapRootURI));
|
||||||
|
|
||||||
nsCAutoString baseURIStr(kImapMessageRootURI);
|
baseMessageURI = kImapMessageRootURI;
|
||||||
baseURIStr += tailURI;
|
baseMessageURI += tailURI;
|
||||||
|
|
||||||
*baseMessageURI = ToNewCString(baseURIStr);
|
|
||||||
if(!*baseMessageURI)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ extern nsresult
|
||||||
nsBuildImapMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
|
nsBuildImapMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
|
||||||
|
|
||||||
extern nsresult
|
extern nsresult
|
||||||
nsCreateImapBaseMessageURI(const char *baseURI, char **baseMessageURI);
|
nsCreateImapBaseMessageURI(const char *baseURI, nsCString &baseMessageURI);
|
||||||
|
|
||||||
void AllocateImapUidString(PRUint32 *msgUids, PRUint32 &msgCount, nsImapFlagAndUidState *flagState, nsCString &returnString);
|
void AllocateImapUidString(PRUint32 *msgUids, PRUint32 &msgCount, nsImapFlagAndUidState *flagState, nsCString &returnString);
|
||||||
void ParseUidString(const char *uidString, nsMsgKeyArray &keys);
|
void ParseUidString(const char *uidString, nsMsgKeyArray &keys);
|
||||||
|
|
|
@ -3161,7 +3161,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::SelectDownloadMsg()
|
||||||
if (mDownloadState == DOWNLOAD_STATE_GOTMSG && mDownloadWindow)
|
if (mDownloadState == DOWNLOAD_STATE_GOTMSG && mDownloadWindow)
|
||||||
{
|
{
|
||||||
nsCAutoString newuri;
|
nsCAutoString newuri;
|
||||||
nsBuildLocalMessageURI(mBaseMessageURI, mDownloadSelectKey, newuri);
|
nsBuildLocalMessageURI(mBaseMessageURI.get(), mDownloadSelectKey, newuri);
|
||||||
nsCOMPtr<nsIMsgWindowCommands> windowCommands;
|
nsCOMPtr<nsIMsgWindowCommands> windowCommands;
|
||||||
mDownloadWindow->GetWindowCommands(getter_AddRefs(windowCommands));
|
mDownloadWindow->GetWindowCommands(getter_AddRefs(windowCommands));
|
||||||
if (windowCommands)
|
if (windowCommands)
|
||||||
|
@ -3291,7 +3291,7 @@ nsMsgLocalMailFolder::GetIncomingServerType()
|
||||||
|
|
||||||
nsresult nsMsgLocalMailFolder::CreateBaseMessageURI(const char *aURI)
|
nsresult nsMsgLocalMailFolder::CreateBaseMessageURI(const char *aURI)
|
||||||
{
|
{
|
||||||
return nsCreateLocalBaseMessageURI(aURI, &mBaseMessageURI);
|
return nsCreateLocalBaseMessageURI(aURI, mBaseMessageURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -3308,7 +3308,7 @@ nsMsgLocalMailFolder::OnStartRunningUrl(nsIURI * aUrl)
|
||||||
nsCOMPtr<nsIPop3Sink> popsink;
|
nsCOMPtr<nsIPop3Sink> popsink;
|
||||||
rv = popurl->GetPop3Sink(getter_AddRefs(popsink));
|
rv = popurl->GetPop3Sink(getter_AddRefs(popsink));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
popsink->SetBaseMessageUri(mBaseMessageURI);
|
popsink->SetBaseMessageUri(mBaseMessageURI.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nsMsgDBFolder::OnStartRunningUrl(aUrl);
|
return nsMsgDBFolder::OnStartRunningUrl(aUrl);
|
||||||
|
|
|
@ -259,23 +259,16 @@ nsresult nsBuildLocalMessageURI(const char *baseURI, PRUint32 key, nsCString& ur
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCreateLocalBaseMessageURI(const char *baseURI, char **baseMessageURI)
|
nsresult nsCreateLocalBaseMessageURI(const char *baseURI, nsCString &baseMessageURI)
|
||||||
{
|
{
|
||||||
if(!baseMessageURI)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsCAutoString tailURI(baseURI);
|
nsCAutoString tailURI(baseURI);
|
||||||
|
|
||||||
// chop off mailbox:/
|
// chop off mailbox:/
|
||||||
if (tailURI.Find(kMailboxRootURI) == 0)
|
if (tailURI.Find(kMailboxRootURI) == 0)
|
||||||
tailURI.Cut(0, PL_strlen(kMailboxRootURI));
|
tailURI.Cut(0, PL_strlen(kMailboxRootURI));
|
||||||
|
|
||||||
nsCAutoString baseURIStr(kMailboxMessageRootURI);
|
baseMessageURI = kMailboxMessageRootURI;
|
||||||
baseURIStr += tailURI;
|
baseMessageURI += tailURI;
|
||||||
|
|
||||||
*baseMessageURI = ToNewCString(baseURIStr);
|
|
||||||
if(!*baseMessageURI)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ nsresult
|
||||||
nsBuildLocalMessageURI(const char* baseURI, PRUint32 key, nsCString& uri);
|
nsBuildLocalMessageURI(const char* baseURI, PRUint32 key, nsCString& uri);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsCreateLocalBaseMessageURI(const char *baseURI, char **baseMessageURI);
|
nsCreateLocalBaseMessageURI(const char *baseURI, nsCString &baseMessageURI);
|
||||||
|
|
||||||
void
|
void
|
||||||
nsEscapeNativePath(nsCString& nativePath);
|
nsEscapeNativePath(nsCString& nativePath);
|
||||||
|
|
|
@ -199,12 +199,11 @@ NS_IMETHODIMP nsMailboxUrl::GetUri(char ** aURI)
|
||||||
(void) MsgMailboxGetURI(m_file, baseUri);
|
(void) MsgMailboxGetURI(m_file, baseUri);
|
||||||
if (baseUri.IsEmpty())
|
if (baseUri.IsEmpty())
|
||||||
m_baseURL->GetSpec(baseUri);
|
m_baseURL->GetSpec(baseUri);
|
||||||
char * baseMessageURI;
|
nsCString baseMessageURI;
|
||||||
nsCreateLocalBaseMessageURI(baseUri.get(), &baseMessageURI);
|
nsCreateLocalBaseMessageURI(baseUri.get(), baseMessageURI);
|
||||||
char * uri = nsnull;
|
char * uri = nsnull;
|
||||||
nsCAutoString uriStr;
|
nsCAutoString uriStr;
|
||||||
nsBuildLocalMessageURI(baseMessageURI, m_messageKey, uriStr);
|
nsBuildLocalMessageURI(baseMessageURI.get(), m_messageKey, uriStr);
|
||||||
nsCRT::free(baseMessageURI);
|
|
||||||
uri = ToNewCString(uriStr);
|
uri = ToNewCString(uriStr);
|
||||||
*aURI = uri;
|
*aURI = uri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1450,7 +1450,7 @@ nsresult nsMsgNewsFolder::CreateBaseMessageURI(const char *aURI)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
rv = nsCreateNewsBaseMessageURI(aURI, &mBaseMessageURI);
|
rv = nsCreateNewsBaseMessageURI(aURI, mBaseMessageURI);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,23 +73,16 @@ nsParseNewsMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCreateNewsBaseMessageURI(const char *baseURI, char **baseMessageURI)
|
nsresult nsCreateNewsBaseMessageURI(const char *baseURI, nsCString &baseMessageURI)
|
||||||
{
|
{
|
||||||
if(!baseMessageURI)
|
nsCAutoString tailURI(baseURI);
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
nsCAutoString tailURI(baseURI);
|
// chop off news:/
|
||||||
|
if (tailURI.Find(kNewsRootURI) == 0)
|
||||||
|
tailURI.Cut(0, PL_strlen(kNewsRootURI));
|
||||||
|
|
||||||
// chop off mailbox:/
|
baseMessageURI = kNewsMessageRootURI;
|
||||||
if (tailURI.Find(kNewsRootURI) == 0)
|
baseMessageURI += tailURI;
|
||||||
tailURI.Cut(0, PL_strlen(kNewsRootURI));
|
|
||||||
|
|
||||||
nsCAutoString baseURIStr(kNewsMessageRootURI);
|
return NS_OK;
|
||||||
baseURIStr += tailURI;
|
|
||||||
|
|
||||||
*baseMessageURI = ToNewCString(baseURIStr);
|
|
||||||
if(!*baseMessageURI)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ extern nsresult
|
||||||
nsParseNewsMessageURI(const char* uri, nsCString& messageUriWithoutKey, PRUint32 *key);
|
nsParseNewsMessageURI(const char* uri, nsCString& messageUriWithoutKey, PRUint32 *key);
|
||||||
|
|
||||||
extern nsresult
|
extern nsresult
|
||||||
nsCreateNewsBaseMessageURI(const char *baseURI, char **baseMessageURI);
|
nsCreateNewsBaseMessageURI(const char *baseURI, nsCString &baseMessageURI);
|
||||||
|
|
||||||
#endif //NS_NEWSUTILS_H
|
#endif //NS_NEWSUTILS_H
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче