From: kiri_feather Date: Sun, 14 Feb 2010 18:47:25 +0000 (+0000) Subject: タブ作成時に既存タブのソート順が引き継がれないバグ修正 X-Git-Tag: Tween_v0.8.5.3-beta^0 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7df73faf1754079a327c6ff88b918c21a47f2eb9;p=opentween%2Fopen-tween.git タブ作成時に既存タブのソート順が引き継がれないバグ修正 メニューの「タブ」からのサウンドファイル指定が反映されないバグ修正 メニューの「タブ」から振り分けルール編集画面が開けないバグ修正 Webモードで半角スペースをnbspに置換できていなかったバグ修正 APIモードでのHTMLタグ付けが正しく行われないバグ修正 git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@100 e39ad16e-3079-482e-bb30-4b4d378143b6 --- diff --git a/Tween/My Project/AssemblyInfo.vb b/Tween/My Project/AssemblyInfo.vb index 68b0fc30..f549be57 100644 --- a/Tween/My Project/AssemblyInfo.vb +++ b/Tween/My Project/AssemblyInfo.vb @@ -55,5 +55,5 @@ Imports System.Runtime.InteropServices ' - + diff --git a/Tween/StatusDictionary.vb b/Tween/StatusDictionary.vb index 7f8ca318..48c49361 100644 --- a/Tween/StatusDictionary.vb +++ b/Tween/StatusDictionary.vb @@ -377,11 +377,13 @@ Public NotInheritable Class TabInformations Public Sub AddTab(ByVal TabName As String, ByVal TabType As TabUsageType) _tabs.Add(TabName, New TabClass(TabName, TabType)) + _tabs(TabName).Sorter.Mode = _sorter.Mode + _tabs(TabName).Sorter.Order = _sorter.Order End Sub - Public Sub AddTab(ByVal TabName As String, ByVal Tab As TabClass) - _tabs.Add(TabName, Tab) - End Sub + 'Public Sub AddTab(ByVal TabName As String, ByVal Tab As TabClass) + ' _tabs.Add(TabName, Tab) + 'End Sub Public Sub RemoveTab(ByVal TabName As String) SyncLock LockObj diff --git a/Tween/Tween.vb b/Tween/Tween.vb index ed19e496..8c31d035 100644 --- a/Tween/Tween.vb +++ b/Tween/Tween.vb @@ -5643,7 +5643,7 @@ RETRY: Private Sub SoundFileComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SoundFileComboBox.SelectedIndexChanged, SoundFileTbComboBox.SelectedIndexChanged If soundfileListup OrElse _rclickTabName = "" Then Exit Sub - _statuses.Tabs(_rclickTabName).SoundFile = DirectCast(SoundFileComboBox.SelectedItem, String) + _statuses.Tabs(_rclickTabName).SoundFile = DirectCast(DirectCast(sender, ToolStripComboBox).SelectedItem, String) 'SaveConfigsTab(_rclickTabName) SaveConfigsTabs() @@ -5659,7 +5659,7 @@ RETRY: SaveConfigsTabs() End Sub - Private Sub FilterEditMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterEditMenuItem.Click + Private Sub FilterEditMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterEditMenuItem.Click, EditRuleTbMenuItem.Click 'If _rclickTabName = "" OrElse _rclickTabName = DEFAULTTAB.RECENT OrElse _rclickTabName = DEFAULTTAB.DM _ ' OrElse _rclickTabName = DEFAULTTAB.FAV Then Exit Sub @@ -7567,4 +7567,5 @@ RETRY: Private Sub MenuItemTab_DropDownOpening(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemTab.DropDownOpening ContextMenuTabProperty_Opening(sender, Nothing) End Sub + End Class diff --git a/Tween/Twitter.vb b/Tween/Twitter.vb index 19bbba94..9276f58b 100644 --- a/Tween/Twitter.vb +++ b/Tween/Twitter.vb @@ -1718,25 +1718,47 @@ Public Module Twitter retStr = retStr.Replace(vbLf, "
") '半角スペースを置換(Thanks @anis774) + Dim ret As Boolean = False + Do + ret = EscapeSpace(retStr) + Loop While Not ret + 'Dim isTag As Boolean = False + 'For i As Integer = 0 To retStr.Length - 1 + ' If retStr(i) = "<"c Then + ' isTag = True + ' End If + ' If retStr(i) = ">"c Then + ' isTag = False + ' End If + + ' If (Not isTag) AndAlso (retStr(i) = " "c) Then + ' retStr = retStr.Remove(i, 1) + ' retStr = retStr.Insert(i, " ") + ' End If + 'Next + + Return SanitizeHtml(retStr) + End Function + + Private Function EscapeSpace(ByRef html As String) As Boolean + '半角スペースを置換(Thanks @anis774) Dim isTag As Boolean = False - For i As Integer = 0 To retStr.Length - 1 - If retStr(i) = "<"c Then + For i As Integer = 0 To html.Length - 1 + If html(i) = "<"c Then isTag = True End If - If retStr(i) = ">"c Then + If html(i) = ">"c Then isTag = False End If - If (Not isTag) AndAlso (retStr(i) = " "c) Then - retStr.Remove(i, 1) - retStr.Insert(i, " ") - i += 5 + If (Not isTag) AndAlso (html(i) = " "c) Then + html = html.Remove(i, 1) + html = html.Insert(i, " ") + Return False End If Next - - Return SanitizeHtml(retStr) + Return True End Function - Private Sub GetIconImage(ByVal post As PostClass) Dim img As Image Dim bmp2 As Bitmap @@ -3798,10 +3820,10 @@ Public Module Twitter Private Function CreateHtmlAnchor(ByVal Text As String, ByVal AtList As List(Of String)) As String 'Dim retStr As String = HttpUtility.HtmlEncode(Text) '要検証(デコードされて取得されるので再エンコード) - Dim retStr As String = HttpUtility.HtmlDecode(Text) - + 'Dim retStr As String = HttpUtility.HtmlDecode(Text) + Dim retStr As String = "" 'uriの正規表現 - Dim rgUrl As Regex = New Regex("(?$&") - For Each mt As Match In rgUrl.Matches(retStr) - Text.Replace(mt.Result("$&"), "" + mt.Result("$&") + "") - Next - retStr = Text + retStr = rgUrl.Replace(Text, "$&") + 'Dim mts As MatchCollection = rgUrl.Matches(retStr) + '''半角スペースを置換(Thanks @anis774) + ''Text = Text.Replace(" ", " ") 'HttpUtility.HtmlEncode()ではスペースが処理されない為 - '半角スペースを置換(Thanks @anis774) - retStr = retStr.Replace(" ", " ") 'HttpUtility.HtmlEncode()ではスペースが処理されない為 + 'For Each mt As Match In mts + ' Text = Text.Replace(mt.Result("$&"), "" + mt.Result("$&") + "") + 'Next + 'retStr = Text '@返信を抽出し、@先リスト作成 '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 'ハッシュタグを抽出し、リンクに置換 'Dim rgh As New Regex("(^|[ .!,\-:;<>?])#([^] !""#$%&'()*+,.:;<=>?@\-[\^`{|}~\r\n]+)") - Dim rgh As New Regex("(^|[^a-zA-Z0-9_/])[##]([a-zA-Z0-9_]+)") - Dim mh As Match = rgh.Match(retStr) - If mh.Success Then - retStr = rgh.Replace(retStr, "$1#$2") - End If - While mh.Success - SyncLock LockObj - _hashList.Add("#" + mh.Result("$2")) - End SyncLock - mh = mh.NextMatch - End While + Dim rgh As New Regex("(^|[^a-zA-Z0-9_/&])[##]([a-zA-Z0-9_]+)") + Dim mhs As MatchCollection = rgh.Matches(retStr) + For Each mt As Match In mhs + If Not IsNumeric(mt.Result("$2")) Then + 'retStr = retStr.Replace(mt.Result("$1") + mt.Result("$2"), "#" + mt.Result("$2") + "") + SyncLock LockObj + _hashList.Add("#" + mt.Result("$2")) + End SyncLock + End If + Next + retStr = rgh.Replace(retStr, "$1#$2") + '数字のみハッシュタグを戻す + Dim rgnh As New Regex("(#[0-9]+)") + retStr = rgnh.Replace(retStr, "$1") + 'If mh.Success Then + ' retStr = rgh.Replace(retStr, "$1#$2") + 'End If + 'While mh.Success + ' SyncLock LockObj + ' _hashList.Add("#" + mh.Result("$2")) + ' End SyncLock + ' mh = mh.NextMatch + 'End While retStr = AdjustHtml(ShortUrlResolve(PreProcessUrl(retStr))) 'IDN置換、短縮Uri解決、@リンクを相対→絶対にしてtarget属性付与 Return retStr