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

XMGAPI0.m

Go to the documentation of this file.
  1. XMGAPI0 ;(WASH ISC)/CAP-Validate/Get Subject APIs ;04/17/2002 08:56
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Entry points (DBIA 1142):
  1. ; $$SUBCHK - Validate a proposed message subject
  1. ; $$SUBGET - Retrieve the subject of a message
  1. ENT(Y,Z) ;Check Input Subject
  1. ;Param1=String
  1. ;Param2=Silent Flag
  1. N A S A=""
  1. I $L(Y)>65 S A=1,%="Entered SUBJECT too long, "_$L($E(Y,66,999))_" characters longer than 65." S Y=$E(Y,1,250) G S:Z Q "3-"_%_U_$E(Y,1,65)
  1. ;
  1. I Y[U S Y=$$ENCODEUP^XMCU1(Y)
  1. ;
  1. ;REMOVE LEADING BLANKS
  1. B I Y?1" ".E S Y=$E(Y,2,99) G B
  1. ;
  1. ;REMOVE TRAILING BLANKS
  1. E I $E(Y,$L(Y))=" " S Y=$E(Y,1,$L(Y)-1) G E
  1. ;
  1. G U:Y'?.E1C.E I 'Z Q "5-Subject cannot contain control characters.^"_Y
  1. F X=1:1 I $E(Y,X)?1C S Y=$E(Y,1,X-1)_$E(Y,X+1,99) Q:Y'?.E1C.E S X=X-1
  1. W $C(7),!,"Control characters removed ("""_Y_""" is Subject accepted).",!
  1. ;
  1. U I Y="" Q ""
  1. I Y="?" S A=1,%="Enter a Message Subject, between 3 & 65 characters long or '^' to exit." G S:Z Q "4-"_%_U_Y
  1. I $L(Y)<3 S A=1,%="SUBJECT must be at least 3 characters long." G S:Z Q "1-"_%_U_Y
  1. I Y?1"R"2N.N S A=1,%="Subject names of this format (1""R""1.N) are RESERVED" G S:Z Q "2-"_%_U_Y
  1. Q Q A_U_Y
  1. S W !,$C(7),%,!
  1. G Q
  1. SUBGET(X) ;Return Subject of a Message (""=Error, Else returns Subject)
  1. S X=$P($G(^XMB(3.9,X,0)),U) I X="" Q ""
  1. Q $$DECODEUP^XMCU1(X)
  1. SUBCHK(X,Z) ;Check Subject (""=Error, Else returns Subject)
  1. ;Param1=String
  1. ;Param2=Silent Flag (0=Silent, 1=Verbose)
  1. N Y S Y=X
  1. Q $$ENT(X,Z)