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

XMR0BLOB.m

Go to the documentation of this file.
  1. XMR0BLOB ;(WASH ISC)/CAP-BLOB Receive ;09/15/97 09:28
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ;
  1. ;This routine receives 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 later capability is planned to receive TCP/IP-SMTP messaes that
  1. ;conform to MIME (MEE-MEE), an extension to RFC-822 that MailMan will
  1. ;conform to.
  1. ;
  1. ;Message Protocol Data Unit (MPDU) received in X (from XMR0A) contains:
  1. ;
  1. ;file_name^BLOB_name^BLOB_type^Origin Date
  1. ;(Eg. X="XIMAGE.756^XRAY2-ulna^STLL IMAGE^2930430
  1. ;API entry requires Path, Netmail entry automatically defaults it
  1. ;
  1. ;Returns: 250 Okay file_path
  1. ;
  1. BLOB(X) ;Receive BLOB
  1. ;
  1. ;Reject BLOBs
  1. I '$D(^DD(2005)) S XMSG="555 Reject - Imaging not installed at "_^XMB("NETNAME"),ER=1 X XMSEN G Q
  1. ;Cannot recieve BLOB without REGISTERED SUBDIRECTORY in DOMAIN file
  1. F Q:$E(X)'=" " S X=$E(X,2,999)
  1. ;
  1. S %=$G(^DIC(4.2,XMINST,"FTP/DIR"))
  1. ;FTP DIRECTORY (File 4.2, Field 6.7) -- Sub-directory for a domain
  1. ;
  1. ;Receive message into Kernel Site Parameter DISK/VOL (7.7) entry
  1. S Y=$G(^XMB(1,1,"DISK/VOL"))
  1. I %_Y="",'$L($P($G(^XMB(1,1,"FTPRCVDISK")),U)) S XMSG="550 Reject - No DISK/VOL or DOMAIN Directory defined in Kernel Site Parameters at "_^XMB("NETNAME") X XMSEN G Q
  1. S XMR0BLOB("DISK")=Y_$S(%="":"",1:$S($L(Y,"\")>1:"",1:"\"))_%
  1. ;
  1. S XMR0BLOB("FILE")=$P(X,U),XMR0BLOB("NAME")=$P(X,U,2),XMR0BLOB("TYPE")=$P(X,U,3),XMR0BLOB("FTP")=Y,XMR0BLOB("DATE")=$P(X,U,4)
  1. ;
  1. ;
  1. FILE K DIC
  1. ;First make sure pointer fields exist in pointed at files
  1. ;Network Location
  1. ;Is it there ?
  1. S X=$P($G(^XMB(1,1,"FTPNETLOC")),U),X=$S($L(X):X,1:"MAG1"),DIC=2005.2,DIC(0)="XF" D ^DIC
  1. ;If not there set it up
  1. I Y<0 D FILE^DICN
  1. S XMR0BLOB("DISK")=Y
  1. ;
  1. ;(TYPE)
  1. ;Is it there ?
  1. K DIC S DIC=2005.02,DIC(0)="FX",X=XMR0BLOB("TYPE") D ^DIC
  1. ;If not there set it up
  1. I Y<0 D FILE^DICN
  1. S XMRBLOB("TYPE")=+Y
  1. ;
  1. ;Is it already in the file ?
  1. S X=XMR0BLOB("NAME"),DIC="^MAG(2005,",DIC(0)="FO" D ^DIC I +Y>0 S XMSG="442 File previously exists",X=$$2005(Y) X XMSEN G Q
  1. ;
  1. ;Finally it's time to stuff the entry in the master file
  1. ;Sends: FTP Address^ ^ ^ ^ Path ^ Username ^ Password ^ Physical Disk
  1. ;EG. 250 Okay^127.0.0.1^^^image\subdir^USERNAME^PASSWORD^_nfa0:
  1. S XMSG="250 Okay ^"_$G(^XMB(1,1,"FTP-RCV"))_"^^^"_$G(^("DISK/VOL"))_U_$G(^("FTPUSER"))_U_$G(^("FTPPWD"))_U_$P($G(^("FTPRCVDISK")),U)
  1. X XMSEN G Q:ER
  1. S DIC="^MAG(2005,",DIC(0)="FI",X=XMR0BLOB("NAME") D FILE^DICN
  1. S DIE="^MAG(2005,",DR="2///"_+XMR0BLOB("DISK")_";1///"_XMR0BLOB("FILE")_";3///"_XMR0BLOB("TYPE")_$S($L(XMR0BLOB("DATE")):";14///"_XMR0BLOB("DATE"),1:""),DA=+Y
  1. D ^DIE S X=$$2005(DA)
  1. Q K DO,DD,DIC,DO,DD,DA,XMR0BLOB
  1. Q
  1. 2005(X) ;Add to Message BLOB list
  1. N XMFDA
  1. S XMFDA(3.92005,"?+1,"_$G(XMZIENS,XMZ_","),.01)=X
  1. D UPDATE^DIE("","XMFDA")
  1. Q 1
  1. API(X) ;BLOB (XMD,XMB)
  1. N %,I,XMMG,XMR0BLOB,XMSEN,XMSG,XMREC
  1. F %=1:1:5 S XMR0BLOB($P("FILE^TYPE^NAME^DATE^DISK",U,I))=$P(X,U,I)
  1. D FILE
  1. Q $S(+XMSG=250:1,+XMSG=440:1,1:0)