Back to index

lightning-sunbird  0.9+nobinonly
nsRssService.cpp
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is mozilla mailnews.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Seth Spitzer <sspitzer@mozilla.org>.
00018  * Portions created by the Initial Developer are Copyright (C) 2004
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #include "nsRssService.h"
00038 #include "nsIRssIncomingServer.h"
00039 #include "nsCOMPtr.h"
00040 #include "nsILocalFile.h"
00041 #include "nsFileSpec.h"
00042 #include "nsIFileSpec.h"
00043 #include "nsAppDirectoryServiceDefs.h"
00044 
00045 nsRssService::nsRssService()
00046 {
00047 }
00048 
00049 nsRssService::~nsRssService()
00050 {
00051 }
00052 
00053 NS_IMPL_ISUPPORTS2(nsRssService,
00054                    nsIRssService,
00055                    nsIMsgProtocolInfo)
00056                    
00057 NS_IMETHODIMP nsRssService::GetDefaultLocalPath(nsIFileSpec * *aDefaultLocalPath)
00058 {
00059     NS_ENSURE_ARG_POINTER(aDefaultLocalPath);
00060     *aDefaultLocalPath = nsnull;
00061     
00062     nsCOMPtr<nsILocalFile> localFile;
00063     nsCOMPtr<nsIProperties> dirService(do_GetService("@mozilla.org/file/directory_service;1"));
00064     if (!dirService) return NS_ERROR_FAILURE;
00065     dirService->Get(NS_APP_MAIL_50_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(localFile));
00066     if (!localFile) return NS_ERROR_FAILURE;
00067 
00068     PRBool exists;
00069     nsresult rv = localFile->Exists(&exists);
00070     if (NS_SUCCEEDED(rv) && !exists)
00071         rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0775);
00072     if (NS_FAILED(rv)) return rv;
00073     
00074     // Make the resulting nsIFileSpec
00075     // TODO: Convert arg to nsILocalFile and avoid this
00076     nsCOMPtr<nsIFileSpec> outSpec;
00077     rv = NS_NewFileSpecFromIFile(localFile, getter_AddRefs(outSpec));
00078     if (NS_FAILED(rv)) return rv;
00079     
00080     NS_IF_ADDREF(*aDefaultLocalPath = outSpec);
00081     return NS_OK;
00082 
00083 }
00084 
00085 NS_IMETHODIMP nsRssService::SetDefaultLocalPath(nsIFileSpec * aDefaultLocalPath)
00086 {
00087     NS_ASSERTION(0,"foo");
00088     return NS_ERROR_NOT_IMPLEMENTED;
00089 }
00090 
00091 NS_IMETHODIMP nsRssService::GetServerIID(nsIID * *aServerIID)
00092 {
00093     NS_ASSERTION(0,"foo");
00094     return NS_ERROR_NOT_IMPLEMENTED;
00095 }
00096 
00097 NS_IMETHODIMP nsRssService::GetRequiresUsername(PRBool *aRequiresUsername)
00098 {
00099     NS_ASSERTION(0,"foo");
00100     return NS_ERROR_NOT_IMPLEMENTED;
00101 }
00102 
00103 NS_IMETHODIMP nsRssService::GetPreflightPrettyNameWithEmailAddress(PRBool *aPreflightPrettyNameWithEmailAddress)
00104 {
00105     NS_ASSERTION(0,"foo");
00106     return NS_ERROR_NOT_IMPLEMENTED;
00107 }
00108 
00109 NS_IMETHODIMP nsRssService::GetCanDelete(PRBool *aCanDelete)
00110 {
00111     NS_ENSURE_ARG_POINTER(aCanDelete);
00112     *aCanDelete = PR_TRUE;
00113     return NS_OK;
00114 }
00115 
00116 NS_IMETHODIMP nsRssService::GetCanLoginAtStartUp(PRBool *aCanLoginAtStartUp)
00117 {
00118     NS_ENSURE_ARG_POINTER(aCanLoginAtStartUp);
00119     *aCanLoginAtStartUp = PR_TRUE;
00120     return NS_OK;
00121 }
00122 
00123 NS_IMETHODIMP nsRssService::GetCanDuplicate(PRBool *aCanDuplicate)
00124 {
00125     NS_ENSURE_ARG_POINTER(aCanDuplicate);
00126     *aCanDuplicate = PR_TRUE;
00127     return NS_OK;
00128 }
00129 
00130 NS_IMETHODIMP nsRssService::GetDefaultServerPort(PRBool isSecure, PRInt32 *_retval)
00131 {
00132     *_retval = -1;
00133     return NS_OK;
00134 }
00135 
00136 NS_IMETHODIMP nsRssService::GetCanGetMessages(PRBool *aCanGetMessages)
00137 {
00138     NS_ENSURE_ARG_POINTER(aCanGetMessages);
00139     *aCanGetMessages = PR_TRUE;
00140     return NS_OK;
00141 }
00142 
00143 NS_IMETHODIMP nsRssService::GetCanGetIncomingMessages(PRBool *aCanGetIncomingMessages)
00144 {
00145     NS_ENSURE_ARG_POINTER(aCanGetIncomingMessages);
00146     *aCanGetIncomingMessages = PR_TRUE;
00147     return NS_OK;
00148 }
00149 
00150 NS_IMETHODIMP nsRssService::GetDefaultDoBiff(PRBool *aDefaultDoBiff)
00151 {
00152     NS_ENSURE_ARG_POINTER(aDefaultDoBiff);
00153     // by default, do biff for RSS feeds
00154     *aDefaultDoBiff = PR_TRUE;    
00155     return NS_OK;
00156 }
00157 
00158 NS_IMETHODIMP nsRssService::GetShowComposeMsgLink(PRBool *aShowComposeMsgLink)
00159 {
00160     NS_ENSURE_ARG_POINTER(aShowComposeMsgLink);
00161     *aShowComposeMsgLink = PR_FALSE;    
00162     return NS_OK;
00163 }
00164 
00165 NS_IMETHODIMP nsRssService::GetNeedToBuildSpecialFolderURIs(PRBool *aNeedToBuildSpecialFolderURIs)
00166 {
00167     NS_ASSERTION(0,"foo");
00168     return NS_ERROR_NOT_IMPLEMENTED;
00169 }
00170 
00171 NS_IMETHODIMP nsRssService::GetSpecialFoldersDeletionAllowed(PRBool *aSpecialFoldersDeletionAllowed)
00172 {
00173     NS_ASSERTION(0,"foo");
00174     return NS_ERROR_NOT_IMPLEMENTED;
00175 }