% -*- slang -*- % This macro allows one to "temporarily score" the current newsgroup based % on subject, author or body. It binds the function 'temp_score_newsgroup' % to the '%' key in article mode. % The following variables can be used to influence the macro's behaviour: % score - score that will be given to any article matching the search % additive - if nonzero, the macro will add "score" to existing scores; % if zero, it will simply overwrite them variable score = 5000; variable additive = 1; variable Search_Last_Art_Search_Str = ""; define temp_score_newsgroup () { variable str; variable deleted; variable mode; variable metamail; % Turn off use_metamail while searching metamail = get_variable_value("use_metamail"); set_integer_variable("use_metamail",0); mode = get_response ("aAbBsS", "Temporarily score based on "+ "\001Author, \001Body or \001Subject?"); str = read_mini ("Score on regexp", Search_Last_Art_Search_Str, ""); if (str == "") return; Search_Last_Art_Search_Str = str; uncollapse_threads (); while(header_up(1)); if ((mode == 'b') or (mode == 'B')) { do % cycle through all articles, scanning their bodies { deleted = (get_header_flags() & HEADER_READ); if (re_search_article (str)) { pop (); if (additive) set_header_score(get_header_score + score); else set_header_score(score); } else !if (additive) set_header_score(0); !if (deleted) set_header_flags (get_header_flags() & ~(HEADER_READ)); call ("hide_article"); } while (header_down(1)); } else { !if (additive) % set all scores to 0 first { do set_header_score(0); while (header_down(1)); while (header_up(1)); } switch(mode) % search for matching articles { case 'a' or case 'A' : while (re_fsearch_author(str)) { set_header_score(get_header_score + score); !if (header_down(1)) break; } } { case 's' or case 'S' : while (re_fsearch_subject(str)) { set_header_score(get_header_score + score); !if (header_down(1)) break; } } } collapse_threads(); ungetkey(typecast((string(get_variable_value("sorting_method"))), Integer_Type)); call("toggle_sort"); while (header_up(1)); set_integer_variable("use_metamail", metamail); % restore metamail setting } definekey ("temp_score_newsgroup", "%", "article");