incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhir...@apache.org
Subject svn commit: r960909 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala
Date Tue, 06 Jul 2010 15:02:21 GMT
Author: rhirsch
Date: Tue Jul  6 15:02:21 2010
New Revision: 960909

URL: http://svn.apache.org/viewvc?rev=960909&view=rev
Log:
[ESME-224] Feed Actor Date parser error
Patch by Imtiaz Ahmed Hajee Esmail 

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala?rev=960909&r1=960908&r2=960909&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala Tue
Jul  6 15:02:21 2010
@@ -35,7 +35,7 @@ object RssFeed {
 class RssFeed(user: User, rssURL: String, source: String, truncateChars: Int, tags: List[String])
   extends Feed(user, rssURL, source, truncateChars, tags) {
   import scala.xml._
-  
+
   override def dateFormats = RssFeed.dateFormats
   
   override def getEntries(xml: Elem) = xml \\ "item"
@@ -68,11 +68,12 @@ class RssFeed(user: User, rssURL: String
   }
   
   // need to compare by text since a pubDate is not mandatory and indeed, often is missing
+  /*
   override def getLastSortedMessages(msgs: List[Msg], lastMessage: Option[Msg]): List[Msg]
= {
     lastMessage match {
       case Some(message: Msg) =>
         // a hack to format text identically- difference in urls & trailing whitespace
-        val lastMessageText = 
+        val lastMessageText =
           Message.create.setTextAndTags(message.text, Nil, Empty).
             get.body.trim
         msgs.takeWhile{ msg =>
@@ -82,5 +83,24 @@ class RssFeed(user: User, rssURL: String
       case None => msgs
     }
   }.reverse
+  */
+
+  override def getLastSortedMessages(msgs: List[Msg], lastMessage: Option[Msg]): List[Msg]
= {
+    import net.liftweb.common.Box
+    lastMessage match {
+      case Some(message: Msg) =>
+        // a hack to format text identically- difference in urls & trailing whitespace
+        val lastMessageText =
+          Message.create.setTextAndTags(message.text, Nil, Empty).
+            choice((m: Message) => Box(m.body.trim))(Box("")).get
+            //get.body.trim
+        msgs.takeWhile{ msg =>
+          Message.create.setTextAndTags(msg.text, Nil, Empty).
+            choice((m: Message) => Box(m.body.trim))(Box("")).get != lastMessageText
+            //get.body.trim != lastMessageText
+        }
+      case None => msgs
+    }
+  }.reverse
 }
 



Mime
View raw message