1*46439007SCharles.Forsyth# 2*46439007SCharles.Forsyth# File: emio.m 3*46439007SCharles.Forsyth# 4*46439007SCharles.Forsyth# This file contains the declaration of the EMIO module. 5*46439007SCharles.Forsyth# The EMIO module provides protocol independent access 6*46439007SCharles.Forsyth# to an email server. 7*46439007SCharles.Forsyth# 8*46439007SCharles.Forsyth 9*46439007SCharles.ForsythEMIO : module 10*46439007SCharles.Forsyth{ 11*46439007SCharles.Forsyth # 12*46439007SCharles.Forsyth # The init function initializes the EMIO module. 13*46439007SCharles.Forsyth # It must be called before any other function in the 14*46439007SCharles.Forsyth # module. 15*46439007SCharles.Forsyth # 16*46439007SCharles.Forsyth init: fn(); 17*46439007SCharles.Forsyth 18*46439007SCharles.Forsyth # 19*46439007SCharles.Forsyth # The open function opens a connection with the email 20*46439007SCharles.Forsyth # server. The function requires the email server's 21*46439007SCharles.Forsyth # tcp/ip address, a username and a password to make the 22*46439007SCharles.Forsyth # connection to the email server. It returns a tuple 23*46439007SCharles.Forsyth # (int, string). The int indicates success or failure 24*46439007SCharles.Forsyth # (0 = failure, 1 = success). If the function fails, 25*46439007SCharles.Forsyth # the int returned is 0, the string returned will indicate 26*46439007SCharles.Forsyth # why the function failed. It should be called after the 27*46439007SCharles.Forsyth # init function and before any other function in the module. 28*46439007SCharles.Forsyth # 29*46439007SCharles.Forsyth open: fn(ipaddr : string, 30*46439007SCharles.Forsyth username : string, 31*46439007SCharles.Forsyth password : string) : (int, string); 32*46439007SCharles.Forsyth 33*46439007SCharles.Forsyth # 34*46439007SCharles.Forsyth # The numberofmessages function indicates how many mail 35*46439007SCharles.Forsyth # messages are in the specified users mailbox. It returns 36*46439007SCharles.Forsyth # a tuple (int, string). The int indicates the number of 37*46439007SCharles.Forsyth # mail messages in the mailbox (-1 = function failed, 0 = 38*46439007SCharles.Forsyth # no mail message, 1 = one mail message ...). If the function fails, 39*46439007SCharles.Forsyth # the int returned is -1, the string returned will indicate 40*46439007SCharles.Forsyth # why the function failed. 41*46439007SCharles.Forsyth # 42*46439007SCharles.Forsyth numberofmessages: fn() : (int, string); 43*46439007SCharles.Forsyth 44*46439007SCharles.Forsyth # 45*46439007SCharles.Forsyth # This function provides the number of octets in the specified 46*46439007SCharles.Forsyth # message number. It returns a tuple (int, string). The int indicates 47*46439007SCharles.Forsyth # the number of octets in the mail message. If it is -1, the 48*46439007SCharles.Forsyth # function has failed and the string returned will contain the 49*46439007SCharles.Forsyth # possible reason. 50*46439007SCharles.Forsyth # This function implements the LIST command, but only with an 51*46439007SCharles.Forsyth # argument - the message number. 52*46439007SCharles.Forsyth messagelength: fn(num : int) : (int, string); 53*46439007SCharles.Forsyth 54*46439007SCharles.Forsyth # 55*46439007SCharles.Forsyth # The messagetext function returns the text of the specified 56*46439007SCharles.Forsyth # mail message. The function requires the number of the 57*46439007SCharles.Forsyth # mail message to retrieve. It returns a triple 58*46439007SCharles.Forsyth # (int, string, list of string). The int indicates success or failure 59*46439007SCharles.Forsyth # (0 = failure, 1 = success). If the function fails, 60*46439007SCharles.Forsyth # the int returned is 0, the string returned will indicate 61*46439007SCharles.Forsyth # why the function failed. If the function succeded the list 62*46439007SCharles.Forsyth # of string contains the text for the specified mail message. 63*46439007SCharles.Forsyth # 64*46439007SCharles.Forsyth messagetext: fn(messagenumber : int) : (int, string, list of string); 65*46439007SCharles.Forsyth 66*46439007SCharles.Forsyth # 67*46439007SCharles.Forsyth # This is similar to messagetext() but returns a string, rather than 68*46439007SCharles.Forsyth # a list of string. The string contains the complete text of the mail 69*46439007SCharles.Forsyth # message, header and body. Each line of the message is separate by a 70*46439007SCharles.Forsyth # DELIMETER (currently set to |&|) fo easier processing. 71*46439007SCharles.Forsyth # 72*46439007SCharles.Forsyth msgtextstring: fn (num : int) : (int, string, string); 73*46439007SCharles.Forsyth 74*46439007SCharles.Forsyth # 75*46439007SCharles.Forsyth # The deletemessage function markes the specified mail 76*46439007SCharles.Forsyth # message as deleted. The function requires the number of 77*46439007SCharles.Forsyth # the mail message to delete. It returns a tuple 78*46439007SCharles.Forsyth # (int, string). The int indicates success or failure 79*46439007SCharles.Forsyth # (0 = failure, 1 = success). If the function fails, 80*46439007SCharles.Forsyth # the int returned is 0, the string returned will indicate 81*46439007SCharles.Forsyth # why the function failed. 82*46439007SCharles.Forsyth # 83*46439007SCharles.Forsyth deletemessage: fn(messagenumber : int) : (int, string); 84*46439007SCharles.Forsyth 85*46439007SCharles.Forsyth # 86*46439007SCharles.Forsyth # The reset function unmarks all messages that have been 87*46439007SCharles.Forsyth # marked deleted during this session. It returns a tuple 88*46439007SCharles.Forsyth # (int, string). The int indicates success or failure 89*46439007SCharles.Forsyth # (0 = failure, 1 = success). If the function fails, 90*46439007SCharles.Forsyth # the int returned is 0, the string returned will indicate 91*46439007SCharles.Forsyth # why the function failed. 92*46439007SCharles.Forsyth # 93*46439007SCharles.Forsyth reset: fn() : (int, string); 94*46439007SCharles.Forsyth 95*46439007SCharles.Forsyth # 96*46439007SCharles.Forsyth # The close function closes a connection with the email 97*46439007SCharles.Forsyth # server. It returns a tuple (int, string). The int 98*46439007SCharles.Forsyth # indicates success or failure (0 = failure, 1 = success). 99*46439007SCharles.Forsyth # If the function fails, the int returned is 0, the string 100*46439007SCharles.Forsyth # returned will indicate why the function failed. 101*46439007SCharles.Forsyth # 102*46439007SCharles.Forsyth close: fn() : (int, string); 103*46439007SCharles.Forsyth}; 104