[Tween-svn] [1259] ・ [ でのリプライ移動時にリプライ先のポストがTLに無い場合には、TLに読み込んだ上で選択する機能を実装

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 12月 27日 (月) 14:42:42 JST


Revision: 1259
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1259
Author:   anis774
Date:     2010-12-27 14:42:42 +0900 (Mon, 27 Dec 2010)

Log Message:
-----------
・[でのリプライ移動時にリプライ先のポストがTLに無い場合には、TLに読み込んだ上で選択する機能を実装
※検索タブでリプライでないポストで[を使うと毎回APIだけ消費してしまうので要対策

Modified Paths:
--------------
    trunk/Tween/Tween.vb

Property Changed:
----------------
    trunk/


-------------- next part --------------

Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/UserStream:1077-1144
/branches/editlist:667-697
/branches/SettingDialog:1216-1230
/branches/panelswitch:447-572
/branches/APIchangeevent:723-746
/branches/tm:782-794
/branches/FixedImage:787-910

   + /branches/tm:782-794
/branches/editlist:667-697
/branches/SettingDialog:1216-1230
/branches/panelswitch:447-572
/branches/APIchangeevent:723-746
/branches/UserStream:1077-1144
/branches/FixedImage:787-910


Modified: trunk/Tween/Tween.vb
===================================================================
--- trunk/Tween/Tween.vb	2010-12-26 12:29:11 UTC (rev 1258)
+++ trunk/Tween/Tween.vb	2010-12-27 05:42:42 UTC (rev 1259)
@@ -5463,12 +5463,17 @@
 
         If Not (Me.ExistCurrentPost AndAlso _curPost.InReplyToUser IsNot Nothing AndAlso _curPost.InReplyToId > 0) Then Return
 
+        If replyChains Is Nothing OrElse (replyChains.Count > 0 AndAlso replyChains.Peek().InReplyToId <> _curPost.Id) Then
+            replyChains = New Stack(Of ReplyChain)
+        End If
+        replyChains.Push(New ReplyChain(_curPost.Id, _curPost.InReplyToId, _curTab))
+
         Dim inReplyToIndex As Integer
         Dim inReplyToTabName As String
+        Dim inReplyToId As Long = _curPost.InReplyToId
+        Dim inReplyToUser As String = _curPost.InReplyToUser
         Dim curTabPosts As Dictionary(Of Long, PostClass)
 
-
-
         If _statuses.Tabs(_curTab.Text).IsInnerStorageTabType Then
             curTabPosts = curTabClass.Posts
         Else
@@ -5481,7 +5486,7 @@
         Else
             Dim inReplyToPosts = From tab In _statuses.Tabs.Values
                                  From post In DirectCast(IIf(tab.IsInnerStorageTabType, tab.Posts, _statuses.Posts), Dictionary(Of Long, PostClass)).Values
-                                 Where post.Id = _curPost.InReplyToId
+                                 Where post.Id = inReplyToId
                                  Let index = tab.IndexOf(post.Id)
                                  Where index <> -1
                                  Select New With {.Tab = tab, .Post = post, .Index = index}
@@ -5491,16 +5496,29 @@
                 inReplyToTabName = inReplyPost.Tab.TabName
                 inReplyToIndex = inReplyPost.Index
             Catch ex As InvalidOperationException
-                OpenUriAsync("http://twitter.com/" + _curPost.InReplyToUser + "/statuses/" + _curPost.InReplyToId.ToString())
-                Exit Sub
+                Dim post As PostClass = Nothing
+                Dim r As String = tw.GetStatusApi(False, _curPost.InReplyToId, post)
+                If r = "" AndAlso post IsNot Nothing Then
+                    _statuses.AddPost(post)
+                    _statuses.DistributePosts()
+                    _statuses.SubmitUpdate(Nothing, Nothing, Nothing, False)
+                    Me.RefreshTimeline(False)
+                    Try
+                        Dim inReplyPost = inReplyToPosts.First()
+                        inReplyToTabName = inReplyPost.Tab.TabName
+                        inReplyToIndex = inReplyPost.Index
+                    Catch ex2 As InvalidOperationException
+                        OpenUriAsync("http://twitter.com/" + inReplyToUser + "/statuses/" + inReplyToId.ToString())
+                        Exit Sub
+                    End Try
+                Else
+                    Me.StatusLabelUrl.Text = r
+                    OpenUriAsync("http://twitter.com/" + inReplyToUser + "/statuses/" + inReplyToId.ToString())
+                    Exit Sub
+                End If
             End Try
         End If
 
-        If replyChains Is Nothing OrElse (replyChains.Count > 0 AndAlso replyChains.Peek().InReplyToId <> _curPost.Id) Then
-            replyChains = New Stack(Of ReplyChain)
-        End If
-        replyChains.Push(New ReplyChain(_curPost.Id, _curPost.InReplyToId, _curTab))
-
         Dim tabPage = Me.ListTab.TabPages.Cast(Of TabPage).First(Function(tp) tp.Text = inReplyToTabName)
         Dim listView = DirectCast(tabPage.Tag, DetailsListView)
 



Tween-svn メーリングリストの案内
Back to archive index