Mercurial > snowl
changeset 74:09357a9bfca8
add importance property to sources
author | Myk Melez <myk@mozilla.org> |
---|---|
date | Wed, 14 May 2008 12:49:22 -0700 |
parents | eb15f69eb7da |
children | 877a7694445f |
files | extension/modules/datastore.js extension/modules/message.js extension/modules/source.js |
diffstat | 3 files changed, 28 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/extension/modules/datastore.js Tue May 13 19:04:14 2008 -0700 +++ b/extension/modules/datastore.js Wed May 14 12:49:22 2008 -0700 @@ -48,6 +48,7 @@ // FIXME: rename this "name" "title TEXT NOT NULL", "lastRefreshed INTEGER", + "importance INTEGER" ] }, @@ -118,10 +119,9 @@ var statement = this.dbConnection.createStatement(aSQLString); } catch(ex) { - Cu.reportError("error creating statement " + aSQLString + ": " + - this.dbConnection.lastError + " - " + - this.dbConnection.lastErrorString); - throw ex; + throw("error creating statement " + aSQLString + " - " + + this.dbConnection.lastError + ": " + + this.dbConnection.lastErrorString + " - " + ex); } var wrappedStatement = Cc["@mozilla.org/storage/statement-wrapper;1"].
--- a/extension/modules/message.js Tue May 13 19:04:14 2008 -0700 +++ b/extension/modules/message.js Wed May 14 12:49:22 2008 -0700 @@ -80,7 +80,8 @@ get _sourceStatement() { let statement = SnowlDatastore.createStatement( - "SELECT sources.id, sources.url, sources.title " + + "SELECT sources.id, sources.url, sources.title, sources.lastRefreshed, " + + "sources.importance " + "FROM messages JOIN sources ON messages.sourceID = sources.id " + "WHERE messages.id = :messageID" ); @@ -100,7 +101,9 @@ // for every message. this._source = new SnowlSource(this._sourceStatement.row.id, this._sourceStatement.row.url, - this._sourceStatement.row.title); + this._sourceStatement.row.title, + new Date(this._sourceStatement.row.lastRefreshed), + this._sourceStatement.row.importance); } catch(ex) { dump(ex + "\n");
--- a/extension/modules/source.js Tue May 13 19:04:14 2008 -0700 +++ b/extension/modules/source.js Wed May 14 12:49:22 2008 -0700 @@ -5,15 +5,32 @@ const Cr = Components.results; const Cu = Components.utils; -function SnowlSource(aID, aURL, aTitle) { +function SnowlSource(aID, aURL, aTitle, aLastRefreshed, aImportance) { this.id = aID; this.url = aURL; this.title = aTitle; + this.lastRefreshed = aLastRefreshed; + this.importance = aImportance; } SnowlSource.prototype = { id: null, + // FIXME: make this an nsIURI. + // FIXME: differentiate between the machine representation of the source + // (the RSS/Atom feed file, the IMAP/POP server) and its human representation + // (the website publishing the feed, the web interface to the mail server) + // by providing two URLs, one for each representation. url: null, - title: null + + // FIXME: rename this property to name. + title: null, + + // A JavaScript Date object representing the last time this source was + // checked for updates to its set of messages. + lastRefreshed: null, + + // An integer representing how important this source is to the user + // relative to other sources to which the user is subscribed. + importance: null };