; EDMSG.MAC - 5/11/87 - Edit message headers. .z80 maclib TNC.LIB entry edmsg,etmsg,mm8,mm9,mm9a,mm10,mm11,mm12 entry etflg,etmto,etmat,etmty,etmtit,etmerr external change,mfcb,mrec,mhtitl,mhbbs external msgnr,mlhd,phdr,firmsg,getto,mhtit external mmhs,mhnr,mhto,mhfrom,mhstat,mhtype,mhprev external fcb1,fcb2,getcmd,cmdlen,cmdtyp,waitc,@cmp external erfind,erwhat,@prtx,@mcmd,numb,decbin,logmnr asciictl tncdefs bdosdef ; Edit the message headers. dseg edchg: ds 1 ; Set true if this message changed mm8: ds 2 mm9: ds 2 mm9a: ds 2 mm10: ds 2 mm11: ds 2 mm12: ds 2 etflg: ds 1 etflg2: ds 1 etmto: ds 2 etmat: ds 2 etmty: ds 2 etmtit: ds 2 etmerr: ds 2 cseg getinp: call getcmd ckcmd getinp,gtina,gtina ld a,(cmdlen) or a ret ; Timeout or disconnect. gtina: pop hl ; Clean stack ret ; Get out with no change etmsg: mvim etflg2,true ; ET command (not E) cmpm etflg,false ; Config allows ET? jp z,erwhat ; If not, give error jr edmsg0 ; Join common code edmsg: mvim etflg2,false ; E command (not ET) edmsg0: dodosa setdma,mmhs ; Point I/O to msg header mvim edchg,false zmov numb,fcb2+1,5 ; Message number call decbin ; Make it binary jp c,erwhat ; Not a number ld (msgnr),hl ; Save it movw mrec,mlhd ; Prepare to read last header edmsga: dtz mrec ; Any headers left? jp z,erfind ; No, not found dodosa rrec,mfcb ; Read message header ld hl,(msgnr) ; Msg we want ld de,(mhnr) ; Msg we got or a ; Clear carry sbc hl,de ; Right one? jr z,edmsgi ; Yes movw mrec,mhprev ; Point to previous header jr edmsga ; and try that one edmsgi: mvim firmsg,true ; To force printing of column head cmpm etflg2,true ; E or ET command? jp z,etmsga ; Go if ET call phdr ; Print the header prtx mm8 ; Ask about TO call getinp ; Get response jr z,edmsgc ; No change mvim edchg,true ; Mark as changed zmov mhto,fcb1+1,6 ; New TO edmsgc: prtx mm9 ; Ask about FROM call getinp ; Get response jr z,edmsgq ; No change mvim edchg,true ; Mark as changed zmov mhfrom,fcb1+1,6 ; New FROM edmsgq: prtx mm9a ; Ask about AT call getinp ; Get response jr z,edmsgd ; No change mvim edchg,true ; Mark as changed zmov mhbbs,fcb1+1,6 ; New AT edmsgd: prtx mm10 ; Ask about TITLE call getinp ; Get response jr z,edmsge ; No change mvim edchg,true ; Mark as changed movcmd mhtit,0,mhtitl-1 ; New TITLE ld (hl),cr ; CR at end edmsge: prtx mm11 ; Ask about STATUS call getinp ; Get response jr z,edmsgf ; No change mvim edchg,true ; Mark as changed movb mhstat,fcb1+1 ; New STATUS edmsgf: prtx mm12 ; Ask about TYPE call getinp ; Get response jr z,edmsgg ; No change mvim edchg,true ; Mark as changed movb mhtype,fcb1+1 ; New TYPE edmsgg: cmpm edchg,false ; Any field changed? jp z,waitc ; No change edmsgz: mvim change,true ; Mark file as changed dodosa wrec,mfcb ; Write the msg header call phdr ; Print changed header call logmnr ; Log changing the msg jp waitc ; Done ; ET. Check for being T or S or to NTS* etmsga: cmpm mhtype,'T' ; Is it a T msg? jr z,etmsgb ; Yes, can do ET cp 'S' ; Is it an S msg? jr z,etmsgb ; Yes, can to ET to that, too ld hl,knts ; Point at "NTS" constant string comp ,mhto,3 ; Is msg to NTSxxx? jr z,etmsgb ; Yes, allow editing even if not T type prtx etmerr ; Say can't edit this one jp waitc ; End of command knts: db 'NTS' ; String for checking TO field etmsgb: call phdr ; Print the header prtx etmto ; Ask about TO call getinp ; Get response jr z,etmsgc ; No change mvim edchg,true ; Mark as changed zmov mhto,fcb1+1,6 ; New TO etmsgc: prtx etmat ; Ask about AT call getinp ; Get response jr z,etmsgd ; No change mvim edchg,true ; Mark as changed zmov mhbbs,fcb1+1,6 ; New AT etmsgd: prtx etmty ; Ask about TYPE call getinp ; Get response jr z,etmsge ; No change mvim edchg,true ; Mark as changed movb mhtype,fcb1+1 ; New TYPE etmsge: prtx etmtit ; Ask about TITLE call getinp ; Get response jr z,etmsgf ; No change mvim edchg,true ; Mark as changed movcmd mhtit,0,mhtitl-1 ; New TITLE ld (hl),cr ; CR at end etmsgf: cmpm edchg,false ; Any field changed? jp z,waitc ; No change mvim mhstat,'N' ; Say not read yet (so will fwd) jp edmsgz ; Go set change, type out hdr. end