tin  2.6.1
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.6.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

filter.c File Reference
#include "tin.h"
#include "version.h"
#include "tcurses.h"
Include dependency graph for filter.c:

Go to the source code of this file.

Macros

#define IS_READ(i)   (arts[i].status == ART_READ)
 
#define IS_KILLED(i)   (arts[i].killed)
 
#define IS_KILLED_UNREAD(i)   (arts[i].killed == ART_KILLED_UNREAD)
 
#define IS_SELECTED(i)   (arts[i].selected)
 
#define SET_FILTER(grp, i, j)
 
#define MSGID(x)   (x->refptr ? x->refptr->txt : "")
 
#define REFS(x, y)   ((y = get_references(x->refptr ? x->refptr->parent : NULL)) ? y : "")
 

Functions

static int get_choice (int x, const char *help, const char *prompt, char *list[], int list_size)
 
static int set_filter_scope (struct t_group *group)
 
static struct t_filter_commentadd_filter_comment (struct t_filter_comment *ptr, char *text)
 
static struct t_filter_commentfree_filter_comment (struct t_filter_comment *ptr)
 
static struct t_filter_commentcopy_filter_comment (struct t_filter_comment *from, struct t_filter_comment *to)
 
static t_bool add_filter_rule (struct t_group *group, struct t_article *art, struct t_filter_rule *rule, t_bool quick_filter_rule)
 
static int test_regex (const char *string, char *regex, t_bool nocase, struct regex_cache *cache)
 
static void expand_filter_array (struct t_filters *ptr)
 
static void fmt_filter_menu_prompt (char *dest, size_t dest_len, const char *fmt_str, int len, const char *text)
 
static void free_filter_item (struct t_filter *ptr)
 
static void print_filter_menu (void)
 
static void set_filter (struct t_filter *ptr)
 
static void write_filter_array (FILE *fp, struct t_filters *ptr)
 
void free_filter_array (struct t_filters *ptr)
 
t_bool read_filter_file (const char *file)
 
void write_filter_file (const char *filename)
 
t_bool filter_menu (t_function type, struct t_group *group, struct t_article *art)
 
t_bool quick_filter (t_function type, struct t_group *group, struct t_article *art)
 
t_bool quick_filter_select_posted_art (struct t_group *group, const char *subj, const char *a_message_id)
 
void unfilter_articles (struct t_group *group)
 
t_bool filter_articles (struct t_group *group)
 
t_bool filter_on_path (struct t_group *group)
 

Variables

struct t_filters glob_filter = { 0, 0, (struct t_filter *) 0 }
 
int filter_file_offset
 
static const char * ptr_filter_comment
 
static const char * ptr_filter_lines
 
static const char * ptr_filter_menu
 
static const char * ptr_filter_scope
 
static const char * ptr_filter_text
 
static const char * ptr_filter_time
 
static const char * ptr_filter_groupname
 
static char text_subj [255]
 
static char text_from [255]
 
static char text_msgid [255]
 
static char text_score [255]
 

Macro Definition Documentation

◆ IS_KILLED

#define IS_KILLED (   i)    (arts[i].killed)

Definition at line 53 of file filter.c.

◆ IS_KILLED_UNREAD

#define IS_KILLED_UNREAD (   i)    (arts[i].killed == ART_KILLED_UNREAD)

Definition at line 54 of file filter.c.

◆ IS_READ

#define IS_READ (   i)    (arts[i].status == ART_READ)

Definition at line 52 of file filter.c.

◆ IS_SELECTED

#define IS_SELECTED (   i)    (arts[i].selected)

Definition at line 55 of file filter.c.

◆ MSGID

#define MSGID (   x)    (x->refptr ? x->refptr->txt : "")

Definition at line 81 of file filter.c.

◆ REFS

#define REFS (   x,
 
)    ((y = get_references(x->refptr ? x->refptr->parent : NULL)) ? y : "")

Definition at line 82 of file filter.c.

◆ SET_FILTER

#define SET_FILTER (   grp,
  i,
 
)
Value:
if (ptr[j].score > 0) { \
arts[i].score = (SCORE_MAX - ptr[j].score >= arts[i].score) ? \
(arts[i].score + ptr[j].score) : SCORE_MAX ; \
} else { \
arts[i].score = (-SCORE_MAX - ptr[j].score <= arts[i].score) ? \
(arts[i].score + ptr[j].score) : -SCORE_MAX ; }
struct t_article * arts
Definition: memory.c:69
int score
Definition: tin.h:1550
#define SCORE_MAX
Definition: tin.h:1376

Definition at line 68 of file filter.c.

Function Documentation

◆ add_filter_comment()

static struct t_filter_comment * add_filter_comment ( struct t_filter_comment ptr,
char *  text 
)
static

◆ add_filter_rule()

static t_bool add_filter_rule ( struct t_group group,
struct t_article art,
struct t_filter_rule rule,
t_bool  quick_filter_rule 
)
static

◆ copy_filter_comment()

static struct t_filter_comment * copy_filter_comment ( struct t_filter_comment from,
struct t_filter_comment to 
)
static

◆ expand_filter_array()

static void expand_filter_array ( struct t_filters ptr)
static

Definition at line 178 of file filter.c.

References t_filters::filter, t_filters::max, my_malloc, and my_realloc.

Referenced by add_filter_rule(), and read_filter_file().

◆ filter_articles()

◆ filter_menu()

t_bool filter_menu ( t_function  type,
struct t_group group,
struct t_article art 
)

Definition at line 1061 of file filter.c.

References _, add_filter_comment(), add_filter_rule(), art, assert, atoi(), buf, cCOLS, cFilter, t_filter_rule::check_string, t_filter_rule::comment, t_filter_rule::counter, t_filter_rule::expire_time, FALSE, t_config::filter_days, FILTER_EDIT, filter_file, filter_file_offset, FILTER_FROM_CASE_IGNORE, FILTER_FROM_CASE_SENSITIVE, filter_keys, FILTER_LINES_EQ, FILTER_LINES_GT, FILTER_LINES_LT, FILTER_LINES_NO, FILTER_MSGID, FILTER_MSGID_LAST, FILTER_MSGID_ONLY, FILTER_REFS_ONLY, FILTER_SAVE, FILTER_SUBJ_CASE_IGNORE, FILTER_SUBJ_CASE_SENSITIVE, fmt_filter_menu_prompt(), forever, free_filter_comment(), t_filter_rule::from_ok, t_filter_rule::fullref, func, get_choice(), GLOBAL_ABORT, GLOBAL_MENU_FILTER_KILL, GLOBAL_QUIT, t_filter_rule::icase, INDEX_TOP, invoke_editor(), LEN, t_filter_rule::lines_cmp, t_filter_rule::lines_num, t_filter_rule::lines_ok, MAX, MAXKEYLEN, MSGID, t_filter_rule::msgid_ok, my_malloc, my_realloc, my_strdup(), my_strncpy(), t_group::name, PATH_LEN, print_filter_menu(), PrintFuncKey, prompt_menu_string(), prompt_slk_response(), ptr_filter_comment, ptr_filter_groupname, ptr_filter_lines, ptr_filter_menu, ptr_filter_scope, ptr_filter_text, ptr_filter_time, read_filter_file(), t_filter_rule::scope, t_filter_rule::score, t_config::score_kill, SCORE_MAX, t_config::score_select, show_menu_help(), signal_context, snprintf, strwidth(), t_filter_rule::subj_ok, t_filter_rule::text, text_from, text_msgid, text_score, text_subj, tinrc, TRUE, txt_all_groups, txt_filter_comment, txt_filter_score, txt_filter_score_help, txt_filter_text_type, txt_from_line_only, txt_from_line_only_case, txt_full, txt_help_filter_comment, txt_help_filter_from, txt_help_filter_lines, txt_help_filter_msgid, txt_help_filter_subj, txt_help_filter_text, txt_help_filter_text_type, txt_help_filter_time, txt_help_kill_scope, txt_help_select_scope, txt_kill_from, txt_kill_lines, txt_kill_menu, txt_kill_msgid, txt_kill_scope, txt_kill_subj, txt_kill_text, txt_kill_time, txt_last, txt_msgid_line_last, txt_msgid_line_only, txt_msgid_refs_line, txt_no, txt_only, txt_quit_edit_save_kill, txt_quit_edit_save_select, txt_refs_line_only, txt_select_from, txt_select_lines, txt_select_menu, txt_select_msgid, txt_select_scope, txt_select_subj, txt_select_text, txt_select_time, txt_subj_line_only, txt_subj_line_only_case, txt_time_default_days, txt_unlimited_time, txt_yes, and unfilter_articles().

Referenced by group_page(), show_page(), and thread_page().

◆ filter_on_path()

t_bool filter_on_path ( struct t_group group)

◆ fmt_filter_menu_prompt()

static void fmt_filter_menu_prompt ( char *  dest,
size_t  dest_len,
const char *  fmt_str,
int  len,
const char *  text 
)
static

Definition at line 1024 of file filter.c.

References buf, my_malloc, snprintf, t_filter_comment::text, and TRUE.

Referenced by filter_menu().

◆ free_filter_array()

void free_filter_array ( struct t_filters ptr)

◆ free_filter_comment()

static struct t_filter_comment * free_filter_comment ( struct t_filter_comment ptr)
static

◆ free_filter_item()

static void free_filter_item ( struct t_filter ptr)
static

◆ get_choice()

static int get_choice ( int  x,
const char *  help,
const char *  prompt,
char *  list[],
int  list_size 
)
static

◆ print_filter_menu()

◆ quick_filter()

◆ quick_filter_select_posted_art()

◆ read_filter_file()

◆ set_filter()

◆ set_filter_scope()

static int set_filter_scope ( struct t_group group)
static

◆ test_regex()

static int test_regex ( const char *  string,
char *  regex,
t_bool  nocase,
struct regex_cache cache 
)
static

◆ unfilter_articles()

◆ write_filter_array()

◆ write_filter_file()

Variable Documentation

◆ filter_file_offset

int filter_file_offset

◆ glob_filter

struct t_filters glob_filter = { 0, 0, (struct t_filter *) 0 }

◆ ptr_filter_comment

const char* ptr_filter_comment
static

Definition at line 960 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ ptr_filter_groupname

const char* ptr_filter_groupname
static

Definition at line 966 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ ptr_filter_lines

const char* ptr_filter_lines
static

Definition at line 961 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ ptr_filter_menu

const char* ptr_filter_menu
static

Definition at line 962 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ ptr_filter_scope

const char* ptr_filter_scope
static

Definition at line 963 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ ptr_filter_text

const char* ptr_filter_text
static

Definition at line 964 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ ptr_filter_time

const char* ptr_filter_time
static

Definition at line 965 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ text_from

char text_from[255]
static

Definition at line 968 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ text_msgid

char text_msgid[255]
static

Definition at line 969 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ text_score

char text_score[255]
static

Definition at line 970 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().

◆ text_subj

char text_subj[255]
static

Definition at line 967 of file filter.c.

Referenced by filter_menu(), and print_filter_menu().