OSDN Git Service

0790リリース。Webモードで公式RT発言が取得できない問題に対応 Tween_v0.7.9.0
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Thu, 19 Nov 2009 09:55:06 +0000 (09:55 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:10:27 +0000 (23:10 +0900)
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@17 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/My Project/AssemblyInfo.vb
Tween/Resources/ChangeLog.txt
Tween/StatusDictionary.vb
Tween/Tween.vb
Tween/Twitter.vb

index a6cda83..6b8852f 100644 (file)
@@ -55,5 +55,5 @@ Imports System.Runtime.InteropServices
 ' <Assembly: AssemblyVersion("1.0.*")> 
 
 <Assembly: AssemblyVersion("0.7.*")> 
-<Assembly: AssemblyFileVersion("0.7.8.0")> 
+<Assembly: AssemblyFileVersion("0.7.9.0")> 
 
index 6257e14..fc875a2 100644 (file)
@@ -1,7 +1,10 @@
 更新履歴
 
-==== Ver 0.7.9.0(Unreleased)
+==== Ver 0.8.0.0(Unreleased)
+ * Webモードで公式RT発言をコピー、開くした時にユーザーと発言IDが不整合になっていた問題に対応
+==== Ver 0.7.9.0(2009/11/19)
  * APIモードでのハッシュタグ誤認対応
+ * Webモードで公式RT発言が取得できない問題に対応。マーク欄に「RT」、発言詳細の発言者の後ろにRTしたユーザーを表示。基本はRT元発言を表示します。(APIモードは変更なし)
 ==== Ver 0.7.8.0(2009/11/18)
  * Webモードで、公式ReTweetが有効になっている場合に、RT発言をFav発言と誤認する問題に対応
 ==== Ver 0.7.7.0(2009/11/15)
index 4d2b5e7..24500c6 100644 (file)
@@ -51,6 +51,7 @@ Public NotInheritable Class PostClass
     Private _statuses As Statuses = Statuses.None
     Private _Uid As Long
     Private _FilterHit As Boolean
+    Private _RetweetedBy As String
 
     <FlagsAttribute()> _
     Private Enum Statuses
@@ -82,7 +83,8 @@ Public NotInheritable Class PostClass
             ByVal ImageIndex As Integer, _
             ByVal IsDm As Boolean, _
             ByVal Uid As Long, _
-            ByVal FilterHit As Boolean)
+            ByVal FilterHit As Boolean, _
+            ByVal RetweetedBy As String)
         _Nick = Nickname
         _Data = Data
         _ImageUrl = ImageUrl
@@ -105,6 +107,7 @@ Public NotInheritable Class PostClass
         _IsDm = IsDm
         _Uid = Uid
         _FilterHit = FilterHit
+        _RetweetedBy = RetweetedBy
     End Sub
 
     Public Sub New()
@@ -306,6 +309,14 @@ Public NotInheritable Class PostClass
             _FilterHit = value
         End Set
     End Property
+    Public Property RetweetedBy() As String
+        Get
+            Return _RetweetedBy
+        End Get
+        Set(ByVal value As String)
+            _RetweetedBy = value
+        End Set
+    End Property
 End Class
 
 Public NotInheritable Class TabInformations
index 0b00cf0..bf3e988 100644 (file)
@@ -3279,6 +3279,7 @@ Public Class TweenMain
         If Post.IsMark Then mk += "♪"
         If Post.IsProtect Then mk += "Ю"
         If Post.InReplyToId > 0 Then mk += "⇒"
+        If Not String.IsNullOrEmpty(Post.RetweetedBy) Then mk += "RT"
         Dim sitem() As String = {"", Post.Nickname, Post.Data, Post.PDate.ToString(SettingDialog.DateTimeFormat), Post.Name, "", mk, Post.Source}
         Dim itm As ListViewItem = New ListViewItem(sitem, Post.ImageIndex)
         Dim read As Boolean = Post.IsRead
@@ -3614,7 +3615,11 @@ RETRY:
     Private Sub StatusOpenMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusOpenMenuItem.Click
         If _curList.SelectedIndices.Count > 0 AndAlso _statuses.Tabs(_curTab.Text).TabType <> TabUsageType.DirectMessage Then
             Dim post As PostClass = _statuses.Item(_curTab.Text, _curList.SelectedIndices(0))
-            OpenUriAsync("http://twitter.com/" + post.Name + "/status/" + post.Id.ToString)
+            If String.IsNullOrEmpty(post.RetweetedBy) Then
+                OpenUriAsync("http://twitter.com/" + post.Name + "/status/" + post.Id.ToString)
+            Else
+                OpenUriAsync("http://twitter.com/" + post.RetweetedBy + "/status/" + post.Id.ToString)
+            End If
         End If
     End Sub
 
@@ -3756,6 +3761,9 @@ RETRY:
             NameLabel.Text = ""
         End If
         NameLabel.Text += _curPost.Name + "/" + _curPost.Nickname
+        If Not String.IsNullOrEmpty(_curPost.RetweetedBy) Then
+            NameLabel.Text += " (RT:" + _curPost.RetweetedBy + ")"
+        End If
         'If UserPicture.Image IsNot Nothing Then UserPicture.Image.Dispose()
         If _curPost.ImageIndex > -1 Then
             UserPicture.Image = TIconDic(_curPost.ImageUrl)
@@ -4005,7 +4013,11 @@ RETRY:
         For Each idx As Integer In _curList.SelectedIndices
             Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
             If post.IsProtect AndAlso SettingDialog.ProtectNotInclude Then Continue For
-            sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.Name, post.Data, post.Id, Environment.NewLine)
+            If String.IsNullOrEmpty(post.RetweetedBy) Then
+                sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.Name, post.Data, post.Id, Environment.NewLine)
+            Else
+                sb.AppendFormat("{0}:{1} [http://twitter.com/{2}/status/{3}]{4}", post.Name, post.Data, post.RetweetedBy, post.Id, Environment.NewLine)
+            End If
         Next
         If sb.Length > 0 Then
             clstr = sb.ToString()
@@ -4018,7 +4030,11 @@ RETRY:
         Dim sb As New StringBuilder()
         For Each idx As Integer In _curList.SelectedIndices
             Dim post As PostClass = _statuses.Item(_curTab.Text, idx)
-            sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.Name, post.Id, Environment.NewLine)
+            If String.IsNullOrEmpty(post.RetweetedBy) Then
+                sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.Name, post.Id, Environment.NewLine)
+            Else
+                sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.RetweetedBy, post.Id, Environment.NewLine)
+            End If
         Next
         If sb.Length > 0 Then
             clstr = sb.ToString()
index 05e4e4d..1dd543c 100644 (file)
@@ -324,7 +324,7 @@ Public Module Twitter
             End If
 
             ' tr 要素の class 属性を消去
-            retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls> class=""[^""]+"")", "${tagStart}")
+            retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls>\s+class=""[^""]+"")", "${tagStart}")
             'Do
             '    Try
             '        Dim idx As Integer = retMsg.IndexOf(_removeClass, StringComparison.Ordinal)
@@ -368,6 +368,8 @@ Public Module Twitter
             Dim dlgt(20) As GetIconImageDelegate
             Dim ar(20) As IAsyncResult
             Dim arIdx As Integer = -1
+            Dim rg As Regex
+            Dim m As Match
 
             For Each strPost As String In posts
                 intCnt += 1
@@ -486,6 +488,17 @@ Public Module Twitter
                         post.IsProtect = True
                     End If
 
+                    'RetweetedBy
+                    If strPost.IndexOf("class=""big-retweet-icon""") > -1 Then
+                        rg = New Regex("class=""shared-content"".+<a href=""/(?<name>[a-zA-Z0-9_]+)""")
+                        m = rg.Match(strPost)
+                        If m.Success Then
+                            post.RetweetedBy = m.Result("${name}")
+                        Else
+                            post.RetweetedBy = ""
+                        End If
+                    End If
+
                     'Get Message
                     pos1 = strPost.IndexOf(_parseMsg1, pos2, StringComparison.Ordinal)
                     If pos1 < 0 Then
@@ -581,8 +594,8 @@ Public Module Twitter
 
                     'from Sourceの取得
                     'ToDo: _parseSourceFromを正規表現へ。wedataからの取得へ変更(次版より)
-                    Dim rg As New Regex("<span>.+>(?<name>.+)</a>.*</span>")
-                    Dim m As Match = rg.Match(strPost)
+                    rg = New Regex("<span>.+>(?<name>.+)</a>.*</span>")
+                    m = rg.Match(strPost)
                     If m.Success Then
                         post.Source = m.Result("${name}")
                     Else
@@ -649,7 +662,6 @@ Public Module Twitter
                     '    post.IsFav = False
                     'End If
 
-
                     If _endingFlag Then Return ""
 
                     post.IsMe = post.Name.Equals(_uid, StringComparison.OrdinalIgnoreCase)
@@ -803,7 +815,7 @@ Public Module Twitter
             End If
 
             ' tr 要素の class 属性を消去
-            retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls> class=""[^""]+"")", "${tagStart}")
+            retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls>\s+class=""[^""]+"")", "${tagStart}")
             'Do
             '    Try
             '        Dim idx As Integer = retMsg.IndexOf(_removeClass, StringComparison.Ordinal)
@@ -1058,7 +1070,7 @@ Public Module Twitter
             End If
 
             ' tr 要素の class 属性を消去
-            retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls> class=""[^""]+"")", "${tagStart}")
+            retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls>\s+class=""[^""]+"")", "${tagStart}")
             'Do
             '    Try
             '        Dim idx As Integer = retMsg.IndexOf(_removeClass, StringComparison.Ordinal)
@@ -1098,6 +1110,8 @@ Public Module Twitter
             Dim dlgt(20) As GetIconImageDelegate
             Dim ar(20) As IAsyncResult
             Dim arIdx As Integer = -1
+            Dim rg As Regex
+            Dim m As Match
 
             For Each strPost As String In posts
                 intCnt += 1
@@ -1180,6 +1194,17 @@ Public Module Twitter
                         post.IsProtect = True
                     End If
 
+                    'RetweetedBy
+                    If strPost.IndexOf("class=""big-retweet-icon""") > -1 Then
+                        rg = New Regex("class=""shared-content"".+<a href=""/(?<name>[a-zA-Z0-9_]+)""")
+                        m = rg.Match(strPost)
+                        If m.Success Then
+                            post.RetweetedBy = m.Result("${name}")
+                        Else
+                            post.RetweetedBy = ""
+                        End If
+                    End If
+
                     'Get Message
                     pos1 = strPost.IndexOf(_parseMsg1, pos2, StringComparison.Ordinal)
                     If pos1 < 0 Then
@@ -1275,8 +1300,8 @@ Public Module Twitter
 
                     'from Sourceの取得
                     'ToDo: _parseSourceFromを正規表現へ。wedataからの取得へ変更(次版より)
-                    Dim rg As New Regex("<span>.+>(?<name>.+)</a>.*</span>")
-                    Dim m As Match = rg.Match(strPost)
+                    rg = New Regex("<span>.+>(?<name>.+)</a>.*</span>")
+                    m = rg.Match(strPost)
                     If m.Success Then
                         post.Source = m.Result("${name}")
                     Else