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