OSDN Git Service

返信All時に、@idが小文字にならないように変更
authorkiri_feather <kiri_feather@users.sourceforge.jp>
Fri, 3 Sep 2010 10:29:44 +0000 (10:29 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:15:11 +0000 (23:15 +0900)
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@808 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/Tween.vb
Tween/Twitter.vb

index 1dee4b5..0d3a8a1 100644 (file)
@@ -5686,7 +5686,12 @@ RETRY:
                                 For Each nm As String In post.ReplyToList
                                     If Not ids.Contains("@" + nm + " ") AndAlso _
                                        Not nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
-                                        ids += "@" + nm + " "
+                                        Dim m As Match = Regex.Match(post.Data, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase)
+                                        If m.Success Then
+                                            ids += "@" + m.Result("${id}") + " "
+                                        Else
+                                            ids += "@" + nm + " "
+                                        End If
                                     End If
                                 Next
                             End If
@@ -5728,7 +5733,12 @@ RETRY:
                         For Each nm As String In post.ReplyToList
                             If Not ids.Contains("@" + nm + " ") AndAlso _
                                Not nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
-                                ids += "@" + nm + " "
+                                Dim m As Match = Regex.Match(post.Data, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase)
+                                If m.Success Then
+                                    ids += "@" + m.Result("${id}") + " "
+                                Else
+                                    ids += "@" + nm + " "
+                                End If
                             End If
                         Next
                         If Not String.IsNullOrEmpty(post.RetweetedBy) Then
index fc43a63..16a2b48 100644 (file)
@@ -2405,9 +2405,8 @@ Public Class Twitter
 
         Dim m As Match = Regex.Match(retStr, "(^|[^a-zA-Z0-9_])[@@]([a-zA-Z0-9_]{1,20})")
         While m.Success
-            AtList.Add(m.Result("$2").ToLower)
+            If Not AtList.Contains(m.Result("$2").ToLower) Then AtList.Add(m.Result("$2").ToLower)
             m = m.NextMatch
-
         End While
         '@先をリンクに置換
         retStr = Regex.Replace(retStr, "(^|[^a-zA-Z0-9_/])([@@])([a-zA-Z0-9_]{1,20})", "$1$2<a href=""/$3"">$3</a>")