mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
Bug #2522688 --> Add rss incoming server attributes for fetching the location of the feed and feed item
data sources for thunderbird. sr=bienvenu
This commit is contained in:
parent
7481f1497b
commit
9962db3236
@ -36,7 +36,13 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsILocalFile;
|
||||
|
||||
[scriptable, uuid(6d744e7f-2218-45c6-8734-998a56cb3c6d)]
|
||||
interface nsIRssIncomingServer : nsISupports {
|
||||
};
|
||||
// Path to the subscriptions data source for this RSS server
|
||||
readonly attribute nsILocalFile subscriptionsDataSourcePath;
|
||||
|
||||
// Path to the feed items data source for this RSS server
|
||||
readonly attribute nsILocalFile feedItemsDataSourcePath;
|
||||
};
|
||||
|
@ -211,6 +211,11 @@ nsShouldIgnoreFile(nsString& name)
|
||||
nsStringEndsWith(name, ".toc"))
|
||||
return PR_TRUE;
|
||||
|
||||
// ignore RSS data source files
|
||||
if (name.LowerCaseEqualsLiteral("feeds.rdf") ||
|
||||
name.LowerCaseEqualsLiteral("feeditems.rdf"))
|
||||
return PR_TRUE;
|
||||
|
||||
return (nsStringEndsWith(name,".sbd") || nsStringEndsWith(name,".msf"));
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,38 @@ nsRssIncomingServer::~nsRssIncomingServer()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsRssIncomingServer::FillInDataSourcePath(const nsAString& aDataSourceName, nsILocalFile ** aLocation)
|
||||
{
|
||||
nsresult rv;
|
||||
// start by gettting the local path for this server
|
||||
nsCOMPtr<nsIFileSpec> localPathForServer;
|
||||
rv = GetLocalPath(getter_AddRefs(localPathForServer));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// convert to a nsIFile
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
nsFileSpec pathSpec;
|
||||
localPathForServer->GetFileSpec(&pathSpec);
|
||||
rv = NS_FileSpecToIFile(&pathSpec, getter_AddRefs(localFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// now append the name of the subscriptions data source
|
||||
rv = localFile->Append(aDataSourceName);
|
||||
NS_IF_ADDREF(*aLocation = localFile);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// nsIRSSIncomingServer methods
|
||||
NS_IMETHODIMP nsRssIncomingServer::GetSubscriptionsDataSourcePath(nsILocalFile ** aLocation)
|
||||
{
|
||||
return FillInDataSourcePath(NS_LITERAL_STRING("feeds.rdf"), aLocation);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRssIncomingServer::GetFeedItemsDataSourcePath(nsILocalFile ** aLocation)
|
||||
{
|
||||
return FillInDataSourcePath(NS_LITERAL_STRING("feeditems.rdf"), aLocation);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRssIncomingServer::CreateDefaultMailboxes(nsIFileSpec *path)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(path);
|
||||
@ -133,9 +165,9 @@ NS_IMETHODIMP nsRssIncomingServer::GetNewMail(nsIMsgWindow *aMsgWindow, nsIUrlLi
|
||||
|
||||
// before we even try to get New Mail, check to see if the passed in folder was the root folder.
|
||||
// If it was, then call PerformBiff which will properly walk through each RSS folder, asking it to check for new Mail.
|
||||
nsCOMPtr<nsIMsgFolder> rootRSSFolder;
|
||||
GetRootMsgFolder(getter_AddRefs(rootRSSFolder));
|
||||
if (rootRSSFolder == aFolder) // pointing to the same folder?
|
||||
PRBool rootFolder = PR_FALSE;
|
||||
aFolder->GetIsServer(&rootFolder);
|
||||
if (rootFolder)
|
||||
return PerformBiff(aMsgWindow);
|
||||
|
||||
PRBool valid = PR_FALSE;
|
||||
|
@ -60,7 +60,8 @@ public:
|
||||
|
||||
nsRssIncomingServer();
|
||||
virtual ~nsRssIncomingServer();
|
||||
|
||||
protected:
|
||||
nsresult FillInDataSourcePath(const nsAString& aDataSourceName, nsILocalFile ** aLocation);
|
||||
};
|
||||
|
||||
#endif /* __nsRssIncomingServer_h */
|
||||
|
Loading…
x
Reference in New Issue
Block a user