internal void CheckReplyTo(string StatusText)
{
MatchCollection m;
//ハッシュタグの保存
m = Regex.Matches(StatusText, Twitter.HASHTAG, RegexOptions.IgnoreCase);
string hstr = "";
foreach (Match hm in m)
{
if (!hstr.Contains("#" + hm.Result("$3") + " "))
{
hstr += "#" + hm.Result("$3") + " ";
HashSupl.AddItem("#" + hm.Result("$3"));
}
}
if (!string.IsNullOrEmpty(HashMgr.UseHash) && !hstr.Contains(HashMgr.UseHash + " "))
{
hstr += HashMgr.UseHash;
}
if (!string.IsNullOrEmpty(hstr)) HashMgr.AddHashToHistory(hstr.Trim(), false);
// 本当にリプライ先指定すべきかどうかの判定
m = Regex.Matches(StatusText, "(^|[ -/:-@[-^`{-~])(?<id>@[a-zA-Z0-9_]+)");
if (this._cfgCommon.UseAtIdSupplement)
{
int bCnt = AtIdSupl.ItemCount;
foreach (Match mid in m)
{
AtIdSupl.AddItem(mid.Result("${id}"));
}
if (bCnt != AtIdSupl.ItemCount) ModifySettingAtId = true;
}
// リプライ先ステータスIDの指定がない場合は指定しない
if (this.inReplyTo == null)
return;
// 通常Reply
// 次の条件を満たす場合に in_reply_to_status_id 指定
// 1. Twitterによりリンクと判定される @idが文中に1つ含まれる (2009/5/28 リンク化される@IDのみカウントするように修正)
// 2. リプライ先ステータスIDが設定されている(リストをダブルクリックで返信している)
// 3. 文中に含まれた@idがリプライ先のポスト者のIDと一致する
if (m != null)
{
var inReplyToScreenName = this.inReplyTo.Item2;
if (StatusText.StartsWith("@", StringComparison.Ordinal))
{
if (StatusText.StartsWith("@" + inReplyToScreenName, StringComparison.Ordinal)) return;
}
else
{
foreach (Match mid in m)
{
if (StatusText.Contains("RT " + mid.Result("${id}") + ":") && mid.Result("${id}") == "@" + inReplyToScreenName) return;
}
}
}
this.inReplyTo = null;
}