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

XMXLIST.m

Go to the documentation of this file.
  1. XMXLIST ;ISC-SF/GMB-List message: multiple conditions ;03/01/2001 09:40
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. LISTMSGS(XMDUZ,XMK,XMFLDS,XMFLAGS,XMAMT,XMSTART,XMF,XMTROOT) ;
  1. ; XMDUZ is the user doing the search
  1. ; XMK is the place to look
  1. ; =number - Look in this basket of the mailbox of XMDUZ
  1. ; =* - Look in all baskets of the mailbox of XMDUZ
  1. ; =! - Look in the MESSAGE file for all messages
  1. ; that XMDUZ sent or received. If XMFLAGS["U"
  1. ; and the user (DUZ) holds the XM SUPER SEARCH
  1. ; key, ALL messages are examined,
  1. ; regardless of ownership.
  1. ; XMFLDS is a list, separated by ';', of fields to retrieve.
  1. ; e.g. XMFLDS="SUBJ;DATE" means retrieve subject and date.
  1. ; "BSKT" = basket (default: <basket ien>^<basket name>)
  1. ; optionally followed by ":" and
  1. ; "I" for basket IEN only (no 2nd piece)
  1. ; "X" adds basket name xref
  1. ; (If XMK="!", and msg is not in user's mailbox, will be:
  1. ; "0^* N/A *")
  1. ; "DATE" = date sent (default: <internal date>^<dd mmm yy hh:mm>)
  1. ; optionally followed by ":" and
  1. ; "I" for internal date only (no 2nd piece)
  1. ; "F" for FileMan date as the 2nd piece
  1. ; "X" adds FileMan date xref
  1. ; "FROM" = message from (default: <internal from>^<external from>)
  1. ; optionally followed by ":" and
  1. ; "I" for internal from only (no 2nd piece)
  1. ; "X" adds external from xref
  1. ; "LINE" = number of lines in the message
  1. ; "NEW" = is the msg new? (0=no; 1=yes; 2=yes, and priority, too)
  1. ; "PRI" = is the message priority? (0=no; 1=yes)
  1. ; "READ" = how much of the message has the user read?
  1. ; null = has not read the message at all
  1. ; 0 = has read the message, but no responses
  1. ; number = has read through this response
  1. ; "RESP" = how many responses does the message have?
  1. ; 0 = none
  1. ; number = this many
  1. ; "SEQN" = sequence number in basket (If XMK="!", and msg is not
  1. ; in user's mailbox, will not be returned at all.)
  1. ; "SUBJ" = message subject (always external)
  1. ; optionally followed by ":" and
  1. ; "X" adds subject xref
  1. ; XMFLAGS are used to control processing
  1. ; =B Backwards order (Default is traverse forward)
  1. ; =U Ignore the file screen on file 3.9 so that all
  1. ; messages can be examined. (valid only if user holds
  1. ; XM SUPER SEARCH key and XMK="!")
  1. ; If XMK="!", the following flags are ignored:
  1. ; =C Use basket C-xref (Default is message IEN)
  1. ; =N New messages only (C flag ignored)
  1. ; =P New Priority messages only (C, N flags ignored)
  1. ; XMAMT How many?
  1. ; =number - Get this many
  1. ; =* - Get all (default)
  1. ; XMSTART is used to start the lister going. The lister will keep it
  1. ; updated from call to call. (If XMK="!", FileMan handles XMSTART,
  1. ; and you should look at FM documentation for an explanation.)
  1. ; XMSTART("XMK") Start with this basket IEN (valid only if XMK="*")
  1. ; Continues from there, with each successive call,
  1. ; to the end.
  1. ; (Default is to start with basket .5, the WASTE basket)
  1. ; XMSTART("XMZ") Start AFTER this message IEN (valid only if no C flag)
  1. ; Continues from there, with each successive call,
  1. ; to the end.
  1. ; (Default is to start at the beginning (or end) of the
  1. ; basket)
  1. ; XMSTART("XMKZ") Start AFTER this message C-xref (valid only if C flag)
  1. ; Continues from there, with each successive call,
  1. ; to the end.
  1. ; (Default is to start at the beginning (or end) of the
  1. ; basket)
  1. ; XMF contains conditions which are 'and'ed together to select only
  1. ; those messages which meet the conditions.
  1. ; XMF("FROM") Message is from this person
  1. ; XMF("FDATE") Message was sent on or after this date
  1. ; (If XMK="!", make sure this doesn't conflict w/XMF("PD"))
  1. ; XMF("FLINE") Message has this many or more lines
  1. ; XMF("PD") Message was sent in this period (FM equiv. of yyy/yyymm)
  1. ; (default is current month) (valid only if XMK="!")
  1. ; XMF("RFROM") Message has a response from this person
  1. ; XMF("SUBJ") Subject contains this string
  1. ; XMF("SUBJ","C") =0 - Search is not case-sensitive (default)
  1. ; =1 - Search is case-sensitive
  1. ; XMF("TDATE") Message was sent on or before this date
  1. ; (If XMK="!", make sure this doesn't conflict w/XMF("PD"))
  1. ; XMF("TEXT") Message contains this string
  1. ; XMF("TEXT","L") =1 - Look in message only (default)
  1. ; =2 - Look in both message and responses
  1. ; =3 - Look in responses only
  1. ; XMF("TEXT","C") =0 - Search is not case-sensitive (default)
  1. ; =1 - Search is case-sensitive
  1. ; XMF("TLINE") Message has this many or fewer lines
  1. ; XMF("TO") Message is to this person
  1. ; XMTROOT is the target root to receive the message list.
  1. ; (default is ^TMP("XMLIST",$J))
  1. ;
  1. ; Variables set and used by the routine:
  1. ; XMF("SUBJ","S") Look for this string in the subject
  1. ; XMF("TEXT","S") Look for this string in the message
  1. ; XMF("PD","S") Look for messages created during this period
  1. N XMORDER
  1. I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
  1. D INIT(.XMFLDS,.XMFLAGS,.XMAMT,.XMORDER,.XMF,.XMTROOT)
  1. I XMK="!" D ALLMSGS(XMDUZ,$G(XMFLAGS),XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. I XMK="*" D Q
  1. . I XMFLAGS["P" D NEWA^XMXLIST1(XMDUZ,"N",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. . I XMFLAGS["N" D NEWA^XMXLIST1(XMDUZ,"N0",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. . I XMFLAGS["C" D REGAC^XMXLIST1(XMDUZ,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. . D REGAZ^XMXLIST1(XMDUZ,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT)
  1. N XMKN
  1. S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1)
  1. I XMFLAGS["P" D NEW1^XMXLIST2(XMDUZ,XMK,XMKN,"N",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. I XMFLAGS["N" D NEW1^XMXLIST2(XMDUZ,XMK,XMKN,"N0",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. I XMFLAGS["C" D REG1C^XMXLIST2(XMDUZ,XMK,XMKN,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
  1. D REG1Z^XMXLIST2(XMDUZ,XMK,XMKN,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT)
  1. Q
  1. INIT(XMFLDS,XMFLAGS,XMAMT,XMORDER,XMF,XMTROOT) ;
  1. I $D(XMFLDS),XMFLDS="" K XMFLDS
  1. I $D(XMTROOT),XMTROOT'="" D
  1. . K @$$CREF^DILF(XMTROOT)
  1. . S XMTROOT=$$OREF^DILF(XMTROOT)_"""XMLIST"","
  1. E D
  1. . K ^TMP("XMLIST",$J)
  1. . S XMTROOT="^TMP(""XMLIST"",$J,"
  1. I $D(XMF) D
  1. . I $D(XMF)'>9 K XMF Q
  1. . S:$D(XMF("SUBJ")) XMF("SUBJ","S")=$S('$G(XMF("SUBJ","C")):$$UP^XLFSTR(XMF("SUBJ")),1:XMF("SUBJ"))
  1. . I $D(XMF("TEXT")) D
  1. . . S XMF("TEXT","S")=$S('$G(XMF("TEXT","C")):$$UP^XLFSTR(XMF("TEXT")),1:XMF("TEXT"))
  1. . . I '$D(XMF("TEXT","L")) S XMF("TEXT","L")=1
  1. . I $D(XMF("PD")) S XMF("PD","S")=$S($E(XMF("PD"),4,5)="00":$E(XMF("PD"),1,3),1:$E(XMF("PD"),1,5))
  1. . I $D(XMF("FROM")) S XMF("FROM")=$$UP^XLFSTR(XMF("FROM"))
  1. . I $D(XMF("RFROM")) S XMF("RFROM")=$$UP^XLFSTR(XMF("RFROM"))
  1. . I $D(XMF("TO")),XMF("TO")["@" S XMF("TO")=$$UP^XLFSTR(XMF("TO"))
  1. S XMFLAGS=$G(XMFLAGS)
  1. S XMORDER=$S(XMFLAGS["B":-1,1:1)
  1. I $G(XMAMT)="" S XMAMT="*"
  1. Q
  1. ALLMSGS(XMDUZ,XMFLAGS,XMORDER,XMFLDS,XMAMT,XMSTART,XMF,XMTROOT) ; Look in the entire MESSAGE file.
  1. N XMSCREEN,XMK,XMKN,XMZ,I,XMNA,XMCNT
  1. I XMFLAGS["U",'$$SSPRIV^XMXSEC1 Q
  1. S XMFLAGS=$TR(XMFLAGS,"CNP")
  1. I XMFLAGS["U" D AUDIT^XMJMFC(.XMF) Q:$D(XMERR)
  1. S XMSCREEN=$$SCREEN^XMJMFC(XMDUZ)
  1. ; File screen ^DD(3.9,0,"SCR") insists that user be author or recipient.
  1. ; If FLAGS["U", then file screen is ignored.
  1. D LIST^DIC(3.9,"","@",XMFLAGS,XMAMT,.XMSTART,$G(XMF("PD","S"),$E(DT,1,5)),"C",XMSCREEN)
  1. S I="",XMCNT=0,XMNA=$$EZBLD^DIALOG(34014) ; * N/A *
  1. F S I=$O(^TMP("DILIST",$J,2,I),XMORDER) Q:I'>0 D
  1. . S XMZ=^TMP("DILIST",$J,2,I)
  1. . S XMCNT=XMCNT+1
  1. . S @(XMTROOT_XMCNT_")")=XMZ
  1. . Q:'$D(XMFLDS)
  1. . I $S(XMFLDS["BSKT":1,XMFLDS["NEW":1,XMFLDS["SEQN":1,1:0) D
  1. . . S XMK=+$O(^XMB(3.7,"M",XMZ,XMDUZ,0))
  1. . . S XMKN=$S(XMK:$P(^XMB(3.7,XMDUZ,2,XMK,0),U),1:XMNA)
  1. . . Q:'XMK
  1. . . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITM^XMUT4A(XMDUZ,XMK,XMZ)
  1. . . I XMFLDS["SEQN" D KSEQN^XMXLIST1(XMDUZ,XMK,XMZ,.XMFLDS,XMTROOT,XMCNT)
  1. . D FIELDS^XMXLIST1(XMDUZ,.XMK,.XMKN,XMZ,.XMFLDS,XMTROOT,XMCNT)
  1. S @(XMTROOT_"0)")=$G(^TMP("DILIST",$J,0)) ; # found^# requested^more?
  1. K ^TMP("DILIST",$J)
  1. Q