OSDN Git Service

scrub_geoに対応
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Thu, 9 Jun 2011 18:22:23 +0000 (03:22 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:19:39 +0000 (23:19 +0900)
Tween/StatusDictionary.vb
Tween/Twitter.vb

index 0a472e4..8d94137 100644 (file)
@@ -480,6 +480,12 @@ Public NotInheritable Class TabInformations
     Private _deletedIds As New List(Of Long)
     Private _retweets As New Dictionary(Of Long, PostClass)
     Private _removedTab As New Stack(Of TabClass)
+    Private _scrubGeo As New List(Of ScrubGeoInfo)
+
+    Private Class ScrubGeoInfo
+        Public UserId As Long
+        Public UpToStatusId As Long
+    End Class
 
     Public BlockIds As New List(Of Long)
 
@@ -705,6 +711,34 @@ Public NotInheritable Class TabInformations
         End SyncLock
     End Sub
 
+    Public Sub ScrubGeoReserve(ByVal id As Long, ByVal upToStatusId As Long)
+        SyncLock LockObj
+            Me._scrubGeo.Add(New ScrubGeoInfo With {.UserId = id, .UpToStatusId = upToStatusId})
+            Me.ScrubGeo(id, upToStatusId)
+        End SyncLock
+    End Sub
+
+    Private Sub ScrubGeo(ByVal userId As Long, ByVal upToStatusId As Long)
+        SyncLock LockObj
+            Dim userPosts = From post In Me._statuses.Values
+                            Where post.UserId = userId AndAlso post.UserId <= upToStatusId
+                            Select post
+
+            For Each p In userPosts
+                p.PostGeo = New PostClass.StatusGeo
+            Next
+
+            Dim userPosts2 = From tb In Me.GetTabsInnerStorageType
+                             From post In tb.Posts.Values
+                             Where post.UserId = userId AndAlso post.UserId <= upToStatusId
+                             Select post
+
+            For Each p In userPosts2
+                p.PostGeo = New PostClass.StatusGeo
+            Next
+        End SyncLock
+    End Sub
+
     Public Sub RemovePostReserve(ByVal id As Long)
         SyncLock LockObj
             Me._deletedIds.Add(id)
index ca290d8..69d9d29 100644 (file)
@@ -3081,7 +3081,8 @@ Public Class Twitter
                     isDm = True
                 ElseIf xElm.Element("scrub_geo") IsNot Nothing Then
                     Try
-                        Debug.Print("scrub_geo: user_id=" + xElm.Element("scrub_geo").Element("user_id").Value.ToString + " up_to_status_id=" + xElm.Element("scrub_geo").Element("up_to_status_id").Value.ToString)
+                        TabInformations.GetInstance.ScrubGeoReserve(Long.Parse(xElm.Element("scrub_geo").Element("user_id").Value),
+                                                                    Long.Parse(xElm.Element("scrub_geo").Element("up_to_status_id").Value))
                     Catch ex As Exception
                         TraceOut("scrub_geo:" + line)
                     End Try