mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
more work on rss extension, NPOB, 225158
This commit is contained in:
parent
6bf085d904
commit
52d462d2ab
@ -10,6 +10,7 @@ const SECONDS_TO_MILLISECONDS = 1000;
|
||||
const MINUTES_TO_MILLISECONDS = MINUTES_TO_SECONDS * SECONDS_TO_MILLISECONDS;
|
||||
const HOURS_TO_MILLISECONDS = HOURS_TO_MINUTES * MINUTES_TO_MILLISECONDS;
|
||||
|
||||
const MSG_FLAG_NEW = 0x10000;
|
||||
|
||||
function FeedItem() {
|
||||
// XXX Convert date to a consistent representation in a setter.
|
||||
@ -361,6 +362,7 @@ FeedItem.prototype.writeToFolder = function() {
|
||||
header.lineCount = this.content.match(/\r?\n?/g).length;
|
||||
header.messageOffset = key;
|
||||
header.statusOffset = openingLine.length;
|
||||
header.flags = MSG_FLAG_NEW;
|
||||
|
||||
db.AddNewHdrToDB(header, true);
|
||||
}
|
||||
|
@ -68,11 +68,7 @@ function onLoad() {
|
||||
|
||||
getAccount();
|
||||
ensureDatabasesAreReady();
|
||||
// Wait a few seconds to give the message databases time to populate themselves.
|
||||
// I'm sure there's a better way to determine when the databases are populated
|
||||
// than this hacky approach, but I don't know what it is.
|
||||
//downloadFeeds();
|
||||
window.setTimeout(downloadFeeds, ENSURANCE_DELAY);
|
||||
downloadFeeds();
|
||||
}
|
||||
|
||||
// Wait a few seconds before starting Forumzilla so we don't grab the UI thread
|
||||
@ -83,12 +79,7 @@ window.setTimeout(onLoad, gFzStartupDelay * 1000);
|
||||
|
||||
function downloadFeeds() {
|
||||
// Reload subscriptions every 30 minutes (XXX make this configurable via a pref).
|
||||
// XXX We call onLoad() instead of downloadFeeds() directly because onLoad calls
|
||||
// ensureDatabasesAreReady() and then delays calling downloadFeeds() for a few
|
||||
// seconds to make sure the header database is ready before we download feeds
|
||||
// and messages, which works around our duplicate message problem.
|
||||
//window.setTimeout(downloadFeeds, 30 * 60 * 1000);
|
||||
window.setTimeout(onLoad, 30 * 60 * 1000);
|
||||
window.setTimeout(downloadFeeds, 30 * 60 * 1000);
|
||||
|
||||
var ds = getSubscriptionsDS();
|
||||
var feeds = getSubscriptionsList().GetElements();
|
||||
|
@ -181,8 +181,13 @@ function doRemove() {
|
||||
// for other purposes?
|
||||
var server = getIncomingServer();
|
||||
var openerResource = server.rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var folderResource = server.rootMsgFolder.getChildNamed(title.Value).QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var foo = window.opener.messenger.DeleteFolders(window.opener.GetFolderDatasource(), openerResource, folderResource);
|
||||
var titleValue = title ? title.QueryInterface(Components.interfaces.nsIRDFLiteral).Value : "";
|
||||
var url = ds.GetTarget(resource, DC_IDENTIFIER, true);
|
||||
var feed = new Feed(url, null, titleValue);
|
||||
try {
|
||||
var folderResource = server.rootMsgFolder.getChildNamed(feed.name).QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var foo = window.opener.messenger.DeleteFolders(window.opener.GetFolderDatasource(), openerResource, folderResource);
|
||||
} catch (e) {}
|
||||
try {
|
||||
// If the folder still exists, then it wasn't deleted,
|
||||
// which means the user answered "no" to the question of whether
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?xml-stylesheet href="edittree.css" type="text/css"?>
|
||||
<!DOCTYPE dialog SYSTEM "chrome://messenger-newsblog/locale/newsblog.dtd">
|
||||
|
||||
<window id="subscriptionsDialog"
|
||||
title="News & Blog Feeds"
|
||||
title="newsBlogSubscriptions.label"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="400"
|
||||
height="400"
|
||||
|
@ -1,18 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE overlay SYSTEM "chrome://messenger-newsblog/locale/newsblog.dtd">
|
||||
|
||||
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
|
||||
<script type="application/x-javascript">
|
||||
function openSubscriptionsDialog() {
|
||||
window.openDialog("chrome://messenger-newsblog/content/subscriptions.xul",
|
||||
"News & Blogs",
|
||||
"",
|
||||
"centerscreen,resizable=yes");
|
||||
}
|
||||
</script>
|
||||
|
||||
<menupopup id="taskPopup">
|
||||
<menuitem id="newsAndBlogsCmd"
|
||||
label="News & Blogs Settings..."
|
||||
label="&newsBlogMenu.label;"
|
||||
insertbefore="menu_preferences"
|
||||
accesskey="e"
|
||||
oncommand="openSubscriptionsDialog();"/>
|
||||
|
@ -34,6 +34,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const kDebug = true;
|
||||
const MSG_FLAG_NEW = 0x10000;
|
||||
|
||||
var nsNewsBlogFeedDownloader =
|
||||
{
|
||||
@ -682,18 +683,18 @@ FeedItem.prototype.isStored = function() {
|
||||
}
|
||||
else {
|
||||
debug(this.identity + " not stored? let's check all headers");
|
||||
var foo = db.EnumerateMessages();
|
||||
var i=0;
|
||||
while (foo.hasMoreElements()) {
|
||||
++i;
|
||||
var bar = foo.getNext();
|
||||
bar = bar.QueryInterface(Components.interfaces.nsIMsgDBHdr);
|
||||
if (this.messageID == bar.messageId) {
|
||||
debug(this.identity + " stored (found it while checking all headers)");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
debug(this.identity + " not stored (checked " + i + " headers but couldn't find it)");
|
||||
// var foo = db.EnumerateMessages();
|
||||
// var i=0;
|
||||
// while (foo.hasMoreElements()) {
|
||||
// ++i;
|
||||
// var bar = foo.getNext();
|
||||
// bar = bar.QueryInterface(Components.interfaces.nsIMsgDBHdr);
|
||||
// if (this.messageID == bar.messageId) {
|
||||
// debug(this.identity + " stored (found it while checking all headers)");
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// debug(this.identity + " not stored (checked " + i + " headers but couldn't find it)");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -834,6 +835,7 @@ FeedItem.prototype.writeToFolder = function() {
|
||||
header.author = this.toUtf8(this.author);
|
||||
header.subject = this.toUtf8(this.title);
|
||||
header.messageId = this.messageID;
|
||||
header.flags = MSG_FLAG_NEW;
|
||||
header.messageSize = length;
|
||||
// Count the number of line break characters to determine the line count.
|
||||
header.lineCount = this.content.match(/\r?\n?/g).length;
|
||||
|
@ -1 +1,2 @@
|
||||
<!ENTITY newsBlogMenu.label "News & Blogs">
|
||||
<!ENTITY newsBlogMenu.label "Feeds...">
|
||||
<!ENTITY newsBlogSubscriptions.label "Feeds">
|
||||
|
Loading…
Reference in New Issue
Block a user