OSDN Git Service

不正なSourceに対応(例:amaz_sales)
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Mon, 6 Dec 2010 06:25:49 +0000 (06:25 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:16:55 +0000 (23:16 +0900)
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@1169 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/Tween.vb
Tween/Twitter.vb

index 06aece3..db01641 100644 (file)
@@ -4500,7 +4500,7 @@ RETRY:
         If _curPost.IsDm Then
             SourceLinkLabel.Tag = Nothing
             SourceLinkLabel.Text = ""
-            SourceLinkLabel.Visible = False
+            'SourceLinkLabel.Visible = False
         Else
             Dim mc As Match = Regex.Match(_curPost.SourceHtml, "<a href=""(?<sourceurl>.+?)""")
             If mc.Success Then
@@ -4514,8 +4514,13 @@ RETRY:
             Else
                 SourceLinkLabel.Tag = Nothing
             End If
-            SourceLinkLabel.Text = "via " + _curPost.Source
-            SourceLinkLabel.Visible = True
+            If String.IsNullOrEmpty(_curPost.Source) Then
+                SourceLinkLabel.Text = ""
+                'SourceLinkLabel.Visible = False
+            Else
+                SourceLinkLabel.Text = "via " + _curPost.Source
+                'SourceLinkLabel.Visible = True
+            End If
         End If
 
         If _statuses.Tabs(_curTab.Text).TabType = TabUsageType.DirectMessage AndAlso Not _curPost.IsOwl Then
index cad9380..4899b91 100644 (file)
@@ -2707,24 +2707,31 @@ Public Class Twitter
 
     'Source整形
     Private Sub CreateSource(ByRef post As PostClass)
-        If post.Source.StartsWith("<") Then
-            If Not post.Source.Contains("</a>") Then
-                post.Source += "</a>"
-            End If
-            post.SourceHtml = String.Copy(ShortUrl.Resolve(PreProcessUrl(post.Source)))
-            Dim mS As Match = Regex.Match(post.Source, ">(?<source>.+)<")
-            If mS.Success Then
-                post.Source = HttpUtility.HtmlDecode(mS.Result("${source}"))
-            End If
-        Else
-            If post.Source = "web" Then
-                post.SourceHtml = My.Resources.WebSourceString
-            ElseIf post.Source = "Keitai Mail" Then
-                post.SourceHtml = My.Resources.KeitaiMailSourceString
+        Try
+            If post.Source.StartsWith("<") Then
+                If Not post.Source.Contains("</a>") Then
+                    post.Source += "</a>"
+                End If
+                Dim mS As Match = Regex.Match(post.Source, ">(?<source>.+)<")
+                If mS.Success Then
+                    post.SourceHtml = String.Copy(ShortUrl.Resolve(PreProcessUrl(post.Source)))
+                    post.Source = HttpUtility.HtmlDecode(mS.Result("${source}"))
+                Else
+                    post.Source = ""
+                    post.SourceHtml = ""
+                End If
             Else
-                post.SourceHtml = String.Copy(post.Source)
+                If post.Source = "web" Then
+                    post.SourceHtml = My.Resources.WebSourceString
+                ElseIf post.Source = "Keitai Mail" Then
+                    post.SourceHtml = My.Resources.KeitaiMailSourceString
+                Else
+                    post.SourceHtml = String.Copy(post.Source)
+                End If
             End If
-        End If
+        Catch ex As Exception
+            TraceOut(post.Source)
+        End Try
     End Sub
 
     Public Function GetInfoApi(ByVal info As ApiInfo) As Boolean
@@ -2847,7 +2854,7 @@ Public Class Twitter
                 End If
                 Exit Sub
             ElseIf xElm.Element("limit") IsNot Nothing Then
-                Debug.Print("limit")
+                Debug.Print(line)
                 Exit Sub
             ElseIf xElm.Element("event") IsNot Nothing Then
                 Debug.Print("event: " + xElm.Element("event").Value)