*** On Tue, 2 Apr 2002 I wrote:

:)   I just created a patch for lynx2.8.4 that does this. I believe the
:) patch can be adpated to be used even with mutt or elm (anyone willing
:) to test this?). I am not submitting the patch right now, but instead I
:) would like that anyone interested in testing and helping me improve the
:) patch could pick the patch from the address below, so that it can be
:) worked on it and submitted later.

Hello,

  I am submitting a patch for your consideration. The patch gives support
of an external e-mail program to Lynx. The documentation below explains
how to set this up using Pine, and since I do not use Mutt, nor elm, the
documentation is missing how to set this feature for those e-mail
programs.  It would be nice if someone added that part to the
documentation. The patch was compressed and attached to this message.

  Thank you for your consideration and feedback.

:)
:)   The way that the patch works is as follows. After one applies the patch
:) and recompiles, one needs to reinstall lynx: "make install". This will
:) create a new lynx.cfg file. The patch is designed so that even if you
:) follow all of these steps, the feature is off. The way to turn it on is by
:) editing the (new) file lynx.cfg and setting
:)
:) EXTERNAL_MAIL:TRUE
:)
:) One also needs to define the variable
:)
:) EXTERNAL_MAIL_PROGRAM
:)
:) The example given in the lynx.cfg file is:
:)
:) EXTERNAL_MAIL_PROGRAM:pine -customized-hdrs="Subject: %s" %s < %s
:)
:) which allows the sender to send a message including the subject and text
:) of the web page using Pine.
:)
:) I would appreciate if those who know mutt or elm could let me know which
:) command works best for them. There's more information in the file lynx.cfg
:) as to what those cryptic %s mean. I believe that if we point users as to
:) which command to use with the most popular mailers, that there won't be
:) any problem for people to use their favorite e-mail program when sending
:) e-mail through Lynx.
:)
:)   There are a few details in the patch where I would appreciate if someone
:) could point me in a better way to do this, as for example, there are a few
:)
:) if (!use_external_command){
:) }
:)
:) statements which I believe should be replaced by something more like
:)
:) #ifdef SOMETHING
:)
:) but I did not know how to do this, and there's also a length of an array
:) (the array containing command to be executed) which I would like some
:) advice as to how to set its length properly.

-- 
Eduardo
http://www.math.washington.edu/~chappa/pine/
diff -rc lynx2-8-4/lynx.cfg lynx2-8-4.mail/lynx.cfg
*** lynx2-8-4/lynx.cfg  Sat Jul 14 19:06:16 2001
--- lynx2-8-4.mail/lynx.cfg     Tue Apr  2 00:55:00 2002
***************
*** 1060,1065 ****
--- 1060,1085 ----
  #
  #CHECKMAIL:FALSE
  
+ .h2 EXTERNAL_MAIL
+ # This variable determines if Lynx will use an external mail program
+ # to send messages when a link of the form mailto:[EMAIL PROTECTED]
+ # is activated. Default is set to FALSE, which means that Lynx will use
+ # its internal mail program to send e-mail.
+ #EXTERNAL_MAIL:FALSE
+ 
+ .h2 EXTERNAL_MAIL_PROGRAM
+ # This variable defines the command used to start an external mail program
+ # from Lynx. This definition is only valid if EXTERNAL_MAIL is set to TRUE.
+ # The general form of this command is as follows:
+ #
+ #     mailer %s %s %s
+ #
+ # The first %s indicates the subject of the message, the second %s the
+ # recipient of the message and the third %s represents and input file
+ # passed by lynx to the mailer (normally containing the contents of the
+ # web page as seen by the user). Below is an example of how to configure
+ # this option when used with Pine.
+ #EXTERNAL_MAIL_PROGRAM:pine -customized-hdrs="Subject: %s" %s < %s
  
  .h1 News-groups
  
diff -rc lynx2-8-4/userdefs.h lynx2-8-4.mail/userdefs.h
*** lynx2-8-4/userdefs.h        Sun Jun  3 12:58:00 2001
--- lynx2-8-4.mail/userdefs.h   Mon Apr  1 23:51:46 2002
***************
*** 1683,1686 ****
--- 1683,1704 ----
   * This ends the section specific to anonymous accounts.
   */
  
+ /*****************************
+  * This variable determines if Lynx will use an external mail program
+  * to send messages when a link of the form mailto:[EMAIL PROTECTED]
+  * is activated. Default: FALSE, if you want to activate it, set it to
+  * TRUE.
+  */
+ #define EXTERNAL_MAIL         FALSE
+ 
+ /*****************************
+  * The purpose of this definition is to give an example of how to configure
+  * the external mail program. You must set a command that have the form
+  *       mailer %s %s %s
+  * the first %s represents the subject of the message, the second %s
+  * represent the recipient of your message, and the third %s must be the
+  * input file from Lynx. In the case of Pine define as below.
+  */
+ #define EXTERNAL_MAIL_PROGRAM "pine -customized-hdrs=\"Subject: %s\" %s < %s"
+ 
  #endif /* USERDEFS_H */
diff -rc lynx2-8-4/src/LYGlobalDefs.h lynx2-8-4.mail/src/LYGlobalDefs.h
*** lynx2-8-4/src/LYGlobalDefs.h        Sat Jul  7 18:30:13 2001
--- lynx2-8-4.mail/src/LYGlobalDefs.h   Mon Apr  1 23:55:47 2002
***************
*** 412,417 ****
--- 412,420 ----
  
  extern char *XLoadImageCommand;               /* Default image viewer for X    */
  
+ extern BOOLEAN use_external_mail;     /* Do we use external mail? */
+ extern char *ExternalMailProgram;     /* command to use as external mail */
+ 
  #ifdef USE_EXTERNALS
  extern BOOLEAN no_externals;          /* don't allow the use of externals */
  #endif
diff -rc lynx2-8-4/src/LYMail.c lynx2-8-4.mail/src/LYMail.c
*** lynx2-8-4/src/LYMail.c      Sun Jun  3 12:58:00 2001
--- lynx2-8-4.mail/src/LYMail.c Tue Apr  2 01:15:24 2002
***************
*** 1286,1291 ****
--- 1286,1292 ----
      /*
       *        Clear the screen and inform the user.
       */
+ if (!use_external_mail){
      LYclear();
      LYmove(2,0);
      scrollok(LYwin, TRUE);    /* Enable scrolling. */
***************
*** 1377,1382 ****
--- 1378,1385 ----
       */
      LYaddstr(ENTER_SUBJECT_LINE);
      label = "Subject";
+ } /* external_mail 
+    * We need to make a pause to pick up the subject */
      if (*default_subject) {
        StrAllocCopy(the_subject, default_subject);
      } else if (!EMPTY(filename)) {
***************
*** 1384,1389 ****
--- 1387,1393 ----
      } else {
        HTSprintf(&the_subject, "mailto:%s";, to_address);
      }
+ if (!use_external_mail){ /* Now we continue */
      if (!header_prompt(label, &the_subject, MAX_SUBJECT)) {
        goto cancelled;
      }
***************
*** 1430,1437 ****
      StrAllocCat(header, "\n");
      CTRACE((tfp,"**header==\n%s",header));
  #endif /* !VMS */
  
!     if (!no_editor && !EMPTY(editor)) {
  
        if (body) {
            cp1 = body;
--- 1434,1442 ----
      StrAllocCat(header, "\n");
      CTRACE((tfp,"**header==\n%s",header));
  #endif /* !VMS */
+ } /* external_mail */
  
!     if ((!no_editor && !EMPTY(editor)) || (use_external_mail)) {
  
        if (body) {
            cp1 = body;
***************
*** 1459,1467 ****
            goto cleanup;
  
        /*
!        *  Spawn the users editor on the mail file
         */
!       edit_temporary_file(my_tmpfile, "", SPAWNING_EDITOR_FOR_MAIL);
  
      } else if (body) {
        /*
--- 1464,1484 ----
            goto cleanup;
  
        /*
!        * Spawn the users editor on the mail file or the external mail program
         */
!       if (use_external_mail){
!           char command[500] = {'\0'};
!           sprintf(command,ExternalMailProgram, the_subject, to_address, 
!                       my_tmpfile);
!           LYclear();
!           stop_curses();
!           LYSystem(command);
!           start_curses();
!           LYRemoveTemp(my_tmpfile);
!           goto cleanup;
!         }
!       else
!          edit_temporary_file(my_tmpfile, "", SPAWNING_EDITOR_FOR_MAIL);
  
      } else if (body) {
        /*
diff -rc lynx2-8-4/src/LYMain.c lynx2-8-4.mail/src/LYMain.c
*** lynx2-8-4/src/LYMain.c      Sat Jul  7 18:30:13 2001
--- lynx2-8-4.mail/src/LYMain.c Mon Apr  1 23:55:01 2002
***************
*** 193,198 ****
--- 193,199 ----
  PUBLIC BOOLEAN child_lynx = FALSE;
  PUBLIC BOOLEAN error_logging = MAIL_SYSTEM_ERROR_LOGGING;
  PUBLIC BOOLEAN check_mail = CHECKMAIL;
+ PUBLIC BOOLEAN use_external_mail = EXTERNAL_MAIL;
  PUBLIC BOOLEAN vi_keys = VI_KEYS_ALWAYS_ON;
  PUBLIC BOOLEAN emacs_keys = EMACS_KEYS_ALWAYS_ON;
  PUBLIC int keypad_mode = DEFAULT_KEYPAD_MODE;
***************
*** 448,453 ****
--- 449,455 ----
  PUBLIC BOOLEAN LYShowTransferRate = TRUE;
  PUBLIC int LYTransferRate = rateEtaKB_maybe;
  
+ PUBLIC char *ExternalMailProgram = NULL; /* default external mailer of lynx */
  PUBLIC char *XLoadImageCommand = NULL;        /* Default image viewer for X */
  PUBLIC BOOLEAN LYNoISMAPifUSEMAP = FALSE; /* Omit ISMAP link if MAP present? */
  PUBLIC int LYHiddenLinks = HIDDENLINKS_SEPARATE; /* Show hidden links? */
***************
*** 677,682 ****
--- 679,685 ----
      FREE(URLDomainPrefixes);
      FREE(URLDomainSuffixes);
      FREE(XLoadImageCommand);
+     FREE(ExternalMailProgram);
  #ifndef VMS
      FREE(lynx_version_putenv_command);
  #endif
***************
*** 1181,1186 ****
--- 1184,1190 ----
      StrAllocCopy(URLDomainPrefixes, URL_DOMAIN_PREFIXES);
      StrAllocCopy(URLDomainSuffixes, URL_DOMAIN_SUFFIXES);
      StrAllocCopy(XLoadImageCommand, XLOADIMAGE_COMMAND);
+     StrAllocCopy(ExternalMailProgram, EXTERNAL_MAIL_PROGRAM);
  
  #ifndef DISABLE_BIBP
      StrAllocCopy(BibP_globalserver, BIBP_GLOBAL_SERVER);
diff -rc lynx2-8-4/src/LYReadCFG.c lynx2-8-4.mail/src/LYReadCFG.c
*** lynx2-8-4/src/LYReadCFG.c   Sat Jul 14 19:06:16 2001
--- lynx2-8-4.mail/src/LYReadCFG.c      Mon Apr  1 23:56:34 2002
***************
*** 1491,1496 ****
--- 1491,1498 ----
       PARSE_FUN("viewer",               viewer_fun),
       PARSE_Env("wais_proxy",           0 ),
       PARSE_STR("xloadimage_command",   XLoadImageCommand),
+      PARSE_SET("external_mail",        use_external_mail),
+      PARSE_STR("external_mail_program",ExternalMailProgram),
  
       PARSE_NIL
  };

Reply via email to