From:	AITGW::"mark%INFOCOMM.COM@VM1.NoDak.EDU"  2-JUL-1991 07:29:08.98
To:	Multiple recipients of list ANU-NEWS <ANU-NEWS@NDSUVM1>
CC:	
Subj:	Fix of MAIL, REPLY, FORWARD /SELF default

Received: by AITGW.DECnet (utk-mail11 v1.5) ; Tue, 2 Jul 91 07:26:31 EDT
Received: from vm1.NoDak.edu by aitgw.ge.com (5.61/GE Gateway 1.3)
	id AA25314; Tue, 2 Jul 91 07:26:01 -0400
Message-Id: <9107021126.AA25314@aitgw.ge.com>
Received: from NDSUVM1.BITNET by VM1.NoDak.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 9346; Tue, 02 Jul 91 06:24:49 CDT
Received: from NDSUVM1.BITNET by NDSUVM1.BITNET (Mailer R2.07) with BSMTP id
 9625; Tue, 02 Jul 91 06:24:47 CDT
Date:         Tue, 2 Jul 1991 08:54:07 GMT
Reply-To: mark%INFOCOMM.COM@VM1.NoDak.EDU
Sender: ANU-NEWS Discussion <ANU-NEWS@VM1.NoDak.EDU>
From: mark%INFOCOMM.COM@VM1.NoDak.EDU
Subject:      Fix of MAIL, REPLY, FORWARD /SELF default
To: Multiple recipients of list ANU-NEWS <ANU-NEWS@NDSUVM1>
 
I've recently started to send mail (reply, forward, and send) from within
NEWS.
 
I've been annoyed by the fact that you can show you mail profile and display
the following fact:
 
        NEWS> show mail copy_self
 
        SHOW MAIL:  Copy_self is enabled for  REPLY SEND
 
The problem that this information was NOT being used for mail originating
within NEWS.
 
The attached patch fixes this problem by using the information in the mail
profile to determine the default action.  The mail profile information can
then be overridden with the use of /SELF or /NOSELF as desired.
 
--
Mark Pizzolato - INFO COMM Computer Consulting, Redwood City, Ca
PHONE:  (415)369-9366   UUCP:  decwrl!infopiz!mark or uunet!lupine!infopiz!mark
DOMAIN: mark@infocomm.com
 
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  2-JUL-1991 01:38:02.80   By user MARK
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. MAILSELF.PATCH;3
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X*** newscmd.cld_orig
X--- newscmd.cld
X**************
X*** 868,874
X      routine do_forward
X      qualifier   HEADERS,    negatable
X      qualifier   SUBJECT,    value(required)
X!     qualifier   SELF,       nonnegatable
X      qualifier   TO,         value(impcat,required,list)
X      qualifier   EDIT,       negatable,default
X      qualifier   MEMBERS
X--- 868,874 -----
X      routine do_forward
X      qualifier   HEADERS,    negatable
X      qualifier   SUBJECT,    value(required)
X!     qualifier   SELF,       negatable
X      qualifier   TO,         value(impcat,required,list)
X      qualifier   EDIT,       negatable,default
X      qualifier   MEMBERS
X**************
X*** 1049,1055
X      parameter   P1,         label=NEWSITEM
X      qualifier   HEADERS,    negatable
X      qualifier   SUBJECT,    value(required)
X!     qualifier   SELF,       nonnegatable
X `20
X `20
X  define verb REPOST
X--- 1049,1055 -----
X      parameter   P1,         label=NEWSITEM
X      qualifier   HEADERS,    negatable
X      qualifier   SUBJECT,    value(required)
X!     qualifier   SELF,       negatable
X `20
X `20
X  define verb REPOST
X**************
X*** 1122,1128
X      qualifier   EXTRACT
X      qualifier   HEADERS,    negatable
X      qualifier   SUBJECT,    value(required)
X!     qualifier   SELF,       nonnegatable
X      qualifier   QUOTE,      value
X      qualifier   TO,         value(impcat,required,list)
X      qualifier   EDIT,       negatable,default
X--- 1122,1128 -----
X      qualifier   EXTRACT
X      qualifier   HEADERS,    negatable
X      qualifier   SUBJECT,    value(required)
X!     qualifier   SELF,       negatable
X      qualifier   QUOTE,      value
X      qualifier   TO,         value(impcat,required,list)
X      qualifier   EDIT,       negatable,default
X*** newsextern.h_orig
X--- newsextern.h
X**************
X*** 395,400
X  static int dfwd __ARGS((void));
X  static int drply __ARGS((void));
X  static int dsnd __ARGS((void));
X  #endif
X  EXTERN int do_mail __ARGS((int, int));
X  EXTERN int do_forward __ARGS((void));
X--- 395,401 -----
X  static int dfwd __ARGS((void));
X  static int drply __ARGS((void));
X  static int dsnd __ARGS((void));
X+ static void set_mail_self_flag __ARGS((int));
X  #endif
X  EXTERN int do_mail __ARGS((int, int));
X  EXTERN int do_forward __ARGS((void));
X*** newsforward.c_orig
X--- newsforward.c
X**************
X*** 30,35
X  **`09    Use call_mail instead of lib$spawn to invoke mail function.`09
X  **`09V6.0-1`09 4-Nov-1990`09glass@mgi.com
X  **`09  - corrections to extraction of reply addresses from the headers
X  **--
X  **/
X  `0C
X--- 30,38 -----
X  **`09    Use call_mail instead of lib$spawn to invoke mail function.`09
X  **`09V6.0-1`09 4-Nov-1990`09glass@mgi.com
X  **`09  - corrections to extraction of reply addresses from the headers
X+ **`09V6.0-3   1-JUL-1991`09mark@infocomm.com
X+ **`09  Use the user's mail-profile info to determine the default state
X+ **`09  of /SELF.
X  **--
X  **/
X  `0C
X**************
X*** 166,173
X    fclose(fpw);
X `20
X `20
X!   if (cli$present(c$dsc("SELF")) == CLI$_PRESENT) mail_self_flag = 1;
X!   else mail_self_flag = 0;
X `20
X    *xfrbuf = '\0';
X    if (cli$get_value(c$dsc("TO"),&ngroup_dsc,&ngroup_len) & 1) `7B
X--- 169,175 -----
X    fclose(fpw);
X `20
X `20
X!   set_mail_self_flag(forward);
X `20
X    *xfrbuf = '\0';
X    if (cli$get_value(c$dsc("TO"),&ngroup_dsc,&ngroup_len) & 1) `7B
X**************
X*** 451,456
X      return(0);
X      `7D
X `20
X    members = (cli$present(c$dsc("MEMBERS")) & 1);
X    if ((cli$present(c$dsc("SELF")) == CLI$_PRESENT) && !members)
X      mail_self_flag = 1;
X--- 453,459 -----
X      return(0);
X      `7D
X `20
X+   mail_self_flag = 0;
X    members = (cli$present(c$dsc("MEMBERS")) & 1);
X    if (!members) set_mail_self_flag(2);
X `20
X**************
X*** 452,460
X      `7D
X `20
X    members = (cli$present(c$dsc("MEMBERS")) & 1);
X!   if ((cli$present(c$dsc("SELF")) == CLI$_PRESENT) && !members)
X!     mail_self_flag = 1;
X!   else mail_self_flag = 0;
X `20
X    *xfrbuf = '\0';
X    addressees = 0;       `20
X--- 455,461 -----
X `20
X    mail_self_flag = 0;
X    members = (cli$present(c$dsc("MEMBERS")) & 1);
X!   if (!members) set_mail_self_flag(2);
X `20
X    *xfrbuf = '\0';
X    addressees = 0;       `20
X**************
X*** 605,608
X  int do_send()
X  `7B
X    return(unwind_display(I_DISPLAY_LOOP,dsnd));
X  `7D
X--- 606,643 -----
X  int do_send()
X  `7B
X    return(unwind_display(I_DISPLAY_LOOP,dsnd));
X+ `7D
X+ `0C
X+ static void set_mail_self_flag(cmd)
X+ int cmd;`09/* 0 = reply, 1 = forward, 2 = send */
X+ `7B
X+   int context = 0,
X+       profile_flag, sts;
X+   struct pmail_item `7B
X+     unsigned short bl;
X+     unsigned short ic;
X+     int *ba;
X+     unsigned short *rl;
X+     `7D sm`5B2`5D = `7B`7Bsizeof(profile_flag), 0, &profile_flag, 0`7D, `7
VB0, 0, 0, 0`7D`7D;
X+   int no_in_list`5B4`5D = `7B0,0,0,0`7D,
X+       no_out_list`5B4`5D = `7B0,0,0,0`7D;
X+`20
X+   switch (cmd)
X+     `7B
X+     case 0: sm`5B0`5D.ic = MAIL$_USER_COPY_REPLY; break;
X+     case 1: sm`5B0`5D.ic = MAIL$_USER_COPY_FORWARD; break;
X+     case 2: sm`5B0`5D.ic = MAIL$_USER_COPY_SEND; break;
X+     `7D;
X+   sysprv();
X+   if ((sts = mail$user_begin(&context,no_in_list,no_out_list)) & 1) `7B
X+     sts = mail$user_get_info(&context,no_in_list,sm);
X+     `7D
X+   mail$user_end(&context,no_in_list,no_out_list);
X+   nosysprv();
X+   mail_self_flag = profile_flag;
X+   if (cli$present(c$dsc("SELF")) == CLI$_PRESENT)
X+     mail_self_flag = 1;
X+   else
X+     if (cli$present(c$dsc("SELF")) == CLI$_NEGATED)
X+       mail_self_flag = 0;
X  `7D
X*** news.hlp_orig
X--- news.hlp
X**************
X*** 1782,1788
X `20
X  /SELF
X `20
X!  Sends a copy of the message back to yourself.
X `20
X  /HEADERS
X `20
X--- 1782,1790 -----
X `20
X  /SELF
X `20
X!  By default a copy of the mail message will sent to yourself if your mail
X!  profile specifies "copy_self forward". The /SELF (or /NOSELF) qualifier`2
V0
X!  overrides this default.
X `20
X  /HEADERS
X `20
X**************
X*** 2998,3004
X   NEWS will prompt for a Subject: field.
X `20
X  /SELF
X-  /NOSELF `5Bdefault`5D
X `20
X   This is a mail qualifier which will forward a copy of the outgoing mail
X   item back to the sender.
X--- 3000,3005 -----
X   NEWS will prompt for a Subject: field.
X `20
X  /SELF
X `20
X   By default a copy of the mail message will sent to yourself if your mail
X   profile specifies "copy_self reply". The /SELF (or /NOSELF) qualifier`20
X**************
X*** 3000,3007
X  /SELF
X   /NOSELF `5Bdefault`5D
X `20
X!  This is a mail qualifier which will forward a copy of the outgoing mail
X!  item back to the sender.
X `20
X  1 REPOST
X `20
X--- 3001,3009 -----
X `20
X  /SELF
X `20
X!  By default a copy of the mail message will sent to yourself if your mail
X!  profile specifies "copy_self reply". The /SELF (or /NOSELF) qualifier`20
X!  overrides this default.
X `20
X  1 REPOST
X `20
X**************
X*** 3406,3413
X `20
X  /SELF
X `20
X!  By default a copy of the mail message will NOT be sent to yourself. The
X!  /SELF qualifier overrides this default.
X `20
X  /SUBJECT
X   /SUBJECT="subject-string"
X--- 3408,3416 -----
X `20
X  /SELF
X `20
X!  By default a copy of the mail message will sent to yourself if your mail
X!  profile specifies "copy_self send". The /SELF (or /NOSELF) qualifier`20
X!  overrides this default.
X `20
X  /SUBJECT
X   /SUBJECT="subject-string"
$ CALL UNPACK MAILSELF.PATCH;3 610777564
$ v=f$verify(v)
$ EXIT
