OpenTweenのfork
修订版 | 328d287878d1bf44011cd2bc092ebd14cd9add06 (tree) |
---|---|
时间 | 2012-02-18 23:10:27 |
作者 | kiri_feather <kiri_feather@user...> |
Commiter | Kimura Youichi |
0790リリース。Webモードで公式RT発言が取得できない問題に対応
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@17 e39ad16e-3079-482e-bb30-4b4d378143b6
@@ -55,5 +55,5 @@ Imports System.Runtime.InteropServices | ||
55 | 55 | ' <Assembly: AssemblyVersion("1.0.*")> |
56 | 56 | |
57 | 57 | <Assembly: AssemblyVersion("0.7.*")> |
58 | -<Assembly: AssemblyFileVersion("0.7.8.0")> | |
58 | +<Assembly: AssemblyFileVersion("0.7.9.0")> | |
59 | 59 |
@@ -1,7 +1,10 @@ | ||
1 | 1 | 更新履歴 |
2 | 2 | |
3 | -==== Ver 0.7.9.0(Unreleased) | |
3 | +==== Ver 0.8.0.0(Unreleased) | |
4 | + * Webモードで公式RT発言をコピー、開くした時にユーザーと発言IDが不整合になっていた問題に対応 | |
5 | +==== Ver 0.7.9.0(2009/11/19) | |
4 | 6 | * APIモードでのハッシュタグ誤認対応 |
7 | + * Webモードで公式RT発言が取得できない問題に対応。マーク欄に「RT」、発言詳細の発言者の後ろにRTしたユーザーを表示。基本はRT元発言を表示します。(APIモードは変更なし) | |
5 | 8 | ==== Ver 0.7.8.0(2009/11/18) |
6 | 9 | * Webモードで、公式ReTweetが有効になっている場合に、RT発言をFav発言と誤認する問題に対応 |
7 | 10 | ==== Ver 0.7.7.0(2009/11/15) |
@@ -51,6 +51,7 @@ Public NotInheritable Class PostClass | ||
51 | 51 | Private _statuses As Statuses = Statuses.None |
52 | 52 | Private _Uid As Long |
53 | 53 | Private _FilterHit As Boolean |
54 | + Private _RetweetedBy As String | |
54 | 55 | |
55 | 56 | <FlagsAttribute()> _ |
56 | 57 | Private Enum Statuses |
@@ -82,7 +83,8 @@ Public NotInheritable Class PostClass | ||
82 | 83 | ByVal ImageIndex As Integer, _ |
83 | 84 | ByVal IsDm As Boolean, _ |
84 | 85 | ByVal Uid As Long, _ |
85 | - ByVal FilterHit As Boolean) | |
86 | + ByVal FilterHit As Boolean, _ | |
87 | + ByVal RetweetedBy As String) | |
86 | 88 | _Nick = Nickname |
87 | 89 | _Data = Data |
88 | 90 | _ImageUrl = ImageUrl |
@@ -105,6 +107,7 @@ Public NotInheritable Class PostClass | ||
105 | 107 | _IsDm = IsDm |
106 | 108 | _Uid = Uid |
107 | 109 | _FilterHit = FilterHit |
110 | + _RetweetedBy = RetweetedBy | |
108 | 111 | End Sub |
109 | 112 | |
110 | 113 | Public Sub New() |
@@ -306,6 +309,14 @@ Public NotInheritable Class PostClass | ||
306 | 309 | _FilterHit = value |
307 | 310 | End Set |
308 | 311 | End Property |
312 | + Public Property RetweetedBy() As String | |
313 | + Get | |
314 | + Return _RetweetedBy | |
315 | + End Get | |
316 | + Set(ByVal value As String) | |
317 | + _RetweetedBy = value | |
318 | + End Set | |
319 | + End Property | |
309 | 320 | End Class |
310 | 321 | |
311 | 322 | Public NotInheritable Class TabInformations |
@@ -3279,6 +3279,7 @@ Public Class TweenMain | ||
3279 | 3279 | If Post.IsMark Then mk += "♪" |
3280 | 3280 | If Post.IsProtect Then mk += "Ю" |
3281 | 3281 | If Post.InReplyToId > 0 Then mk += "⇒" |
3282 | + If Not String.IsNullOrEmpty(Post.RetweetedBy) Then mk += "RT" | |
3282 | 3283 | Dim sitem() As String = {"", Post.Nickname, Post.Data, Post.PDate.ToString(SettingDialog.DateTimeFormat), Post.Name, "", mk, Post.Source} |
3283 | 3284 | Dim itm As ListViewItem = New ListViewItem(sitem, Post.ImageIndex) |
3284 | 3285 | Dim read As Boolean = Post.IsRead |
@@ -3614,7 +3615,11 @@ RETRY: | ||
3614 | 3615 | Private Sub StatusOpenMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusOpenMenuItem.Click |
3615 | 3616 | If _curList.SelectedIndices.Count > 0 AndAlso _statuses.Tabs(_curTab.Text).TabType <> TabUsageType.DirectMessage Then |
3616 | 3617 | Dim post As PostClass = _statuses.Item(_curTab.Text, _curList.SelectedIndices(0)) |
3617 | - OpenUriAsync("http://twitter.com/" + post.Name + "/status/" + post.Id.ToString) | |
3618 | + If String.IsNullOrEmpty(post.RetweetedBy) Then | |
3619 | + OpenUriAsync("http://twitter.com/" + post.Name + "/status/" + post.Id.ToString) | |
3620 | + Else | |
3621 | + OpenUriAsync("http://twitter.com/" + post.RetweetedBy + "/status/" + post.Id.ToString) | |
3622 | + End If | |
3618 | 3623 | End If |
3619 | 3624 | End Sub |
3620 | 3625 |
@@ -3756,6 +3761,9 @@ RETRY: | ||
3756 | 3761 | NameLabel.Text = "" |
3757 | 3762 | End If |
3758 | 3763 | NameLabel.Text += _curPost.Name + "/" + _curPost.Nickname |
3764 | + If Not String.IsNullOrEmpty(_curPost.RetweetedBy) Then | |
3765 | + NameLabel.Text += " (RT:" + _curPost.RetweetedBy + ")" | |
3766 | + End If | |
3759 | 3767 | 'If UserPicture.Image IsNot Nothing Then UserPicture.Image.Dispose() |
3760 | 3768 | If _curPost.ImageIndex > -1 Then |
3761 | 3769 | UserPicture.Image = TIconDic(_curPost.ImageUrl) |
@@ -4005,7 +4013,11 @@ RETRY: | ||
4005 | 4013 | For Each idx As Integer In _curList.SelectedIndices |
4006 | 4014 | Dim post As PostClass = _statuses.Item(_curTab.Text, idx) |
4007 | 4015 | If post.IsProtect AndAlso SettingDialog.ProtectNotInclude Then Continue For |
4008 | - sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.Name, post.Data, post.Id, Environment.NewLine) | |
4016 | + If String.IsNullOrEmpty(post.RetweetedBy) Then | |
4017 | + sb.AppendFormat("{0}:{1} [http://twitter.com/{0}/status/{2}]{3}", post.Name, post.Data, post.Id, Environment.NewLine) | |
4018 | + Else | |
4019 | + sb.AppendFormat("{0}:{1} [http://twitter.com/{2}/status/{3}]{4}", post.Name, post.Data, post.RetweetedBy, post.Id, Environment.NewLine) | |
4020 | + End If | |
4009 | 4021 | Next |
4010 | 4022 | If sb.Length > 0 Then |
4011 | 4023 | clstr = sb.ToString() |
@@ -4018,7 +4030,11 @@ RETRY: | ||
4018 | 4030 | Dim sb As New StringBuilder() |
4019 | 4031 | For Each idx As Integer In _curList.SelectedIndices |
4020 | 4032 | Dim post As PostClass = _statuses.Item(_curTab.Text, idx) |
4021 | - sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.Name, post.Id, Environment.NewLine) | |
4033 | + If String.IsNullOrEmpty(post.RetweetedBy) Then | |
4034 | + sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.Name, post.Id, Environment.NewLine) | |
4035 | + Else | |
4036 | + sb.AppendFormat("http://twitter.com/{0}/status/{1}{2}", post.RetweetedBy, post.Id, Environment.NewLine) | |
4037 | + End If | |
4022 | 4038 | Next |
4023 | 4039 | If sb.Length > 0 Then |
4024 | 4040 | clstr = sb.ToString() |
@@ -324,7 +324,7 @@ Public Module Twitter | ||
324 | 324 | End If |
325 | 325 | |
326 | 326 | ' tr 要素の class 属性を消去 |
327 | - retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls> class=""[^""]+"")", "${tagStart}") | |
327 | + retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls>\s+class=""[^""]+"")", "${tagStart}") | |
328 | 328 | 'Do |
329 | 329 | ' Try |
330 | 330 | ' Dim idx As Integer = retMsg.IndexOf(_removeClass, StringComparison.Ordinal) |
@@ -368,6 +368,8 @@ Public Module Twitter | ||
368 | 368 | Dim dlgt(20) As GetIconImageDelegate |
369 | 369 | Dim ar(20) As IAsyncResult |
370 | 370 | Dim arIdx As Integer = -1 |
371 | + Dim rg As Regex | |
372 | + Dim m As Match | |
371 | 373 | |
372 | 374 | For Each strPost As String In posts |
373 | 375 | intCnt += 1 |
@@ -486,6 +488,17 @@ Public Module Twitter | ||
486 | 488 | post.IsProtect = True |
487 | 489 | End If |
488 | 490 | |
491 | + 'RetweetedBy | |
492 | + If strPost.IndexOf("class=""big-retweet-icon""") > -1 Then | |
493 | + rg = New Regex("class=""shared-content"".+<a href=""/(?<name>[a-zA-Z0-9_]+)""") | |
494 | + m = rg.Match(strPost) | |
495 | + If m.Success Then | |
496 | + post.RetweetedBy = m.Result("${name}") | |
497 | + Else | |
498 | + post.RetweetedBy = "" | |
499 | + End If | |
500 | + End If | |
501 | + | |
489 | 502 | 'Get Message |
490 | 503 | pos1 = strPost.IndexOf(_parseMsg1, pos2, StringComparison.Ordinal) |
491 | 504 | If pos1 < 0 Then |
@@ -581,8 +594,8 @@ Public Module Twitter | ||
581 | 594 | |
582 | 595 | 'from Sourceの取得 |
583 | 596 | 'ToDo: _parseSourceFromを正規表現へ。wedataからの取得へ変更(次版より) |
584 | - Dim rg As New Regex("<span>.+>(?<name>.+)</a>.*</span>") | |
585 | - Dim m As Match = rg.Match(strPost) | |
597 | + rg = New Regex("<span>.+>(?<name>.+)</a>.*</span>") | |
598 | + m = rg.Match(strPost) | |
586 | 599 | If m.Success Then |
587 | 600 | post.Source = m.Result("${name}") |
588 | 601 | Else |
@@ -649,7 +662,6 @@ Public Module Twitter | ||
649 | 662 | ' post.IsFav = False |
650 | 663 | 'End If |
651 | 664 | |
652 | - | |
653 | 665 | If _endingFlag Then Return "" |
654 | 666 | |
655 | 667 | post.IsMe = post.Name.Equals(_uid, StringComparison.OrdinalIgnoreCase) |
@@ -803,7 +815,7 @@ Public Module Twitter | ||
803 | 815 | End If |
804 | 816 | |
805 | 817 | ' tr 要素の class 属性を消去 |
806 | - retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls> class=""[^""]+"")", "${tagStart}") | |
818 | + retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls>\s+class=""[^""]+"")", "${tagStart}") | |
807 | 819 | 'Do |
808 | 820 | ' Try |
809 | 821 | ' Dim idx As Integer = retMsg.IndexOf(_removeClass, StringComparison.Ordinal) |
@@ -1058,7 +1070,7 @@ Public Module Twitter | ||
1058 | 1070 | End If |
1059 | 1071 | |
1060 | 1072 | ' tr 要素の class 属性を消去 |
1061 | - retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls> class=""[^""]+"")", "${tagStart}") | |
1073 | + retMsg = Regex.Replace(retMsg, "(?<tagStart><li)(?<cls>\s+class=""[^""]+"")", "${tagStart}") | |
1062 | 1074 | 'Do |
1063 | 1075 | ' Try |
1064 | 1076 | ' Dim idx As Integer = retMsg.IndexOf(_removeClass, StringComparison.Ordinal) |
@@ -1098,6 +1110,8 @@ Public Module Twitter | ||
1098 | 1110 | Dim dlgt(20) As GetIconImageDelegate |
1099 | 1111 | Dim ar(20) As IAsyncResult |
1100 | 1112 | Dim arIdx As Integer = -1 |
1113 | + Dim rg As Regex | |
1114 | + Dim m As Match | |
1101 | 1115 | |
1102 | 1116 | For Each strPost As String In posts |
1103 | 1117 | intCnt += 1 |
@@ -1180,6 +1194,17 @@ Public Module Twitter | ||
1180 | 1194 | post.IsProtect = True |
1181 | 1195 | End If |
1182 | 1196 | |
1197 | + 'RetweetedBy | |
1198 | + If strPost.IndexOf("class=""big-retweet-icon""") > -1 Then | |
1199 | + rg = New Regex("class=""shared-content"".+<a href=""/(?<name>[a-zA-Z0-9_]+)""") | |
1200 | + m = rg.Match(strPost) | |
1201 | + If m.Success Then | |
1202 | + post.RetweetedBy = m.Result("${name}") | |
1203 | + Else | |
1204 | + post.RetweetedBy = "" | |
1205 | + End If | |
1206 | + End If | |
1207 | + | |
1183 | 1208 | 'Get Message |
1184 | 1209 | pos1 = strPost.IndexOf(_parseMsg1, pos2, StringComparison.Ordinal) |
1185 | 1210 | If pos1 < 0 Then |
@@ -1275,8 +1300,8 @@ Public Module Twitter | ||
1275 | 1300 | |
1276 | 1301 | 'from Sourceの取得 |
1277 | 1302 | 'ToDo: _parseSourceFromを正規表現へ。wedataからの取得へ変更(次版より) |
1278 | - Dim rg As New Regex("<span>.+>(?<name>.+)</a>.*</span>") | |
1279 | - Dim m As Match = rg.Match(strPost) | |
1303 | + rg = New Regex("<span>.+>(?<name>.+)</a>.*</span>") | |
1304 | + m = rg.Match(strPost) | |
1280 | 1305 | If m.Success Then |
1281 | 1306 | post.Source = m.Result("${name}") |
1282 | 1307 | Else |