root/db/FORMAT.txt

Revision 2114058982a08f59f0f312544a16250eceab0098, 3.8 KB (checked in by Antti-Juhani Kaijanaho <antti-juhani@…>, 17 months ago)

#14: Support moderators with kill/mark-as-spam and resurrection powers

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

  • Property mode set to 100644
Line 
1The basic idea is that the database file is an append-only journal.
2For now, there is no "vacuum" or "expire".  The file SHOULD NOT be
3edited, only appened to.
4
5The file is a line-oriented text file.  A record consists of a
6transaction start line, followed by a record description line, then
7zero or more dot-stuffed lines (in the style of RFC 3977), and finally
8a transaction end line.  The idea is that a truncated record can (and
9MUST) always be detected and ignored.
10
11Lines end with either LF or CRLF.  Readers MUST be able to handle both
12formats, and convert between them when required for other media (for
13example, NNTP requires CRLF, and so any LF neeeds to be converted to
14CRLF before sending over NNTP).
15
16WARNING: The format is not safe for concurrent writing.
17
18A record starts with the line
19.BEGIN <datetime>
20where <datetime> is in ISO format (yyyymmddThhmmss) and in UTC, indicating the
21timestamp of the record.
22
23A record ends with the line
24.END
25
26Empty lines between records must be ignored.
27
28
29                             USER records
30
31.BEGIN <datetime>
32USER <userid>
33<attribute> <value>
34.END
35
36USER MUST NOT be repeated inside the same record.
37
38The attribute lines MAY be repeated and MAY be omitted.
39
40Possible <attributes>:
41  - display_name (string)
42  - display_email (string)
43  - delivery_email (string)
44  - delivery_email_verified ("yes" / "no") [default: no]
45  - delivery_email_cookie (string)
46  - allow_cleartext_password ("yes" / "no")
47  - has_read (string: msgid)
48  - has_not_read (string: msgid)
49
50If the userid doesn't yet exist, it is created with the given
51settings.  If it exists, the included setting changes are made.
52
53
54                             ROLE records
55
56.BEGIN <datetime>
57ROLE <name>
58DESCRIPTION <description>
59USER ADD <userid>
60USER DEL <userid>
61.END
62
63The ROLE line is REQUIRED and MUST NOT be repeated.
64The other lines are OPTIONAL.
65USER lines may be repeated.
66
67If the role doesn't exist yet, it is created with the given settings.
68If it exists, the included setting changes are made.
69
70NOTE: The following role names are reserved: anonymous, authenticated,
71poster.  Similarly, all names starting with "subscribers:" and
72"moderator:" are reserved.  No ROLE records may be given for
73"anonymous" and "authenticated".  ROLE records for the other reserved
74names are forbidden to include DESCRIPTION.
75
76
77                           NEWGROUP records
78
79.BEGIN <datetime>
80NEWGROUP <groupname>
81DESCRIPTION <group description for LIST NEWSGROUPS>
82READING <permission-token>
83.END
84
85The NEWGROUP MUST NOT be repeated.
86
87<permission-token> is PERMITTED | RESTRICTED (the latter meaning that
88the group is available only to authenticated users)
89
90
91                           ARTICLE records
92
93.BEGIN <datetime>
94ARTICLE <msgid>
95POSTED BY <userid>
96FILE AS <groupname>:<article-number>
97FOLLOWS
98<article header and body>
99.END
100
101The FILE AS line SHOULD occur at least once, and MAY occur multiple times.
102POSTED BY is recommended but may be omitted.
103The other lines are REQUIRED.
104
105The <article header and body> lines MUST be dot-stuffed as discussed
106in RFC 3977.  However, it ends in .END, not a lone dot line.
107
108The article SHOULD NOT contain a Xref header field; if there is one,
109it MUST be ignored (and a new one generated based on the actual server
110state).
111
112
113                          MODERATION records
114
115.BEGIN <datetime>
116MODERATION <userid>
117<verb> <msgid> <reason>
118.END
119
120<verb> ::= KILL
121         | SPAM
122         | CLEAR
123
124<reason> ::= <text not containing line terminator or separator>
125
126The MODERATION line is REQUIRED and MUST NOT be repeated.  The other
127lines MAY occur multiple times.  The <userid> indicates the user who
128authorized these moderation actions.
129
130The effect of a KILL or SPAM line is to make the message disappear
131(the reason is free form text that is intended to be used as
132rationale); it will be as if it never existed.  The effect of a CLEAR
133line is to undo a previous KILL or SPAM line.
Note: See TracBrowser for help on using the browser.