% lessee if these works... % translate English dates into Finnish % (not necessary if using 0.9.7.0+ or patches for earlier versions) % and yes, this function is ugly, but that's just cause I haven't properly % rewritten it for S-Lang 1.3.5+ define translate_day (day) { switch (day) { case "Mon,": return "Maanantaina "; } { case "Tue,": return "Tiistaina "; } { case "Wed,": return "Keskiviikkona "; } { case "Thu,": return "Torstaina "; } { case "Fri,": return "Perjantaina "; } { case "Sat,": return "Lauantaina "; } { case "Sun,": return "Sunnuntaina "; } } define translate_month (month) { switch (month) { case "Jan" or case "January": return "tammikuuta "; } { case "Feb" or case "February": return "helmikuuta "; } { case "Mar" or case "March": return "maaliskuuta "; } { case "Apr" or case "April": return "huhtikuuta "; } { case "May": return "toukokuuta "; } { case "Jun" or case "June": return "kesäkuuta "; } { case "Jul" or case "July": return "heinäkuuta "; } { case "Aug" or case "August": return "elokuuta "; } { case "Sep" or case "September": return "syyskuuta "; } { case "Oct" or case "October": return "lokakuuta "; } { case "Nov" or case "November": return "marraskuuta "; } { case "Dec" or case "December": return "joulukuuta "; } } define translate_date() { variable orig=extract_article_header("date"); variable n,t=0,i=0; variable new=""; n = strchop (orig, ' ', 0); if (string_match(n[i],"^[MTWFS][a-z][a-z],",1)) { new += translate_day(n[i]); i++; new += n[i]+". "; } else { new += n[i]+". "; t=1; } i++; new += translate_month(n[i]); i++; new += n[i]+" "; i++; if(length(n)==6 or t==1) new += n[i]+" "; if(length(n)==7) { i++; new += n[i]+" ";} % DST! i++; new += n[i]; return new; } % Finnish attribution for Finnish groups, sort by score in c.i.w.a.* define article_mode_hook () { variable attribution = "%r <%f> informed\n%n with the following:"; variable sig = ".Sig/foo"; variable sort = 1; % variable hiscore = 1; variable dateformat = "%1e %B %Y %R %Z"; variable locale = "C"; if (is_substr (current_newsgroup (), "sfnet") or is_substr (current_newsgroup (), "finet") or is_substr (current_newsgroup (), "hy.")) { attribution = "%r <%f> kirjoitti seuraavaa:"; sig = ".Sig/bar"; } if (is_substr (current_newsgroup (), "sodat") or string_match (current_newsgroup(), "^hy\.nurkka\.flame", 1) or string_match (current_newsgroup(), "^sfnet\.keskustelu\.varaventtiili",1)) { attribution = "%r <%f> pläjäytti seuraavaa:"; sig = ".Sig/spam"; } if (is_substr (current_newsgroup (), "test")) { dateformat = "%1e. %Bta %Y %R %Z"; locale = "fi_FI.ISO8859-1"; attribution = "%D testaili\n%r <%f> seuraavaa:"; } if (string_match (current_newsgroup(), "^comp\.infosystems\.www\.authoring.*", 1)) { % hiscore = 9000; sort=5; } set_integer_variable("sorting_method", sort); % set_integer_variable("min_high_score", hiscore); set_string_variable ("followup",attribution); set_string_variable ("signature",sig); set_string_variable ("followup_date_format",dateformat); setlocale (LC_TIME, locale); } define followup_hook() { variable attribution = get_variable_value("followup"); if (is_substr(current_newsgroup(), "test")) { % attribution = translate_date() + " testaili\n%r <%f> seuraavaa:"; set_string_variable ("followup", attribution); } } % kill whole thread from middle of it. define mark_whole_thread_read () { if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); collapse_thread (); call ("delete"); } definekey ("mark_whole_thread_read", "\eK", "article"); % mark whole thread unread from middle of it. define mark_whole_thread_unread () { if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); collapse_thread (); call ("undelete"); } definekey ("mark_whole_thread_unread", "Z", "article"); % mark article/thread read without jumping to next unread. define mark_read() { variable status; if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); set_header_flags(get_header_flags () | HEADER_READ); if(thread_size() > 1) { uncollapse_thread (); loop(thread_size() - 1) { () = header_down(1); set_header_flags(get_header_flags () | HEADER_READ); } collapse_thread (); } } definekey("mark_read","D","article"); define urlencode(str) { variable len = strlen (str); !if (len) return; variable new_str = ""; variable ch, chlo, i; for (i = 0; i < len; i++) { ch = str [i]; chlo = ch | 0x20; if ((chlo > 'z') or (chlo < 'a')) ch = Sprintf ("%%%02X", ch, 1); else ch = char (ch); new_str = strcat (new_str, ch); } return new_str; } % Author profile via Deja News define author_profile () { if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); variable browser = "lynx"; variable url = "http://www.deja.com/=dnc/"; variable cgi = "profile.xp?author="; variable str, new_str; variable cmd; str = extract_article_header("from"); str = read_mini ("Author Profile: ","", str); new_str = urlencode(str); cmd = Sprintf ("%s '%s%s%s'", browser, url, cgi, new_str, 4); () = system (cmd); } definekey("author_profile","^A","article"); define viewpic() { if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); pipe_article ("(slrn-uudecode --stdout --guess | xv - &) <&0"); } definekey ("viewpic","\e[11","article"); % F1 definekey ("viewpic","ä", "article"); define urlview() { if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); pipe_article ("urlview"); } definekey("urlview","[9~","article"); %F10 (Amiga) definekey("urlview","[24~","article");%F12 (PC/AT) % couple tin-like keybindings define tin_space_key_cmd () { if (is_group_mode ()) error (_function_name () + " doesn't work in group mode!"); !if (is_article_visible ()) { ERROR_BLOCK { _clear_error (); header_bob (); } call ("pagedn"); return; } call ("article_pagedn"); } definekey ("tin_space_key_cmd", " ", "article"); % Using UP/DOWN arrow keys in group mode causes a wrap at % ends of the buffer. define tin_group_up () { !if (group_up_n (1)) group_eob (); } define tin_group_down () { !if (group_down_n (1)) group_bob (); } define hide_art_or_quit () { variable last=0; if (is_group_mode ()) return; % just to make sure. !if (header_next_unread ()) last=1; if (is_article_visible () and last!=1) call ("hide_article"); else call ("quit"); } definekey ("hide_art_or_quit", "q", "article"); %definekey ("hide_art_or_quit", "0D", "article"); definekey ("hide_art_or_quit", "", "article"); define call_browser () { variable Null_String = ""; variable cmd = Null_String; variable browser = "lynx"; variable url = read_mini ("give an URL", Null_String, Null_String); if (strlen (url)) { cmd = Sprintf ("%s %s", browser, url, 2); () = system (cmd); } } define browse () { ERROR_BLOCK { _clear_error (); call_browser (); } call ("browse_url"); } definekey ("browse", "U", "article"); define follow_and_reply () { variable cc_followup_status = get_variable_value ("cc_followup"); if (cc_followup_status != 1) set_integer_variable ("cc_followup", 1); call ("followup"); set_integer_variable ("cc_followup", cc_followup_status); } definekey ("follow_and_reply", "^f", "article"); define resize_screen_hook () % old slrn %{ % set_integer_variable ("author_field_width", SCREEN_WIDTH / 5); %} % 0.9.5.x { variable format="%F%-5l %-5S %t%"+string(SCREEN_WIDTH/2)+"s%-"+ string(SCREEN_WIDTH/5)+"g%r"; set_header_display_format (0, format); } % spam address detector define reply_hook() { variable address=extract_article_header("Reply-To"); if(address=="") address=extract_article_header("From"); if(string_match(address, "spam",1) or string_match(address, "remove",1) or string_match(address, "poista",1) or string_match(address,"\.invalid",1)) % add other keywords if needed if(get_yes_no_cancel(address+" looks bogus, give up?")) error("Reply cancelled."); } % This function prompts for a search string and then calls Digital's % AltaVista search engine. define altavista_search () { variable browser="lynx"; variable url = "http://www.altavista.digital.com/"; variable cgi = "cgi-bin/query?pg=q&what=news&fmt=.&q="; variable str, new_str, len, ch, chlo, i; variable cmd; str = strcat ("+newsgroups:", current_newsgroup ()); str = strcat (str, " +"); str = read_mini ("AltaVista Search: ","", str); new_str = urlencode(str); cmd = Sprintf ("%s '%s%s%s'", browser, url, cgi, new_str, 4); () = system (cmd); } definekey ("altavista_search", "^", "article"); define tag_header () { set_header_flags (get_header_flags () | HEADER_TAGGED); } define untag_header () { set_header_flags (get_header_flags () & ~(HEADER_TAGGED)); } define header_number_hook () { tag_header (); } define tag_via_subject_regexp () { variable str; variable count = 0; str = read_mini ("Tag subjects pattern: ", ""); !if (strlen (str)) return; call ("mark_spot"); uncollapse_threads (); while (re_fsearch_subject (str)) { tag_header (); count++; !if (header_down (1)) break; } collapse_threads (); call ("exchange_mark"); message (Sprintf ("%d headers marked.", count, 1)); } definekey ("tag_via_subject_regexp", "%", "article"); % Move automatically to next newsgroup with unread articles define group_next_unread() { variable no_articles=1; if (not(is_group_mode ())) call("quit"); % be sure we're in % groupmode do { if (group_unread() == 0) group_down_n(1); else if (select_group() == -1) group_down_n(1); else no_articles=0; } while (no_articles); } definekey ("group_next_unread()"," ","group"); %definekey ("group_next_unread()","N","article"); define execute_slang () { variable str; str = read_mini ("S-Lang> ", "", ""); !if (strlen (str)) return; eval (str); } definekey ("execute_slang", ":", "group"); definekey ("execute_slang", ":", "article"); % Override sig elimination define followup_with_sig() { set_integer_variable("followup_strip_signature",0); call("followup"); set_integer_variable("followup_strip_signature",1); } definekey("followup_with_sig","\eF","article"); define reply_with_sig() { set_integer_variable("followup_strip_signature",0); call("reply"); set_integer_variable("followup_strip_signature",1); } %definekey("reply_with_sig","\eR","article"); define confirm_quit() { if(get_yes_no_cancel("Really quit")) call("quit"); else message("Wonderful!"); } definekey("confirm_quit","","group"); define make_from_string_hook () { return "Heikki Kantola "; } % Turn on ASCII emulated thread trees define use_ascii_trees() { set_integer_variable("simulate_graphic_chars",1); } definekey("use_ascii_trees","[15~", "group"); % F5 definekey("use_ascii_trees","[15~", "article"); % F5 % Smart parent article fetching % Not ready yet... define fetch_parent() { if (is_group_mode ()) return; % just to make sure. if(call("get_parent_header")) { % ok, no need to use Google } else % old article, let's dig it from Google { variable browser="lynx"; variable google="http://groups.google.com/groups?q=msgid%3A"; variable msgids=extract_article_header("References"); } }