Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMS0BLOB

XMS0BLOB.m

Go to the documentation of this file.
  1. XMS0BLOB ;(WASH ISC)/CAP-Send BLOBs (other body parts) ;04/18/2002 07:52
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ;
  1. ;This routine sends BLOBS (Basic Large Objects), also known in the
  1. ;messaging world as 'Other Body Parts' of messages.
  1. ;It can do this only with MailMan systems after (not including)
  1. ;version 7.0.
  1. ;
  1. ;A second portion of this code will be able to send to TCP/IP-SMTP
  1. ;systems that conform to MIME (MEE-MEE), an extension of RFC-822 that
  1. ;MailMan will conform to when dealing with MIME compatible structures.
  1. ;
  1. ;See XMR0BLOB for documentation on MPDUs (Message Protocol Data Units)
  1. ;exchanged between sender and receiver.
  1. ;
  1. ;Get data on BLOB from Imaging files
  1. S XMSBLOBX=0
  1. 0 S XMSBLOBX=$O(^XMB(3.9,XMZ,2005,XMSBLOBX)) G Q:XMSBLOBX="" S Y=$G(^(XMSBLOBX,0)) G 0:Y=""
  1. S X=+Y,ER=0,Y=$G(^MAG(2005,X,0)) G 0:Y=""
  1. S XMSBLOBT=Y,XMSBLOBT("#")=X,XMSBLOBT("NAME")=$P(Y,U),XMSBLOBT("FILE")=$P(Y,U,2),XMSBLOBT("DATE")=$P(Y,U,9)
  1. S Y(0)="" F %=3,4,5 S X=$P(Y,U,%) I X S Y(0)=$G(^MAG(2005.2,X,0)) Q:$L(Y(0))
  1. G 0:'$L(Y(0)) ;BLOB can not be sent -- no known disk reference
  1. S XMSBLOBT("DISK")=$P(Y(0),U,2),DIC=2005.02,DIC(0)="NZ"
  1. S X=$P(XMSBLOBT,U,6) D ^DIC G 0:Y<1 S XMSBLOBT("TYPE")=$P(Y,U,2)
  1. ;
  1. ;Send MPDU (Message Protocol Data Unit), Directory to send to returned
  1. ;
  1. S XMSG="MESS BLOB: "_XMSBLOBT("FILE")_"^"_XMSBLOBT("NAME")_"^"_XMSBLOBT("TYPE")_"^"_XMSBLOBT("DATE")
  1. 1 X XMSEN Q:ER X XMREC Q:ER I +XMRG'=250 G 0:$E(XMRG)=4 K ^XMB(3.9,XMZ,1,"AQUEUE",XMINST) N XMA0 S XMA0=XMCI_U_XMINST_U_XMZ D ERRR S XMINST=$P(XMA0,U,2),XMBLOBER=1,XMCI=$P(XMA0,U),XMZ=$P(XMA0,U,3) Q
  1. ;
  1. ;Determine IP address to send BLOB to / Use domain file data if it exists
  1. S %=$P(XMRG,U,2),X=$P($G(^DIC(4.2,XMINST,"IP")),U),%=$S($L(X):X,$L(%):%,1:"")
  1. I %="" S XMSG="MESS BLOB: < BLOB(s) not sent - No FTP channel defined !!! >" X XMSEN G ERR
  1. S XMSBLOBT("IP")=%
  1. ;
  1. ;FTP file to remote site
  1. ;
  1. K XMSFTP S XMSFTP(1)=$P($G(^XMB(1,1,"FTP-GET")),U),XMSFTP(2)=$P(XMRG,U,5),XMSFTP(2,"F")=XMSBLOBT("FILE"),XMSFTP(3)=XMSBLOBT("IP"),XMSFTP("IMAGE-PTR")=XMSBLOBT("#")
  1. F I=6,7,8 S XMSFTP(I)=$P(XMRG,U,I)
  1. I '$L($G(XMSFTP(6))) S %=$G(^DIC(4.2,XMINST,3)) I $L(%) S XMSFTP(7)=$P(%,";"),XMSFTP(7.1)=$P(%,";",2)
  1. D ^XMSFTP K XMSFTP
  1. G 0
  1. ;
  1. ;Record error, set error flag to RESET message transmission,
  1. ;remove message from queue, send message to sender.
  1. ERRR N ER,XMA0
  1. ERR ;
  1. N I,XMTEXT,XMSEN,XMREC,XMRECIP,XMSITE,XMSUBJ,XMIEN,XMTO,XMINSTR
  1. S XMINSTR("FROM")=.5
  1. S XMSUBJ="TRANSMISSION ERROR (Non-Textual Body-Part Message [BLOB])"
  1. S XMTEXT(1)="Error (sending your Multi-Body-Part Message):"
  1. S XMTEXT(2)=" "
  1. S XMTEXT(3)="Subject: "_$P(XMR,U)
  1. S XMTEXT(4)=" "
  1. S XMTEXT(5)=XMSG
  1. S XMTEXT(6)=" "
  1. S XMTEXT(7)="The message was not sent. It was removed from the transmission queue."
  1. S XMTEXT(8)="You should get this problem fixed and reforward this message"
  1. S XMSITE=$P(^DIC(4.2,XMINST,0),U)
  1. S XMTEXT(9)="to the recipients at "_XMSITE_":"
  1. S XMRECIP=":",I=9
  1. F S XMRECIP=$O(^XMB(3.9,XMZ,1,"C",XMRECIP)) Q:XMRECIP="" D
  1. . S XMIEN=""
  1. . F S XMIEN=$O(^XMB(3.9,XMZ,1,"C",XMRECIP,XMIEN)) Q:XMIEN="" D
  1. . . S XMREC=$G(^XMB(3.9,XMZ,1,XMIEN,0))
  1. . . Q:$P($P(XMREC,U,1),"@",2)'=XMSITE
  1. . . S I=I+1,XMTEXT(I)=$P(XMREC,U,1)
  1. . . S XMFWDBY=$P($G(^XMB(3.9,XMZ,1,XMIEN,"F")),U,2)
  1. . . S:XMFWDBY'="" XMTO(XMFWDBY)=""
  1. S:'$D(XMTO) XMTO($P(XMR,U,2))="" ; Sender of the message
  1. D SENDMSG^XMXSEND(.5,XMSUBJ,"XMTEXT",XMTO,.XMINSTR)
  1. Q
  1. ;Clean up and quit
  1. Q K XMSBLOBT,XMSBLOBX,DIC Q
  1. ;
  1. TEST S XMSEN="Q",XMREC="S XMRG=250",XMZ=18067
  1. G XMS0BLOB