Back to index

lightning-sunbird  0.9+nobinonly
nsMovemailService.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Adam D. Moss <adam@gimp.org>
00024  *   Seth Spitzer <sspitzer@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifdef MOZ_LOGGING
00041 #define FORCE_PR_LOG
00042 #endif
00043 
00044 #include <unistd.h>    // for link(), used in spool-file locking
00045 
00046 #include "prenv.h"
00047 #include "nspr.h"
00048 
00049 #include "msgCore.h"    // precompiled header...
00050 
00051 #include "nsMovemailService.h"
00052 #include "nsIMovemailService.h"
00053 #include "nsIMsgIncomingServer.h"
00054 #include "nsIMovemailIncomingServer.h"
00055 #include "nsIMsgProtocolInfo.h"
00056 #include "nsIMsgMailSession.h"
00057 #include "nsParseMailbox.h"
00058 #include "nsIMsgFolder.h"
00059 #include "nsIPrompt.h"
00060 
00061 #include "nsILocalFile.h"
00062 #include "nsFileStream.h"
00063 #include "nsIFileSpec.h"
00064 #include "nsAppDirectoryServiceDefs.h"
00065 #include "nsMsgUtils.h"
00066 
00067 #include "nsMsgLocalCID.h"
00068 #include "nsMsgBaseCID.h"
00069 #include "nsXPIDLString.h"
00070 #include "nsCOMPtr.h"
00071 #include "nsMsgFolderFlags.h"
00072 
00073 #include "nsILineInputStream.h"
00074 #include "nsNetUtil.h"
00075 #include "nsAutoPtr.h"
00076 
00077 #include "prlog.h"
00078 #if defined(PR_LOGGING)
00079 //
00080 // export NSPR_LOG_MODULES=Movemail:5
00081 //
00082 static PRLogModuleInfo *gMovemailLog = nsnull;
00083 #define LOG(args) PR_LOG(gMovemailLog, PR_LOG_DEBUG, args)
00084 #else
00085 #define LOG(args)
00086 #endif
00087 
00088 #define PREF_MAIL_ROOT_MOVEMAIL "mail.root.movemail"            // old - for backward compatibility only
00089 #define PREF_MAIL_ROOT_MOVEMAIL_REL "mail.root.movemail-rel"
00090 
00091 const char * gDefaultSpoolPaths[] = {
00092     "/var/spool/mail/",
00093     "/usr/spool/mail/",
00094     "/var/mail/",
00095     "/usr/mail/"
00096 };
00097 #define NUM_DEFAULT_SPOOL_PATHS (sizeof(gDefaultSpoolPaths)/sizeof(gDefaultSpoolPaths[0]))
00098 
00099 nsMovemailService::nsMovemailService()
00100 {
00101 #if defined(PR_LOGGING)
00102     if (!gMovemailLog)
00103         gMovemailLog = PR_NewLogModule("Movemail");
00104 #endif
00105     LOG(("nsMovemailService created: 0x%x\n", this));
00106     mStringService = do_GetService(NS_MSG_POPSTRINGSERVICE_CONTRACTID);
00107 }
00108 
00109 nsMovemailService::~nsMovemailService()
00110 {}
00111 
00112 
00113 NS_IMPL_ISUPPORTS2(nsMovemailService,
00114                    nsIMovemailService,
00115                    nsIMsgProtocolInfo)
00116 
00117 
00118 NS_IMETHODIMP
00119 nsMovemailService::CheckForNewMail(nsIUrlListener * aUrlListener,
00120                                    nsIMsgFolder *inbox,
00121                                    nsIMovemailIncomingServer *movemailServer,
00122                                    nsIURI ** aURL)
00123 {
00124     nsresult rv = NS_OK;
00125     LOG(("nsMovemailService::CheckForNewMail\n"));
00126     return rv;
00127 }
00128 
00129 
00130 void
00131 nsMovemailService::Error(PRInt32 errorCode,
00132                          const PRUnichar **params,
00133                          PRUint32 length)
00134 {
00135     if (!mStringService) return;
00136     if (!mMsgWindow) return;
00137 
00138     nsCOMPtr<nsIPrompt> dialog;
00139     nsresult rv = mMsgWindow->GetPromptDialog(getter_AddRefs(dialog));
00140     if (NS_FAILED(rv))
00141         return;
00142 
00143     nsXPIDLString errStr;
00144 
00145     // Format the error string if necessary
00146     if (params) {
00147         nsCOMPtr<nsIStringBundle> bundle;
00148         rv = mStringService->GetBundle(getter_AddRefs(bundle));
00149         if (NS_SUCCEEDED(rv))
00150             bundle->FormatStringFromID(errorCode, params, length,
00151                                        getter_Copies(errStr));
00152     }
00153     else {
00154         mStringService->GetStringByID(errorCode, getter_Copies(errStr));
00155     }
00156 
00157     if (!errStr.IsEmpty()) {
00158         dialog->Alert(nsnull, errStr.get());
00159     }
00160 }
00161 
00162 
00163 PRBool ObtainSpoolLock(const char *spoolnameStr,
00164                        int seconds /* number of seconds to retry */)
00165 {
00166     // How to lock:
00167     // step 1: create SPOOLNAME.mozlock
00168     //        1a: can remove it if it already exists (probably crash-droppings)
00169     // step 2: hard-link SPOOLNAME.mozlock to SPOOLNAME.lock for NFS atomicity
00170     //        2a: if SPOOLNAME.lock is >60sec old then nuke it from orbit
00171     //        2b: repeat step 2 until retry-count expired or hard-link succeeds
00172     // step 3: remove SPOOLNAME.mozlock
00173     // step 4: If step 2 hard-link failed, fail hard; we do not hold the lock
00174     // DONE.
00175     //
00176     // (step 2a not yet implemented)
00177     
00178     nsCAutoString mozlockstr(spoolnameStr);
00179     mozlockstr.Append(".mozlock");
00180     nsCAutoString lockstr(spoolnameStr);
00181     lockstr.Append(".lock");
00182 
00183     nsresult rv;
00184 
00185     // Create nsILocalFile for the spool.mozlock file
00186     nsCOMPtr<nsILocalFile> tmplocfile;
00187     rv = NS_NewNativeLocalFile(mozlockstr, PR_TRUE, getter_AddRefs(tmplocfile));
00188     if (NS_FAILED(rv))
00189         return PR_FALSE;
00190     // THOUGHT: hmm, perhaps use MakeUnique to generate us a unique mozlock?
00191     // ... perhaps not, MakeUnique implementation looks racey -- use mktemp()?
00192 
00193     // step 1: create SPOOLNAME.mozlock
00194     rv = tmplocfile->Create(nsIFile::NORMAL_FILE_TYPE, 0666);
00195     if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS) {
00196         // can't create our .mozlock file... game over already
00197         LOG(("Failed to create file %s\n", mozlockstr.get()));
00198         return PR_FALSE;
00199     }
00200 
00201     // step 2: hard-link .mozlock file to .lock file (this wackiness
00202     //         is necessary for non-racey locking on NFS-mounted spool dirs)
00203     // n.b. XPCOM utilities don't support hard-linking yet, so we
00204     // skip out to <unistd.h> and the POSIX interface for link()
00205     int link_result = 0;
00206     int retry_count = 0;
00207     
00208     do {
00209         link_result = link(mozlockstr.get(),lockstr.get());
00210 
00211         retry_count++;
00212         LOG(("Attempt %d of %d to create lock file", retry_count, seconds));
00213 
00214         if (seconds > 0 && link_result == -1) {
00215             // pause 1sec, waiting for .lock to go away
00216             PRIntervalTime sleepTime = 1000; // 1 second
00217             PR_Sleep(sleepTime);
00218         }
00219     } while (link_result == -1 && retry_count < seconds);
00220     LOG(("Link result: %d", link_result));
00221 
00222     // step 3: remove .mozlock file, in any case
00223     rv = tmplocfile->Remove(PR_FALSE /* non-recursive */);
00224     if (NS_FAILED(rv)) {
00225         // Could not delete our .mozlock file... very unusual, but
00226         // not fatal.
00227         LOG(("Unable to delete %s", mozlockstr.get()));
00228     }
00229 
00230     // step 4: now we know whether we succeeded or failed
00231     if (link_result == 0)
00232         return PR_TRUE; // got the lock.
00233     else
00234         return PR_FALSE; // didn't.  :(
00235 }
00236 
00237 
00238 // Remove our mail-spool-file lock (n.b. we should only try this if
00239 // we're the ones who made the lock in the first place!)
00240 PRBool YieldSpoolLock(const char *spoolnameStr)
00241 {
00242     LOG(("YieldSpoolLock(%s)", spoolnameStr));
00243 
00244     nsCAutoString lockstr(spoolnameStr);
00245     lockstr.Append(".lock");
00246 
00247     nsresult rv;
00248 
00249     // Create nsILocalFile for the spool.lock file
00250     nsCOMPtr<nsILocalFile> locklocfile;
00251     rv = NS_NewNativeLocalFile(lockstr, PR_TRUE, getter_AddRefs(locklocfile));
00252     if (NS_FAILED(rv))
00253         return PR_FALSE;
00254 
00255     // Check if the lock file exists
00256     PRBool exists;
00257     rv = locklocfile->Exists(&exists);
00258     if (NS_FAILED(rv))
00259         return PR_FALSE;
00260 
00261     // Delete the file if it exists
00262     if (exists) {
00263         rv = locklocfile->Remove(PR_FALSE /* non-recursive */);
00264         if (NS_FAILED(rv))
00265             return PR_FALSE;
00266     }
00267 
00268     LOG(("YieldSpoolLock was successful."));
00269 
00270     // Success.
00271     return PR_TRUE;
00272 }
00273 
00274 static nsresult
00275 LocateSpoolFile(nsACString & spoolPath)
00276 {
00277     PRBool isFile;
00278     nsresult rv;
00279 
00280     nsCOMPtr<nsILocalFile> spoolFile;
00281     rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(spoolFile));
00282     NS_ENSURE_SUCCESS(rv, rv);
00283 
00284     char * mailEnv = PR_GetEnv("MAIL");
00285     char * userEnv = PR_GetEnv("USER");
00286     if (!userEnv)
00287         userEnv = PR_GetEnv("USERNAME");
00288 
00289     if (mailEnv) {
00290         rv = spoolFile->InitWithNativePath(nsDependentCString(mailEnv));
00291         NS_ENSURE_SUCCESS(rv, rv);
00292         rv = spoolFile->IsFile(&isFile);
00293         if (NS_SUCCEEDED(rv) && isFile)
00294             spoolPath = mailEnv;
00295     }
00296     else if (userEnv) {
00297         // Try to build the mailbox path from the username and a number
00298         // of guessed spool directory paths.
00299         nsCAutoString tmpPath;
00300         PRUint32 i;
00301         for (i = 0; i < NUM_DEFAULT_SPOOL_PATHS; i++) {
00302             tmpPath = gDefaultSpoolPaths[i];
00303             tmpPath += userEnv;
00304             rv = spoolFile->InitWithNativePath(tmpPath);
00305             NS_ENSURE_SUCCESS(rv, rv);
00306             rv = spoolFile->IsFile(&isFile);
00307             if (NS_SUCCEEDED(rv) && isFile) {
00308                 spoolPath = tmpPath;
00309                 break;
00310             }
00311         }
00312     }
00313 
00314     return rv;
00315 }
00316 
00317 nsresult
00318 nsMovemailService::GetNewMail(nsIMsgWindow *aMsgWindow,
00319                               nsIUrlListener *aUrlListener,
00320                               nsIMsgFolder *aMsgFolder,
00321                               nsIMovemailIncomingServer *movemailServer,
00322                               nsIURI ** aURL)
00323 {
00324     LOG(("nsMovemailService::GetNewMail"));
00325     nsresult rv = NS_OK;
00326 
00327     nsCOMPtr<nsIMsgIncomingServer> in_server =
00328         do_QueryInterface(movemailServer);
00329     if (!in_server)
00330         return NS_MSG_INVALID_OR_MISSING_SERVER;
00331     mMsgWindow = aMsgWindow;
00332 
00333     // Attempt to locate the mail spool file
00334     nsCAutoString spoolPath;
00335     rv = LocateSpoolFile(spoolPath);
00336     if (NS_FAILED(rv) || spoolPath.IsEmpty()) {
00337         Error(MOVEMAIL_SPOOL_FILE_NOT_FOUND, nsnull, 0);
00338         return NS_ERROR_FAILURE;
00339     }
00340 
00341     // Create an input stream for the spool file
00342     nsCOMPtr<nsILocalFile> spoolFile;
00343     rv = NS_NewNativeLocalFile(spoolPath, PR_TRUE, getter_AddRefs(spoolFile));
00344     NS_ENSURE_SUCCESS(rv, rv);
00345     nsCOMPtr<nsIInputStream> spoolInputStream;
00346     rv = NS_NewLocalFileInputStream(getter_AddRefs(spoolInputStream), spoolFile);
00347     if (NS_FAILED(rv)) {
00348         const PRUnichar *params[] = {
00349             NS_ConvertUTF8toUCS2(spoolPath).get()
00350         };
00351         Error(MOVEMAIL_CANT_OPEN_SPOOL_FILE, params, 1);
00352         return rv;
00353     }
00354 
00355     // Get a line input interface for the spool file
00356     nsCOMPtr<nsILineInputStream> lineInputStream =
00357         do_QueryInterface(spoolInputStream, &rv);
00358     if (!lineInputStream)
00359         return rv;
00360 
00361     nsCOMPtr<nsIFileSpec> mailDirectory;
00362     rv = in_server->GetLocalPath(getter_AddRefs(mailDirectory));
00363     NS_ENSURE_SUCCESS(rv, rv);
00364 
00365     nsFileSpec fileSpec;
00366     mailDirectory->GetFileSpec(&fileSpec);
00367     fileSpec += "Inbox";
00368     nsIOFileStream outFileStream(fileSpec);
00369     outFileStream.seek(fileSpec.GetFileSize());
00370     nsCOMPtr<nsIMsgFolder> serverFolder;
00371     nsCOMPtr<nsIMsgFolder> inbox;
00372     nsCOMPtr<nsIMsgFolder> rootMsgFolder;
00373         
00374     // create a new mail parser
00375     nsRefPtr<nsParseNewMailState> newMailParser = new nsParseNewMailState;
00376     if (newMailParser == nsnull)
00377         return NS_ERROR_OUT_OF_MEMORY;
00378 
00379     rv = in_server->GetRootFolder(getter_AddRefs(serverFolder));
00380     NS_ENSURE_SUCCESS(rv, rv);
00381 
00382     rootMsgFolder = do_QueryInterface(serverFolder, &rv);
00383     if (!rootMsgFolder)
00384         return rv;
00385     PRUint32 numFolders;
00386     rv = rootMsgFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1,
00387                                            &numFolders,
00388                                            getter_AddRefs(inbox));
00389     NS_ENSURE_SUCCESS(rv, rv);
00390     rv = newMailParser->Init(serverFolder, inbox, 
00391                              fileSpec, &outFileStream, nsnull, PR_FALSE);
00392     NS_ENSURE_SUCCESS(rv, rv);
00393 
00394     in_server->SetServerBusy(PR_TRUE);
00395 
00396     // Try and obtain the lock for the spool file
00397     if (!ObtainSpoolLock(spoolPath.get(), 5)) {
00398         nsAutoString lockFile = NS_ConvertUTF8toUCS2(spoolPath);
00399         lockFile.AppendLiteral(".lock");
00400         const PRUnichar *params[] = {
00401             lockFile.get()
00402         };
00403         Error(MOVEMAIL_CANT_CREATE_LOCK, params, 1);
00404         return NS_ERROR_FAILURE;
00405     }
00406             
00407     // MIDDLE of the FUN : consume the mailbox data.
00408     PRBool isMore = PR_TRUE;
00409     nsCAutoString buffer;
00410 
00411     while (isMore &&
00412            NS_SUCCEEDED(lineInputStream->ReadLine(buffer, &isMore)))
00413     {
00414 
00415         // If first string is empty and we're now at EOF then abort parsing.
00416         if (buffer.IsEmpty() && !isMore) {
00417             LOG(("Empty spool file"));
00418             break;
00419         }
00420 
00421         buffer += MSG_LINEBREAK;
00422 
00423         newMailParser->HandleLine(buffer.BeginWriting(), buffer.Length());
00424         outFileStream << buffer.get();
00425 
00426         // 'From' lines delimit messages
00427         if (isMore && !strncmp(buffer.get(), "From ", 5)) {
00428             buffer.AssignLiteral("X-Mozilla-Status: 8000" MSG_LINEBREAK);
00429             newMailParser->HandleLine(buffer.BeginWriting(), buffer.Length());
00430             outFileStream << buffer.get();
00431             buffer.AssignLiteral("X-Mozilla-Status2: 00000000" MSG_LINEBREAK);
00432             newMailParser->HandleLine(buffer.BeginWriting(), buffer.Length());
00433             outFileStream << buffer.get();
00434         }
00435     }
00436 
00437     outFileStream.flush();
00438     newMailParser->OnStopRequest(nsnull, nsnull, NS_OK);
00439     newMailParser->SetDBFolderStream(nsnull); // stream is going away
00440     if (outFileStream.is_open())
00441         outFileStream.close();
00442 
00443     // Truncate the spool file
00444     rv = spoolFile->SetFileSize(0);
00445     if (NS_FAILED(rv)) {
00446         const PRUnichar *params[] = {
00447             NS_ConvertUTF8toUCS2(spoolPath).get()
00448         };
00449         Error(MOVEMAIL_CANT_TRUNCATE_SPOOL_FILE, params, 1);
00450     }
00451 
00452     if (!YieldSpoolLock(spoolPath.get())) {
00453         nsAutoString spoolLock = NS_ConvertUTF8toUCS2(spoolPath);
00454         spoolLock.AppendLiteral(".lock");
00455         const PRUnichar *params[] = {
00456             spoolLock.get()
00457         };
00458         Error(MOVEMAIL_CANT_DELETE_LOCK, params, 1);
00459     }
00460 
00461     in_server->SetServerBusy(PR_FALSE);
00462 
00463     LOG(("GetNewMail returning rv=%d", rv));
00464     return rv;
00465 }
00466 
00467 
00468 NS_IMETHODIMP
00469 nsMovemailService::SetDefaultLocalPath(nsIFileSpec *aPath)
00470 {
00471     NS_ENSURE_ARG(aPath);
00472     nsresult rv;
00473     
00474     nsFileSpec spec;
00475     rv = aPath->GetFileSpec(&spec);
00476     if (NS_FAILED(rv)) return rv;
00477     nsCOMPtr<nsILocalFile> localFile;
00478     NS_FileSpecToIFile(&spec, getter_AddRefs(localFile));
00479     if (!localFile) return NS_ERROR_FAILURE;
00480     
00481     rv = NS_SetPersistentFile(PREF_MAIL_ROOT_MOVEMAIL_REL, PREF_MAIL_ROOT_MOVEMAIL, localFile);
00482 
00483     return rv;
00484 }     
00485 
00486 NS_IMETHODIMP
00487 nsMovemailService::GetDefaultLocalPath(nsIFileSpec ** aResult)
00488 {
00489     NS_ENSURE_ARG_POINTER(aResult);
00490     *aResult = nsnull;
00491     
00492     nsresult rv;
00493     PRBool havePref;
00494     nsCOMPtr<nsILocalFile> localFile;    
00495     rv = NS_GetPersistentFile(PREF_MAIL_ROOT_MOVEMAIL_REL,
00496                               PREF_MAIL_ROOT_MOVEMAIL,
00497                               NS_APP_MAIL_50_DIR,
00498                               havePref,
00499                               getter_AddRefs(localFile));
00500         if (NS_FAILED(rv)) return rv;
00501         
00502     PRBool exists;
00503     rv = localFile->Exists(&exists);
00504     if (NS_SUCCEEDED(rv) && !exists)
00505         rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0775);
00506     if (NS_FAILED(rv)) return rv;
00507     
00508     // Make the resulting nsIFileSpec
00509     // TODO: Convert arg to nsILocalFile and avoid this
00510     nsCOMPtr<nsIFileSpec> outSpec;
00511     rv = NS_NewFileSpecFromIFile(localFile, getter_AddRefs(outSpec));
00512     if (NS_FAILED(rv)) return rv;
00513     
00514     if (!havePref || !exists) {
00515         rv = NS_SetPersistentFile(PREF_MAIL_ROOT_MOVEMAIL_REL, PREF_MAIL_ROOT_MOVEMAIL, localFile);
00516         NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to set root dir pref.");
00517     }
00518         
00519     *aResult = outSpec;
00520     NS_IF_ADDREF(*aResult);
00521     return NS_OK;
00522 }
00523     
00524 
00525 NS_IMETHODIMP
00526 nsMovemailService::GetServerIID(nsIID* *aServerIID)
00527 {
00528     *aServerIID = new nsIID(NS_GET_IID(nsIMovemailIncomingServer));
00529     return NS_OK;
00530 }
00531 
00532 NS_IMETHODIMP
00533 nsMovemailService::GetRequiresUsername(PRBool *aRequiresUsername)
00534 {
00535     NS_ENSURE_ARG_POINTER(aRequiresUsername);
00536     *aRequiresUsername = PR_FALSE;
00537     return NS_OK;
00538 }
00539 
00540 NS_IMETHODIMP
00541 nsMovemailService::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNameWithEmailAddress)
00542 {
00543     NS_ENSURE_ARG_POINTER(aPreflightPrettyNameWithEmailAddress);
00544     *aPreflightPrettyNameWithEmailAddress = PR_TRUE;
00545     return NS_OK;
00546 }
00547 
00548 NS_IMETHODIMP
00549 nsMovemailService::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
00550 {
00551     NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
00552     *aCanLoginAtStartUp = PR_FALSE;
00553     return NS_OK;
00554 }
00555 
00556 NS_IMETHODIMP
00557 nsMovemailService::GetCanDelete(PRBool *aCanDelete)
00558 {
00559     NS_ENSURE_ARG_POINTER(aCanDelete);
00560     *aCanDelete = PR_TRUE;
00561     return NS_OK;
00562 }  
00563 
00564 NS_IMETHODIMP
00565 nsMovemailService::GetCanGetMessages(PRBool *aCanGetMessages)
00566 {
00567     NS_ENSURE_ARG_POINTER(aCanGetMessages);
00568     *aCanGetMessages = PR_TRUE;
00569     return NS_OK;
00570 }  
00571 
00572 NS_IMETHODIMP
00573 nsMovemailService::GetCanGetIncomingMessages(PRBool *aCanGetIncomingMessages)
00574 {
00575     NS_ENSURE_ARG_POINTER(aCanGetIncomingMessages);
00576     *aCanGetIncomingMessages = PR_TRUE;
00577     return NS_OK;
00578 } 
00579 
00580 NS_IMETHODIMP
00581 nsMovemailService::GetCanDuplicate(PRBool *aCanDuplicate)
00582 {
00583     NS_ENSURE_ARG_POINTER(aCanDuplicate);
00584     *aCanDuplicate = PR_FALSE;
00585     return NS_OK;
00586 }  
00587 
00588 NS_IMETHODIMP 
00589 nsMovemailService::GetDefaultDoBiff(PRBool *aDoBiff)
00590 {
00591     NS_ENSURE_ARG_POINTER(aDoBiff);
00592     // by default, do biff for movemail
00593     *aDoBiff = PR_TRUE;    
00594     return NS_OK;
00595 }
00596 
00597 NS_IMETHODIMP
00598 nsMovemailService::GetDefaultServerPort(PRBool isSecure, PRInt32 *aDefaultPort)
00599 {
00600     NS_ASSERTION(0, "This should probably never be called!");
00601     NS_ENSURE_ARG_POINTER(aDefaultPort);
00602     *aDefaultPort = -1;
00603     return NS_OK;
00604 }
00605 
00606 NS_IMETHODIMP
00607 nsMovemailService::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
00608 {
00609     NS_ENSURE_ARG_POINTER(showComposeMsgLink);
00610     *showComposeMsgLink = PR_TRUE;
00611     return NS_OK;
00612 }
00613 
00614 NS_IMETHODIMP
00615 nsMovemailService::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
00616 {
00617     NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
00618     *needToBuildSpecialFolderURIs = PR_FALSE;
00619     return NS_OK;
00620 }
00621 
00622 NS_IMETHODIMP
00623 nsMovemailService::GetSpecialFoldersDeletionAllowed(PRBool *specialFoldersDeletionAllowed)
00624 {
00625     NS_ENSURE_ARG_POINTER(specialFoldersDeletionAllowed);
00626     *specialFoldersDeletionAllowed = PR_TRUE;
00627     return NS_OK;
00628 }