mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 14:46:02 +00:00
nsString updates --> nsString(eOneByte) --> nsCString
This commit is contained in:
parent
87085548ea
commit
8309a0f824
@ -489,16 +489,16 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
|
|||||||
if(NS_FAILED(rv))
|
if(NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsAutoString leafName (folderName, eOneByte);
|
nsAutoString leafName (folderName);
|
||||||
nsString folderNameStr;
|
nsAutoString folderNameStr;
|
||||||
nsString parentName = leafName;
|
nsAutoString parentName = leafName;
|
||||||
PRInt32 folderStart = leafName.FindChar('/');
|
PRInt32 folderStart = leafName.FindChar('/');
|
||||||
if (folderStart > 0)
|
if (folderStart > 0)
|
||||||
{
|
{
|
||||||
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
||||||
nsCOMPtr<nsIRDFResource> res;
|
nsCOMPtr<nsIRDFResource> res;
|
||||||
nsCOMPtr<nsIMsgImapMailFolder> parentFolder;
|
nsCOMPtr<nsIMsgImapMailFolder> parentFolder;
|
||||||
nsAutoString uri ((const char *) mURI, eOneByte);
|
nsCAutoString uri (mURI);
|
||||||
parentName.Right(leafName, leafName.Length() - folderStart - 1);
|
parentName.Right(leafName, leafName.Length() - folderStart - 1);
|
||||||
parentName.Truncate(folderStart);
|
parentName.Truncate(folderStart);
|
||||||
path += parentName;
|
path += parentName;
|
||||||
@ -506,12 +506,12 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
|
|||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
uri.Append('/');
|
uri.Append('/');
|
||||||
uri.Append(parentName);
|
uri.Append(parentName);
|
||||||
rv = rdf->GetResource(uri.GetBuffer(),
|
rv = rdf->GetResource(uri,
|
||||||
getter_AddRefs(res));
|
getter_AddRefs(res));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
parentFolder = do_QueryInterface(res, &rv);
|
parentFolder = do_QueryInterface(res, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
return parentFolder->CreateClientSubfolderInfo(leafName.GetBuffer());
|
return parentFolder->CreateClientSubfolderInfo(nsCAutoString(leafName));
|
||||||
}
|
}
|
||||||
|
|
||||||
folderNameStr = leafName;
|
folderNameStr = leafName;
|
||||||
@ -1202,7 +1202,7 @@ NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
|
|||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsAutoString folderName = aSpec->allocatedPathName;
|
nsAutoString folderName = aSpec->allocatedPathName;
|
||||||
nsAutoString uri ((const char *)"", eOneByte);
|
nsCAutoString uri;
|
||||||
uri.Append(kImapRootURI);
|
uri.Append(kImapRootURI);
|
||||||
uri.Append('/');
|
uri.Append('/');
|
||||||
|
|
||||||
@ -1224,7 +1224,7 @@ NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFResource> res;
|
nsCOMPtr<nsIRDFResource> res;
|
||||||
rv = rdf->GetResource(uri.GetBuffer(), getter_AddRefs(res));
|
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
// OK, this is purely temporary - we either need getParent, or
|
// OK, this is purely temporary - we either need getParent, or
|
||||||
@ -1244,7 +1244,7 @@ NS_IMETHODIMP nsImapMailFolder::PossibleImapMailbox(
|
|||||||
|
|
||||||
uri.Append('/');
|
uri.Append('/');
|
||||||
uri.Append(aSpec->allocatedPathName);
|
uri.Append(aSpec->allocatedPathName);
|
||||||
a_nsIFolder->GetChildWithURI(uri.GetBuffer(), PR_TRUE, getter_AddRefs(child));
|
a_nsIFolder->GetChildWithURI(uri, PR_TRUE, getter_AddRefs(child));
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
found = PR_TRUE;
|
found = PR_TRUE;
|
||||||
@ -1902,7 +1902,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
|
|||||||
{
|
{
|
||||||
PRUint32 msgFlags;
|
PRUint32 msgFlags;
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
nsString trashNameVal(eOneByte);
|
nsCAutoString trashNameVal;
|
||||||
|
|
||||||
msgHdr->GetFlags(&msgFlags);
|
msgHdr->GetFlags(&msgFlags);
|
||||||
msgHdr->GetMessageKey(&msgKey);
|
msgHdr->GetMessageKey(&msgKey);
|
||||||
@ -1923,8 +1923,8 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, PRBool *app
|
|||||||
// so we use an nsString from above.
|
// so we use an nsString from above.
|
||||||
PRUnichar *folderName = nsnull;
|
PRUnichar *folderName = nsnull;
|
||||||
rv = mailTrash->GetName(&folderName);
|
rv = mailTrash->GetName(&folderName);
|
||||||
trashNameVal = folderName;
|
trashNameVal = nsCAutoString(folderName);
|
||||||
PR_FREEIF(folderName);
|
nsCRT::free(folderName);
|
||||||
value = (void *) trashNameVal.GetBuffer();
|
value = (void *) trashNameVal.GetBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||||||
if(NS_SUCCEEDED( rv = QueryInterface(nsIRDFResource::GetIID(), (void**)&resource)))
|
if(NS_SUCCEEDED( rv = QueryInterface(nsIRDFResource::GetIID(), (void**)&resource)))
|
||||||
{
|
{
|
||||||
resource->GetValue( getter_Copies(uri) );
|
resource->GetValue( getter_Copies(uri) );
|
||||||
nsString messageFolderURIStr;
|
nsCAutoString messageFolderURIStr;
|
||||||
nsMsgKey key;
|
nsMsgKey key;
|
||||||
nsParseImapMessageURI(uri, messageFolderURIStr, &key);
|
nsParseImapMessageURI(uri, messageFolderURIStr, &key);
|
||||||
nsString folderOnly, folderURIStr;
|
nsCAutoString folderOnly, folderURIStr;
|
||||||
|
|
||||||
if (messageFolderURIStr.Find(kImapRootURI) != ((PRInt32)-1))
|
if (messageFolderURIStr.Find(kImapRootURI) != ((PRInt32)-1))
|
||||||
{
|
{
|
||||||
@ -77,7 +77,7 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||||||
folderURIStr = kImapRootURI;
|
folderURIStr = kImapRootURI;
|
||||||
folderURIStr+= folderOnly;
|
folderURIStr+= folderOnly;
|
||||||
nsIRDFResource *folderResource;
|
nsIRDFResource *folderResource;
|
||||||
char *folderURI = folderURIStr.ToNewCString();
|
const char *folderURI = folderURIStr.GetBuffer();
|
||||||
|
|
||||||
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
|
NS_WITH_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, &rv);
|
||||||
if (NS_SUCCEEDED(rv)) // always check this before proceeding
|
if (NS_SUCCEEDED(rv)) // always check this before proceeding
|
||||||
@ -89,9 +89,6 @@ nsresult nsImapMessage::GetFolderFromURI(nsIMsgFolder **folder)
|
|||||||
NS_RELEASE(folderResource);
|
NS_RELEASE(folderResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delete[] folderURI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_RELEASE(resource);
|
NS_RELEASE(resource);
|
||||||
|
@ -174,7 +174,7 @@ NS_IMETHODIMP nsImapProtocol::QueryInterface(const nsIID &aIID, void** aInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsImapProtocol::nsImapProtocol() :
|
nsImapProtocol::nsImapProtocol() :
|
||||||
m_currentCommand(""),m_parser(*this), m_flagState(kImapFlagAndUidStateSize, PR_FALSE)
|
m_parser(*this), m_flagState(kImapFlagAndUidStateSize, PR_FALSE)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
m_flags = 0;
|
m_flags = 0;
|
||||||
@ -6006,8 +6006,7 @@ nsImapProtocol::GetDeleteIsMoveToTrash()
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIMAPMailboxInfo::nsIMAPMailboxInfo(const char *name, char delimiter) :
|
nsIMAPMailboxInfo::nsIMAPMailboxInfo(const char *name, char delimiter)
|
||||||
m_mailboxName("")
|
|
||||||
{
|
{
|
||||||
m_mailboxName = name;
|
m_mailboxName = name;
|
||||||
m_delimiter = delimiter;
|
m_delimiter = delimiter;
|
||||||
|
@ -249,13 +249,13 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
|||||||
|
|
||||||
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
||||||
|
|
||||||
nsString folderURI ("",eOneByte);
|
nsCAutoString folderURI;
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
rv = nsParseImapMessageURI(aMessageURI, folderURI, &msgKey);
|
rv = nsParseImapMessageURI(aMessageURI, folderURI, &msgKey);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsIRDFResource* res;
|
nsIRDFResource* res;
|
||||||
rv = rdf->GetResource(folderURI.GetBuffer(), &res);
|
rv = rdf->GetResource(folderURI, &res);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
|
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
|
||||||
@ -265,12 +265,12 @@ NS_IMETHODIMP nsImapService::DisplayMessage(const char* aMessageURI,
|
|||||||
imapMessageSink(do_QueryInterface(res, &rv));
|
imapMessageSink(do_QueryInterface(res, &rv));
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCString messageIdString;
|
nsCAutoString messageIdString;
|
||||||
|
|
||||||
messageIdString.Append(msgKey, 10);
|
messageIdString.Append(msgKey, 10);
|
||||||
rv = FetchMessage(queue, folder, imapMessageSink,
|
rv = FetchMessage(queue, folder, imapMessageSink,
|
||||||
aUrlListener, aURL, aDisplayConsumer,
|
aUrlListener, aURL, aDisplayConsumer,
|
||||||
messageIdString.GetBuffer(), PR_TRUE);
|
messageIdString, PR_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,13 +302,13 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
|
|||||||
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsString folderURI ("",eOneByte);
|
nsCAutoString folderURI;
|
||||||
nsMsgKey msgKey;
|
nsMsgKey msgKey;
|
||||||
rv = nsParseImapMessageURI(aSrcMailboxURI, folderURI, &msgKey);
|
rv = nsParseImapMessageURI(aSrcMailboxURI, folderURI, &msgKey);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsIRDFResource* res;
|
nsIRDFResource* res;
|
||||||
rv = rdf->GetResource(folderURI.GetBuffer(), &res);
|
rv = rdf->GetResource(folderURI, &res);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
|
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
|
||||||
@ -323,14 +323,14 @@ nsImapService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener *
|
|||||||
messageIdString.Append(msgKey, 10);
|
messageIdString.Append(msgKey, 10);
|
||||||
rv = FetchMessage(queue, folder, imapMessageSink,
|
rv = FetchMessage(queue, folder, imapMessageSink,
|
||||||
aUrlListener, aURL, streamSupport,
|
aUrlListener, aURL, streamSupport,
|
||||||
messageIdString.GetBuffer(), PR_TRUE);
|
messageIdString, PR_TRUE);
|
||||||
if (NS_SUCCEEDED(rv) && moveMessage)
|
if (NS_SUCCEEDED(rv) && moveMessage)
|
||||||
{
|
{
|
||||||
// ** jt -- this really isn't an optimal way of deleting a
|
// ** jt -- this really isn't an optimal way of deleting a
|
||||||
// list of messages but I don't have a better way at this
|
// list of messages but I don't have a better way at this
|
||||||
// moment
|
// moment
|
||||||
rv = AddMessageFlags(queue, folder, aUrlListener, nsnull,
|
rv = AddMessageFlags(queue, folder, aUrlListener, nsnull,
|
||||||
messageIdString.GetBuffer(),
|
messageIdString,
|
||||||
kImapMsgDeletedFlag,
|
kImapMsgDeletedFlag,
|
||||||
PR_TRUE);
|
PR_TRUE);
|
||||||
// ** jt -- force to update the folder
|
// ** jt -- force to update the folder
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
|
static NS_DEFINE_CID(kCImapService, NS_IMAPSERVICE_CID);
|
||||||
|
|
||||||
nsImapMoveCopyMsgTxn::nsImapMoveCopyMsgTxn() :
|
nsImapMoveCopyMsgTxn::nsImapMoveCopyMsgTxn() :
|
||||||
m_srcMsgIdString(""), m_dstMsgIdString(""),
|
|
||||||
m_idsAreUids(PR_FALSE), m_isMove(PR_FALSE), m_srcIsPop3(PR_FALSE)
|
m_idsAreUids(PR_FALSE), m_isMove(PR_FALSE), m_srcIsPop3(PR_FALSE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -35,7 +34,6 @@ nsImapMoveCopyMsgTxn::nsImapMoveCopyMsgTxn(
|
|||||||
const char* srcMsgIdString, nsIMsgFolder* dstFolder,
|
const char* srcMsgIdString, nsIMsgFolder* dstFolder,
|
||||||
PRBool idsAreUids, PRBool isMove,
|
PRBool idsAreUids, PRBool isMove,
|
||||||
nsIEventQueue* eventQueue, nsIUrlListener* urlListener) :
|
nsIEventQueue* eventQueue, nsIUrlListener* urlListener) :
|
||||||
m_srcMsgIdString("", eOneByte), m_dstMsgIdString("", eOneByte),
|
|
||||||
m_idsAreUids(PR_FALSE), m_isMove(PR_FALSE), m_srcIsPop3(PR_FALSE)
|
m_idsAreUids(PR_FALSE), m_isMove(PR_FALSE), m_srcIsPop3(PR_FALSE)
|
||||||
{
|
{
|
||||||
Init(srcFolder, srcKeyArray, srcMsgIdString, dstFolder, idsAreUids,
|
Init(srcFolder, srcKeyArray, srcMsgIdString, dstFolder, idsAreUids,
|
||||||
@ -162,7 +160,7 @@ nsImapMoveCopyMsgTxn::Undo(void)
|
|||||||
do_QueryInterface(m_srcFolder, &rv);
|
do_QueryInterface(m_srcFolder, &rv);
|
||||||
rv = imapService->SubtractMessageFlags(
|
rv = imapService->SubtractMessageFlags(
|
||||||
m_eventQueue, m_srcFolder, srcListener, nsnull,
|
m_eventQueue, m_srcFolder, srcListener, nsnull,
|
||||||
m_srcMsgIdString.GetBuffer(), kImapMsgDeletedFlag,
|
m_srcMsgIdString, kImapMsgDeletedFlag,
|
||||||
m_idsAreUids);
|
m_idsAreUids);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = imapService->SelectFolder(m_eventQueue, m_srcFolder,
|
rv = imapService->SelectFolder(m_eventQueue, m_srcFolder,
|
||||||
@ -204,7 +202,7 @@ nsImapMoveCopyMsgTxn::Redo(void)
|
|||||||
do_QueryInterface(m_srcFolder, &rv);
|
do_QueryInterface(m_srcFolder, &rv);
|
||||||
rv = imapService->AddMessageFlags(m_eventQueue, m_srcFolder,
|
rv = imapService->AddMessageFlags(m_eventQueue, m_srcFolder,
|
||||||
srcListener, nsnull,
|
srcListener, nsnull,
|
||||||
m_srcMsgIdString.GetBuffer(),
|
m_srcMsgIdString,
|
||||||
kImapMsgDeletedFlag,
|
kImapMsgDeletedFlag,
|
||||||
m_idsAreUids);
|
m_idsAreUids);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
|
@ -73,10 +73,10 @@ private:
|
|||||||
|
|
||||||
nsCOMPtr<nsIMsgFolder> m_srcFolder;
|
nsCOMPtr<nsIMsgFolder> m_srcFolder;
|
||||||
nsMsgKeyArray m_srcKeyArray;
|
nsMsgKeyArray m_srcKeyArray;
|
||||||
nsString m_srcMsgIdString;
|
nsCString m_srcMsgIdString;
|
||||||
nsCOMPtr<nsIMsgFolder> m_dstFolder;
|
nsCOMPtr<nsIMsgFolder> m_dstFolder;
|
||||||
nsMsgKeyArray m_dstKeyArray;
|
nsMsgKeyArray m_dstKeyArray;
|
||||||
nsString m_dstMsgIdString;
|
nsCString m_dstMsgIdString;
|
||||||
nsCOMPtr<nsIEventQueue> m_eventQueue;
|
nsCOMPtr<nsIEventQueue> m_eventQueue;
|
||||||
nsCOMPtr<nsIUrlListener> m_urlListener;
|
nsCOMPtr<nsIUrlListener> m_urlListener;
|
||||||
nsString m_undoString;
|
nsString m_undoString;
|
||||||
|
@ -232,19 +232,19 @@ nsURI2ProtocolType(const char* uriStr, nsString& type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parses ImapMessageURI */
|
/* parses ImapMessageURI */
|
||||||
nsresult nsParseImapMessageURI(const char* uri, nsString& folderURI, PRUint32 *key)
|
nsresult nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key)
|
||||||
{
|
{
|
||||||
if(!key)
|
if(!key)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsAutoString uriStr = uri;
|
nsCAutoString uriStr = uri;
|
||||||
PRInt32 keySeparator = uriStr.FindChar('#');
|
PRInt32 keySeparator = uriStr.FindChar('#');
|
||||||
if(keySeparator != -1)
|
if(keySeparator != -1)
|
||||||
{
|
{
|
||||||
nsAutoString folderPath;
|
nsAutoString folderPath;
|
||||||
uriStr.Left(folderURI, keySeparator);
|
uriStr.Left(folderURI, keySeparator);
|
||||||
folderURI.Cut(4, 8); // cut out the _message part of imap_message:
|
folderURI.Cut(4, 8); // cut out the _message part of imap_message:
|
||||||
nsAutoString keyStr;
|
nsCAutoString keyStr;
|
||||||
uriStr.Right(keyStr, uriStr.Length() - (keySeparator + 1));
|
uriStr.Right(keyStr, uriStr.Length() - (keySeparator + 1));
|
||||||
PRInt32 errorCode;
|
PRInt32 errorCode;
|
||||||
*key = keyStr.ToInteger(&errorCode);
|
*key = keyStr.ToInteger(&errorCode);
|
||||||
|
@ -48,7 +48,7 @@ extern nsresult
|
|||||||
nsURI2ProtocolType(const char* uriStr, nsString& type);
|
nsURI2ProtocolType(const char* uriStr, nsString& type);
|
||||||
|
|
||||||
extern nsresult
|
extern nsresult
|
||||||
nsParseImapMessageURI(const char* uri, nsString& folderURI, PRUint32 *key);
|
nsParseImapMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key);
|
||||||
|
|
||||||
extern nsresult
|
extern nsresult
|
||||||
nsBuildImapMessageURI(const char *baseURI, PRUint32 key, char **uri);
|
nsBuildImapMessageURI(const char *baseURI, PRUint32 key, char **uri);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user