Example #1
0
        public override Func <TwitterStatus, bool> GetEvaluator()
        {
            var ads = GetAccountsFromString(_screenName);

            return(_ => _.StatusType == StatusType.DirectMessage &&
                   ads.Any(ad => FilterSystemUtil.InReplyToUsers(_).Contains(ad.Id)));
        }
Example #2
0
 private bool CheckVisibleTimeline(TwitterStatus status, IEnumerable <TwitterAccount> datas)
 {
     if (status.StatusType == StatusType.DirectMessage)
     {
         return(false);
     }
     return(datas.Any(account =>
                      status.User.Id == account.Id ||
                      account.RelationData.IsFollowing(status.User.Id) ||
                      FilterSystemUtil.InReplyToUsers(status).Contains(account.Id)));
 }
Example #3
0
        internal static void EndAcceptNewArrival(TwitterStatus status)
        {
            List <TabModel> removal;
            // ignore retweet which mentions me
            var isMention = status.RetweetedOriginal == null &&
                            FilterSystemUtil.InReplyToUsers(status)
                            .Intersect(Setting.Accounts.Ids)
                            .Any();
            var isMessage    = status.StatusType == StatusType.DirectMessage;
            var alwaysAccept = (Setting.NotifyMention.Value && isMention) ||
                               (Setting.NotifyMessage.Value && isMessage);

            lock (_acceptingArrivals)
            {
                if (!_acceptingArrivals.TryGetValue(status.Id, out removal))
                {
                    return;
                }
                // end accept notification
                _acceptingArrivals.Remove(status.Id);

                if (!alwaysAccept && removal.Count == 0)
                {
                    return;
                }
            }
            var soundSource = removal
                              .Select(t => t.NotifySoundSource)
                              .Where(s => !String.IsNullOrEmpty(s))
                              .Where(File.Exists)
                              .FirstOrDefault();

            if (isMessage)
            {
                Task.Run(() => NotifyNewArrival(status, NotificationType.DirectMessage, soundSource));
            }
            else if (isMention)
            {
                Task.Run(() => NotifyNewArrival(status, NotificationType.Mention, soundSource));
            }
            else
            {
                Task.Run(() => NotifyNewArrival(status, NotificationType.Normal, soundSource));
            }
        }
Example #4
0
 public override Func <TwitterStatus, IReadOnlyCollection <long> > GetSetValueProvider()
 {
     return(s => s.StatusType == StatusType.Tweet || s.Recipient == null?
            FilterSystemUtil.InReplyToUsers(s.GetOriginal()).ToList() :
                new[] { s.Recipient.Id }.ToList());
 }