Exemple #1
0
 public static bool IsRetweetedThis(TwitterStatus status)
 {
     if (status == null) return false;
     var sd = TweetModel.GetExtraData(status).RetweetTable;
     if (sd == null) return false;
     var dat = sd.Select((d) => d.Key.ScreenName).ToArray();
     return AccountModel.GetAccountElements().Any((d) => dat.Contains(d.CredentialInfo.UserScreenName));
 }
Exemple #2
0
 public static bool IsFavoredThisWithCurrent(TwitterStatus status)
 {
     if (status == null) return false;
     var ctab = CommonEventServer.CurrentTabData;
     if (ctab == null) return false;
     var dat = TweetModel.GetExtraData(status);
     return ctab.LinkAccounts.Any((a) => dat.IsFavored(a));
 }
Exemple #3
0
 public static bool IsRetweetedThisWithCurrent(TwitterStatus status)
 {
     if (status == null) return false;
     var ctab = CommonEventServer.CurrentTabData;
     if (ctab == null) return false;
     var sd = TweetModel.GetExtraData(status).RetweetTable;
     if (sd == null) return false;
     var dat = sd.Select((d) => d.Key.ScreenName).ToArray();
     return ctab.LinkAccounts.Any((a) => dat.Contains(a));
 }
Exemple #4
0
 /// <summary>
 /// Create twitter status from search api node
 /// </summary>
 public static TwitterStatus CreateBySearchNode(XElement sNode)
 {
     var ts = new TwitterStatus();
     ts.Id = sNode.Element("id").ParseLong();
     ts.Truncated = false;
     ts.Text = sNode.Element("text").ParseString();
     ts.Source = sNode.Element("source").ParseString();
     ts.Favorited = false;
     ts.CreatedAt = sNode.Element("created_at").ParseDateTime("ddd MMM d HH':'mm':'ss zzz yyyy");
     ts.InReplyToStatusId = 0;
     ts.InReplyToUserId = sNode.Element("to_user_id").ParseLong();
     ts.InReplyToScreenName = sNode.Element("to_user").ParseString();
     ts.Kind = StatusKind.SearchResult;
     ts.User = TwitterUser.CreateBySearchNode(sNode);
     return ts;
 }
Exemple #5
0
 /// <summary>
 /// ツイートを公式リツイートします。(非同期)
 /// </summary>
 /// <param name="accelems">使用するアカウントの列挙</param>
 /// <param name="status">リツイートするステータス</param>
 public static void Retweet(IEnumerable<AccountElement> accelems, TwitterStatus status)
 {
     Melchior.Retweet(accelems, status);
 }
Exemple #6
0
 private void RetweetSink(IEnumerable<AccountElement> descriptors, TwitterStatus status)
 {
     Parallel.ForEach(descriptors,
         (d) =>
         {
             if (Executive.ExecApi(() => d.CredentialInfo.Retweet(status.Id)) != null)
             {
                 var td = d.TwitterUserData;
                 if (td != null)
                 {
                     if (status.RetweetedOriginal != null)
                     {
                         TweetModel.GetExtraData(status.RetweetedOriginal).AddRetweet(td, DateTime.Now);
                     }
                     else
                     {
                         TweetModel.GetExtraData(status).AddRetweet(td, DateTime.Now);
                     }
                 }
             }
             else
             {
                 InformServer.Report("Retweetできませんでした(@" + d.CredentialInfo.UserScreenName + ")", InformServer.NotifyLevel.Error);
             }
         });
     InformServer.Report("Retweetしました:" + status.ToString(), InformServer.NotifyLevel.Note);
 }
Exemple #7
0
 internal void Retweet(IEnumerable<AccountElement> descriptors, TwitterStatus status)
 {
     Task.Factory.StartNew(() => RetweetSink(descriptors, status), TaskCreationOptions.LongRunning);
 }
Exemple #8
0
 public static bool IsFavoredThis(TwitterStatus status)
 {
     if (status == null) return false;
     var dat = TweetModel.GetExtraData(status);
     return AccountModel.GetAccountElements().Any((d) => dat.IsFavored(d.CredentialInfo.UserScreenName));
 }
Exemple #9
0
 public static bool IsMyCurrentTweet(TwitterStatus status)
 {
     var ctab = CommonEventServer.CurrentTabData;
     if (ctab == null) return false;
     return ctab.LinkAccounts.Any((a) => a == status.User.ScreenName);
 }
Exemple #10
0
 public static bool IsMyTweet(TwitterStatus status)
 {
     return AccountModel.GetAccountElements()
         .Any((d) => status.User.ScreenName == d.CredentialInfo.UserScreenName);
 }
Exemple #11
0
 public static bool PublishedByRetweet(TwitterStatus status)
 {
     return status != null && status.PublishedByRetweet;
 }