(* -------------------------------------------------------------------------- :Program. ums :Contents. Interfaces for ums.library :Author. Martin Koyro [mk] :Address. SnailMail: EMail: :Address. Salzmannstr. 12 MAUS: MS3 :Address. 48147 Muenster INET: mk@ms3.ms.open.de :Address. GERMANY :Author. Martin Loos [ml] :Address. SnailMail: EMail: :Address. Im Scheidt 25 MAUS: UN :Address. 58640 Iserlohn-Kalthof INET: mattin@unicorn.mk.open.de :Address. GERMANY FIDO: 2:243/4624.2 (GCC) :Author. Kai Bolay [kb] :Address. SnailMail: EMail: :Address. Hoffmannstraße 168 FIDO: 2:2407/106.3 (Classic) :Address. 71229 Leonberg UUCP: kai@amokle.stgt.sub.org :Author. Martin Horneffer [mh] :Address. MAUS: AC2 :Address. FIDO: 2:242/7.9 (Classic) :Address. USENET: mh@umshq.dfv.rwth.aachen.de :Address. ADSP: mh@umshq.adsp.sub.org :History. [ml] 19-Jan-93: Conversion from Oberon to Modula-2 :History. [kb] 28-Mar-93: New Consts added :History. [ml] 20-May-93: New Consts and Tags added :History. [mh] 2-Jun-93: changed and added some Consts :History. [mh] 29-Jun-93: added some Consts :History. [mh] 26-Aug-93: added tagHide :History. [mk] 24-Okt-93: Setstructure revised :Language. Modula II :Translator. M2Amiga V4.107d -------------------------------------------------------------------------- *) DEFINITION MODULE UmsD; (*$ Implementation:=FALSE LargeVars:=FALSE *) IMPORT u:UtilityD,s:SYSTEM; TYPE NUM = LONGINT; (* user status-bits *) UserStatusFlags = (us0,us1,us2,us3, archive, (* msg should be archived, don't delete *) junk, (* negative selection, inheritance suggested *) postPoned, (* to be read again, (but not now) *) selected, (* positive selection, inheritance suggested *) Old, (* user has already read this Message *) WriteAccess, (* user may change or delete this message *) ReadAccess, (* user may read this message *) ViewAccess, (* user may read the header of this message *) Owner, (* user 'owns' (wrote) this message *) us13,us14, filtered, (* msg has been processed by filter, 'selected' and 'junk' have been properly set *) us16,us17,us18,us19,us20,us21,us22,us23, us24,us25,us26,us27,us28,us29,us30,us31); UserStatusFlagSet = SET OF UserStatusFlags; (* global status-bits *) GlobalStatusFlags = ( Deleted, (* msg is really deleted *) Expired, (* msg has expired and may be deleted *) Exported, (* msg has been exported *) Orphan, (* msg could not be exported *) Link, (* within a ring of linked msgs *) HardLink, (* link is hardLink *) gs6,gs7,gs8,gs9,gs10,gs11,gs12,gs13,gs14,gs15,gs16,gs17,gs18,gs19, gs20,gs21,gs22,gs23,gs24,gs25,gs26,gs27,gs28,gs29,gs30,gs31); GlobalStatusFlagSet = SET OF GlobalStatusFlags; CONST umsName = "ums.library"; MaxMsgs = MAX(NUM); NumFields = 128; ProtectedUserFlags = UserStatusFlagSet{WriteAccess,ReadAccess, ViewAccess,Owner}; ProtectedGlobalFlags = GlobalStatusFlagSet{Deleted,Exported,Orphan, Link,HardLink}; Read = UserStatusFlagSet{Old}; TYPE STRPTR = POINTER TO ARRAY[0..MAX(NUM) - 2] OF CHAR; oldMsg = ARRAY[0..15] OF STRPTR; oldMsgPtr = POINTER TO oldMsg; MsgTextFields = ARRAY[0..NumFields - 1] OF STRPTR; MessageInfo = RECORD hdrLen : LONGINT; txtLen : LONGINT; date : LONGINT; up, dn, lt, rt : LONGINT; globalStat : GlobalStatusFlagSet; userStat : UserStatusFlagSet; loginStat : s.LONGSET; hardLink : LONGINT; softLink : LONGINT; END; (*of RECORD*) CONST (* enumeration of fields in an UMS-message *) msgText = 0; fromName = 1; fromAddr = 2; toName = 3; toAddr = 4; msgID = 5; creationDate = 6; receiveDate = 7; refID = 8; group = 9; subject = 10; attributes = 11; comments = 12; organization = 13; distribution = 14; folder = 15; fidoID = 16; mausID = 17; replyGroup = 18; replyName = 19; replyAddr = 20; fidoText = 32; errorText = 33; newsreader = 34; (*** Errors ***) CONST ok = 0; unknown = 1; codeMissing = 100; forbiddenCode = 101; noWriteAccess = 102; noReader = 103; noExporter = 104; badLink = 105; noWork = 106; noSysop = 107; badChange = 108; dupe = 200; noReadAccess = 201; noViewAccess = 202; msgCorrupted = 203; noHdrSpace = 204; noSuchMsg = 205; badName = 206; badTag = 207; missingTag = 208; noSuchUser = 209; notFound = 210; autoBounce = 211; msgDeleted = 212; noNetAccess = 213; badPattern = 214; badVarname = 215; fsFull = 216; noMsgMem = 217; missingIndex = 218; serverTerminated = 300; cantWrite = 301; cantRead = 302; wrongMsgPtr = 303; serverNotFree = 304; idCountProb = 305; noLogin = 306; wrongServer = 307; noMem = 308; (* tag-values *) typeSTRPTR = 2000H; typeVARPAR = 4000H; (** tags for WriteUMSMsg() **) (* add 'typeVARPAR' for ReadUMSMsg() *) (* no 'typeVARPAR' for WriteUMSMsg() *) tagMsgNum = 1 + u.tagUser; tagMsgDate = 4 + u.tagUser; (* don't usually use when writing! *) (* Using tagMsgDate with WriteUMSMsg() *) (* has a very special meaning. *) tagChainUp = 7 + u.tagUser; tagHardLink = 14 + u.tagUser; tagSoftLink = 15 + u.tagUser; tagAutoBounce = 65 + u.tagUser; (* when writing: *) (* data # 0: server returns error 'autoBounce', *) (* but still keeps the Msg and sends *) (* it to the sysops. *) tagHdrFill = 66 + u.tagUser; (* when writing: how much bytes to be reserved *) tagTxtFill = 67 + u.tagUser; (* for header and text *) tagNoUpdate = 69 + u.tagUser; (* data = 0: (default) set 'Old'-Flag when *) (* reading or writing *) (* data = 1: don't touch 'Old'-Flag *) tagHide = 70 + u.tagUser; (* for writing: *) (* data = 0: default *) (* data = 1: msg only accessible by exporters *) (* data = 2: msg only accessible by users *) tagMsgText = 256 + typeSTRPTR; tagFromName = tagMsgText + 1; tagFromAddr = tagMsgText + 2; tagToName = tagMsgText + 3; tagToAddr = tagMsgText + 4; tagMsgID = tagMsgText + 5; tagCreationDate = tagMsgText + 6; tagReceiveDate = tagMsgText + 7; tagRefID = tagMsgText + 8; tagGroup = tagMsgText + 9; tagSubject = tagMsgText +10; tagAttributes = tagMsgText +11; tagComments = tagMsgText +12; tagOrganisation = tagMsgText +13; tagDistribution = tagMsgText +14; tagFolder = tagMsgText +15; tagFidoId = tagMsgText +16; tagMausID = tagMsgText +17; tagReplyGroup = tagMsgText +18; tagReplyName = tagMsgText +19; tagReplyAddr = tagMsgText +20; tagFidoText = tagMsgText +32; tagErrorText = tagMsgText +33; tagNewsreader = tagMsgText +34; (* tagMsgText+15 .. tagMsgText+127 are also usable as text-fields *) tagTextFields = 513 + u.tagUser; (* datatype: POINTER TO MsgTextFields *) (** tags for ReadUMSMsg() **) (* add 'typeVARPAR' for ReadUMSMsg() *) (* no 'typeVARPAR' for WriteUMSMsg() *) tagRMsgNum = 1 + u.tagUser; tagRHdrLength = 2 + u.tagUser + typeVARPAR; tagRTxtLength = 3 + u.tagUser + typeVARPAR; tagRMsgDate = 4 + u.tagUser + typeVARPAR; tagRChainUp = 7 + u.tagUser + typeVARPAR; tagRChainDn = 8 + u.tagUser + typeVARPAR; tagRChainLt = 9 + u.tagUser + typeVARPAR; tagRChainRt = 10 + u.tagUser + typeVARPAR; tagRGlobalFlags = 11 + u.tagUser + typeVARPAR; tagRUserFlags = 12 + u.tagUser + typeVARPAR; tagRLoginFlags = 13 + u.tagUser + typeVARPAR; tagRHardLink = 14 + u.tagUser + typeVARPAR; tagRSoftLink = 15 + u.tagUser + typeVARPAR; tagRDateStyle = 64 + u.tagUser; (* style for receiveDate when reading: *) (* data = 0: no receiveDate *) (* data = 1: emulate old-style receiveDate *) tagRIDStyle = 68 + u.tagUser; (* style for Message-ID *) (* data = 0: real Message-ID *) (* data = 1: old style dec-number *) tagRNoUpdate = 69 + u.tagUser; (* data = 0: (default) set 'Old'-Flag when *) (* reading or writing *) (* data = 1: don't touch 'Old'-Flag *) tagRMsgText = 256 + typeSTRPTR + typeVARPAR + u.tagUser; tagRFromName = tagRMsgText + 1; tagRFromAddr = tagRMsgText + 2; tagRToName = tagRMsgText + 3; tagRToAddr = tagRMsgText + 4; tagRMsgID = tagRMsgText + 5; tagRCreationDate = tagRMsgText + 6; tagRReceiveDate = tagRMsgText + 7; tagRRefID = tagRMsgText + 8; tagRGroup = tagRMsgText + 9; tagRSubject = tagRMsgText +10; tagRAttributes = tagRMsgText +11; tagRComments = tagRMsgText +12; tagROrganisation = tagRMsgText +13; tagRDistribution = tagRMsgText +14; tagRFolder = tagRMsgText +15; tagRFidoID = tagRMsgText +16; tagRMausID = tagRMsgText +17; tagRReplyGroup = tagRMsgText +18; tagRReplyName = tagRMsgText +19; tagRReplyAddr = tagRMsgText +20; tagRFidoText = tagRMsgText +32; tagRErrorText = tagRMsgText +33; tagRNewsreader = tagRMsgText +34; (* tagRMsgText+15 .. tagRMsgText+127 are also usable as text-fields *) tagRMsgInfo = 512 + u.tagUser; (* datatype: POINTER TO MessageInfo *) tagRTextFields = tagRMsgInfo + 1; (* datatype: POINTER TO MsgTextFields *) tagRReadHeader = tagRMsgInfo + 2; (* read all header-fields *) tagRReadAll = tagRMsgInfo + 3; (* read all text-fields *) (** tags for UMSSelect() **) tagSelSet = 1024 + u.tagUser; (* flags to set on selected msgs *) tagSelUnset = tagSelSet + 1; (* flags to clear *) tagSelWriteGlobal = tagSelSet + 2; (* change global flags, not user-flags *) tagSelWriteLocal = tagSelSet + 3; (* change login-local flags, not user-flags *) tagSelWriteUser = tagSelSet + 4+typeSTRPTR; (* change other user's flags *) tagSelStart = tagSelSet + 8; (* process only msgs AFTER this one *) tagSelStop = tagSelSet + 9; (* process only msgs BEFORE this one *) (* the following are mutual-exclusiv *) (* use only one of the following operations, *) (* otherwise unpredictable things may happen! *) tagSelReadGlobal = tagSelSet +10; (* examine global flags, not user-flags *) tagSelReadLocal = tagSelSet +11; (* examine login-local flags, not user-flags *) tagSelReadUser = tagSelSet +12+typeSTRPTR; (* examine other user's flags *) tagSelMask = tagSelSet +16; (* select msgs, that's flags *) tagSelMatch = tagSelSet +17; (* ANDed with mask equal match *) tagSelParent = tagSelSet +18; (* examine parent's flags *) tagSelDate = tagSelSet +19; (* select msgs younger than this date *) tagSelTree = tagSelSet +20; (* select whole tree this msg is in *) tagSelSubTree = tagSelSet +21; (* select sub-tree this msg is root of *) tagSelMsg = tagSelSet +22; (* select a msg specified by number *) tagSelQuick = tagSelSet +23; (* quick select enabled *) (* tagMsgText .. tagMsgText+127 are also allowed for selecting *) (** tags for UMSSearch() **) tagSearchLast = 2048 + u.tagUser; (* number of LAST msg not to search *) tagSearchQuick = tagSearchLast+ 1; (* quick searches enabled *) tagSearchGlobal = tagSearchLast+ 2; (* examine global flags instead of user-flags*) tagSearchLocal = tagSearchLast+ 3; (* examine login-local flags, not user-flags *) tagSearchUser = tagSearchLast+ 4+typeSTRPTR; (* examine other user's flags *) tagSearchDirection= tagSearchLast+ 5; (* set search direction *) (* 0 = default *) (* 1 = forward *) (* -1 = backward *) tagSearchPattern = tagSearchLast + 6; (* string in tagMsgText .. tagMsgText+127 is: *) (* 0: no pattern, just a plain string *) (* 1: an AmigaDOS style pattern *) (* 2: a pattern, only if it contains *) (* wildcards ('auto-detect patterns') *) tagSearchMask = tagSearchLast+16; (* search a msg, that's flags *) tagSearchMatch = tagSearchLast+17; (* ANDed with mask equal match *) (* tagMsgText .. tagMsgText+127 are also allowed for searching *) (** tags for ReadUMSConfig(), WriteUMSConfig() **) tagCfgGlobalOnly = 3072 + u.tagUser; (* read or write only global config, *) (* thus must not be combined with tagCfgUser *) tagCfgName = tagCfgGlobalOnly+ 1 + typeSTRPTR; (* name of config var to read or write *) tagCfgUser = tagCfgGlobalOnly+ 2 + typeSTRPTR; (* name of user to read/write locals from/to *) (** tags for ReadUMSConfig() **) tagCfgUserName = tagCfgGlobalOnly+ 3 + typeSTRPTR; (* alias to get realname from *) tagCfgNextVar = tagCfgGlobalOnly+ 4 + typeSTRPTR; (* get name of next var *) (** tags for WriteUMSConfig() **) tagCfgDump = tagCfgGlobalOnly+16 + typeSTRPTR; (* write current settings to a file *) tagCfgData = tagCfgGlobalOnly+17 + typeSTRPTR; (* data to write to specified var *) END UmsD.Lib9