home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / mozilla-thunderbird / components / newsblog.js < prev    next >
Encoding:
JavaScript  |  2005-08-23  |  21.3 KB  |  559 lines

  1. /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  * ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is the News&Blog Feed Downloader
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * The Mozilla Foundation.
  19.  * Portions created by the Initial Developer are Copyright (C) 2004
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *  Myk Melez <myk@mozilla.org) (Original Author)
  24.  *  David Bienvenu <bienvenu@nventure.com> 
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. var gExternalScriptsLoaded = false;
  41.  
  42. var nsNewsBlogFeedDownloader =
  43. {
  44.   downloadFeed: function(aUrl, aFolder, aQuickMode, aTitle, aUrlListener, aMsgWindow)
  45.   {
  46.     if (!gExternalScriptsLoaded)
  47.       loadScripts();
  48.  
  49.     // we don't yet support the ability to check for new articles while we are in the middle of 
  50.     // subscribing to a feed. For now, abort the check for new feeds. 
  51.     if (progressNotifier.mSubscribeMode)
  52.     {
  53.       debug('Aborting RSS New Mail Check. Feed subscription in progress\n');
  54.       return;
  55.     }
  56.     // if folder seems to have lost its feeds, look in DS for feeds.
  57.     if (!aUrl.length)
  58.     {
  59.       var ds = getSubscriptionsDS(aFolder.server);
  60.       var enumerator = ds.GetSources(FZ_DESTFOLDER, aFolder, true);
  61.       var concatenatedUris = "";
  62.       while (enumerator.hasMoreElements())
  63.       {
  64.         var containerArc = enumerator.getNext();
  65.         var uri = containerArc.QueryInterface(Components.interfaces.nsIRDFResource).Value;
  66.         if (concatenatedUris.length > 0)
  67.           concatenatedUris += "|";
  68.         concatenatedUris += uri;
  69.       }
  70.       if (concatenatedUris.length > 0)
  71.       {
  72.         aUrl = concatenatedUris;
  73.         try
  74.         {
  75.           var msgdb = aFolder.getMsgDatabase(null);
  76.           var folderInfo = msgdb.dBFolderInfo;
  77.           folderInfo.setCharPtrProperty("feedUrl", concatenatedUris);
  78.         }
  79.         catch (ex) {dump(ex);}
  80.       }
  81.     }
  82.     // aUrl may be a delimited list of feeds for a particular folder. We need to kick off a download
  83.     // for each feed.
  84.  
  85.     var feedUrlArray = aUrl.split("|");
  86.  
  87.     // we might just pull all these args out of the aFolder DB, instead of passing them in...
  88.     var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
  89.         .getService(Components.interfaces.nsIRDFService);
  90.  
  91.     progressNotifier.init(aMsgWindow, false);
  92.  
  93.     for (url in feedUrlArray)
  94.     {
  95.       if (feedUrlArray[url])
  96.       {        
  97.         id = rdf.GetResource(feedUrlArray[url]);
  98.         feed = new Feed(id, aFolder.server);
  99.         feed.folder = aFolder;
  100.         gNumPendingFeedDownloads++; // bump our pending feed download count
  101.         feed.download(true, progressNotifier);
  102.       }
  103.     }
  104.   },
  105.  
  106.   subscribeToFeed: function(aUrl, aFolder, aMsgWindow)
  107.   {
  108.     if (!gExternalScriptsLoaded)
  109.       loadScripts();
  110.  
  111.     // we don't support the ability to subscribe to several feeds at once yet...
  112.     // for now, abort the subscription if we are already in the middle of subscribing to a feed
  113.     // via drag and drop.
  114.     if (gNumPendingFeedDownloads)
  115.     {
  116.       debug('Aborting RSS subscription. Feed downloads already in progress\n');
  117.       return;
  118.     }
  119.  
  120.     // if aFolder is null, then use the root folder for the first RSS account
  121.     if (!aFolder)
  122.     {
  123.       var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"]
  124.                            .getService(Components.interfaces.nsIMsgAccountManager);
  125.       var allServers = accountManager.allServers;
  126.       for (var i=0; i< allServers.Count() && !aFolder; i++)
  127.       {
  128.         var currentServer = allServers.GetElementAt(i).QueryInterface(Components.interfaces.nsIMsgIncomingServer);
  129.         if (currentServer && currentServer.type == 'rss')
  130.           aFolder = currentServer.rootFolder;      
  131.       }
  132.     }
  133.  
  134.     // What do we do if the user hasn't created an RSS account yet? 
  135.     // for now, fall out, would be nice if we could force RSS account creation
  136.     if (!aFolder)
  137.       return;
  138.  
  139.     // if aUrl is a feed url, then it is of the form: feed:http://somesite/feed.xml or 
  140.     // feed://http://somesite/feed.xml
  141.     // Strip off the feed: part so we can subscribe to the contained URL.
  142.     if (/^feed:/i.test(aUrl))
  143.     {
  144.       aUrl = aUrl.replace(/^feed:/i, '');
  145.       // Strip off the optional forward slashes if we were given feed://
  146.       aUrl = aUrl.replace(/^\x2f\x2f/, '');
  147.     }
  148.  
  149.     // make sure we aren't already subscribed to this feed before we attempt to subscribe to it.
  150.     if (feedAlreadyExists(aUrl, aFolder.server))
  151.     {
  152.       aMsgWindow.statusFeedback.showStatusString(GetNewsBlogStringBundle().GetStringFromName('subscribe-feedAlreadySubscribed'));     
  153.       return;
  154.     }
  155.  
  156.     var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
  157.               .getService(Components.interfaces.nsIRDFService);
  158.     
  159.     var itemResource = rdf.GetResource(aUrl);
  160.     var feed = new Feed(itemResource, aFolder.server);
  161.     feed.quickMode = feed.server.getBoolAttribute('quickMode');
  162.  
  163.     if (!aFolder.isServer) // if the root server, create a new folder for the feed
  164.       feed.folder = aFolder; // user must want us to add this subscription url to an existing RSS folder.
  165.  
  166.     progressNotifier.init(aMsgWindow, true);
  167.     gNumPendingFeedDownloads++;
  168.     feed.download(true, progressNotifier);
  169.   },
  170.  
  171.   updateSubscriptionsDS: function(aFolder, aUnsubscribe)
  172.   {
  173.     if (!gExternalScriptsLoaded)
  174.       loadScripts();
  175.  
  176.     // an rss folder was just renamed...we need to update our feed data source
  177.     var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder).getMsgDatabase(null);
  178.     var folderInfo = msgdb.dBFolderInfo;
  179.     var feedurls = folderInfo.getCharPtrProperty("feedUrl");
  180.     var feedUrlArray = feedurls.split("|");
  181.  
  182.     var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
  183.     var ds = getSubscriptionsDS(aFolder.server);
  184.  
  185.     for (url in feedUrlArray)
  186.     {
  187.       if (feedUrlArray[url])
  188.       {        
  189.         id = rdf.GetResource(feedUrlArray[url]);
  190.         // get the node for the current folder URI
  191.         var node = ds.GetTarget(id, FZ_DESTFOLDER, true);
  192.  
  193.         // we need to check and see if the folder is a child of the trash...if it is, then we can
  194.         // treat this as an unsubscribe action
  195.         if (aUnsubscribe)
  196.         {
  197.           var feeds = getSubscriptionsList(aFolder.server);
  198.           var index = feeds.IndexOf(id);
  199.           if (index != -1)
  200.             feeds.RemoveElementAt(index, false);
  201.           removeAssertions(ds, id);
  202.         }  
  203.         else
  204.           ds.Change(id, FZ_DESTFOLDER, node, rdf.GetResource(aFolder.URI));
  205.       }
  206.     } // for each feed url in the folder property
  207.  
  208.     ds.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush(); // flush any changes
  209.   },
  210.  
  211.   QueryInterface: function(aIID)
  212.   {
  213.     if (aIID.equals(Components.interfaces.nsINewsBlogFeedDownloader) ||
  214.         aIID.equals(Components.interfaces.nsISupports))
  215.       return this;
  216.  
  217.     Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
  218.     return null;
  219.   }
  220. }
  221.  
  222. var nsNewsBlogAcctMgrExtension = 
  223.   name: "newsblog",
  224.   chromePackageName: "messenger-newsblog",
  225.   showPanel: function (server)
  226.   {
  227.     return server.type == "rss";
  228.   },
  229.   QueryInterface: function(aIID)
  230.   {
  231.     if (aIID.equals(Components.interfaces.nsIMsgAccountManagerExtension) ||
  232.         aIID.equals(Components.interfaces.nsISupports))
  233.       return this;
  234.  
  235.     Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
  236.     return null;
  237.   }  
  238. }
  239.  
  240. var nsFeedCommandLineHandler = 
  241. {
  242.   /* nsISupports */
  243.   QueryInterface : function(aIID) 
  244.   {
  245.     if (!aIID.equals(Components.interfaces.nsISupports) &&
  246.         !aIID.equals(Components.interfaces.nsICommandLineHandler))
  247.       throw Components.errors.NS_ERROR_NO_INTERFACE;
  248.     return this;
  249.   },
  250.  
  251.   /* nsICommandLineHandler */
  252.   handle : function(cmdLine) 
  253.   {
  254.     // we only care about "-mail someurl" where someurl is a feed: url
  255.     // we also don't want to remove the parameter in case we don't end up handling it...
  256.  
  257.     var mailPos = cmdLine.findFlag("mail", false);
  258.     if (mailPos != -1 && cmdLine.length >= mailPos )
  259.     { 
  260.       var uriStr = cmdLine.getArgument(mailPos + 1);
  261.       if (/^feed:/i.test(uriStr))
  262.       {
  263.         var mailWindow = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService()
  264.                          .QueryInterface(Components.interfaces.nsIWindowMediator).getMostRecentWindow("mail:3pane");
  265.                  
  266.         // if we don't have a 3 pane window visible already, then we can optimize and do nothing here,
  267.         // that will let the default command line handler create a 3pane window for us using the feed
  268.         // URL as an argument to that window when it gets constructed...so we only care about the
  269.         // case where we want to re-use an existing 3 pane to subscribe to the feed url
  270.         if (mailWindow)
  271.         {
  272.           cmdLine.handleFlagWithParam("mail", false); // eat up the arguments we are now handling
  273.           cmdLine.preventDefault = true; // prevent the default cmd line handler from doing anything
  274.  
  275.           var feedHandler = Components.classes["@mozilla.org/newsblog-feed-downloader;1"].getService(Components.interfaces.nsINewsBlogFeedDownloader);
  276.           if (feedHandler)
  277.             feedHandler.subscribeToFeed(uriStr, null, mailWindow.msgWindow);
  278.         }        
  279.       }
  280.     }
  281.   },
  282.  
  283.   helpInfo : ""
  284. };
  285.  
  286. var nsNewsBlogFeedDownloaderModule =
  287. {
  288.   getClassObject: function(aCompMgr, aCID, aIID)
  289.   {
  290.     if (!aIID.equals(Components.interfaces.nsIFactory))
  291.       throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  292.  
  293.     for (var key in this.mObjects) 
  294.       if (aCID.equals(this.mObjects[key].CID))
  295.         return this.mObjects[key].factory;
  296.  
  297.     throw Components.results.NS_ERROR_NO_INTERFACE;
  298.   },
  299.  
  300.   mObjects: 
  301.   {
  302.     feedDownloader: 
  303.     { 
  304.       CID: Components.ID("{5c124537-adca-4456-b2b5-641ab687d1f6}"),
  305.       contractID: "@mozilla.org/newsblog-feed-downloader;1",
  306.       className: "News+Blog Feed Downloader",
  307.       factory: 
  308.       {
  309.         createInstance: function (aOuter, aIID) 
  310.         {
  311.           if (aOuter != null)
  312.             throw Components.results.NS_ERROR_NO_AGGREGATION;
  313.           if (!aIID.equals(Components.interfaces.nsINewsBlogFeedDownloader) &&
  314.               !aIID.equals(Components.interfaces.nsISupports))
  315.             throw Components.results.NS_ERROR_INVALID_ARG;
  316.  
  317.           // return the singleton
  318.           return nsNewsBlogFeedDownloader.QueryInterface(aIID);
  319.         }       
  320.       } // factory
  321.     }, // feed downloader
  322.     
  323.     nsNewsBlogAcctMgrExtension: 
  324.     { 
  325.       CID: Components.ID("{E109C05F-D304-4ca5-8C44-6DE1BFAF1F74}"),
  326.       contractID: "@mozilla.org/accountmanager/extension;1?name=newsblog",
  327.       className: "News+Blog Account Manager Extension",
  328.       factory: 
  329.       {
  330.         createInstance: function (aOuter, aIID) 
  331.         {
  332.           if (aOuter != null)
  333.             throw Components.results.NS_ERROR_NO_AGGREGATION;
  334.           if (!aIID.equals(Components.interfaces.nsIMsgAccountManagerExtension) &&
  335.               !aIID.equals(Components.interfaces.nsISupports))
  336.             throw Components.results.NS_ERROR_INVALID_ARG;
  337.  
  338.           // return the singleton
  339.           return nsNewsBlogAcctMgrExtension.QueryInterface(aIID);
  340.         }       
  341.       } // factory
  342.     }, // account manager extension
  343.  
  344.     nsFeedCommandLineHandler: 
  345.     {
  346.       CID: Components.ID("{0E377BF7-E4FE-4c94-804C-0C33D49F883E}"),
  347.       contractID: "@mozilla.org/newsblog-feed-downloader/clh;1",
  348.       className: "Feed CommandLine Handler",
  349.       factory: 
  350.       {
  351.         createInstance: function (aOuter, aIID) 
  352.         {
  353.           if (aOuter != null)
  354.             throw Components.results.NS_ERROR_NO_AGGREGATION;
  355.           if (!aIID.equals(Components.interfaces.nsICommandLineHandler) &&
  356.               !aIID.equals(Components.interfaces.nsISupports))
  357.             throw Components.results.NS_ERROR_INVALID_ARG;
  358.  
  359.           // return the singleton
  360.           return nsFeedCommandLineHandler.QueryInterface(aIID);
  361.         }       
  362.       } // factory
  363.     }
  364.   },
  365.  
  366.   registerSelf: function(aCompMgr, aFileSpec, aLocation, aType)
  367.   {        
  368.     aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
  369.     for (var key in this.mObjects) 
  370.     {
  371.       var obj = this.mObjects[key];
  372.       aCompMgr.registerFactoryLocation(obj.CID, obj.className, obj.contractID, aFileSpec, aLocation, aType);
  373.     }
  374.  
  375.     // we also need to do special account extension registration
  376.     var catman = Components.classes["@mozilla.org/categorymanager;1"].getService(Components.interfaces.nsICategoryManager);
  377.     catman.addCategoryEntry("mailnews-accountmanager-extensions",
  378.                             "newsblog account manager extension",
  379.                             "@mozilla.org/accountmanager/extension;1?name=newsblog", true, true);
  380.     catman.addCategoryEntry("command-line-handler",
  381.                             "l-feed",
  382.                             "@mozilla.org/newsblog-feed-downloader/clh;1", true, true);
  383.   },
  384.  
  385.   unregisterSelf: function(aCompMgr, aFileSpec, aLocation)
  386.   {
  387.     aCompMgr = aCompMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
  388.     for (var key in this.mObjects) 
  389.     {
  390.       var obj = this.mObjects[key];
  391.       aCompMgr.unregisterFactoryLocation(obj.CID, aFileSpec);
  392.     }
  393.  
  394.     // unregister the account manager extension
  395.     catman = Components.classes["@mozilla.org/categorymanager;1"].getService(Components.interfaces.nsICategoryManager);
  396.     catman.deleteCategoryEntry("mailnews-accountmanager-extensions",
  397.                                "@mozilla.org/accountmanager/extension;1?name=newsblog", true);
  398.     catMan.addCategoryEntry("command-line-handler",
  399.                             "@mozilla.org/newsblog-feed-downloader/clh;1", true);
  400.   },
  401.  
  402.   canUnload: function(aCompMgr)
  403.   {
  404.     return true;
  405.   }
  406. };
  407.  
  408. function NSGetModule(aCompMgr, aFileSpec)
  409. {
  410.   return nsNewsBlogFeedDownloaderModule;
  411. }
  412.  
  413. function loadScripts()
  414. {
  415.   var scriptLoader =  Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
  416.                      .getService(Components.interfaces.mozIJSSubScriptLoader);
  417.   if (scriptLoader)
  418.   { 
  419.     scriptLoader.loadSubScript("chrome://messenger-newsblog/content/Feed.js");
  420.     scriptLoader.loadSubScript("chrome://messenger-newsblog/content/FeedItem.js");
  421.     scriptLoader.loadSubScript("chrome://messenger-newsblog/content/feed-parser.js");
  422.     scriptLoader.loadSubScript("chrome://messenger-newsblog/content/file-utils.js");
  423.     scriptLoader.loadSubScript("chrome://messenger-newsblog/content/utils.js");
  424.   }
  425.  
  426.   gExternalScriptsLoaded = true;
  427. }
  428.  
  429. // Progress glue code. Acts as a go between the RSS back end and the mail window front end
  430. // determined by the aMsgWindow parameter passed into nsINewsBlogFeedDownloader.
  431. // gNumPendingFeedDownloads: keeps track of the total number of feeds we have been asked to download
  432. //                           this number may not reflect the # of entries in our mFeeds array because not all
  433. //                           feeds may have reported in for the first time...
  434. var gNumPendingFeedDownloads = 0;
  435.  
  436. var progressNotifier = {
  437.   mSubscribeMode: false,
  438.   mMsgWindow: null, 
  439.   mStatusFeedback: null,
  440.   mFeeds: new Array,
  441.  
  442.   init: function(aMsgWindow, aSubscribeMode)
  443.   {
  444.     if (!gNumPendingFeedDownloads) // if we aren't already in the middle of downloading feed items...
  445.     {
  446.       this.mStatusFeedback = aMsgWindow ? aMsgWindow.statusFeedback : null;
  447.       this.mSubscribeMode = aSubscribeMode;
  448.       this.mMsgWindow = aMsgWindow;
  449.  
  450.       if (this.mStatusFeedback)
  451.       {
  452.         this.mStatusFeedback.startMeteors();
  453.         this.mStatusFeedback.showStatusString(aSubscribeMode ? GetNewsBlogStringBundle().GetStringFromName('subscribe-validating') 
  454.                                             : GetNewsBlogStringBundle().GetStringFromName('newsblog-getNewMailCheck'));
  455.       }
  456.     }
  457.   },
  458.  
  459.   downloaded: function(feed, aErrorCode)
  460.   {
  461.     if (this.mSubscribeMode && aErrorCode == kNewsBlogSuccess)
  462.     {
  463.       // if we get here...we should always have a folder by now...either
  464.       // in feed.folder or FeedItems created the folder for us....
  465.       updateFolderFeedUrl(feed.folder, feed.url, false);        
  466.       addFeed(feed.url, feed.name, feed.folder); // add feed just adds the feed to the subscription UI and flushes the datasource
  467.       
  468.       // Nice touch: select the folder that now contains the newly subscribed feed...this is particularly nice 
  469.       // if we just finished subscribing to a feed URL that the operating system gave us.
  470.       this.mMsgWindow.SelectFolder(feed.folder.URI);
  471.     } 
  472.  
  473.     if (this.mStatusFeedback)
  474.     {
  475.       var newsBlogBundle = GetNewsBlogStringBundle();
  476.       if (aErrorCode == kNewsBlogNoNewItems)
  477.         this.mStatusFeedback.showStatusString(newsBlogBundle.GetStringFromName("newsblog-noNewArticlesForFeed"));
  478.       else if (aErrorCode == kNewsBlogInvalidFeed)
  479.         this.mStatusFeedback.showStatusString(newsBlogBundle.formatStringFromName("newsblog-invalidFeed",
  480.                                               [feed.url], 1));
  481.       else if (aErrorCode == kNewsBlogRequestFailure)
  482.         this.mStatusFeedback.showStatusString(newsBlogBundle.formatStringFromName("newsblog-networkError",
  483.                                               [feed.url], 1));                                           
  484.       this.mStatusFeedback.stopMeteors();
  485.     }
  486.  
  487.     gNumPendingFeedDownloads--;
  488.  
  489.     if (!gNumPendingFeedDownloads)
  490.     {
  491.       this.mFeeds = new Array;
  492.  
  493.       this.mSubscribeMode = false;
  494.  
  495.       // should we do this on a timer so the text sticks around for a little while? 
  496.       // It doesnt look like we do it on a timer for newsgroups so we'll follow that model.
  497.       if (aErrorCode == kNewsBlogSuccess && this.mStatusFeedback) // don't clear the status text if we just dumped an error to the status bar!
  498.         this.mStatusFeedback.showStatusString("");
  499.     }
  500.   },
  501.  
  502.   // this gets called after the RSS parser finishes storing a feed item to disk
  503.   // aCurrentFeedItems is an integer corresponding to how many feed items have been downloaded so far
  504.   // aMaxFeedItems is an integer corresponding to the total number of feed items to download
  505.   onFeedItemStored: function (feed, aCurrentFeedItems, aMaxFeedItems)
  506.   { 
  507.     // we currently don't do anything here. Eventually we may add
  508.     // status text about the number of new feed articles received.
  509.  
  510.     if (this.mSubscribeMode && this.mStatusFeedback) // if we are subscribing to a feed, show feed download progress
  511.     {
  512.       this.mStatusFeedback.showStatusString(GetNewsBlogStringBundle().formatStringFromName("subscribe-fetchingFeedItems", [aCurrentFeedItems, aMaxFeedItems], 2));
  513.       this.onProgress(feed, aCurrentFeedItems, aMaxFeedItems);
  514.     }
  515.   },
  516.  
  517.   onProgress: function(feed, aProgress, aProgressMax)
  518.   {
  519.     if (feed.url in this.mFeeds) // have we already seen this feed?
  520.       this.mFeeds[feed.url].currentProgress = aProgress;
  521.     else
  522.       this.mFeeds[feed.url] = {currentProgress: aProgress, maxProgress: aProgressMax};
  523.     
  524.     this.updateProgressBar();     
  525.   },
  526.  
  527.   updateProgressBar: function()
  528.   {
  529.     var currentProgress = 0;
  530.     var maxProgress = 0;
  531.     for (index in this.mFeeds)
  532.     {
  533.       currentProgress += this.mFeeds[index].currentProgress;
  534.       maxProgress += this.mFeeds[index].maxProgress;
  535.     }
  536.  
  537.     // if we start seeing weird "jumping" behavior where the progress bar goes below a threshold then above it again,
  538.     // then we can factor a fudge factor here based on the number of feeds that have not reported yet and the avg
  539.     // progress we've already received for existing feeds. Fortunately the progressmeter is on a timer
  540.     // and only updates every so often. For the most part all of our request have initial progress
  541.     // before the UI actually picks up a progress value. 
  542.  
  543.     if (this.mStatusFeedback)
  544.     {
  545.       var progress = (currentProgress * 100) / maxProgress;
  546.       this.mStatusFeedback.showProgress(progress);
  547.     }
  548.   }
  549. }
  550.  
  551. function GetNewsBlogStringBundle(name)
  552. {
  553.   var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(); 
  554.   strBundleService = strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService);
  555.   var strBundle = strBundleService.createBundle("chrome://messenger-newsblog/locale/newsblog.properties"); 
  556.   return strBundle;
  557. }
  558.