diff modules/feed.js @ 260:f88055405aee

make all messages received in the same refresh have the same received datetime, and support multiple sort properties when sorting a collection
author Myk Melez <myk@mozilla.org>
date Mon, 25 Aug 2008 17:33:13 -0700
parents 842cc8be67d2
children 54b59324bd71
line wrap: on
line diff
--- a/modules/feed.js	Fri Aug 22 18:23:26 2008 -0700
+++ b/modules/feed.js	Mon Aug 25 17:33:13 2008 -0700
@@ -271,7 +271,7 @@
 
         messagesChanged = true;
         this._log.info(this.name + " adding message " + externalID);
-        internalID = this._addMessage(feed, entry, externalID);
+        internalID = this._addMessage(feed, entry, externalID, this.lastRefreshed);
         currentMessageIDs.push(internalID);
       }
 
@@ -299,8 +299,9 @@
    * @param aFeed         {nsIFeed}       the feed
    * @param aEntry        {nsIFeedEntry}  the entry
    * @param aExternalID   {string}        the external ID of the entry
+   * @param aReceived     {Date}          when the message was received
    */
-  _addMessage: function(aFeed, aEntry, aExternalID) {
+  _addMessage: function(aFeed, aEntry, aExternalID, aReceived) {
     let authorID = null;
     let authors = (aEntry.authors.length > 0) ? aEntry.authors
                   : (aFeed.authors.length > 0) ? aFeed.authors
@@ -335,7 +336,7 @@
     // FIXME: handle titles that contain markup or are missing.
     let messageID = this.addSimpleMessage(this.id, aExternalID,
                                           aEntry.title.text, authorID,
-                                          timestamp, aEntry.link);
+                                          timestamp, aReceived, aEntry.link);
 
     // Add parts
     if (aEntry.content) {
@@ -456,14 +457,14 @@
    * @returns {integer} the internal ID of the newly-created message
    */
   addSimpleMessage: function(aSourceID, aExternalID, aSubject, aAuthorID,
-                             aTimestamp, aLink) {
+                             aTimestamp, aReceived, aLink) {
     // Convert the link to its string spec, which is how we store it
     // in the datastore.
     let link = aLink ? aLink.spec : null;
 
     let messageID =
       SnowlDatastore.insertMessage(aSourceID, aExternalID, aSubject, aAuthorID,
-                                   aTimestamp, link);
+                                   aTimestamp, aReceived, link);
 
     return messageID;
   },