NS_WITH_SERVICE (nsIComponentManager, compMgr, kComponentManagerCID, &rv); if (NS_SUCCEEDED(rv)) { rv = compMgr->CreateInstance(kTransactionManagerCID, nsnull, nsCOMTypeInfo<nsITransactionManager>::GetIID(), getter_AddRefs(mTxnMgr)); if (NS_SUCCEEDED(rv)) mTxnMgr->SetMaxTransactionCount(-1); }
void nsMessenger::InitializeFolderRoot(){    nsresult rv;    	// get the current identity from the mail session....    NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);    if (NS_FAILED(rv)) return;    nsCOMPtr<nsIMsgIncomingServer> server;    rv = mailSession->GetCurrentServer(getter_AddRefs(server));        nsCOMPtr<nsIFileSpec> folderRoot;    if (NS_SUCCEEDED(rv) && server)        rv = server->GetLocalPath(getter_AddRefs(folderRoot));        if (NS_SUCCEEDED(rv) && folderRoot) {        // everyone should have a inbox so let's        // tack that folder name on to the root path...        rv = folderRoot->GetFileSpec(&m_folderPath);        if (NS_SUCCEEDED(rv))          m_folderPath += "Inbox";    } // if we have a folder root for the current server        // create Undo/Redo Transaction Manager    NS_WITH_SERVICE (nsIComponentManager, compMgr, kComponentManagerCID, &rv);    if (NS_SUCCEEDED(rv))    {      rv = compMgr->CreateInstance(kTransactionManagerCID, nsnull,                                    nsCOMTypeInfo<nsITransactionManager>::GetIID(),                                   getter_AddRefs(mTxnMgr));      if (NS_SUCCEEDED(rv))        mTxnMgr->SetMaxTransactionCount(-1);    }}