incubator-esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r753022 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala
Date Thu, 12 Mar 2009 21:20:49 GMT
Author: vdichev
Date: Thu Mar 12 21:20:46 2009
New Revision: 753022

URL: http://svn.apache.org/viewvc?rev=753022&view=rev
Log:
Twitter API: improved support for replies.

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala?rev=753022&r1=753021&r2=753022&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/TwitterAPI.scala Thu Mar
12 21:20:46 2009
@@ -119,9 +119,17 @@
     "source" -> msg.source,
     "truncated" -> false,
     "favorited" -> false,
-    "in_reply_to_status_id" -> None,
-    "in_reply_to_user_id" -> None,
-    "in_reply_to_screen_name" -> None
+    "in_reply_to_status_id" ->
+      Message.find(msg.conversation).
+        map(_.id.is).getOrElse(None),
+    "in_reply_to_user_id" ->
+      Message.find(msg.conversation).
+        map(_.author.is).getOrElse(None),
+    "in_reply_to_screen_name" ->
+      Message.find(msg.conversation).
+        map(msg => 
+            User.find(msg.author).get.nickname
+        ).getOrElse(None)
     )
   }
   
@@ -193,8 +201,18 @@
     calcUser map (userTimeline)
   }
   
+  def replies(user: User): TwitterResponse = {
+    val statusList = 
+      Message.findAll(By(Message.author, user),
+                      NotNullRef(Message.conversation),
+                      MaxRows(20),
+                      OrderBy(Message.id, Descending)).
+        map(msgData _)
+    Right(Map("statuses" -> ("status", statusList) ))
+  }
+  
   def replies(): Box[TwitterResponse] = {
-    userTimeline
+    calcUser map (replies)
   }
 
   def directMessages(): Box[TwitterResponse] = {



Mime
View raw message