INN commit: branches/2.5 (5 files)
INN Commit
rra at isc.org
Thu Dec 3 21:08:59 UTC 2009
Date: Thursday, December 3, 2009 @ 13:08:59
Author: iulius
Revision: 8837
Implement LIST COUNTS. It is a combination of LIST ACTIVE and
GROUP. It returns the same result as LIST ACTIVE except that
the number of articles in a newsgroup is inserted before its
status.
LIST COUNTS was first implemented in Highwinds products
(e.g. Cyclone, Tornado, Typhoon, Twister -- when they support
readers).
Modified:
branches/2.5/doc/pod/getlist.pod
branches/2.5/doc/pod/news.pod
branches/2.5/doc/pod/nnrpd.pod
branches/2.5/nnrpd/list.c
branches/2.5/nnrpd/nnrpd.c
---------------------+
doc/pod/getlist.pod | 6 ++++--
doc/pod/news.pod | 7 +++++++
doc/pod/nnrpd.pod | 9 +++++----
nnrpd/list.c | 39 ++++++++++++++++++++++++++++++++++++---
nnrpd/nnrpd.c | 4 ++--
5 files changed, 54 insertions(+), 11 deletions(-)
Modified: doc/pod/getlist.pod
===================================================================
--- doc/pod/getlist.pod 2009-12-03 21:08:00 UTC (rev 8836)
+++ doc/pod/getlist.pod 2009-12-03 21:08:59 UTC (rev 8837)
@@ -23,7 +23,7 @@
active.times(5), distrib.pats(5) and newsgroups(5).
The listing files other than the F<active> file are common extensions to the
-NNTP protocol and may not be available on all servers. For instance,
+NNTP protocol and may not be available on all servers. For instance, C<counts>
C<distributions>, C<headers>, C<moderators>, C<motd>, C<overview.fmt> and
C<subscriptions>, amongst other, may be available. Moreover, a uwildmat(3)
pattern I<pattern> may also be usable for some of these listing files.
@@ -34,7 +34,9 @@
is consistent (see I<extraoverviewadvertised> in F<inn.conf> for more
information). The list obtained with C<headers> contains the fields
that can be retrieved using the HDR command (I<pattern> can then be
-either C<msgid> or C<range>).
+either C<msgid> or C<range>). The list obtained with C<counts> is like
+the C<active> one except that the number of articles in a newsgroup
+is mentioned just before the flag of this newsgroup.
The I<pattern> parameter may be used with a I<list> value of C<active>,
C<active.times> or C<newsgroups> to limit the output. If given, only
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2009-12-03 21:08:00 UTC (rev 8836)
+++ doc/pod/news.pod 2009-12-03 21:08:59 UTC (rev 8837)
@@ -76,6 +76,13 @@
=item *
+A new LIST variant named COUNTS is supported by B<nnrpd>: LIST COUNTS
+is a combination of LIST ACTIVE and GROUP. It returns the same
+result as LIST ACTIVE except that the number of articles in a
+newsgroup is inserted before its status.
+
+=item *
+
A new feature has been added to B<sm>. When the B<-c> flag is used,
it shows a clear, decoded form of the storage API token. This
was previously done by the contrib B<showtoken> script developed
Modified: doc/pod/nnrpd.pod
===================================================================
--- doc/pod/nnrpd.pod 2009-12-03 21:08:00 UTC (rev 8836)
+++ doc/pod/nnrpd.pod 2009-12-03 21:08:59 UTC (rev 8837)
@@ -235,10 +235,11 @@
Besides the keywords defined in S<RFC 3977> (ACTIVE, ACTIVE.TIMES,
DISTRIB.PATS, HEADERS, NEWSGROUPS and OVERVIEW.FMT), the LIST command
-may be followed by the optional keywords DISTRIBUTIONS, MODERATORS, MOTD
-and SUBSCRIPTIONS to get a list of valid distributions, the moderators list,
-the message of the day information for readers, or a list of the
-automatic group subscriptions.
+may be followed by the optional keywords COUNTS, DISTRIBUTIONS, MODERATORS,
+MOTD and SUBSCRIPTIONS to respectively get an improved version of the
+ACTIVE variant with the number of articles in every newsgroup, a list
+of valid distributions, the moderators list, the message of the day
+information for readers, and a list of recommended group subscriptions.
=item 2.
Modified: nnrpd/list.c
===================================================================
--- nnrpd/list.c 2009-12-03 21:08:00 UTC (rev 8836)
+++ nnrpd/list.c 2009-12-03 21:08:59 UTC (rev 8837)
@@ -31,6 +31,10 @@
"ACTIVE.TIMES", INN_PATH_ACTIVETIMES, NULL, false, "creation times",
"Group creations in form \"name time who\""
};
+static LISTINFO INFOcounts = {
+ "COUNTS", INN_PATH_ACTIVE, NULL, true, "active newsgroups with counts",
+ "Newsgroups in form \"group high low count status\""
+};
static LISTINFO INFOdistribs = {
"DISTRIBUTIONS", INN_PATH_NNRPDIST, NULL, false, "newsgroup distributions",
"Distributions in form \"distribution description\""
@@ -39,7 +43,7 @@
"HEADERS", NULL, cmd_list_headers, true, "supported headers and metadata",
"Headers and metadata items supported"
};
-static LISTINFO INFOsubs = {
+static LISTINFO INFOsubs = {
"SUBSCRIPTIONS", INN_PATH_NNRPSUBS, NULL, false,
"recommended group subscriptions", "Subscriptions in form \"group\""
};
@@ -67,6 +71,7 @@
static LISTINFO *info[] = {
&INFOactive,
&INFOactivetimes,
+ &INFOcounts,
&INFOdistribs,
&INFOheaders,
&INFOsubs,
@@ -177,8 +182,10 @@
char *wildarg = NULL;
char savec;
unsigned int i;
+ int lo, hi, count, flag;
p = av[1];
+
/* LIST ACTIVE is the default LIST command. If a keyword is provided,
* we check whether it is defined. */
if (p == NULL) {
@@ -192,6 +199,7 @@
}
}
}
+
/* If no defined LIST keyword is found, we return. */
if (lp == NULL) {
Reply("%d Unknown LIST keyword\r\n", NNTP_ERR_SYNTAX);
@@ -205,12 +213,13 @@
if (CMD_list_single(wildarg))
return;
}
- } else if (lp == &INFOgroups || lp == &INFOactivetimes
+ } else if (lp == &INFOgroups || lp == &INFOactivetimes || lp == &INFOcounts
|| lp == &INFOheaders || lp == &INFOsubs) {
if (ac == 3)
wildarg = av[2];
}
- /* Three arguments can be passed only when ACTIVE, ACTIVE.TIMES,
+
+ /* Three arguments can be passed only when ACTIVE, ACTIVE.TIMES, COUNTS
* HEADERS, NEWSGROUPS or SUBSCRIPTIONS keywords are used. */
if (ac > 2 && !wildarg) {
Reply("%d Unexpected wildmat\r\n", NNTP_ERR_SYNTAX);
@@ -224,6 +233,7 @@
}
path = innconf->pathetc;
+
/* The active, active.times and newsgroups files are in pathdb. */
if ((strstr(lp->File, "active") != NULL) ||
(strstr(lp->File, "newsgroups") != NULL))
@@ -310,6 +320,28 @@
if (wildarg && !uwildmat(p, wildarg))
continue;
+ if (lp == &INFOcounts) {
+ if (OVgroupstats(p, &lo, &hi, &count, &flag)) {
+ /* When a newsgroup is empty, the high water mark should be
+ * one less than the low water mark according to RFC 3977. */
+ if (count == 0)
+ lo = hi + 1;
+
+ if (flag != '=') {
+ Printf("%s %u %u %u %c\r\n", p, hi, lo, count, flag);
+ } else if (savec != '\0') {
+ *save = savec;
+
+ if ((q = strrchr(p, '=')) != NULL) {
+ *save = '\0';
+ Printf("%s %u %u %u %s\r\n", p, hi, lo, count, q);
+ }
+ }
+ }
+
+ continue;
+ }
+
if (savec != '\0')
*save = savec;
@@ -321,6 +353,7 @@
*q = 'n';
}
}
+
Printf("%s\r\n", p);
}
QIOclose(qp);
Modified: nnrpd/nnrpd.c
===================================================================
--- nnrpd/nnrpd.c 2009-12-03 21:08:00 UTC (rev 8836)
+++ nnrpd/nnrpd.c 2009-12-03 21:08:59 UTC (rev 8837)
@@ -140,8 +140,8 @@
{ "LAST", CMDnextlast, true, 1, 1, true,
NULL },
{ "LIST", CMDlist, true, 1, 3, true,
- "[ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|DISTRIB.PATS|DISTRIBUTIONS"
- "|HEADERS [MSGID|RANGE]|MODERATORS|MOTD|NEWSGROUPS [wildmat]"
+ "[ACTIVE [wildmat]|ACTIVE.TIMES [wildmat]|COUNTS [wildmat]|DISTRIB.PATS"
+ "|DISTRIBUTIONS|HEADERS [MSGID|RANGE]|MODERATORS|MOTD|NEWSGROUPS [wildmat]"
"|OVERVIEW.FMT|SUBSCRIPTIONS [wildmat]]" },
{ "LISTGROUP", CMDgroup, true, 1, 3, true,
"[newsgroup [range]]" },
More information about the inn-committers
mailing list