XMXEDIT ;ISC-SF/GMB-Edit msg that user has sent to self ;05/19/2000  13:41
 ;;8.0;MailMan;;Jun 28, 2002
 ; All entry points covered by DBIA 2730.
 ; These entry points edit a message.  They do not perform any checks to
 ; see whether it is appropriate to do so.  That is the responsibility
 ; of the calling routine.
 ; For these entry points, it is expected that:
 ; OPTMSG^XMXSEC2  has been called and has given its permission to
 ;                 edit the message or to toggle information only.
 ; OPTEDIT^XMXSEC2 has been called and has given its permission to
 ;                 edit the particular thing we are editing here.
 ; INMSG2^XMXUTIL2 has been called to set XMINSTR.  These routines expect
 ;                 that XMINSTR has been correctly set.  They will change
 ;                 XMINSTR according to the edit.
CLOSED(XMZ,XMINSTR,XMMSG) ; Toggle Closed msg
 I $D(^TMP("XMY",$J,.6)) D ERRSET^XMXUTIL(37320.6) Q  ; Messages addressed to SHARED,MAIL may not be closed
 D FLAGTOGL(XMZ,1.95,.XMINSTR,"X",37319.9,37320.9,.XMMSG)
 Q
CONFID(XMZ,XMINSTR,XMMSG) ; Toggle Confidential msg
 I $D(^TMP("XMY",$J,.6)) D ERRSET^XMXUTIL(37301.6) Q  ; Messages addressed to SHARED,MAIL may not be confidential
 D FLAGTOGL(XMZ,1.96,.XMINSTR,"C",37301.9,37302.9,.XMMSG)
 Q
CONFIRM(XMZ,XMINSTR,XMMSG) ; Toggle Confirm receipt of msg
 D FLAGTOGL(XMZ,1.3,.XMINSTR,"R",37313.9,37314.9,.XMMSG)
 Q
DELIVER(XMZ,XMDBSKT,XMINSTR,XMMSG) ; Delivery basket
 I XMDBSKT="@" D  Q
 . K XMINSTR("RCPT BSKT")
 . S XMFDA(3.9,XMZ_",",21)="@"
 . D FILE^DIE("","XMFDA")
 . S XMMSG=$$EZBLD^DIALOG(37304.9) ; Delivery basket removed
 S XMINSTR("RCPT BSKT")=XMDBSKT
 S XMFDA(3.9,XMZ_",",21)=XMINSTR("RCPT BSKT")
 D FILE^DIE("","XMFDA")
 S XMMSG=$$EZBLD^DIALOG(37303.9) ; Delivery basket set
 Q
INFO(XMZ,XMINSTR,XMMSG) ; Toggle Information only msg
 D FLAGTOGL(XMZ,1.97,.XMINSTR,"I",37307.9,37308.9,.XMMSG)
 Q
NETSIG(XMDUZ,XMZ,XMINSTR,XMMSG) ; Add Network Signature
 N I,XMNSIG
 S XMNSIG(.1)=""
 S XMNSIG(.2)=""
 S XMNSIG(.3)=$$REPEAT^XLFSTR("-",79)
 S XMNSIG=$G(^XMB(3.7,XMDUZ,"NS1"))
 F I=1:1:3 S:$P(XMNSIG,U,I)'="" XMNSIG(I)=$P(XMNSIG,U,I)
 N XMABORT
 I $D(^XMB(3.9,XMZ,"K")) D  Q:XMABORT
 . ; If XMSECURE does not exist, then XMINSTR("SCR KEY") must hold the
 . ; correct scramble key.
 . I '$D(XMSECURE) N XMSECURE
 . I '$D(XMSECURE),'$$GOODKEY^XMJMCODE(XMZ,XMINSTR("SCR KEY")) D  Q
 . . D ERRSET^XMXUTIL(34623) ; The key is not correct.
 . . S XMABORT=1
 . S XMABORT=0
 . S I=0
 . F  S I=$O(XMNSIG(I)) Q:'I  S XMNSIG(I)=$$ENCSTR^XMJMCODE(XMNSIG(I))
 D MOVEBODY^XMXSEND(XMZ,"XMNSIG","A") ; Add the network signature
 S XMMSG=$$EZBLD^DIALOG(37309.9) ; Network Signature added
 Q
PRIORITY(XMZ,XMINSTR,XMMSG) ; Toggle Priority msg
 D FLAGTOGL(XMZ,1.7,.XMINSTR,"P",37311.9,37312.9,.XMMSG)
 Q
SCRAMBLE(XMZ,XMINSTR,XMMSG) ; Scramble or Unscramble the message text
 N XMFDA,XMIENS
 S XMIENS=XMZ_","
 I $D(^XMB(3.9,XMZ,"K")) D  Q
 . ; Unscramble the text.
 . ; If XMSECURE does not exist, then XMINSTR("SCR KEY") must hold the
 . ; correct scramble key.
 . I '$D(XMSECURE),'$$GOODKEY^XMJMCODE(XMZ,XMINSTR("SCR KEY")) D ERRSET^XMXUTIL(34623) Q  ; The key is not correct.
 . S XMFDA(3.9,XMIENS,1.8)="@"
 . S XMFDA(3.9,XMIENS,1.85)="@"
 . D FILE^DIE("","XMFDA")
 . D DECMSG^XMJMCODE(XMZ)
 . K XMSECURE,XMINSTR("SCR KEY"),XMINSTR("SCR HINT"),^XMB(3.9,XMZ,"K")
 . S XMMSG=$$EZBLD^DIALOG(37316.9) ; Message text UnScrambled
 ; Check the key and hint
 D XMKEY^XMXPARM1($G(XMINSTR("SCR KEY")))
 D:$G(XMINSTR("SCR HINT"))'="" XMHINT^XMXPARM1(XMINSTR("SCR HINT"))
 Q:$D(XMERR)
 ; Scramble the text.
 N XMKEY
 K XMSECURE
 S XMFDA(3.9,XMIENS,1.8)=$S($G(XMINSTR("SCR HINT"))="":" ",1:XMINSTR("SCR HINT"))
 D LOADCODE^XMJMCODE ; XMSECURE is created here
 S XMKEY=XMINSTR("SCR KEY")
 D ADJUST^XMJMCODE(.XMKEY) ; XMSECURE is adjusted here
 S XMFDA(3.9,XMIENS,1.85)="1"_$$ENCSTR^XMJMCODE(XMKEY)
 D ENCMSG^XMJMCODE(XMZ)
 D FILE^DIE("","XMFDA")
 S XMMSG=$$EZBLD^DIALOG(37315.9) ; Message text Scrambled
 Q
SUBJ(XMZ,XMSUBJ,XMIM) ; Replace Subject
 S XMSUBJ=$$XMSUBJ^XMXPARM("XMSUBJ",$G(XMSUBJ)) Q:$D(XMERR)
 S (XMIM("SUBJ"),XMFDA(3.9,XMZ_",",.01))=$$ENCODEUP^XMXUTIL1(XMSUBJ)
 D FILE^DIE("","XMFDA")
 Q
TEXT(XMZ,XMBODY) ; Replace Text
 D WP^DIE(3.9,XMZ_",",3,"",XMBODY)
 Q
VAPOR(XMZ,XMVAPOR,XMINSTR,XMMSG) ; Vaporize date
 I XMVAPOR="@" D  Q
 . K XMINSTR("VAPOR")
 . S XMFDA(3.9,XMZ_",",1.6)="@"
 . D FILE^DIE("","XMFDA")
 . S XMMSG=$$EZBLD^DIALOG(37318.9) ; Vaporize Date removed
 S XMINSTR("VAPOR")=XMVAPOR
 S XMFDA(3.9,XMZ_",",1.6)=XMINSTR("VAPOR")
 D FILE^DIE("","XMFDA")
 S XMMSG=$$EZBLD^DIALOG(37317.9) ; Vaporize Date set
 Q
FLAGTOGL(XMZ,XMFIELD,XMINSTR,XMFLAG,XMSET,XMREMOVE,XMMSG) ; Flag Toggle (For internal MM use only!)
 N XMFDA
 I $G(XMINSTR("FLAGS"))[XMFLAG D
 . S XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),XMFLAG)
 . S XMMSG=$$EZBLD^DIALOG(XMREMOVE)
 . I XMFLAG="P" D
 . . S XMFDA(3.9,XMZ_",",XMFIELD)=$S($G(XMINSTR("TYPE"))="":"@",1:XMINSTR("TYPE"))
 . E  S XMFDA(3.9,XMZ_",",XMFIELD)="@"
 E  D
 . S XMINSTR("FLAGS")=$G(XMINSTR("FLAGS"))_XMFLAG
 . S XMMSG=$$EZBLD^DIALOG(XMSET)
 . I XMFLAG="P" S XMFDA(3.9,XMZ_",",XMFIELD)=$G(XMINSTR("TYPE"))_"P"
 . E  S XMFDA(3.9,XMZ_",",XMFIELD)="y"
 D FILE^DIE("","XMFDA")
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMXEDIT   5302     printed  Sep 23, 2025@19:50:08                                                                                                                                                                                                     Page 2
XMXEDIT   ;ISC-SF/GMB-Edit msg that user has sent to self ;05/19/2000  13:41
 +1       ;;8.0;MailMan;;Jun 28, 2002
 +2       ; All entry points covered by DBIA 2730.
 +3       ; These entry points edit a message.  They do not perform any checks to
 +4       ; see whether it is appropriate to do so.  That is the responsibility
 +5       ; of the calling routine.
 +6       ; For these entry points, it is expected that:
 +7       ; OPTMSG^XMXSEC2  has been called and has given its permission to
 +8       ;                 edit the message or to toggle information only.
 +9       ; OPTEDIT^XMXSEC2 has been called and has given its permission to
 +10      ;                 edit the particular thing we are editing here.
 +11      ; INMSG2^XMXUTIL2 has been called to set XMINSTR.  These routines expect
 +12      ;                 that XMINSTR has been correctly set.  They will change
 +13      ;                 XMINSTR according to the edit.
CLOSED(XMZ,XMINSTR,XMMSG) ; Toggle Closed msg
 +1       ; Messages addressed to SHARED,MAIL may not be closed
           IF $DATA(^TMP("XMY",$JOB,.6))
               DO ERRSET^XMXUTIL(37320.6)
               QUIT 
 +2        DO FLAGTOGL(XMZ,1.95,.XMINSTR,"X",37319.9,37320.9,.XMMSG)
 +3        QUIT 
CONFID(XMZ,XMINSTR,XMMSG) ; Toggle Confidential msg
 +1       ; Messages addressed to SHARED,MAIL may not be confidential
           IF $DATA(^TMP("XMY",$JOB,.6))
               DO ERRSET^XMXUTIL(37301.6)
               QUIT 
 +2        DO FLAGTOGL(XMZ,1.96,.XMINSTR,"C",37301.9,37302.9,.XMMSG)
 +3        QUIT 
CONFIRM(XMZ,XMINSTR,XMMSG) ; Toggle Confirm receipt of msg
 +1        DO FLAGTOGL(XMZ,1.3,.XMINSTR,"R",37313.9,37314.9,.XMMSG)
 +2        QUIT 
DELIVER(XMZ,XMDBSKT,XMINSTR,XMMSG) ; Delivery basket
 +1        IF XMDBSKT="@"
               Begin DoDot:1
 +2                KILL XMINSTR("RCPT BSKT")
 +3                SET XMFDA(3.9,XMZ_",",21)="@"
 +4                DO FILE^DIE("","XMFDA")
 +5       ; Delivery basket removed
                   SET XMMSG=$$EZBLD^DIALOG(37304.9)
               End DoDot:1
               QUIT 
 +6        SET XMINSTR("RCPT BSKT")=XMDBSKT
 +7        SET XMFDA(3.9,XMZ_",",21)=XMINSTR("RCPT BSKT")
 +8        DO FILE^DIE("","XMFDA")
 +9       ; Delivery basket set
           SET XMMSG=$$EZBLD^DIALOG(37303.9)
 +10       QUIT 
INFO(XMZ,XMINSTR,XMMSG) ; Toggle Information only msg
 +1        DO FLAGTOGL(XMZ,1.97,.XMINSTR,"I",37307.9,37308.9,.XMMSG)
 +2        QUIT 
NETSIG(XMDUZ,XMZ,XMINSTR,XMMSG) ; Add Network Signature
 +1        NEW I,XMNSIG
 +2        SET XMNSIG(.1)=""
 +3        SET XMNSIG(.2)=""
 +4        SET XMNSIG(.3)=$$REPEAT^XLFSTR("-",79)
 +5        SET XMNSIG=$GET(^XMB(3.7,XMDUZ,"NS1"))
 +6        FOR I=1:1:3
               if $PIECE(XMNSIG,U,I)'=""
                   SET XMNSIG(I)=$PIECE(XMNSIG,U,I)
 +7        NEW XMABORT
 +8        IF $DATA(^XMB(3.9,XMZ,"K"))
               Begin DoDot:1
 +9       ; If XMSECURE does not exist, then XMINSTR("SCR KEY") must hold the
 +10      ; correct scramble key.
 +11               IF '$DATA(XMSECURE)
                       NEW XMSECURE
 +12               IF '$DATA(XMSECURE)
                       IF '$$GOODKEY^XMJMCODE(XMZ,XMINSTR("SCR KEY"))
                           Begin DoDot:2
 +13      ; The key is not correct.
                               DO ERRSET^XMXUTIL(34623)
 +14                           SET XMABORT=1
                           End DoDot:2
                           QUIT 
 +15               SET XMABORT=0
 +16               SET I=0
 +17               FOR 
                       SET I=$ORDER(XMNSIG(I))
                       if 'I
                           QUIT 
                       SET XMNSIG(I)=$$ENCSTR^XMJMCODE(XMNSIG(I))
               End DoDot:1
               if XMABORT
                   QUIT 
 +18      ; Add the network signature
           DO MOVEBODY^XMXSEND(XMZ,"XMNSIG","A")
 +19      ; Network Signature added
           SET XMMSG=$$EZBLD^DIALOG(37309.9)
 +20       QUIT 
PRIORITY(XMZ,XMINSTR,XMMSG) ; Toggle Priority msg
 +1        DO FLAGTOGL(XMZ,1.7,.XMINSTR,"P",37311.9,37312.9,.XMMSG)
 +2        QUIT 
SCRAMBLE(XMZ,XMINSTR,XMMSG) ; Scramble or Unscramble the message text
 +1        NEW XMFDA,XMIENS
 +2        SET XMIENS=XMZ_","
 +3        IF $DATA(^XMB(3.9,XMZ,"K"))
               Begin DoDot:1
 +4       ; Unscramble the text.
 +5       ; If XMSECURE does not exist, then XMINSTR("SCR KEY") must hold the
 +6       ; correct scramble key.
 +7       ; The key is not correct.
                   IF '$DATA(XMSECURE)
                       IF '$$GOODKEY^XMJMCODE(XMZ,XMINSTR("SCR KEY"))
                           DO ERRSET^XMXUTIL(34623)
                           QUIT 
 +8                SET XMFDA(3.9,XMIENS,1.8)="@"
 +9                SET XMFDA(3.9,XMIENS,1.85)="@"
 +10               DO FILE^DIE("","XMFDA")
 +11               DO DECMSG^XMJMCODE(XMZ)
 +12               KILL XMSECURE,XMINSTR("SCR KEY"),XMINSTR("SCR HINT"),^XMB(3.9,XMZ,"K")
 +13      ; Message text UnScrambled
                   SET XMMSG=$$EZBLD^DIALOG(37316.9)
               End DoDot:1
               QUIT 
 +14      ; Check the key and hint
 +15       DO XMKEY^XMXPARM1($GET(XMINSTR("SCR KEY")))
 +16       if $GET(XMINSTR("SCR HINT"))'=""
               DO XMHINT^XMXPARM1(XMINSTR("SCR HINT"))
 +17       if $DATA(XMERR)
               QUIT 
 +18      ; Scramble the text.
 +19       NEW XMKEY
 +20       KILL XMSECURE
 +21       SET XMFDA(3.9,XMIENS,1.8)=$SELECT($GET(XMINSTR("SCR HINT"))="":" ",1:XMINSTR("SCR HINT"))
 +22      ; XMSECURE is created here
           DO LOADCODE^XMJMCODE
 +23       SET XMKEY=XMINSTR("SCR KEY")
 +24      ; XMSECURE is adjusted here
           DO ADJUST^XMJMCODE(.XMKEY)
 +25       SET XMFDA(3.9,XMIENS,1.85)="1"_$$ENCSTR^XMJMCODE(XMKEY)
 +26       DO ENCMSG^XMJMCODE(XMZ)
 +27       DO FILE^DIE("","XMFDA")
 +28      ; Message text Scrambled
           SET XMMSG=$$EZBLD^DIALOG(37315.9)
 +29       QUIT 
SUBJ(XMZ,XMSUBJ,XMIM) ; Replace Subject
 +1        SET XMSUBJ=$$XMSUBJ^XMXPARM("XMSUBJ",$GET(XMSUBJ))
           if $DATA(XMERR)
               QUIT 
 +2        SET (XMIM("SUBJ"),XMFDA(3.9,XMZ_",",.01))=$$ENCODEUP^XMXUTIL1(XMSUBJ)
 +3        DO FILE^DIE("","XMFDA")
 +4        QUIT 
TEXT(XMZ,XMBODY) ; Replace Text
 +1        DO WP^DIE(3.9,XMZ_",",3,"",XMBODY)
 +2        QUIT 
VAPOR(XMZ,XMVAPOR,XMINSTR,XMMSG) ; Vaporize date
 +1        IF XMVAPOR="@"
               Begin DoDot:1
 +2                KILL XMINSTR("VAPOR")
 +3                SET XMFDA(3.9,XMZ_",",1.6)="@"
 +4                DO FILE^DIE("","XMFDA")
 +5       ; Vaporize Date removed
                   SET XMMSG=$$EZBLD^DIALOG(37318.9)
               End DoDot:1
               QUIT 
 +6        SET XMINSTR("VAPOR")=XMVAPOR
 +7        SET XMFDA(3.9,XMZ_",",1.6)=XMINSTR("VAPOR")
 +8        DO FILE^DIE("","XMFDA")
 +9       ; Vaporize Date set
           SET XMMSG=$$EZBLD^DIALOG(37317.9)
 +10       QUIT 
FLAGTOGL(XMZ,XMFIELD,XMINSTR,XMFLAG,XMSET,XMREMOVE,XMMSG) ; Flag Toggle (For internal MM use only!)
 +1        NEW XMFDA
 +2        IF $GET(XMINSTR("FLAGS"))[XMFLAG
               Begin DoDot:1
 +3                SET XMINSTR("FLAGS")=$TRANSLATE(XMINSTR("FLAGS"),XMFLAG)
 +4                SET XMMSG=$$EZBLD^DIALOG(XMREMOVE)
 +5                IF XMFLAG="P"
                       Begin DoDot:2
 +6                        SET XMFDA(3.9,XMZ_",",XMFIELD)=$SELECT($GET(XMINSTR("TYPE"))="":"@",1:XMINSTR("TYPE"))
                       End DoDot:2
 +7               IF '$TEST
                       SET XMFDA(3.9,XMZ_",",XMFIELD)="@"
               End DoDot:1
 +8       IF '$TEST
               Begin DoDot:1
 +9                SET XMINSTR("FLAGS")=$GET(XMINSTR("FLAGS"))_XMFLAG
 +10               SET XMMSG=$$EZBLD^DIALOG(XMSET)
 +11               IF XMFLAG="P"
                       SET XMFDA(3.9,XMZ_",",XMFIELD)=$GET(XMINSTR("TYPE"))_"P"
 +12              IF '$TEST
                       SET XMFDA(3.9,XMZ_",",XMFIELD)="y"
               End DoDot:1
 +13       DO FILE^DIE("","XMFDA")
 +14       QUIT