🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Iulius Thu, 19 Apr 2007 19:16
Approving articles with nnrpd filters
#76032
Author: Iulius
Date: Thu, 19 Apr 2007 19:16
49 lines
2784 bytes
Hi,

1/ Is it possible to approve articles without sending a mail to the
moderator, using filter_nnrpd.pl?
In fact, if I add an Approved header with the nnrpd filter, the
article is correctly posted to the newsgroup in question but it
is also mailed to the moderator.  I would have wanted to know
whether it were possible not to send such a mail.

I use:

if (($hdr{Newsgroups} =~ /my\.moderated\.newsgroup/i) && ($user =~ /^(me|you|her)$/i)) {
# these users are trustful -- they will not crosspost to another moderated group
    $modify_headers = 1;
    $hdr{'X-Approved'} = "Auto-approbation for $user";
    $hdr{Approved} = 'mail-address';
    if ($hdr{'Followup-To'} !~ /hierarchy\./i) {
        $hdr{'Followup-To'} = "hierarchy.group";
    }
    my $message = post_announce();
    $hdr{Subject} = "[$user-OK] ".$hdr{Subject};
}


It sends a mail with the subject set at the last line.
Can't it be avoided?


2/ Another issue is the posting.  It would have been great if that code
without the last two lines had worked.  But it is not the case since
INN rejects the article (reason: Unapproved article).
That is why I use a post_announce function which uses rnews to post
the article.  It is quite a pain (especially to write headers).
I did not manage to make inews work, but as long as rnews works, it is fine :)

So the question is: can't innd see that the Approved header is here
and allow the article to be posted, without having to write a separate
code in filter_nnrpd.pl to post the article?


I think the two questions are linked.  But why such a behaviour?

Regards,

-- 
Iulius

« Pour Rome, la direction importe peu, car tous les chemins
  y mènent. » (Astérix)
Re: Approving articles with nnrpd filters
#76033
Author: Jeffrey M. Vinocur
Date: Fri, 20 Apr 2007 01:00
44 lines
2911 bytes
In article <f08f5n$8f8$1@guepard.ecp.fr>,
Iulius  <iulius@nom-de-mon-site.com.invalid> wrote:
>
>1/ Is it possible to approve articles without sending a mail to the
>moderator, using filter_nnrpd.pl?

It doesn't look like it -- long before the perl filter code is
called, a flag is set to indicate that the article needs to be
sent to the moderator, and there's no way currently available to
unset that flag from within the filter code.  (Of course, we
could patch the code -- I'm looking at the use of modgroup in
nnrpd/post.c.)


>2/ Another issue is the posting.  It would have been great if that code
>without the last two lines had worked.  But it is not the case since
>INN rejects the article (reason: Unapproved article).
>That is why I use a post_announce function which uses rnews to post
>the article.  It is quite a pain (especially to write headers).
>I did not manage to make inews work, but as long as rnews works, it is fine :)

Now wait, is post_announce something you wrote that posts a whole
new article from scratch?  If so, no wonder you're having it show
up in two places -- you've made two articles!

This is a kinda circuitous approach, but I suppose the way to
make it work is to have your filter code drop the original copy
of the article.  In other words, if your post_announce works,
have your filter return DROP so that the original copy is not
emailed.

I should mention that I really don't like this whole approach.  I
think it has the potential to end up silently eating articles (if
there's something wrong that rnews finds out but has no way to
communicate it back through all of the convolutions).

Is there really no way that you could just give the relevant
users "access: A" permission and have their newsreaders
automatically add the Approved header when needed?


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: Approving articles with nnrpd filters
#76034
Author: Iulius
Date: Fri, 20 Apr 2007 06:46
67 lines
3973 bytes
En réponse à Jeffrey M. Vinocur :
>> 1/ Is it possible to approve articles without sending a mail to the
>> moderator, using filter_nnrpd.pl?
> 
> It doesn't look like it -- long before the perl filter code is
> called, a flag is set to indicate that the article needs to be
> sent to the moderator, and there's no way currently available to
> unset that flag from within the filter code.  (Of course, we
> could patch the code -- I'm looking at the use of modgroup in
> nnrpd/post.c.)

All right.  But « modgroup » is the flag in the active file, isn't it?
In nnrpd/post.c, you have:
(line 448) /* Approved; left alone. */

Perhaps it would be possible to do something here, before it the article
is passed to innd/art.c where it is rejected:
(line 2072) if (ngp->Rest[0] == NF_FLAG_MODERATED && !Approved) {
    snprintf(cp->Error, sizeof(cp->Error), "%d Unapproved for \"%s\"",
    NNTP_FAIL_IHAVE_REJECT, MaxLength(ngp->Name, ngp->Name));


> Now wait, is post_announce something you wrote that posts a whole
> new article from scratch?

Yes.  It is difficult to do differently with the current implementation.


> This is a kinda circuitous approach, but I suppose the way to
> make it work is to have your filter code drop the original copy
> of the article.  In other words, if your post_announce works,
> have your filter return DROP so that the original copy is not
> emailed.

That's a good idea for preventing the mail from being sent.


> I should mention that I really don't like this whole approach.  I
> think it has the potential to end up silently eating articles (if
> there's something wrong that rnews finds out but has no way to
> communicate it back through all of the convolutions).

Yes, you're right.  So sending the mail (with a modified subject
header in order to immediately see that it has normally already been
posted) is currently wiser.


> Is there really no way that you could just give the relevant
> users "access: A" permission and have their newsreaders
> automatically add the Approved header when needed?

It is exactly what I wanted to avoid for my users (everybody does not
use newsreaders which can easily add headers).  Up to now, I moderate
all the articles but it happens that somebody wishes to post during
a week-end or at night (and I am not always here to moderate the article).

That's why I tried to do that a couple of days ago and found these
little technical problems with nnrpd_filter.  But no worry, there is
no harm if I still receive an e-mail (at least, it allows me to see
to it whether rnews has correctly sent the article!).

Regards,

-- 
Iulius

« Aures serua. »
Re: Approving articles with nnrpd filters
#76037
Author: Jeffrey M. Vinocur
Date: Fri, 20 Apr 2007 09:22
19 lines
1765 bytes
In article <f09nkc$u42$1@guepard.ecp.fr>,
Iulius  <iulius@nom-de-mon-site.com.invalid> wrote:
>
>All right.  But « modgroup » is the flag in the active file, isn't it?
>In nnrpd/post.c, you have:
>(line 448) /* Approved; left alone. */
>
>Perhaps it would be possible to do something here, before it the article
>is passed to innd/art.c where it is rejected:

That's not a useful place -- you don't know there whether the
perl filter is going to add an Approved header.  If you wanted to
fix this, you'd have to put it within the DO_PERL block (to check
again if there's an Approved header and free modgroup if so).


-- 
Jeffrey M. Vinocur
jeff@litech.org
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads