Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From fded6b930c7d30c01e5da75bb44e58c3432af06b Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <[email protected]>
>Date: Sat, 20 Feb 2021 19:15:05 +0000
>Subject: [PATCH] Add code to create a "mime_command" to display articles with
> a different encoding

  The name of the variable "mime_command" is a command,
that changes the encoding of a article to that,
what the user uses,
so it can be read.

  It is set in the init file.

  The default name is "nnmime".

  "mime_command" was created in analogy to "patch_command".

save.c: add the code here

variable.c: add definitions of "mime_command" and "edit_mime_command"
here.

Signed-off-by: Bjarni Ingi Gislason <[email protected]>
---
 save.c     | 25 +++++++++++++++++++++++++
 variable.c |  4 ++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/save.c b/save.c
index 35c0a52..b35211f 100644
--- a/save.c
+++ b/save.c
@@ -59,6 +59,9 @@ int             edit_patch_command = 1;
 char            unshar_command[FILENAME] = SHELL;
 int             edit_unshar_command = 0;
 
+char            mime_command[FILENAME] = "";
+int             edit_mime_command = 1;
+
 extern char    *temp_file;
 extern int      shell_restrictions;
 extern char     delayed_msg[];
@@ -196,6 +199,11 @@ init_save(int command, char **mode_textp)
     static char     name_buf[512];     /* buffer for file name expansion */
     char           *start, *last, *np;
 
+    if (mime_command[0] == NUL) {
+       snprintf(mime_command, FILENAME, "%s %s %s %s", "nnmime -c",
+           curchset->cs_name, "2>&1 |", pager);
+    }
+
     uniq_counter = 0;
     short_header_lines = save_header_lines;
 
@@ -313,6 +321,23 @@ init_save(int command, char **mode_textp)
            unshar_cmd = patch_command;
            goto unshar1;
 
+       case K_MIME:
+           save_mode = FULL_HEADER | IS_PIPE | DO_MIME;
+           mode_text = "Mime";
+           if (!shell_restrictions && edit_mime_command) {
+               prompt("\1Mime command:\1 ");
+               save_name = get_s(NONE, mime_command, NONE, NULL_FCT);
+               if (save_name == NULL || *save_name == NUL)
+                   return NULL;
+               strcpy(mime_command, save_name);
+           }
+           if (!edit_mime_command)
+               save_name = mime_command;
+/*         unshar_cmd = mime_command; */
+           clrdisp();
+           fl; /* May be irrelevant */
+           break;
+
        case K_UNSHAR:
            save_mode = NO_HEADER | SEPARATE_FILES | DO_UNSHAR;
            mode_text = "Unshar";
diff --git a/variable.c b/variable.c
index 0709b95..3c50f79 100644
--- a/variable.c
+++ b/variable.c
@@ -91,7 +91,7 @@ extern char                   /* string variables */
                *folder_save_file, *header_lines, *folder_directory, 
included_mark[],
                *inews_program, *initial_newsrc_path, *mail_alias_expander,
                *mail_box, *mail_record, *mail_script, *mailer_program,
-                attributes[], *newsrc_file, *news_record, *news_script,
+               attributes[], mime_command[], *newsrc_file, *news_record, 
*news_script,
                *pager, patch_command[], printer[], *print_header_lines,
                *response_dflt_answer, *save_counter_format, *save_header_lines,
                *saved_header_escape, *shade_on_attr, *shade_off_attr, 
*spell_checker,
@@ -107,7 +107,7 @@ extern int                  /* boolean variables */
                 conf_junk_seen, consolidated_manual, consolidated_menu,
                 counter_padding, decode_keep, delay_redraw, dflt_kill_select,
                 do_kill_handling, dont_sort_articles, dont_sort_folders,
-                dont_split_digests, echo_prefix_key, edit_patch_command,
+                dont_split_digests, echo_prefix_key, edit_mime_command, 
edit_patch_command,
                 edit_print_command, edit_unshar_command, empty_answer_check,
                 enter_last_read_mode, flow_control, flush_typeahead, 
fmt_rptsubj,
                 folder_format_check, folder_rewrite_trace, guard_double_slash,
-- 
2.30.0



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to