MailNews:Fakeserver: Difference between revisions

Jump to navigation Jump to search
(→‎NNTP: API!)
Line 109: Line 109:
The SMTP fakeserver is still unfinished.
The SMTP fakeserver is still unfinished.
=== NNTP ===
=== NNTP ===
The NNTP fakeserver is still unfinished.
<tt>nntpd.js</tt> defines a few different classes of NNTP servers: compliance for RFC 977, RFC 2980, and RFC 3977, as well as a Giganews and an INN server. (Full 2980 and 3977 compliance as well as INN is not yet written).
 
For xpcshell tests in <tt>mailnews/news</tt>, all files in <tt>mailnews/news/test/postings/auto-add</tt> are automatically added based on the Newsgroups header. There are added in alphabetical order, which may help for purposes that rely on article key orders. The only generated header is Lines.
 
The following comprises the API of the news fakeserver itself:
{| border="1" cellspacing="1" cellpadding="2"
! colspan="4" | <tt>nntpDaemon</tt> API
|-
! Name !! Arguments !! Returns !! Notes
|-
| [constructor] || daemon flags || N/A || Flags are defined below
|-
| addGroup || group name (string), is postable || nothing || Adds the group (resetting if it exists)
|-
| addArticle || <tt>newsArticle</tt> object || nothing || Adds the message to all groups in the article's group list
|-
| addArticleToGroup || <tt>newsArticle</tt> object, group (string), integral key for group || nothing || Adds the message to the specified group with the specified key
|-
| getGroup || group name || group object || Group is a map key->article, with the additional properties: flags, keys (array of keys), nextKey (next key to use for new articles)
|-
| getGroupStats || group name || array of [size, min, max] || the size is an estimate if NNTP_REAL_LENGTH is not specified in the daemon flags.
|-
| getArticle || message ID || <tt>newsArticle</tt> object || Pretty self-explanatory
|-
! colspan="4" | <tt>newsArticle</tt> API
|-
! Name !! Arguments !! Returns !! Notes
|-
| [constructor] || text (as a string) || N/A || initializes all fields
|-
| headers || (property) || colspan="2" | map of header (lower-case) -> value
|-
| body || (property) || colspan="2" | text of body
|-
| messageID || (property) || colspan="2" | message ID
|-
| fullText || (property) || colspan="2" | Full text as message without modification except added headers.
|}
192

edits

Navigation menu