From e7d0e02634cb6a2aa912c702b1c618910ae9312b Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Thu, 22 Jul 2004 23:29:36 +0000 Subject: [PATCH] Bug #252688 --> Move feeds.rdf and feeditems.rdf into the RSS account directory. Any time we try to fetch one of the data sources, we have to passing the incoming server for those data sources. Minor improvements to the RSS account settings panel, allow the user to change the name of the RSS server in the folder pane. Allow the user to reach the subscriptions dialog from the account settings panel. Make the feed parser clear out the xml http request after it is done with it to eliminate some weird shut down errors. --- mail/extensions/newsblog/content/Feed.js | 19 +++--- mail/extensions/newsblog/content/FeedItem.js | 6 +- .../newsblog/content/am-newsblog.js | 22 +++++++ .../newsblog/content/am-newsblog.xul | 28 +++++++-- .../newsblog/content/subscriptions.js | 20 +++--- mail/extensions/newsblog/content/utils.js | 63 +++++-------------- .../newsblog/locale/am-newsblog.dtd | 5 +- 7 files changed, 86 insertions(+), 77 deletions(-) diff --git a/mail/extensions/newsblog/content/Feed.js b/mail/extensions/newsblog/content/Feed.js index 95c723c63235..57e9f08a929b 100755 --- a/mail/extensions/newsblog/content/Feed.js +++ b/mail/extensions/newsblog/content/Feed.js @@ -70,7 +70,6 @@ Feed.prototype.download = function(parseItems, aCallback) { this.downloadCallback = aCallback; // may be null - // var loadgroup = this.request.channel.loadgroup; this.request.overrideMimeType("text/xml"); this.request.onload = Feed.onDownloaded; this.request.onerror = Feed.onDownloadError; @@ -115,7 +114,7 @@ Feed.onDownloadError = function(event) { } Feed.prototype.url getter = function() { - var ds = getSubscriptionsDS(); + var ds = getSubscriptionsDS(this.server); var url = ds.GetTarget(this.resource, DC_IDENTIFIER, true); if (url) url = url.QueryInterface(Components.interfaces.nsIRDFLiteral).Value; @@ -125,7 +124,7 @@ Feed.prototype.url getter = function() { } Feed.prototype.title getter = function() { - var ds = getSubscriptionsDS(); + var ds = getSubscriptionsDS(this.server); var title = ds.GetTarget(this.resource, DC_TITLE, true); if (title) title = title.QueryInterface(Components.interfaces.nsIRDFLiteral).Value; @@ -133,7 +132,7 @@ Feed.prototype.title getter = function() { } Feed.prototype.title setter = function(new_title) { - var ds = getSubscriptionsDS(); + var ds = getSubscriptionsDS(this.server); new_title = rdf.GetLiteral(new_title || ""); var old_title = ds.GetTarget(this.resource, DC_TITLE, true); if (old_title) @@ -143,7 +142,7 @@ Feed.prototype.title setter = function(new_title) { } Feed.prototype.quickMode getter = function() { - var ds = getSubscriptionsDS(); + var ds = getSubscriptionsDS(this.server); var quickMode = ds.GetTarget(this.resource, FZ_QUICKMODE, true); if (quickMode) { quickMode = quickMode.QueryInterface(Components.interfaces.nsIRDFLiteral); @@ -186,7 +185,7 @@ Feed.prototype.parse = function() { debug(this.url + " is of unknown format; assuming an RSS 0.9x feed"); this.parseAsRSS2(); } - var ds = getItemsDS(); + var ds = getItemsDS(this.server); ds = ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); ds.Flush(); } @@ -409,7 +408,7 @@ Feed.prototype.parseAsAtom = function() { } Feed.prototype.invalidateItems = function invalidateItems() { - var ds = getItemsDS(); + var ds = getItemsDS(this.server); debug("invalidating items for " + this.url); var items = ds.GetSources(FZ_FEED, this.resource, true); var item; @@ -424,7 +423,7 @@ Feed.prototype.invalidateItems = function invalidateItems() { } Feed.prototype.removeInvalidItems = function() { - var ds = getItemsDS(); + var ds = getItemsDS(this.server); debug("removing invalid items for " + this.url); var items = ds.GetSources(FZ_FEED, this.resource, true); var item; @@ -475,9 +474,13 @@ function storeNextItem() else { item.feed.removeInvalidItems(); + if (item.feed.downloadCallback) item.feed.downloadCallback.downloaded(item.feed); + item.feed.request = null; // force the xml http request to go away. This helps reduce some + // nasty assertions on shut down of all things. + gItemsToStore = ""; gItemsToStoreIndex = 0; } diff --git a/mail/extensions/newsblog/content/FeedItem.js b/mail/extensions/newsblog/content/FeedItem.js index fed6e051540b..1e8b3ec0093c 100755 --- a/mail/extensions/newsblog/content/FeedItem.js +++ b/mail/extensions/newsblog/content/FeedItem.js @@ -185,7 +185,7 @@ FeedItem.prototype.isStored = function() { return false; } - var ds = getItemsDS(); + var ds = getItemsDS(server); var itemResource = rdf.GetResource(this.url || ("urn:" + this.id)); var downloaded = ds.GetTarget(itemResource, FZ_STORED, true); if (!downloaded || downloaded.QueryInterface(Components.interfaces.nsIRDFLiteral).Value == "false") @@ -204,7 +204,7 @@ FeedItem.prototype.isStored = function() { FeedItem.prototype.markValid = function() { debug("validating " + this.url); - var ds = getItemsDS(); + var ds = getItemsDS(this.feed.server); var resource = rdf.GetResource(this.url || ("urn:" + this.id)); if (!ds.HasAssertion(resource, FZ_FEED, rdf.GetResource(this.feed.url), true)) @@ -221,7 +221,7 @@ FeedItem.prototype.markValid = function() { FeedItem.prototype.markStored = function() { - var ds = getItemsDS(); + var ds = getItemsDS(this.feed.server); var resource = rdf.GetResource(this.url || ("urn:" + this.id)); if (!ds.HasAssertion(resource, FZ_FEED, rdf.GetResource(this.feed.url), true)) diff --git a/mail/extensions/newsblog/content/am-newsblog.js b/mail/extensions/newsblog/content/am-newsblog.js index aa05c04a245e..6d2da116f2b2 100644 --- a/mail/extensions/newsblog/content/am-newsblog.js +++ b/mail/extensions/newsblog/content/am-newsblog.js @@ -29,7 +29,29 @@ # the terms of any one of the MPL, the GPL or the LGPL. # ***** END LICENSE BLOCK ***** +var gIncomingServer; + function onInit() { // nothing to do here yet... } + +function onPreInit(account, accountValues) +{ + gIncomingServer = account.incomingServer; +} + +function manageSubscriptions() +{ + // XXX: This code should be shared with the JS in toolbar-icon.xul + const kWindowMediatorContractID = "@mozilla.org/appshell/window-mediator;1"; + const kWindowMediatorIID = Components.interfaces.nsIWindowMediator; + const kWindowMediator = Components.classes[kWindowMediatorContractID].getService(kWindowMediatorIID); + var lastSubscriptionWindow = kWindowMediator.getMostRecentWindow("Mail:News-BlogSubscriptions"); + + if (lastSubscriptionWindow) + lastSubscriptionWindow.focus(); + else + window.openDialog("chrome://messenger-newsblog/content/subscriptions.xul", "", + "centerscreen,resizable=yes", { server: gIncomingServer}); +} \ No newline at end of file diff --git a/mail/extensions/newsblog/content/am-newsblog.xul b/mail/extensions/newsblog/content/am-newsblog.xul index 9bb2250f2f11..1128614a83f9 100644 --- a/mail/extensions/newsblog/content/am-newsblog.xul +++ b/mail/extensions/newsblog/content/am-newsblog.xul @@ -31,7 +31,12 @@ - + +%newsblogDTD; + +%accountNoIdentDTD; +]> - - + + + + + + - + prefstring="mail.server.%serverkey%.login_at_startup"/> + + + +