OSDN Git Service

自分宛のリプライの場合に先頭の「@... 」を除去する (in_reply_to_status_id は保持する)
authorKimura Youichi <kim.upsilon@bucyou.net>
Sun, 29 Oct 2017 11:29:26 +0000 (20:29 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sun, 29 Oct 2017 11:29:26 +0000 (20:29 +0900)
OpenTween/Resources/ChangeLog.txt
OpenTween/Tween.cs

index 62ca51c..678b702 100644 (file)
@@ -1,6 +1,7 @@
 更新履歴
 
 ==== Ver 1.4.0-dev(2017/xx/xx)
+ * NEW: 自分宛のリプライを送信する場合に先頭の「@... 」を除去します (返信先ツイートの情報は維持したまま投稿されます)
  * NEW: サムネイル画像のコンテキストメニューに「開く」「URLをコピー」を追加
  * NEW: ウィンドウ上部の「その他機能」メニューに「投稿設定」を追加
   - 右下の ▼ (POST動作切り替えメニュー) と同じ内容のメニューが表示されます
index f941185..53c3d96 100644 (file)
@@ -4757,6 +4757,14 @@ namespace OpenTween
             if (statusText.Contains("RT @"))
                 disableFooter = true;
 
+            // 自分宛のリプライの場合は先頭の「@screen_name 」の部分を除去する (in_reply_to_status_id は維持される)
+            if (this.inReplyTo != null && this.inReplyTo.Item2 == this.tw.Username)
+            {
+                var mentionSelf = $"@{this.tw.Username} ";
+                if (statusText.Length > mentionSelf.Length && statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase))
+                    statusText = statusText.Substring(mentionSelf.Length);
+            }
+
             var header = "";
             var footer = "";