Back to index

lightning-sunbird  0.9+nobinonly
nsPop3Service.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  *   Pierre Phaneuf <pp@ludusdesign.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "msgCore.h"    // precompiled header...
00040 
00041 #include "nsPop3Service.h"
00042 #include "nsIMsgIncomingServer.h"
00043 #include "nsIPop3IncomingServer.h"
00044 #include "nsIMsgMailSession.h"
00045 
00046 #include "nsPop3URL.h"
00047 #include "nsPop3Sink.h"
00048 #include "nsPop3Protocol.h"
00049 #include "nsMsgLocalCID.h"
00050 #include "nsMsgBaseCID.h"
00051 #include "nsXPIDLString.h"
00052 #include "nsCOMPtr.h"
00053 #include "nsIMsgWindow.h"
00054 
00055 #include "nsIRDFService.h"
00056 #include "nsIRDFDataSource.h"
00057 #include "nsRDFCID.h"
00058 #include "nsIDirectoryService.h"
00059 #include "nsAppDirectoryServiceDefs.h"
00060 #include "prprf.h"
00061 #include "nsEscape.h"
00062 #include "nsMsgUtils.h"
00063 #include "nsIMsgAccountManager.h"
00064 #include "nsIMsgAccount.h"
00065 #include "nsLocalMailFolder.h"
00066 #include "nsIMailboxUrl.h"
00067 #include "nsInt64.h"
00068 #include "nsIPrompt.h"
00069 
00070 #define POP3_PORT 110 // The IANA port for Pop3
00071 #define SECURE_POP3_PORT 995 // The port for Pop3 over SSL
00072 
00073 #define PREF_MAIL_ROOT_POP3 "mail.root.pop3"        // old - for backward compatibility only
00074 #define PREF_MAIL_ROOT_POP3_REL "mail.root.pop3-rel"
00075 
00076 static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID);
00077 static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
00078 
00079 nsPop3Service::nsPop3Service()
00080 {
00081 }
00082 
00083 nsPop3Service::~nsPop3Service()
00084 {}
00085 
00086 NS_IMPL_ISUPPORTS3(nsPop3Service,
00087                          nsIPop3Service,
00088                          nsIProtocolHandler,
00089                          nsIMsgProtocolInfo)
00090 
00091 NS_IMETHODIMP nsPop3Service::CheckForNewMail(nsIMsgWindow* aMsgWindow, 
00092                                              nsIUrlListener * aUrlListener,
00093                                              nsIMsgFolder *aInbox, 
00094                                              nsIPop3IncomingServer *aPopServer,
00095                                              nsIURI ** aURL)
00096 {
00097   return GetMail(PR_FALSE /* don't download, just check */, aMsgWindow, aUrlListener, aInbox, aPopServer, aURL);
00098 }
00099 
00100 
00101 nsresult nsPop3Service::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlListener * aUrlListener,
00102                                    nsIMsgFolder *aInbox,
00103                                    nsIPop3IncomingServer *aPopServer,
00104                                    nsIURI ** aURL)
00105 {
00106   return GetMail(PR_TRUE /* download */, aMsgWindow, aUrlListener, aInbox, aPopServer, aURL);
00107 }
00108 
00109 nsresult nsPop3Service::GetMail(PRBool downloadNewMail,
00110                                 nsIMsgWindow* aMsgWindow, 
00111                                 nsIUrlListener * aUrlListener,
00112                                 nsIMsgFolder *aInbox, 
00113                                 nsIPop3IncomingServer *aPopServer,
00114                                 nsIURI ** aURL)
00115 {
00116 
00117   NS_ENSURE_ARG_POINTER(aInbox);
00118   nsXPIDLCString popHost;
00119   nsXPIDLCString popUser;
00120   PRInt32 popPort = -1;
00121   
00122   nsCOMPtr<nsIMsgIncomingServer> server;
00123   nsCOMPtr<nsIURI> url;
00124   
00125   server = do_QueryInterface(aPopServer);
00126   
00127   nsCOMPtr <nsIMsgLocalMailFolder> destLocalFolder = do_QueryInterface(aInbox);
00128   if (destLocalFolder)
00129   {
00130     PRBool destFolderTooBig;
00131     destLocalFolder->WarnIfLocalFileTooBig(aMsgWindow, &destFolderTooBig);
00132     if (destFolderTooBig)
00133       return NS_MSG_ERROR_WRITING_MAIL_FOLDER;
00134   }
00135 
00136   if (!server) 
00137     return NS_MSG_INVALID_OR_MISSING_SERVER;
00138   
00139   nsresult rv = server->GetHostName(getter_Copies(popHost));
00140   NS_ENSURE_SUCCESS(rv, rv);
00141   if (!((const char *)popHost)) 
00142     return NS_MSG_INVALID_OR_MISSING_SERVER;
00143   
00144   rv = server->GetPort(&popPort);
00145   NS_ENSURE_SUCCESS(rv, rv);
00146   
00147   rv = server->GetUsername(getter_Copies(popUser));
00148   NS_ENSURE_SUCCESS(rv, rv);
00149   if (!((const char *)popUser)) 
00150     return NS_MSG_SERVER_USERNAME_MISSING;
00151   
00152   nsXPIDLCString escapedUsername;
00153   *((char**)getter_Copies(escapedUsername)) = nsEscape(popUser, url_XAlphas);
00154   
00155   if (NS_SUCCEEDED(rv) && aPopServer)
00156   {
00157     // now construct a pop3 url...
00158     // we need to escape the username because it may contain
00159     // characters like / % or @
00160     char * urlSpec = (downloadNewMail)
00161       ? PR_smprintf("pop3://%s@%s:%d", (const char *)escapedUsername, (const char *)popHost, popPort)
00162       : PR_smprintf("pop3://%s@%s:%d/?check", (const char *)escapedUsername, (const char *)popHost, popPort);
00163     rv = BuildPop3Url(urlSpec, aInbox, aPopServer, aUrlListener, getter_AddRefs(url), aMsgWindow);
00164     PR_Free(urlSpec);
00165   }
00166   
00167   
00168   if (NS_SUCCEEDED(rv) && url) 
00169     rv = RunPopUrl(server, url);
00170   
00171   if (aURL && url) // we already have a ref count on pop3url...
00172     NS_IF_ADDREF(*aURL = url);
00173   
00174   return rv;
00175 }
00176 
00177 nsresult nsPop3Service::BuildPop3Url(const char * urlSpec,
00178                                      nsIMsgFolder *inbox,
00179                                      nsIPop3IncomingServer *server,
00180                                      nsIUrlListener * aUrlListener,
00181                                      nsIURI ** aUrl,
00182                                      nsIMsgWindow *aMsgWindow)
00183 {
00184   nsresult rv;
00185   
00186   nsPop3Sink * pop3Sink = new nsPop3Sink();
00187   if (pop3Sink)
00188   {
00189     pop3Sink->SetPopServer(server);
00190     pop3Sink->SetFolder(inbox);
00191   }
00192   
00193   // now create a pop3 url and a protocol instance to run the url....
00194   nsCOMPtr<nsIPop3URL> pop3Url = do_CreateInstance(kPop3UrlCID, &rv);
00195   NS_ENSURE_SUCCESS(rv,rv);
00196     
00197   pop3Url->SetPop3Sink(pop3Sink);
00198     
00199   rv = pop3Url->QueryInterface(NS_GET_IID(nsIURI), (void **) aUrl);
00200   NS_ENSURE_SUCCESS(rv,rv);
00201     
00202   (*aUrl)->SetSpec(nsDependentCString(urlSpec));
00203     
00204   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(pop3Url);
00205   if (mailnewsurl)
00206   {
00207     if (aUrlListener)
00208       mailnewsurl->RegisterListener(aUrlListener);
00209     if (aMsgWindow)
00210       mailnewsurl->SetMsgWindow(aMsgWindow);
00211   }
00212     
00213   return rv;
00214 }
00215 
00216 nsresult nsPop3Service::RunPopUrl(nsIMsgIncomingServer * aServer, nsIURI * aUrlToRun)
00217 {
00218   nsresult rv = NS_OK;
00219   if (aServer && aUrlToRun)
00220   {
00221     nsXPIDLCString userName;
00222     
00223     // load up required server information
00224     // we store the username unescaped in the server
00225     // so there is no need to unescape it
00226     rv = aServer->GetRealUsername(getter_Copies(userName));
00227     
00228     // find out if the server is busy or not...if the server is busy, we are 
00229     // *NOT* going to run the url
00230     PRBool serverBusy = PR_FALSE;
00231     rv = aServer->GetServerBusy(&serverBusy);
00232     
00233     if (!serverBusy)
00234     {
00235       nsPop3Protocol * protocol = new nsPop3Protocol(aUrlToRun);
00236       if (protocol)
00237       {
00238         NS_ADDREF(protocol);
00239         rv = protocol->Initialize(aUrlToRun);
00240         if(NS_FAILED(rv))
00241         {
00242           delete protocol;
00243           return rv;
00244         }
00245         // the protocol stores the unescaped username, so there is no need to escape it.
00246         protocol->SetUsername(userName);
00247         rv = protocol->LoadUrl(aUrlToRun);
00248         NS_RELEASE(protocol);
00249         if (NS_FAILED(rv))
00250           aServer->SetServerBusy(PR_FALSE);
00251       }
00252     } 
00253     else
00254     {
00255       nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(aUrlToRun);
00256       if (url)
00257         AlertServerBusy(url);
00258       rv = NS_ERROR_FAILURE;
00259     }
00260   } // if server
00261   
00262   return rv;
00263 }
00264 
00265 
00266 NS_IMETHODIMP nsPop3Service::GetScheme(nsACString &aScheme)
00267 {
00268     aScheme = "pop3";
00269     return NS_OK; 
00270 }
00271 
00272 NS_IMETHODIMP nsPop3Service::GetDefaultPort(PRInt32 *aDefaultPort)
00273 {
00274     NS_ENSURE_ARG_POINTER(aDefaultPort);
00275     *aDefaultPort = POP3_PORT;
00276     return NS_OK;
00277 }
00278 
00279 NS_IMETHODIMP nsPop3Service::AllowPort(PRInt32 port, const char *scheme, PRBool *_retval)
00280 {
00281     *_retval = PR_TRUE; // allow pop on any port
00282     return NS_OK;
00283 }
00284 
00285 NS_IMETHODIMP nsPop3Service::GetDefaultDoBiff(PRBool *aDoBiff)
00286 {
00287     NS_ENSURE_ARG_POINTER(aDoBiff);
00288     // by default, do biff for POP3 servers
00289     *aDoBiff = PR_TRUE;
00290     return NS_OK;
00291 }
00292 
00293 NS_IMETHODIMP nsPop3Service::GetProtocolFlags(PRUint32 *result)
00294 {
00295     NS_ENSURE_ARG_POINTER(result);
00296     *result = URI_NORELATIVE | ALLOWS_PROXY;
00297     return NS_OK;
00298 }
00299 
00300 NS_IMETHODIMP nsPop3Service::NewURI(const nsACString &aSpec,
00301                                     const char *aOriginCharset, // ignored
00302                                     nsIURI *aBaseURI,
00303                                     nsIURI **_retval)
00304 {
00305     nsresult rv = NS_ERROR_FAILURE;
00306     if (!_retval) return rv;
00307     nsCAutoString folderUri(aSpec);
00308     nsCOMPtr<nsIRDFResource> resource;
00309     PRInt32 offset = folderUri.Find("?");
00310     if (offset != -1)
00311         folderUri.Truncate(offset);
00312 
00313     const nsCString &flatSpec = PromiseFlatCString(aSpec);
00314     const char *uidl = PL_strstr(flatSpec.get(), "uidl=");
00315     if (!uidl) return NS_ERROR_FAILURE;
00316 
00317     nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv)); 
00318     if (NS_FAILED(rv)) return rv;
00319     rv = rdfService->GetResource(folderUri, getter_AddRefs(resource));
00320     if (NS_FAILED(rv)) return rv;
00321     nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(resource, &rv);
00322     if (NS_FAILED(rv)) return rv;
00323     nsCOMPtr<nsIMsgIncomingServer> server;
00324 
00325     nsLocalFolderScanState folderScanState;
00326     nsCOMPtr<nsIMsgLocalMailFolder> localFolder = do_QueryInterface(folder);
00327     nsCOMPtr <nsIMailboxUrl> mailboxUrl = do_QueryInterface(aBaseURI);
00328 
00329     nsCOMPtr<nsIFileSpec> path;
00330     rv = folder->GetPath(getter_AddRefs(path));
00331     if (NS_FAILED(rv)) return rv;
00332 
00333     nsFileSpec fileSpec;
00334     path->GetFileSpec(&fileSpec);
00335     folderScanState.m_fileSpec = &fileSpec;
00336     if (mailboxUrl && localFolder)
00337     {
00338       rv = localFolder->GetFolderScanState(&folderScanState);
00339       NS_ENSURE_SUCCESS(rv, rv);
00340       nsCOMPtr <nsIMsgDBHdr> msgHdr;
00341       nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(mailboxUrl, &rv);
00342       NS_ENSURE_SUCCESS(rv,rv);
00343       msgUrl->GetMessageHeader(getter_AddRefs(msgHdr));
00344       // we do this to get the account key
00345       if (msgHdr)
00346         localFolder->GetUidlFromFolder(&folderScanState, msgHdr);
00347       if (!folderScanState.m_accountKey.IsEmpty())
00348       {
00349         nsCOMPtr<nsIMsgAccountManager> accountManager = 
00350                  do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
00351         if (accountManager)
00352         {
00353           nsCOMPtr <nsIMsgAccount> account;
00354           accountManager->GetAccount(folderScanState.m_accountKey.get(), getter_AddRefs(account));
00355           if (account)
00356             account->GetIncomingServer(getter_AddRefs(server));
00357         }
00358       }
00359     }
00360 
00361     if (!server)
00362     rv = folder->GetServer(getter_AddRefs(server));
00363     if (NS_FAILED(rv)) return rv;
00364     nsCOMPtr<nsIPop3IncomingServer> popServer = do_QueryInterface(server,&rv);
00365     if (NS_FAILED(rv)) return rv;
00366     nsXPIDLCString hostname;
00367     nsXPIDLCString username;
00368     server->GetHostName(getter_Copies(hostname));
00369     server->GetUsername(getter_Copies(username));
00370 
00371     PRInt32 port;
00372     server->GetPort(&port);
00373     if (port == -1) port = POP3_PORT;
00374     
00375        // we need to escape the username because it may contain
00376        // characters like / % or @
00377     nsXPIDLCString escapedUsername;
00378     *((char **)getter_Copies(escapedUsername)) =
00379       nsEscape(username, url_XAlphas);
00380     
00381     nsCAutoString popSpec("pop://");
00382     popSpec += escapedUsername;
00383     popSpec += "@";
00384     popSpec += hostname;
00385     popSpec += ":";
00386     popSpec.AppendInt(port);
00387     popSpec += "?";
00388     popSpec += uidl;
00389     nsCOMPtr<nsIUrlListener> urlListener = do_QueryInterface(folder, &rv);
00390     if (NS_FAILED(rv)) return rv;
00391     rv = BuildPop3Url(popSpec.get(), folder, popServer,
00392                       urlListener, _retval, nsnull); 
00393     if (NS_SUCCEEDED(rv))
00394     {
00395         nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = 
00396             do_QueryInterface(*_retval, &rv);
00397         if (NS_SUCCEEDED(rv))
00398         {
00399                      // escape the username before we call SetUsername().  we do this because GetUsername()
00400                      // will unescape the username
00401             mailnewsurl->SetUsername(escapedUsername);
00402         }
00403         nsCOMPtr<nsIPop3URL> popurl = do_QueryInterface(mailnewsurl, &rv);
00404         if (NS_SUCCEEDED(rv))
00405         {
00406             nsCAutoString messageUri (aSpec);
00407             messageUri.ReplaceSubstring("mailbox:", "mailbox-message:");
00408             messageUri.ReplaceSubstring("?number=", "#");
00409             offset = messageUri.Find("&");
00410             if (offset != -1)
00411                 messageUri.Truncate(offset);
00412             popurl->SetMessageUri(messageUri.get());
00413             nsCOMPtr<nsIPop3Sink> pop3Sink;
00414             rv = popurl->GetPop3Sink(getter_AddRefs(pop3Sink));
00415             if (NS_SUCCEEDED(rv))
00416                 pop3Sink->SetBuildMessageUri(PR_TRUE);
00417         }
00418     }
00419     return rv;
00420 }
00421 
00422 void nsPop3Service::AlertServerBusy(nsIMsgMailNewsUrl *url)
00423 {
00424   nsCOMPtr <nsIMsgStringService> stringService = do_GetService(NS_MSG_POPSTRINGSERVICE_CONTRACTID);
00425   nsCOMPtr<nsIMsgWindow> msgWindow;
00426   nsCOMPtr<nsIPrompt> dialog;
00427   nsresult rv = url->GetMsgWindow(getter_AddRefs(msgWindow)); //it is ok to have null msgWindow, for example when biffing
00428   if (NS_SUCCEEDED(rv) && msgWindow)
00429   {
00430     rv = msgWindow->GetPromptDialog(getter_AddRefs(dialog));
00431     if (NS_SUCCEEDED(rv))
00432     {
00433       nsXPIDLString alertString;
00434       stringService->GetStringByID(POP3_MESSAGE_FOLDER_BUSY, getter_Copies(alertString));
00435       if (!alertString.IsEmpty())
00436         dialog->Alert(nsnull, alertString.get()); 
00437     }
00438   }
00439 }
00440 
00441 NS_IMETHODIMP nsPop3Service::NewChannel(nsIURI *aURI, nsIChannel **_retval)
00442 {
00443   NS_ENSURE_ARG_POINTER(aURI);
00444   nsresult rv = NS_OK;
00445 
00446   nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(aURI, &rv);
00447   nsXPIDLCString realUserName;
00448   if (NS_SUCCEEDED(rv) && url)
00449   {
00450     nsCOMPtr <nsIMsgIncomingServer> server;
00451     url->GetServer(getter_AddRefs(server));
00452     if (server)
00453     {
00454       // find out if the server is busy or not...if the server is busy, we are 
00455       // *NOT* going to run the url. The error code isn't quite right...
00456       // We might want to put up an error right here.
00457       PRBool serverBusy = PR_FALSE;
00458       rv = server->GetServerBusy(&serverBusy);
00459       if (serverBusy)
00460       {
00461         AlertServerBusy(url);
00462         return NS_MSG_FOLDER_BUSY;
00463       }
00464       server->GetRealUsername(getter_Copies(realUserName));
00465     }
00466   }
00467   
00468   nsPop3Protocol * protocol = new nsPop3Protocol(aURI);
00469   if (protocol)
00470   {
00471     rv = protocol->Initialize(aURI);
00472     if (NS_FAILED(rv)) 
00473     {
00474       delete protocol;
00475       return rv;
00476     }
00477     protocol->SetUsername(realUserName.get());
00478     rv = protocol->QueryInterface(NS_GET_IID(nsIChannel), (void **) _retval);
00479   }
00480   else
00481     rv = NS_ERROR_NULL_POINTER;
00482   
00483   return rv;
00484 }
00485 
00486 
00487 NS_IMETHODIMP
00488 nsPop3Service::SetDefaultLocalPath(nsIFileSpec *aPath)
00489 {
00490     NS_ENSURE_ARG(aPath);
00491     nsresult rv;
00492     
00493     nsFileSpec spec;
00494     rv = aPath->GetFileSpec(&spec);
00495     if (NS_FAILED(rv)) return rv;
00496     nsCOMPtr<nsILocalFile> localFile;
00497     NS_FileSpecToIFile(&spec, getter_AddRefs(localFile));
00498     if (!localFile) return NS_ERROR_FAILURE;
00499     
00500     rv = NS_SetPersistentFile(PREF_MAIL_ROOT_POP3_REL, PREF_MAIL_ROOT_POP3, localFile);
00501 
00502     return rv;
00503 }     
00504 
00505 NS_IMETHODIMP
00506 nsPop3Service::GetDefaultLocalPath(nsIFileSpec ** aResult)
00507 {
00508     NS_ENSURE_ARG_POINTER(aResult);
00509     *aResult = nsnull;
00510     
00511     nsresult rv;
00512     PRBool havePref;
00513     nsCOMPtr<nsILocalFile> localFile;    
00514     rv = NS_GetPersistentFile(PREF_MAIL_ROOT_POP3_REL,
00515                               PREF_MAIL_ROOT_POP3,
00516                               NS_APP_MAIL_50_DIR,
00517                               havePref,
00518                               getter_AddRefs(localFile));
00519         if (NS_FAILED(rv)) return rv;
00520         
00521     PRBool exists;
00522     rv = localFile->Exists(&exists);
00523     if (NS_SUCCEEDED(rv) && !exists)
00524         rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0775);
00525         if (NS_FAILED(rv)) return rv;
00526     
00527     // Make the resulting nsIFileSpec
00528     // TODO: Convert arg to nsILocalFile and avoid this
00529     nsCOMPtr<nsIFileSpec> outSpec;
00530     rv = NS_NewFileSpecFromIFile(localFile, getter_AddRefs(outSpec));
00531     if (NS_FAILED(rv)) return rv;
00532     
00533     if (!havePref || !exists) {
00534         rv = NS_SetPersistentFile(PREF_MAIL_ROOT_POP3_REL, PREF_MAIL_ROOT_POP3, localFile);
00535         NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to set root dir pref.");
00536     }
00537         
00538     *aResult = outSpec;
00539     NS_IF_ADDREF(*aResult);
00540     return NS_OK;
00541 }
00542     
00543 
00544 NS_IMETHODIMP
00545 nsPop3Service::GetServerIID(nsIID* *aServerIID)
00546 {
00547     *aServerIID = new nsIID(NS_GET_IID(nsIPop3IncomingServer));
00548     return NS_OK;
00549 }
00550 
00551 NS_IMETHODIMP
00552 nsPop3Service::GetRequiresUsername(PRBool *aRequiresUsername)
00553 {
00554         NS_ENSURE_ARG_POINTER(aRequiresUsername);
00555         *aRequiresUsername = PR_TRUE;
00556         return NS_OK;
00557 }
00558 
00559 NS_IMETHODIMP
00560 nsPop3Service::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNameWithEmailAddress)
00561 {
00562         NS_ENSURE_ARG_POINTER(aPreflightPrettyNameWithEmailAddress);
00563         *aPreflightPrettyNameWithEmailAddress = PR_TRUE;
00564         return NS_OK;
00565 }
00566 
00567 NS_IMETHODIMP
00568 nsPop3Service::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
00569 {
00570         NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
00571         *aCanLoginAtStartUp = PR_TRUE;
00572         return NS_OK;
00573 }
00574 
00575 NS_IMETHODIMP
00576 nsPop3Service::GetCanDelete(PRBool *aCanDelete)
00577 {
00578         NS_ENSURE_ARG_POINTER(aCanDelete);
00579         *aCanDelete = PR_TRUE;
00580         return NS_OK;
00581 }
00582 
00583 NS_IMETHODIMP
00584 nsPop3Service::GetCanDuplicate(PRBool *aCanDuplicate)
00585 {
00586         NS_ENSURE_ARG_POINTER(aCanDuplicate);
00587         *aCanDuplicate = PR_TRUE;
00588         return NS_OK;
00589 }        
00590 
00591 NS_IMETHODIMP
00592 nsPop3Service::GetCanGetMessages(PRBool *aCanGetMessages)
00593 {
00594     NS_ENSURE_ARG_POINTER(aCanGetMessages);
00595     *aCanGetMessages = PR_TRUE;
00596     return NS_OK;
00597 }  
00598 
00599 NS_IMETHODIMP
00600 nsPop3Service::GetCanGetIncomingMessages(PRBool *aCanGetIncomingMessages)
00601 {
00602     NS_ENSURE_ARG_POINTER(aCanGetIncomingMessages);
00603     *aCanGetIncomingMessages = PR_TRUE;
00604     return NS_OK;
00605 } 
00606 
00607 NS_IMETHODIMP
00608 nsPop3Service::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
00609 {
00610     NS_ENSURE_ARG_POINTER(showComposeMsgLink);
00611     *showComposeMsgLink = PR_TRUE;
00612     return NS_OK;
00613 }  
00614 
00615 NS_IMETHODIMP
00616 nsPop3Service::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
00617 {
00618     NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
00619     *needToBuildSpecialFolderURIs = PR_FALSE;
00620     return NS_OK;
00621 }
00622 
00623 
00624 NS_IMETHODIMP
00625 nsPop3Service::GetDefaultServerPort(PRBool isSecure, PRInt32 *aPort)
00626 {
00627     NS_ENSURE_ARG_POINTER(aPort);
00628     nsresult rv = NS_OK;
00629 
00630     if (isSecure)
00631       *aPort = SECURE_POP3_PORT;
00632     else
00633       rv = GetDefaultPort(aPort);
00634 
00635     return rv;
00636 }
00637 
00638 NS_IMETHODIMP
00639 nsPop3Service::GetSpecialFoldersDeletionAllowed(PRBool *specialFoldersDeletionAllowed)
00640 {
00641     NS_ENSURE_ARG_POINTER(specialFoldersDeletionAllowed);
00642     *specialFoldersDeletionAllowed = PR_TRUE;
00643     return NS_OK;
00644 }
00645