[PATCH] filter issues

Dennis Preiser <[email protected]> Sun, 7 Mar 2010 18:38:48 +0100
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
Attached patch, which has to be applied over my last patch, includes the
following changes:

- Reworked the postprocessing after invocation of any FILTER action:
	- unfilter_articles() is needed in all cases, otherwise an formerly
	  HOT article keeps the 'selected' mark after killing (resulting
	  score == 0).
	- filter_article() returns TRUE only if articles were killed. If an
	  article was HOT, the resulting score after killing is 0 and
	  filter_articles() returns FALSE. Removed the if (){} around
	  filter_article() to not skip make_threads() in that cases.

	Try this with sort_threads_type=1 to see what I mean:

	At group level: mark a thread with score == 0 as selected with '[',
	confirm with Y. The thread does not move according to the new score.
	Now mark this thread as killed with ']', confirm with Y. The 'HOT'
	mark remains on screen.

- Inserted an art_mark(X, X, ART_UNREAD) call in
  filter.c:unfilter_articles(). filter_articles() already does
  art_mark(X, X, ART_READ), so we have to do the opposit in
  unfilter_articles(). Steps to show what's wrong:

	set up a filter like this:

	group=*
	case=0
	score=kill
	lines=>0

	Enter a group. All articles with at least one line are killed (as
	expected). 'E'dit the filter file and remove that filter entry. All
	articles are shown as unread (OK). Now, leave the group. No articles
	are indicated as unread for this group.  Enter the group again -> no
	unread articles.

  Now, after leaving the group, the unread count is correct and entering
  the group again shows all unread articles.

  In addition, art_mark() is only called when the article was unread
  before killing. This prevents killed read articles from beeing tagged
  as unread in unfilter_articles().

  To ensure an correct art->killed status, ART_KILLED_UNREAD gets
  changed to ART_KILLED when reading an (killed) article.

- The behaviour after applying filter rules has changed a little bit.
  Now, we are leaving thread/page level only if we lost the
  article/thread. If the article/thread is still present, we stay in the
  current level. Thereby, filtered_articles (global var) is no longer
  needed (removed).

  If this is not acceptable, I will prepare a patch to switch back to
  the old behaviour: If filter_articles() returnes TRUE, leave the
  current level regardless whether we lost the article/thread or not.

- Moved an info_message() in group.c:group_page() (never shown before
  because show_group_page() clears the screen immediately) and added
  that info_message() to page.c:show_page() for GLOBAL_QUICK_FILTER_*.

- Inserted an clear_message() in filter_articles().

Dennis
20100307.diff.gz (application/x-gunzip, 3.8 KB) - not displayed