예제 #1
0
 protected override bool FilterStatus(TwitterStatusBase status)
 {
     var ts = status as TwitterStatus;
     if (ts == null) return false;
     if (ts.User.ScreenName == User1)
     {
         if (ts.InReplyToScreenName == User2 ||
             TweetModel.GetExtraData(ts.Id).InReplyFromUserScreenNameContains(User2) ||
             ts.Text.Contains("@" + User2))
             return true;
         else
             return false;
     }
     else if (ts.User.ScreenName == User2)
     {
         if (ts.InReplyToScreenName == User1 ||
             TweetModel.GetExtraData(ts.Id).InReplyFromUserScreenNameContains(User1) ||
             ts.Text.Contains("@" + User1))
             return true;
         else
             return false;
     }
     else
         return false;
 }
예제 #2
0
 protected override bool FilterStatus(TwitterStatusBase status)
 {
     var ts = status as TwitterDirectMessage;
     if (ts == null) return false;
     return (ts.Sender.ScreenName == User1 && ts.Recipient.ScreenName == User2) ||
         (ts.Sender.ScreenName == User2 && ts.Recipient.ScreenName == User1);
 }
예제 #3
0
 public LocalNGViewModel(TabData tabData, TwitterStatusBase status)
 {
     this._tabdata = tabData;
     this._status = status;
     this._selectedText = String.Empty;
     RejectModeIndex = 0;
 }
예제 #4
0
 public static bool IsInReplyToMeCurrent(TwitterStatusBase status)
 {
     if (IsInReplyToMeCurrentStrict(status)) return true;
     var ctab = CommonEventServer.CurrentTabData;
     if (ctab == null) return false;
     return ctab.LinkAccounts.Any((a) =>
         Regex.IsMatch(status.Text, "@" + a + "(?![a-zA-Z0-9_])", RegexOptions.Singleline | RegexOptions.IgnoreCase));
 }
예제 #5
0
 internal static TwitterUser SuggestedUser(TwitterStatusBase status)
 {
     if (status == null) return null;
     if (Analyzer.PublishedByRetweet(status as TwitterStatus))
         return ((TwitterStatus)status).RetweetedOriginal.User;
     else
         return status.User;
 }
예제 #6
0
 private bool CheckFilter(TwitterStatusBase status)
 {
     try
     {
         return Filter != null ? Filter.Filter(status) : true;
     }
     catch (Exception e)
     {
         InformServer.Report("フィルタの適用時にエラーが発生しました: " + e.Message, InformServer.NotifyLevel.Error);
         return false;
     }
 }
예제 #7
0
 /// <summary>
 /// このフィルタクラスタに所属するフィルタについて、フィルタ条件に合致するかの判定を行います。<para />
 /// Negateは内部で考慮されます。<para />
 /// フィルタが一つもない場合は、U=∅のときの∀(AND)、∃(OR)のBoolean値に準じます。<para />
 /// (ANDのとき:TRUE ORのとき:FALSE)
 /// </summary>
 /// <param name="status">フィルタテストするステータス</param>
 /// <returns>ステータスがフィルタに合致するか</returns>
 public bool Filter(TwitterStatusBase status)
 {
     if (_filters != null)
     {
         foreach (var f in _filters)
         {
             // ANDのとき => FALSEに出会ったらFALSEを返す
             // ORのとき => TRUEに出会ったらTRUEを返す 
             if (f.Filter(status) == ConcatenateOR)
                 return ConcatenateOR == !Negate;
         }
     }
     // ANDのとき => FALSEに出会っていないのでTRUEを返す
     // ORのとき => TRUEに出会っていないのでFALSEを返す
     return !ConcatenateOR == !Negate;
 }
예제 #8
0
 public static bool IsInReplyToMeStrict(TwitterStatusBase status)
 {
     var s = status as TwitterStatus;
     if (s != null)
     {
         return AccountModel.GetAccountElements().Any((d) =>
             d.CredentialInfo.UserScreenName == s.InReplyToScreenName);
     }
     else
     {
         var dm = status as TwitterDirectMessage;
         if (dm != null)
         {
             return AccountModel.GetAccountElements().Any((d) =>
                 d.CredentialInfo.UserScreenName == dm.Recipient.ScreenName);
         }
         else
         {
             return false;
         }
     }
 }
예제 #9
0
 /// <summary>
 /// フィルタを適用します。
 /// </summary>
 /// <returns>フィルタを通過したか</returns>
 public bool Filter(TwitterStatusBase status)
 {
     return FilterStatus(status) == !Negate;
 }
예제 #10
0
 internal static void RaiseSelectedStatusChanged(TwitterStatusBase selected)
 {
     dispatcher.BeginInvoke(() =>
     {
         CurrentSelectedStatus = selected;
         CurrentSelectedStatusChanged(selected);
     });
 }
 public UserSelectInteraction(InteractionKind kind, TwitterStatusBase status, Action<IEnumerable<AccountElement>> callback)
 {
     this.Kind = kind;
     this.Status = status;
     this.Callback = callback;
 }
예제 #12
0
 internal static void RaiseSelectedStatusChanged(TwitterStatusBase selected)
 {
     CurrentSelectedStatus = selected;
     CurrentSelectedStatusChanged(selected);
 }
예제 #13
0
 public InputInteractionDescriptor(TwitterStatusBase inReplyTo, bool setFocus = true)
     : this(null, inReplyTo, CursorPoint.End , setFocus) { }
예제 #14
0
 public InputInteractionDescriptor(string text, TwitterStatusBase inReplyTo = null, CursorPoint cp = CursorPoint.Begin, bool setFocus = true)
 {
     this.Text = text;
     this.InReplyTo = inReplyTo;
     this.NewCursorPoint = cp;
     this.SetFocus = setFocus;
 }
예제 #15
0
 public static bool IsInReplyToMeCurrentStrict(TwitterStatusBase status)
 {
     var ctab = CommonEventServer.CurrentTabData;
     if (ctab == null) return false;
     var s = status as TwitterStatus;
     if (s != null)
     {
         return ctab.LinkAccounts.Any((a) =>
             a == s.InReplyToScreenName);
     }
     else
     {
         var dm = status as TwitterDirectMessage;
         if (dm != null)
         {
             return ctab.LinkAccounts.Any((a) =>
                 a == dm.Recipient.ScreenName);
         }
         else
         {
             return false;
         }
     }
 }
예제 #16
0
 protected abstract bool FilterStatus(TwitterStatusBase status);
예제 #17
0
 void TweetServerModel_ReceivedStatus(TwitterStatusBase obj)
 {
     if (CheckFilter(obj))
     {
         try
         {
             rwLock.EnterWriteLock();
             internalStorage.Add(obj);
         }
         finally
         {
             rwLock.ExitWriteLock();
         }
         AddTweet(obj);
     }
 }
예제 #18
0
 public static bool IsInReplyToMe(TwitterStatusBase status)
 {
     if (IsInReplyToMeStrict(status)) return true;
     return AccountModel.GetAccountElements().Any((d) =>
         Regex.IsMatch(status.Text, "@" + d.CredentialInfo.UserScreenName + "(?![a-zA-Z0-9_])", RegexOptions.Singleline | RegexOptions.IgnoreCase));
 }