add importance property to sources

This commit is contained in:
Myk Melez 2008-05-14 12:49:22 -07:00
Родитель 01810a04a0
Коммит 38d5dafd19
3 изменённых файлов: 28 добавлений и 8 удалений

Просмотреть файл

@ -48,6 +48,7 @@ let SnowlDatastore = {
// FIXME: rename this "name"
"title TEXT NOT NULL",
"lastRefreshed INTEGER",
"importance INTEGER"
]
},
@ -118,10 +119,9 @@ let SnowlDatastore = {
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"].

Просмотреть файл

@ -80,7 +80,8 @@ SnowlMessage.prototype = {
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 @@ SnowlMessage.prototype = {
// 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");

Просмотреть файл

@ -5,15 +5,32 @@ const Ci = Components.interfaces;
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
};