[tin 1.7.x] a few new functions/keybindings

Urs Janßen <[email protected]>
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
the attached patch (over the last snapshot) adds GLOBAL_PRINT ('o')
to the thread-level and introduces {SELECT,THREAD}_EDIT_FILTER ('E').
I didn't combine *_EDIT_FILTER to a single 'keyname/event' as I'd like
to have an auto-update mechanism first - I've documented the need of a
'join' (and a few other bus and flaws) in the TODO-file.

urs
-- 
"Only whimps use tape backup: _real_ men just upload their important stuff
 on ftp, and let the rest of the world mirror it ;)" - Linus
tin-1.7.8.snaptotin-1.7.8.diff (text/plain, 15.4 KB)
-----------------------------------------------------------------------------
 doc/CHANGES       |   10 ++++++----
 doc/TODO          |   19 ++++++++++++++++---
 doc/keymap.sample |    2 ++
 doc/tin.1         |    1 +
 doc/tin.5         |   30 +++++++++++++++---------------
 include/keymap.h  |    4 +++-
 src/keymap.c      |   18 +++++++++++++++++-
 src/lang.c        |    4 ++--
 src/select.c      |    8 +++++++-
 src/thread.c      |   29 ++++++++++++++++++++++++++---
 24 files changed, 148 insertions(+), 55 deletions(-)
-----------------------------------------------------------------------------
diff -Nurp tin-1.7.8.snap/doc/CHANGES tin-1.7.8/doc/CHANGES
--- tin-1.7.8.snap/doc/CHANGES	2005-03-08 11:33:46.000000000 +0100
+++ tin-1.7.8/doc/CHANGES	2005-03-11 11:24:50.000000000 +0100
@@ -1,4 +1,4 @@
--- 1.7.8 release 20050308 "" --
+-- 1.7.8 release 20050311 "" --
 
 U038) Sebnem Korkmaz <[email protected]>
       ADD. started turkish translation
@@ -18,14 +18,16 @@ U036) Michael Bienia <[email protected]
 U035) Urs Janssen <[email protected]>
       ADD. basic code for new nntp-command CAPABILITIES
       ADD. config.guess, config.sub update
+      ADD. GLOBAL_PRINT ('o') to thread-level
+      ADD. {SELECT,THREAD}_EDIT_FILTER ('E')
       BUG. typos in the german translation
       BUG. description of a few keys in the online help was wrong
       BUG. out of bounds read in utf8_valid()
       BUG. missing postinit_regexp() call in batch_mode.
       FIX. keymap.h, nntplib.h, proto.h, config.c, debug.c, feed.c, filter.c
-           help.c, keymap.c, main.c, memory.c, misc.c, nntplib.c, post.c
-           screen.c, thread.c, xref.c, de.po, tr.po, Makefile, configure.in
-           config.guess, config.sub, tin.5
+           help.c, keymap.c, lang.c, main.c, memory.c, misc.c, nntplib.c
+           post.c, screen.c, select.c, thread.c, xref.c, de.po, tr.po,
+           Makefile, configure.in, config.guess, config.sub, tin.5
 
 -- 1.7.7 release 20041215 "Scalpay" --
 
diff -Nurp tin-1.7.8.snap/doc/TODO tin-1.7.8/doc/TODO
--- tin-1.7.8.snap/doc/TODO	2005-02-25 11:54:05.000000000 +0100
+++ tin-1.7.8/doc/TODO	2005-03-11 11:12:51.000000000 +0100
@@ -4,6 +4,14 @@ not read only ,-).
 
 Bugs
 ----
+o  the decription in the online 'h'elp for '<CR>' is dublicated in
+   all levels, e.g.:
+   | Group/thread/article operations
+   | -------------------------------
+   | <CR>      read chosen group
+   | <CR>      read chosen group
+   [20050311 Urs Janssen <[email protected]>]
+
 o  can 'V'iew mime-parts with (illegal) encoded filename, e.g:
    | Content-Type: image/jpeg;
    |  name="=?iso-8859-1?Q?internationales_Zeichen_f=FCr_Ehe.jpg?="
@@ -315,7 +323,6 @@ o  Additions to the thread menu:
      'D'  (cancel article)
      ']'  quick kill
      '['  quick auto-select
-     'E'  (edit filter)
      'r'  (reply to) /* not 'R' cause it conflicts with mail_bugreport */
      ''   r should be toggle show all/show only unread
      'f'  (post a followup) (maybe also 'F', '^W', ...)
@@ -325,7 +332,6 @@ o  Additions to the thread menu:
      '='  (mark pattern as hot)
      'Y'  (check for new articles in thread)
      '%'  (toggle rot13 encoding of screen content)
-     'o'  (print)
      'x'  (repost)
      keys to go to previous/next thread
 
@@ -480,6 +486,10 @@ o  suppress hide_uue=2 checking unless f
 
 Internal Changes
 ----------------
+o  join GROUP_EDIT_FILTER, THREAD_EDIT_FILTER, PAGE_EDIT_FILTER,
+   SELECT_EDIT_FILTER to a single 'key'.
+   [20050311 Urs Janssen <[email protected]>]
+
 o  read_overview() calls eat_re() which strips the "Re: " out of the
    subject. the modified subject ist used for batch_mode opperatios (-N/-M)
    which might not be what ppl. expect and eat_re() is the only function
@@ -660,10 +670,13 @@ o  add installation guide (in html)
 o  add cross-compilation hints
 
 o  better document keymap feature
+   -ThreadEditFilter & SelectEditFilter aren't documented at all
+   -*EditFilter isn't mentioned in the online 'h'elp
 
 o  man page always needs work and proof reading
    e.g. 'U', 'V' in pager need better documentation, random organization
-   feature isn't documented at all
+   feature isn't documented at all. tin.1 still mentions some obsolete keys
+   (e.g. Down2, Up2, PageUp2, PageDown2, ConfigSelect2, SelectReadGrp2, ...)
 
 o  tin.defaults could use more documentation in manpage (tin.5)
 
diff -Nurp tin-1.7.8.snap/doc/keymap.sample tin-1.7.8/doc/keymap.sample
--- tin-1.7.8.snap/doc/keymap.sample	2005-03-08 00:49:52.000000000 +0100
+++ tin-1.7.8/doc/keymap.sample	2005-03-11 11:06:34.000000000 +0100
@@ -207,6 +207,7 @@ SelectEnterNextUnreadGrp	TAB	n
 SelectReadGrp			^J	^M
 SelectResetNewsrc		^R
 SelectCatchupNextUnread		C
+SelectEditFilter		E
 SelectNextUnreadGrp		N
 SelectBugReport			R
 SelectSubscribePat		S
@@ -233,6 +234,7 @@ ThreadSelArt			*
 ThreadToggleArtSel		.
 ThreadReverseSel		@
 ThreadCatchupNextUnread		C
+ThreadEditFilter		E
 ThreadMarkArtRead		K
 ThreadBugReport			R
 ThreadAutoSave			S
diff -Nurp tin-1.7.8.snap/doc/tin.1 tin-1.7.8/doc/tin.1
--- tin-1.7.8.snap/doc/tin.1	2005-02-18 13:36:52.000000000 +0100
+++ tin-1.7.8/doc/tin.1	2005-03-09 11:11:00.000000000 +0100
@@ -7,6 +7,7 @@
 .\" Notes     : use american english; still needs some work, e.g.:
 .\"             - document authorization (.newsauth)
 .\"             - document random organization feature
+.\"             - update keybindings, remove obsolete references
 .\"
 .\"
 .TH tin 1 "February 18th, 2005" "1.7.8" "A Usenet newsreader"
diff -Nurp tin-1.7.8.snap/doc/tin.5 tin-1.7.8/doc/tin.5
--- tin-1.7.8.snap/doc/tin.5	2005-03-08 00:59:17.000000000 +0100
+++ tin-1.7.8/doc/tin.5	2005-03-09 13:28:08.000000000 +0100
@@ -18,11 +18,11 @@ newsreader.
 
 .SH FILES
 .\" TODO: mention
-.\" ${TIN_HOMEDIR-"$HOME"}/dead.article
-.\" ${TIN_HOMEDIR-"$HOME"}/dead.articles
-.\" ${TIN_HOMEDIR-"$HOME"}/.article[.$$]
-.\" ${TIN_HOMEDIR-"$HOME"}/.cancel[.$$]
-.\" ${TIN_HOMEDIR-"$HOME"}/.letter[.$$]
+.\" ${TIN_HOMEDIR\-"$HOME"}/dead.article
+.\" ${TIN_HOMEDIR\-"$HOME"}/dead.articles
+.\" ${TIN_HOMEDIR\-"$HOME"}/.article[.$$]
+.\" ${TIN_HOMEDIR\-"$HOME"}/.cancel[.$$]
+.\" ${TIN_HOMEDIR\-"$HOME"}/.letter[.$$]
 .PP
 .IR $MAILCAPS
 .br
@@ -66,7 +66,7 @@ message. If it contains "%t", those two 
 content-type field, including the subtype, if any. If it contains "%{"
 followed by a parameter name and a closing "}", then all those characters
 will be replaced by the value of the named parameter, if any, from the
-Content-Type header. Finally, if the field contains "\\%", those two
+Content\-Type header. Finally, if the field contains "\\%", those two
 characters will be replaced by a single "%" character.
 .\"
 .\" Two special codes can appear in the viewing command for objects of type
@@ -85,16 +85,16 @@ support mail composing agents that suppo
 of mail using external composing agents. As with the view-command, the
 semantics of program execution are operating system dependent. The result of
 the composing program may be data that is not yet suitable for mail
-transport - that is, a Content-Transfer-Encoding may need to be applied to
+transport - that is, a Content\-Transfer\-Encoding may need to be applied to
 the data.
 .TP
 .B composetyped
 The "composetyped" field is similar to the "compose" field, but is to be
-used when the composing program needs to specify the Content-Type header
+used when the composing program needs to specify the Content\-Type header
 field to be applied to the composed data. The "compose" field is simpler,
 and is preferred for use with existing (non-mail-oriented) programs for
 composing data in a given format. The "composetyped" field is necessary when
-the Content-Type information must include auxiliary parameters, and the
+the Content\-Type information must include auxiliary parameters, and the
 composition program must then know enough about mail formats to produce
 output that includes the mail type information.
 .TP
@@ -150,8 +150,8 @@ will be in that form after decoding. In 
 if there is line-oriented data of some type other than text/* or non-line-
 oriented data that is a subtype of text.
 .TP
-.B x11-bitmap
-The "x11-bitmap" field names a file, in X11 bitmap (xbm) format, which
+.B x11\-bitmap
+The "x11\-bitmap" field names a file, in X11 bitmap (xbm) format, which
 points to an appropriate icon to be used to visually denote the presence of
 this kind of data.
 .TP
@@ -178,7 +178,7 @@ image/*;\\
 .in +.3i
 xv \-8 \-geometry +0 '%s';\\
 .br
-description=%{name} %t-Image;\\
+description=%{name} %t\-Image;\\
 .br
 test=test "$DISPLAY" \\
 .br
@@ -387,7 +387,7 @@ active file of user's saved newsgroups, 
 .\" tin uses inns old (pre 2.x) Path convention.
 .\" as with inn >= 2.2.x getting more and more popular
 .\" we should think about checking for the new Paths (/news/etc/)
-.\" ${TIN_LIBDIR-/news/etc"}/attributes
+.\" ${TIN_LIBDIR\-/news/etc"}/attributes
 .IR /etc/tin/attributes
 .br
 .IR ${TIN_HOMEDIR\-"$HOME"}/.tin/attributes
@@ -1019,7 +1019,7 @@ to keep track of new newsgroups on the s
 .\" tin uses inns old (pre 2.x) Path convention.
 .\" as with inn >= 2.2.x getting more and more popular
 .\" we should think about checking for the new Paths (/news/etc/)
-.\" .IR ${TIN_LIBDIR-"/news/etc"}/tinrc
+.\" .IR ${TIN_LIBDIR\-"/news/etc"}/tinrc
 .IR /etc/tin/tinrc
 .br
 .IR ${TIN_HOMEDIR\-"$HOME"}/.tin/tinrc
@@ -1103,7 +1103,7 @@ Reconnect to server automatically. Defau
 .TP
 .B auto_save
 If ON articles/threads with ''Archive\-name:'' in header will be
-automatically saved with the Archive-name & part/patch no and post
+automatically saved with the Archive\-name & part/patch no and post
 processed if \fBpost_process_type\fP is set to something other than 'No'.
 Default is OFF.
 .TP
diff -Nurp tin-1.7.8.snap/include/keymap.h tin-1.7.8/include/keymap.h
--- tin-1.7.8.snap/include/keymap.h	2005-02-03 19:26:31.000000000 +0100
+++ tin-1.7.8/include/keymap.h	2005-03-11 11:04:03.000000000 +0100
@@ -319,6 +319,7 @@ enum defined_functions {
 	SAVE_OVERWRITE_FILE,
 	SELECT_CATCHUP,
 	SELECT_CATCHUP_NEXT_UNREAD,
+	SELECT_EDIT_FILTER,
 	SELECT_ENTER_GROUP,
 	SELECT_ENTER_NEXT_UNREAD_GROUP,
 	SELECT_GOTO,
@@ -340,6 +341,7 @@ enum defined_functions {
 	THREAD_AUTOSELECT,
 	THREAD_CATCHUP,
 	THREAD_CATCHUP_NEXT_UNREAD,
+	THREAD_EDIT_FILTER,
 	THREAD_KILL,
 	THREAD_MAIL,
 	THREAD_MARK_ARTICLE_READ,
diff -Nurp tin-1.7.8.snap/src/keymap.c tin-1.7.8/src/keymap.c
--- tin-1.7.8.snap/src/keymap.c	2005-03-08 00:59:37.000000000 +0100
+++ tin-1.7.8/src/keymap.c	2005-03-11 11:06:15.000000000 +0100
@@ -1230,6 +1230,7 @@ process_mapping(
 			if (strcmp(keyname, "Print") == 0) {
 				process_keys(GLOBAL_PRINT, keys, &group_keys);
 				process_keys(GLOBAL_PRINT, keys, &page_keys);
+				process_keys(GLOBAL_PRINT, keys, &thread_keys);
 
 				return TRUE;
 			}
@@ -1392,6 +1393,11 @@ process_mapping(
 
 				return TRUE;
 			}
+         if (strcmp(keyname, "SelectEditFilter") == 0) {
+				process_keys(SELECT_EDIT_FILTER, keys, &select_keys);
+
+				return TRUE;
+			}
 			if (strcmp(keyname, "SelectEnterNextUnreadGrp") == 0 || strcmp(keyname, "SelectEnterNextUnreadGrp2") == 0) {
 				process_keys(SELECT_ENTER_NEXT_UNREAD_GROUP, keys, &select_keys);
 
@@ -1522,6 +1528,11 @@ process_mapping(
 
 				return TRUE;
 			}
+			if (strcmp(keyname, "ThreadEditFilter") == 0) {
+				process_keys(THREAD_EDIT_FILTER, keys, &thread_keys);
+
+				return TRUE;
+			}
 			if (strcmp(keyname, "ThreadKill") == 0) {
 				process_keys(THREAD_KILL, keys, &thread_keys);
 
@@ -1689,6 +1700,7 @@ setup_default_keys(
 	add_default_key(&select_keys, 'y', SELECT_YANK_ACTIVE);
 	add_default_key(&select_keys, 'z', SELECT_MARK_GROUP_UNREAD);
 	add_default_key(&select_keys, 'C', SELECT_CATCHUP_NEXT_UNREAD);
+	add_default_key(&select_keys, 'E', SELECT_EDIT_FILTER);
 	add_default_key(&select_keys, 'N', SELECT_NEXT_UNREAD_GROUP);
 	add_default_key(&select_keys, 'S', SELECT_SUBSCRIBE_PATTERN);
 	add_default_key(&select_keys, 'U', SELECT_UNSUBSCRIBE_PATTERN);
@@ -1760,12 +1772,16 @@ setup_default_keys(
 	add_default_key(&thread_keys, 'c', THREAD_CATCHUP);
 	add_default_key(&thread_keys, 'd', THREAD_TOGGLE_SUBJECT_DISPLAY);
 	add_default_key(&thread_keys, 'm', THREAD_MAIL);
+#ifndef DISABLE_PRINTING
+	add_default_key(&thread_keys, 'o', GLOBAL_PRINT);
+#endif /* !DISABLE_PRINTING */
 	add_default_key(&thread_keys, 's', THREAD_SAVE);
 	add_default_key(&thread_keys, 't', THREAD_TAG);
 	add_default_key(&thread_keys, 'z', THREAD_MARK_ARTICLE_UNREAD);
 	add_default_key(&thread_keys, 'A', GLOBAL_SEARCH_AUTHOR_BACKWARD);
 	add_default_key(&thread_keys, 'B', GLOBAL_SEARCH_BODY);
 	add_default_key(&thread_keys, 'C', THREAD_CATCHUP_NEXT_UNREAD);
+	add_default_key(&thread_keys, 'E', THREAD_EDIT_FILTER);
 	add_default_key(&thread_keys, 'K', THREAD_MARK_ARTICLE_READ);
 	add_default_key(&thread_keys, 'L', GLOBAL_LOOKUP_MESSAGEID);
 	add_default_key(&thread_keys, 'S', THREAD_AUTOSAVE);
diff -Nurp tin-1.7.8.snap/src/lang.c tin-1.7.8/src/lang.c
--- tin-1.7.8.snap/src/lang.c	2005-01-31 14:19:10.000000000 +0100
+++ tin-1.7.8/src/lang.c	2005-03-10 17:21:01.000000000 +0100
@@ -472,7 +472,7 @@ constext txt_last_resp[] = N_("-- Last r
 constext txt_lines[] = N_("Lines %s  ");
 
 constext txt_msgid_line_only[] = N_("Message-ID: line              ");
-constext txt_mail[] = "Mail";
+constext txt_mail[] = N_("Mail");
 constext txt_mailbox[] = N_("mailbox ");
 constext txt_mail_art_to[] = N_("Mail article(s) to [%.*s]> ");
 constext txt_mail_log_to[] = N_("Mailing log to %s\n");
diff -Nurp tin-1.7.8.snap/src/select.c tin-1.7.8/src/select.c
--- tin-1.7.8.snap/src/select.c	2005-02-12 14:24:10.000000000 +0100
+++ tin-1.7.8/src/select.c	2005-03-11 11:09:39.000000000 +0100
@@ -252,6 +252,12 @@ selection_page(
 					info_message(_(txt_no_groups));
 				break;
 
+			case SELECT_EDIT_FILTER:
+				if (!invoke_editor(filter_file, FILTER_FILE_OFFSET))
+					break;
+				(void) read_filter_file(filter_file);
+				break;
+
 			case SELECT_TOGGLE_DESCRIPTIONS:	/* toggle newsgroup descriptions */
 				show_description = bool_not(show_description);
 				if (show_description)
diff -Nurp tin-1.7.8.snap/src/thread.c tin-1.7.8/src/thread.c
--- tin-1.7.8.snap/src/thread.c	2005-03-07 16:24:03.000000000 +0100
+++ tin-1.7.8/src/thread.c	2005-03-11 10:49:07.000000000 +0100
@@ -509,12 +509,19 @@ thread_page(
 					show_thread_page();
 				break;
 
-			case GLOBAL_PIPE:			/* pipe article to command */
+			case GLOBAL_PIPE:			/* pipe article(s) to command */
 				if (thread_basenote >= 0)
 					feed_articles(FEED_PIPE, THREAD_LEVEL, group, find_response(thread_basenote, thdmenu.curr));
 				break;
 
-			case THREAD_MAIL:	/* mail article to somebody */
+#ifndef DISABLE_PRINTING
+			case GLOBAL_PRINT:			/* print article(s) */
+				if (thread_basenote >= 0)
+					feed_articles(FEED_PRINT, THREAD_LEVEL, group, find_response(thread_basenote, thdmenu.curr));
+				break;
+#endif /* !DISABLE_PRINTING */
+
+			case THREAD_MAIL:	/* mail article(s) to somebody */
 				if (thread_basenote >= 0)
 					feed_articles(FEED_MAIL, THREAD_LEVEL, group, find_response(thread_basenote, thdmenu.curr));
 				break;
@@ -548,6 +555,22 @@ thread_page(
 				show_thread_page();
 				break;
 
+			case THREAD_EDIT_FILTER:
+				if (!invoke_editor(filter_file, FILTER_FILE_OFFSET))
+					break;
+				unfilter_articles();
+				(void) read_filter_file(filter_file);
+				if (filter_articles(group)) {
+					make_threads(group, FALSE);
+					if ((n = next_unread(n)) == -1) {
+						ret_code = GRP_EXIT;
+						break;
+					}
+					fixup_thread(n, TRUE);
+				}
+				show_thread_page();
+				break;
+
 			case THREAD_READ_ARTICLE:	/* read current article within thread */
 				ret_code = enter_pager(find_response(thread_basenote, thdmenu.curr), FALSE, THREAD_LEVEL);
 				break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.