Misc commands

RatGenId
Generate a unique ID (ie unique for this machine) which is a maximum of 14 characters long
RatWrapCited
Wraps a text which is expected to be a cited message.
RatBgExec exitStatus args
Works like the tcl exec command except that the commands is always placed in the background and the call to RatBgExec returns immediately. When the executed commands are done the variable exitStatus will be set to the exit value of the last process that exited.
RatSend action ?handler?
If action is init
then the ratDeferred variable is initialized.
If the action is sendDeferred then all deferred messages are sent and the number of sent messages is returned.
If the action is kill
then the child is killed (if it exists).
If action is direct or deferred
then we send the message identified by the handler using the prefered method of sending messages.
The handler argument should be the name of an array which may contain the following entries (entries marked with a '*' are required):
handler(remail)remail headers
handler(return_path)error return address
handler(date)message composition date string
handler(from)originator address list
handler(reply_to)reply address list
handler(subject)message subject string
handler(to)*primary recipient list
handler(cc)secondary recipient list
handler(bcc)blind secondary recipient list
handler(in_reply_to)replied message ID
handler(message_id)message ID
handler(body)bodypart handler
handler(request_dsn)true if DSN is requested
handler(charset)*Which character set to use. If this is auto then the best set is choosen for each encoded entity. This also serves as default for the bodyparts. ie if they do not have a charset parameter
The bodypart handler should be the name of an array which may have the following elements ('*' marked entries are mandatory): (not needed for multipart entities)
bhandler(type)*type
bhandler(subtype)*subtype
bhandler(encoding)*CTE the data is in
bhandler(disp_type)disposition type
bhandler(disp_parm)list of parameters to Content-Disposition:
bhandler(parameter)list of parameters to Content-Type:
bhandler(id)bodypart identifier
bhandler(description)bodypart description
bhandler(filename)*name of file which contains the actual data
bhandler(children)list of parts in a multipart message
bhandler(copy)true if should make a local copy of the file.
RatGetEncoding filename
Examines a file and returns a guess of which MIME-encoding it is in.
RatCleanup
This should always be called before the program exits.
RatTildeSubst
Do tilde substitution on a filename and return the new filename.
RatTime [+days]
Returns the time now, or in +days days as an integer (unix time).
RatInsert msgId keywords exDate exType
Insert the given message into the dbase. Keywords are the keywords the message should get, exDate is expiration date in number of days from now. exType should be 'none', 'remove', 'incoming', 'backup' or 'custom '.
RatLock variable ...
Locks the varibles agains changes. Locked variables can't be changed or unset.
RatIsLocked variable
Returns 1 if the variable is locked, else 0 is returned.
RatType filename
Tries to determine what MIME-type the given file has. The result is a list of two elements; {type/subtype encoding}.
RatDaysSinceExpire
Returns the number of days that have passed since the last time the database was expired.
RatExpire inbox backupCmd backupDir
Expires the database. Inbox should be the name of the inbox folder (which must be open). BackupCmd is a command to run after the expire (if there were any files to backup) which should move the files in backupDir to some backup storage. Returns the following list: {num_scanned num_deleted num_backup num_inbox num_custom}.
RatDSNList
List the messages in the list. Return a list of message entries. Each message entry consists of the following list: {id date subject {{recipient1} {recipient2} ...}} The id identifies this message. The date is the number of seconds since the epoch when the message was sent. There may be one or more recipient blocks. The syntax is: {status recipient id} Recipient is the recipient address. Id contains an identification which can be used in other calls to obtain more information about this delivery. Status is the current status and can have the following values: none, failed, delayed, delivered, relayed or expanded
RatDSNGet what id ?recipient?
Returns data about the referenced DSN. The what argument can have one of the following values: msg - A message handle which handles the DSN message. report - A list of DSN report fields. Each item consists of a list with two values, the key and the value. The recipient argument determines which of the recipient fields to return.
RatSMTPSupportDSN host
Returns true if the given host supports DSN.
RatImport def
Imports mail folders. The def argument should have one of the following forms (knwon flags are trace and subscribed):
	{NAME dir {FLAGS} {OPTIONS} PATTERN DIR}
	{NAME mh {FLAGS} {OPTIONS} PATTERN DIR}
	{NAME imap {FLAGS} {OPTIONS} PATTERN HOST USER MBOX PORT}
It will return a list of tuples, where the following tuples exists:
	{v vfolderdef}
	{s name {list of tuples}}
RatLL line
Returns the length of the given line. This function counts tab stops to the next even eight characters.
RatGen count
Generates (and returns) a string of spaces which has the given length.
RatDbaseCheck fix
Checks the dbase and if fix is true then it tries to fix the dbase as well. The result is a list with the following values: Total number of messages in index Number of malformed entries Number of entries without messages Number of unlinked messages Total size in bytes of all messages A list of diagnostic messages
RatParseExp expression
Parses the given expression and returns an expression identifier.
RatGetExp id
Returns the requested expression as a tcl list.
RatFreeExp id
Removes the identified expression from all internal tables.
RatSplitAdr address
Expects a string with addresses as input and splits it into a list of addresses.
RatMailcapReload
Reloads the mailcap data
RatImapCreateFolder name user
Creates a new IMAP folder
RatImapDeleteFolder name user
Deletes a IMAP folder
RatMangleNumber number
This command returns a short string represenatation of the number.
RatCheckEncodings variable charsets
Checks if any of the encodings can encode the data contained in the variable whose name is passed in the variable argument. This function will return the name of the matching characters set or an empty string if none matches.
RatPurgePwChache
Purge that password cache, both in memory and on disk