File httpmail.lua

HTTPMAIL, what else. This module implements the HTTPMAIL protocol on top of the browser module and the xml2table/table2xml modules.

Functions

clean_entities (s) Avoids wrong entities.
delete (b, uri, extraheader) Deletes a dav resource, use this for mails.
folderlist (b, uri) HTTPMAIL folder disocevery implementation.
get (b, uri, extraheader) Retrives a dav resuorce, use this for mails.
href_of_Txml (answer) Resources mentioned in the answer.
login (b, uri, username, password, auth) HTTPMAIL login implementation.
pipe (b, uri, cb, extraheader) Pipes a dav resource, works as the pipe_uri method of the browser object.
propfind (b, uri, post, header) Executes a proprind dav request.
safe_traverse (t, ...) Descends a Txml tree.
stat (b, uri) HTTPMAIL stat implementation.


Functions

clean_entities (s)
Avoids wrong entities.

Parameters

  • s: string the ugly XML.

Return value:

string the cleaned XML.
delete (b, uri, extraheader)
Deletes a dav resource, use this for mails.

Parameters

  • b:
  • uri:
  • extraheader:
folderlist (b, uri)
HTTPMAIL folder disocevery implementation. currently finds only the first level folders and not subfolders.

Parameters

  • b:
  • uri:

Return value:

table like {{uri="uri",name="name"},...,{uri="uri",name="name"}}.
get (b, uri, extraheader)
Retrives a dav resuorce, use this for mails.

Parameters

  • b:
  • uri:
  • extraheader:
href_of_Txml (answer)
Resources mentioned in the answer. This function simply gets all the uris in the response.

Parameters

  • answer: table a Txml object.

Return value:

table a uri list.
login (b, uri, username, password, auth)
HTTPMAIL login implementation. Finds where the mailboxes are rooted.

Parameters

  • b:
  • uri:
  • username:
  • password:
  • auth: number one of httpmail.LOGIN_*.

Return value:

string base_uri of the folders, and err if nil.
pipe (b, uri, cb, extraheader)
Pipes a dav resource, works as the pipe_uri method of the browser object.

Parameters

  • b:
  • uri:
  • cb:
  • extraheader:
propfind (b, uri, post, header)
Executes a proprind dav request. Tailors the browser b to a DAV request.

Parameters

  • b:
  • uri:
  • post: string is an XML string.
  • header: table is in the browser fashion extra header.

Return value:

string the returned page.
safe_traverse (t, ...)
Descends a Txml tree. A correct call is local base_uri,err = httpmail.safe_traverse(answer, "D__response", "D__propstat", "D__prop", "hm__msgfolderroot", "_content").

Parameters

  • t:
  • ...:

Return value:

string the content, or nil and an error message.
stat (b, uri)
HTTPMAIL stat implementation. Does a STAT for the folder pointed by uri.

Parameters

  • b:
  • uri:

Return value:

table like {{uri="uri",size=1234},...,{uri="uri",size=1234}}.

Valid XHTML 1.0!