Skip to content
Permalink
Browse files

RTと同様にふぁぼをリスト内に一件づつ表示

  • Loading branch information...
upsilon committed Mar 19, 2014
1 parent 97e00c3 commit 697771fb4041f0ab83b22224d31b003f85962f4a
Showing with 31 additions and 3 deletions.
  1. +2 −0 OpenTween/StatusDictionary.cs
  2. +15 −3 OpenTween/Tween.cs
  3. +14 −0 OpenTween/Twitter.cs
@@ -80,6 +80,8 @@ public override int GetHashCode()
public bool FilterHit { get; set; }
public string RetweetedBy { get; set; }
public long? RetweetedId { get; set; }
public string FavoritedBy { get; set; }
public long? FavoritedId { get; set; }
private bool _IsDeleted = false;
private StatusGeo _postGeo = new StatusGeo();
public int RetweetedCount { get; set; }
@@ -5077,25 +5077,37 @@ private ListViewItem CreateItem(TabPage Tab, PostClass Post, int Index)
//if (Post.InReplyToStatusId != null) mk.Append("⇒");
if (Post.FavoritedCount > 0) mk.Append("+" + Post.FavoritedCount.ToString());
ImageListViewItem itm;
if (Post.RetweetedId == null)
if (Post.RetweetedId != null)
{
string[] sitem= {"",
Post.Nickname,
Post.IsDeleted ? "(DELETED)" : Post.TextSingleLine,
Post.CreatedAt.ToString(this._cfgCommon.DateTimeFormat),
Post.ScreenName,
Post.ScreenName + Environment.NewLine + "(RT:" + Post.RetweetedBy + ")",
"",
mk.ToString(),
Post.Source};
itm = new ImageListViewItem(sitem, this.IconCache, Post.ImageUrl);
}
else if (Post.FavoritedId != null)
{
string[] sitem = {"",
Post.Nickname,
Post.IsDeleted ? "(DELETED)" : Post.TextSingleLine,
Post.CreatedAt.ToString(this._cfgCommon.DateTimeFormat),
Post.ScreenName + Environment.NewLine + "(Fav:" + Post.FavoritedBy + ")",
"",
mk.ToString(),
Post.Source};
itm = new ImageListViewItem(sitem, this.IconCache, Post.ImageUrl);
}
else
{
string[] sitem = {"",
Post.Nickname,
Post.IsDeleted ? "(DELETED)" : Post.TextSingleLine,
Post.CreatedAt.ToString(this._cfgCommon.DateTimeFormat),
Post.ScreenName + Environment.NewLine + "(RT:" + Post.RetweetedBy + ")",
Post.ScreenName,
"",
mk.ToString(),
Post.Source};
@@ -3484,6 +3484,8 @@ private void userStream_StatusArrived(string line)
this.NewPostFromStream(this, EventArgs.Empty);
}

private readonly DateTime TwitterEpoch = new DateTime(2010, 11, 4, 1, 42, 54, DateTimeKind.Unspecified);

private void CreateEventFromJson(string content)
{
TwitterStreamEvent eventData = null;
@@ -3500,6 +3502,18 @@ private void CreateEventFromJson(string content)
MyCommon.TraceOut(ex, "Event Exception!" + Environment.NewLine + content);
}

if (eventData.Event == "favorite")
{
var post = this.CreatePostsFromStatusData(eventData.TargetObject);
post.FavoritedBy = eventData.Source.ScreenName;
post.FavoritedId = eventData.Source.Id;

// 適当にIDを生成する
post.StatusId = ((long)(MyCommon.DateTimeParse(eventData.CreatedAt).ToUniversalTime() - TwitterEpoch).TotalMilliseconds) << 22;

TabInformations.GetInstance().AddPost(post);
}

var evt = new FormattedEvent();
evt.CreatedAt = MyCommon.DateTimeParse(eventData.CreatedAt);
evt.Event = eventData.Event;

0 comments on commit 697771f

Please sign in to comment.
You can’t perform that action at this time.