[Tween-svn] [1169] 不正なSourceに対応(例:amaz_sales)

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 12月 6日 (月) 15:25:49 JST


Revision: 1169
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1169
Author:   kiri_feather
Date:     2010-12-06 15:25:49 +0900 (Mon, 06 Dec 2010)

Log Message:
-----------
不正なSourceに対応(例:amaz_sales)

Modified Paths:
--------------
    trunk/Tween/Tween.vb
    trunk/Tween/Twitter.vb


-------------- next part --------------
Modified: trunk/Tween/Tween.vb
===================================================================
--- trunk/Tween/Tween.vb	2010-12-04 02:32:34 UTC (rev 1168)
+++ trunk/Tween/Tween.vb	2010-12-06 06:25:49 UTC (rev 1169)
@@ -4500,7 +4500,7 @@
         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 @@
             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

Modified: trunk/Tween/Twitter.vb
===================================================================
--- trunk/Tween/Twitter.vb	2010-12-04 02:32:34 UTC (rev 1168)
+++ trunk/Tween/Twitter.vb	2010-12-06 06:25:49 UTC (rev 1169)
@@ -2707,24 +2707,31 @@
 
     '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 @@
                 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)



Tween-svn メーリングリストの案内
Back to archive index