OpenTweenのfork
修订版 | 7df73faf1754079a327c6ff88b918c21a47f2eb9 (tree) |
---|---|
时间 | 2012-02-18 23:11:02 |
作者 | kiri_feather <kiri_feather@user...> |
Commiter | Kimura Youichi |
タブ作成時に既存タブのソート順が引き継がれないバグ修正
メニューの「タブ」からのサウンドファイル指定が反映されないバグ修正
メニューの「タブ」から振り分けルール編集画面が開けないバグ修正
Webモードで半角スペースをnbspに置換できていなかったバグ修正
APIモードでのHTMLタグ付けが正しく行われないバグ修正
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@100 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.1.0.0")> |
58 | -<Assembly: AssemblyFileVersion("0.8.5.1")> | |
58 | +<Assembly: AssemblyFileVersion("0.8.5.3")> | |
59 | 59 |
@@ -377,11 +377,13 @@ Public NotInheritable Class TabInformations | ||
377 | 377 | |
378 | 378 | Public Sub AddTab(ByVal TabName As String, ByVal TabType As TabUsageType) |
379 | 379 | _tabs.Add(TabName, New TabClass(TabName, TabType)) |
380 | + _tabs(TabName).Sorter.Mode = _sorter.Mode | |
381 | + _tabs(TabName).Sorter.Order = _sorter.Order | |
380 | 382 | End Sub |
381 | 383 | |
382 | - Public Sub AddTab(ByVal TabName As String, ByVal Tab As TabClass) | |
383 | - _tabs.Add(TabName, Tab) | |
384 | - End Sub | |
384 | + 'Public Sub AddTab(ByVal TabName As String, ByVal Tab As TabClass) | |
385 | + ' _tabs.Add(TabName, Tab) | |
386 | + 'End Sub | |
385 | 387 | |
386 | 388 | Public Sub RemoveTab(ByVal TabName As String) |
387 | 389 | SyncLock LockObj |
@@ -5643,7 +5643,7 @@ RETRY: | ||
5643 | 5643 | Private Sub SoundFileComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SoundFileComboBox.SelectedIndexChanged, SoundFileTbComboBox.SelectedIndexChanged |
5644 | 5644 | If soundfileListup OrElse _rclickTabName = "" Then Exit Sub |
5645 | 5645 | |
5646 | - _statuses.Tabs(_rclickTabName).SoundFile = DirectCast(SoundFileComboBox.SelectedItem, String) | |
5646 | + _statuses.Tabs(_rclickTabName).SoundFile = DirectCast(DirectCast(sender, ToolStripComboBox).SelectedItem, String) | |
5647 | 5647 | |
5648 | 5648 | 'SaveConfigsTab(_rclickTabName) |
5649 | 5649 | SaveConfigsTabs() |
@@ -5659,7 +5659,7 @@ RETRY: | ||
5659 | 5659 | SaveConfigsTabs() |
5660 | 5660 | End Sub |
5661 | 5661 | |
5662 | - Private Sub FilterEditMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterEditMenuItem.Click | |
5662 | + Private Sub FilterEditMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterEditMenuItem.Click, EditRuleTbMenuItem.Click | |
5663 | 5663 | 'If _rclickTabName = "" OrElse _rclickTabName = DEFAULTTAB.RECENT OrElse _rclickTabName = DEFAULTTAB.DM _ |
5664 | 5664 | ' OrElse _rclickTabName = DEFAULTTAB.FAV Then Exit Sub |
5665 | 5665 |
@@ -7567,4 +7567,5 @@ RETRY: | ||
7567 | 7567 | Private Sub MenuItemTab_DropDownOpening(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemTab.DropDownOpening |
7568 | 7568 | ContextMenuTabProperty_Opening(sender, Nothing) |
7569 | 7569 | End Sub |
7570 | + | |
7570 | 7571 | End Class |
@@ -1718,25 +1718,47 @@ Public Module Twitter | ||
1718 | 1718 | retStr = retStr.Replace(vbLf, "<br>") |
1719 | 1719 | |
1720 | 1720 | '半角スペースを置換(Thanks @anis774) |
1721 | + Dim ret As Boolean = False | |
1722 | + Do | |
1723 | + ret = EscapeSpace(retStr) | |
1724 | + Loop While Not ret | |
1725 | + 'Dim isTag As Boolean = False | |
1726 | + 'For i As Integer = 0 To retStr.Length - 1 | |
1727 | + ' If retStr(i) = "<"c Then | |
1728 | + ' isTag = True | |
1729 | + ' End If | |
1730 | + ' If retStr(i) = ">"c Then | |
1731 | + ' isTag = False | |
1732 | + ' End If | |
1733 | + | |
1734 | + ' If (Not isTag) AndAlso (retStr(i) = " "c) Then | |
1735 | + ' retStr = retStr.Remove(i, 1) | |
1736 | + ' retStr = retStr.Insert(i, " ") | |
1737 | + ' End If | |
1738 | + 'Next | |
1739 | + | |
1740 | + Return SanitizeHtml(retStr) | |
1741 | + End Function | |
1742 | + | |
1743 | + Private Function EscapeSpace(ByRef html As String) As Boolean | |
1744 | + '半角スペースを置換(Thanks @anis774) | |
1721 | 1745 | Dim isTag As Boolean = False |
1722 | - For i As Integer = 0 To retStr.Length - 1 | |
1723 | - If retStr(i) = "<"c Then | |
1746 | + For i As Integer = 0 To html.Length - 1 | |
1747 | + If html(i) = "<"c Then | |
1724 | 1748 | isTag = True |
1725 | 1749 | End If |
1726 | - If retStr(i) = ">"c Then | |
1750 | + If html(i) = ">"c Then | |
1727 | 1751 | isTag = False |
1728 | 1752 | End If |
1729 | 1753 | |
1730 | - If (Not isTag) AndAlso (retStr(i) = " "c) Then | |
1731 | - retStr.Remove(i, 1) | |
1732 | - retStr.Insert(i, " ") | |
1733 | - i += 5 | |
1754 | + If (Not isTag) AndAlso (html(i) = " "c) Then | |
1755 | + html = html.Remove(i, 1) | |
1756 | + html = html.Insert(i, " ") | |
1757 | + Return False | |
1734 | 1758 | End If |
1735 | 1759 | Next |
1736 | - | |
1737 | - Return SanitizeHtml(retStr) | |
1760 | + Return True | |
1738 | 1761 | End Function |
1739 | - | |
1740 | 1762 | Private Sub GetIconImage(ByVal post As PostClass) |
1741 | 1763 | Dim img As Image |
1742 | 1764 | Dim bmp2 As Bitmap |
@@ -3798,10 +3820,10 @@ Public Module Twitter | ||
3798 | 3820 | |
3799 | 3821 | Private Function CreateHtmlAnchor(ByVal Text As String, ByVal AtList As List(Of String)) As String |
3800 | 3822 | 'Dim retStr As String = HttpUtility.HtmlEncode(Text) '要検証(デコードされて取得されるので再エンコード) |
3801 | - Dim retStr As String = HttpUtility.HtmlDecode(Text) | |
3802 | - | |
3823 | + 'Dim retStr As String = HttpUtility.HtmlDecode(Text) | |
3824 | + Dim retStr As String = "" | |
3803 | 3825 | 'uriの正規表現 |
3804 | - Dim rgUrl As Regex = New Regex("(?<![0-9A-Za-z])(?:https?|shttp|ftps?)://(?:(?:[-_.!~*'()a-zA-Z0-9;:&=+$,]|%[0-9A-Fa-f" + _ | |
3826 | + Dim rgUrl As Regex = New Regex("(?<![0-9A-Za-z=])(?:https?|shttp|ftps?)://(?:(?:[-_.!~*'()a-zA-Z0-9;:&=+$,]|%[0-9A-Fa-f" + _ | |
3805 | 3827 | "][0-9A-Fa-f])*@)?(?:(?:[a-zA-Z0-9](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.)" + _ |
3806 | 3828 | "*[a-zA-Z](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.?|[0-9]+\.[0-9]+\.[0-9]+\." + _ |
3807 | 3829 | "[0-9]+)(?::[0-9]*)?(?:/(?:[-_.!~*'()a-zA-Z0-9:@&=+$,]|%[0-9A-Fa-f]" + _ |
@@ -3811,14 +3833,15 @@ Public Module Twitter | ||
3811 | 3833 | "*)?(?:\?(?:[-_.!~*'()a-zA-Z0-9;/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])" + _ |
3812 | 3834 | "*)?(?:#(?:[-_.!~*'()a-zA-Z0-9;/?:@&=+$,]|%[0-9A-Fa-f][0-9A-Fa-f])*)?") |
3813 | 3835 | '絶対パス表現のUriをリンクに置換 |
3814 | - 'retStr = rgUrl.Replace(retStr, "<a href=""$&"">$&</a>") | |
3815 | - For Each mt As Match In rgUrl.Matches(retStr) | |
3816 | - Text.Replace(mt.Result("$&"), "<a href=""" + mt.Result("$&") + """>" + mt.Result("$&") + "</a>") | |
3817 | - Next | |
3818 | - retStr = Text | |
3836 | + retStr = rgUrl.Replace(Text, "<a href=""$&"">$&</a>") | |
3837 | + 'Dim mts As MatchCollection = rgUrl.Matches(retStr) | |
3838 | + '''半角スペースを置換(Thanks @anis774) | |
3839 | + ''Text = Text.Replace(" ", " ") 'HttpUtility.HtmlEncode()ではスペースが処理されない為 | |
3819 | 3840 | |
3820 | - '半角スペースを置換(Thanks @anis774) | |
3821 | - retStr = retStr.Replace(" ", " ") 'HttpUtility.HtmlEncode()ではスペースが処理されない為 | |
3841 | + 'For Each mt As Match In mts | |
3842 | + ' Text = Text.Replace(mt.Result("$&"), "<a href=""" + mt.Result("$&") + """>" + mt.Result("$&") + "</a>") | |
3843 | + 'Next | |
3844 | + 'retStr = Text | |
3822 | 3845 | |
3823 | 3846 | '@返信を抽出し、@先リスト作成 |
3824 | 3847 | 'Dim rg As New Regex("(^|[ -/:-@[-^`{-~])@([a-zA-Z0-9_]{1,20}/[a-zA-Z0-9_\-]{1,24}[a-zA-Z0-9_])") |
@@ -3839,17 +3862,29 @@ Public Module Twitter | ||
3839 | 3862 | |
3840 | 3863 | 'ハッシュタグを抽出し、リンクに置換 |
3841 | 3864 | 'Dim rgh As New Regex("(^|[ .!,\-:;<>?])#([^] !""#$%&'()*+,.:;<=>?@\-[\^`{|}~\r\n]+)") |
3842 | - Dim rgh As New Regex("(^|[^a-zA-Z0-9_/])[##]([a-zA-Z0-9_]+)") | |
3843 | - Dim mh As Match = rgh.Match(retStr) | |
3844 | - If mh.Success Then | |
3845 | - retStr = rgh.Replace(retStr, "$1<a href=""" + _protocol + "twitter.com/search?q=%23$2"">#$2</a>") | |
3846 | - End If | |
3847 | - While mh.Success | |
3848 | - SyncLock LockObj | |
3849 | - _hashList.Add("#" + mh.Result("$2")) | |
3850 | - End SyncLock | |
3851 | - mh = mh.NextMatch | |
3852 | - End While | |
3865 | + Dim rgh As New Regex("(^|[^a-zA-Z0-9_/&])[##]([a-zA-Z0-9_]+)") | |
3866 | + Dim mhs As MatchCollection = rgh.Matches(retStr) | |
3867 | + For Each mt As Match In mhs | |
3868 | + If Not IsNumeric(mt.Result("$2")) Then | |
3869 | + 'retStr = retStr.Replace(mt.Result("$1") + mt.Result("$2"), "<a href=""" + _protocol + "twitter.com/search?q=%23" + mt.Result("$2") + """>#" + mt.Result("$2") + "</a>") | |
3870 | + SyncLock LockObj | |
3871 | + _hashList.Add("#" + mt.Result("$2")) | |
3872 | + End SyncLock | |
3873 | + End If | |
3874 | + Next | |
3875 | + retStr = rgh.Replace(retStr, "$1<a href=""" + _protocol + "twitter.com/search?q=%23$2"">#$2</a>") | |
3876 | + '数字のみハッシュタグを戻す | |
3877 | + Dim rgnh As New Regex("<a href=""" + _protocol + "twitter.com/search\?q=%23[0-9]+"">(#[0-9]+)</a>") | |
3878 | + retStr = rgnh.Replace(retStr, "$1") | |
3879 | + 'If mh.Success Then | |
3880 | + ' retStr = rgh.Replace(retStr, "$1<a href=""" + _protocol + "twitter.com/search?q=%23$2"">#$2</a>") | |
3881 | + 'End If | |
3882 | + 'While mh.Success | |
3883 | + ' SyncLock LockObj | |
3884 | + ' _hashList.Add("#" + mh.Result("$2")) | |
3885 | + ' End SyncLock | |
3886 | + ' mh = mh.NextMatch | |
3887 | + 'End While | |
3853 | 3888 | |
3854 | 3889 | retStr = AdjustHtml(ShortUrlResolve(PreProcessUrl(retStr))) 'IDN置換、短縮Uri解決、@リンクを相対→絶対にしてtarget属性付与 |
3855 | 3890 | Return retStr |