annotate INTERNALS @ 88:1fcdced0246e noffle

[svn] Move posting code to post.c, add command line posting
author bears
date Thu, 18 May 2000 13:17:23 +0100
parents 63d7b9549732
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
80
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
1 -------------------------------------------------------------------------------
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
2 NOFFLE Internals
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
3 -------------------------------------------------------------------------------
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
4
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
5 This document is, for the moment, a collection of jottings on aspects
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
6 of Noffle internals.One day it might make it into something resembling
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
7 documentation, but I wouldn't put your money on it. Use the Source,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
8 Luke!
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
9
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
10 1. Where do things get stored?
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
11
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
12 Articles: Articles are held keyed by Message-ID in the articles
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
13 database, articles.gdbm. This is handled by database.[hc]. Articles
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
14 are marked with a status, indicating if they were only partially
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
15 downloaded (think overview mode) or if something went wrong on
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
16 retrieval.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
17
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
18 Groups: The list of groups known is held in the groups database,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
19 groupinfo.gdbm, keyed on group name. This holds the group first and
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
20 last article numbers, the last article number read on the remote
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
21 server, group creation and last access times, plus the group
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
22 description, the name of the server from which the group is drawn and
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
23 a flag indicating if posting to the group is allowed.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
24
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
25 Local groups are indicated as belonging to a special server. They are
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
26 for the most part treated identically to remote groups (though the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
27 whole business of auto-subscribe and auto-unsubscribe obviously
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
28 doesn't apply, and posting operates locally).
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
29
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
30 The fetchlist (fetchlist.[hc]) holds the list of group names Noffle
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
31 currently subscribes to, and the subscription mode.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
32
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
33 Subscribed groups may have a file with their name in the overview
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
34 directory. This file - the overview file - contains details of the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
35 articles in the group that can currently be read from the server. Each
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
36 entry in the file is an overview (over.[hc]), while a group overview
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
37 file is handled by content.[hc]. If no articles are left in a group,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
38 the overview file is deleted.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
39
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
40 The Noffle server loads the overview for a group into memory when it
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
41 needs to manipulate the group and uses its reckoning on the first and
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
42 last article number from there on. This may not correspond with the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
43 first and last number given in the groups database entry. Typically,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
44 the database first and last entries are updated from the overview on
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
45 completion of actions affecting the group.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
46
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
47 Outbound articles are placed in a directory under the Noffle spool
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
48 'outgoing' directory. Each is in its own file, named by the article
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
49 Message-ID, in a directory with the name of the server. outgoing.[hc]
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
50 handle tracking what outbound messages are queued and queueing new ones.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
51 When Noffle connects to the appropriate server, the message is posted
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
52 on and the file removed.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
53
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
54 2. Posting
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
55
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
56 Posting to remote groups is straightforward; the article is placed in
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
57 the outgoing queue, and will be read back from the server as part of
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
58 collecting new messages for the group. The article is placed once only
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
59 in the queue, regardless of the number of external groups, as it only
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
60 needs to appear once on the remote server. Articles posted only to
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
61 newsgroups unknown to Noffle are rejected.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
62
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
63 If the group is marked as 'can't post' ('n' in LIST ACTIVE) the post
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
64 is rejected immediately. Note you can't have moderated local groups at
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
65 the moment; you can have read-only ones, though.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
66
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
67 Control message are similarly passed on, unless the control is
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
68 'cancel' and the cancel can be done entirely locally because the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
69 article is still in the outgoing queue.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
70
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
71 Posts to local groups appear in the article database
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
72 immediately. Control messages (control.[hc]) for local groups are
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
73 honoured, though currently only 'cancel' does anything.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
74
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
75 Things get more complex when an article is cross-posted to a local and
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
76 remote group. Essentially, both the above happen; if the remote server
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
77 does not change the Message-ID, the local copy will be the definitive
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
78 for both groups. Obviously if the remote server does change the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
79 Message-ID, Noffle will tread the article coming back from the server
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
80 as a new one.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
81
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
82 post.[hc] holds the code for posting local articles.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
83
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
84 The posting code in post 1.0 Noffle should (i.e. I'll do it if time
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
85 permits) be rearranged to provide one function to post (or reject) an
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
86 article regardless of original source. This would hopefully make it
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
87 clearer what happens during a post, and make it easy to add a
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
88 command-line article post function, which could remove the necessity
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
89 for Python or Perl intervention gateing mailing lists into local newsgroups.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
90
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
91 3. Pseudo articles
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
92
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
93 Noffle generates various pseudo articles itself (see pseudo.[hc]), to
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
94 inform the user of changes of state or to give instruction. All but
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
95 one are, in fact, done by generating and posting a regular article,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
96 but one is special; the general information article.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
97
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
98 The gen info article is the one shown when one tries to read from a
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
99 currently unsubscribed (Noffle is not subscribed to it, that it)
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
100 newsgroup. It is apparently present in every single group known to
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
101 Noffle, but is faked; it never appears in the article database. LIST
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
102 ACTIVE fakes the first and last article numbers for a group if it
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
103 knows the group is not subscribed to (and not local), and entry to a
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
104 group with the GROUP command will cause an overview to be added to the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
105 group overview in memory only. If the article is not read, the
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
106 overview is lost unsaved when moving to the next group.
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
107
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
108 Reading the article triggers stuff happening. If auto-subscribe is on,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
109 a pseudo article confirming subcription is posted and the group
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
110 overview saved. Gen info articles are not normally saved in overviews,
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
111 but to prevent them vanishing very suddenly their overview is saved
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
112 with other articles in the group if they form part of the sequence of
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
113 the group. In this case it will persist until the subscription confirm
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
114 article expires. This will not stop another gen info being generated
63d7b9549732 [svn] Initial meanderings
bears
parents:
diff changeset
115 if (say) the group gets auto-unsubscribed.