🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
4 messages
4 total messages Started by Arjan Drieman Sun, 23 Jul 2000 00:00
[slrn/slang] selected article -=> viewed article?
#63595
Author: Arjan Drieman
Date: Sun, 23 Jul 2000 00:00
22 lines
1499 bytes
Hello,

Is there a single command I can use in my slang scripts that displays
the current selected article in the article window?

Or, if that's possible, is there a way to download the message header
so extract_article_header() returns the headers which aren't in the
overview database?  The only way I know to achieve that is by
displaying the article ;-)

Right now I'm using search_article("From"), but I think that's rather
ugly.

BTW - using search_article("") (searching for an empty string) has a
rather nasty result.  If you call a looping slrn with a great appetite
for CPU cycles nasty, that is ;-)


Thanks in advance,
Arjan

Re: [slrn/slang] selected article -=> viewed article?
#63616
Author: J.B. Nicholson-Owens
Date: Sun, 23 Jul 2000 00:00
42 lines
2515 bytes
Arjan Drieman wrote:
> Is there a single command I can use in my slang scripts that displays
> the current selected article in the article window?

There is more than one way to do this, here's one way:

#v+
   !if (_is_article_visible () & 1) call ("hide_article");
#v-

Of course this will only work from article mode.  For more specific info on
which article is showing, see the _is_article_visible() documentation in
doc/slrnfuns.txt in the slrn distribution or an online copy.

> Or, if that's possible, is there a way to download the message header
> so extract_article_header() returns the headers which aren't in the
> overview database?

extract_article_header() only returns the value of one header--the header
whose name you supply.  There is no programmatic indication where the header
value came from--overview, cached headers or downloaded just before the
function returned.  It is not wise to infer that a header is not in the
server's overview because you received an empty string from
extract_article_header().

If you want to know what headers are in the overview database you need to
parse the output of the "LIST OVERVIEW.FMT" NNTP command.  slrn's S-Lang API
offers no direct access to the server (short of opening a connection to the
server yourself and parsing the entire datastream).

> The only way I know to achieve that is by displaying the article ;-)

Looking only at an article with full headers you can't determine which
headers are in the overview and which aren't.  You can't even know if the
server supports news overviews (a server might not).  Any assumptions are
server-specific and therefore not a good idea to use in a general-purpose
program.

What task are you trying to accomplish that requires knowledge of the
overview database?

Re: [slrn/slang] selected article -=> viewed article?
#63638
Author: Arjan Drieman
Date: Sun, 23 Jul 2000 00:00
100 lines
5322 bytes
On 23 Jul 2000 19:50:32 GMT, J.B. Nicholson-Owens <jbn@forestfield.org> wrote:
>#v+
>   !if (_is_article_visible () & 1) call ("hide_article");
>#v-
>
>Of course this will only work from article mode.

Which is enough for me, thanks! :-)  Is there any good documentation
available about the slrn internal functions?  I only know the list at
 http://www.math.ohio-state.edu/~lahvak/software/slrn/internals.html
which is just that - a list without descriptions or syntaxes.  Quite
useful by itself, unless you don't know what you're looking for ;-)


>For more specific info on
>which article is showing, see the _is_article_visible() documentation in
>doc/slrnfuns.txt in the slrn distribution or an online copy.
>
>> Or, if that's possible, is there a way to download the message header
>> so extract_article_header() returns the headers which aren't in the
>> overview database?
>
>extract_article_header() only returns the value of one header--the header
>whose name you supply.

I know.  Unless slrn doesn't have the header yet, then the string is
empty.


>There is no programmatic indication where the header
>value came from--overview, cached headers or downloaded just before the
>function returned.

Nod I realize that, and that's not the point.  I don't care where the
headers came from, as long as I have 'em ;-)

That's why I needed the other function, to display the article.  If
slrn displays the article, it'll know the headers for sure.  If the
article is selected but not displayed, all you know for sure is that
it has the stuff from the overview database, which in most cases (if
not all) is not enough to do my stuff.  I think I wasn't very clear
while asking my question, sorry.


>> The only way I know to achieve that is by displaying the article ;-)
>
>Looking only at an article with full headers you can't determine which
>headers are in the overview and which aren't.  You can't even know if the
>server supports news overviews (a server might not).  Any assumptions are
>server-specific and therefore not a good idea to use in a general-purpose
>program.
>
>What task are you trying to accomplish that requires knowledge of the
>overview database?

It doesn't require knowledge of the overview database ;-)  I'm a
despammer.  I cancel spam when I see it in the newsgroups I read, like
EMP and MMF spam.  I wrote a cancel script to issue third-party
cancels.

I just hit some keycombo and it'll ask me what type of cancel I want
to issue.  It then fetches the headers I need, creates and writes a
cancel to a file, makes a backup of the article, and uses netcat (or
a patched inews) through system() to send the cancel to my news server.
It also creates a file to report the spam cancels to
nl.internet.misbruik, a dutch newsgroup about net-abuse.  I send that
file using inews from a daily cronjob.

When I have a list of Message-ID's (e.g. from my news server or
Dejanews) though, it gets rather old to get the articles with esc
control-l, view them, use my script, and that all again and again...

I'm extending the script now so I can just stuff the MID's in a file.
It'll read the MID's from the file, use locate_header_by_msgid() to
search and select it, hide_article to display it,
extract_article_header to fetch the headers I need, and so on.

Or perhaps I'll stuff the article headers I use in a linked list first,
gonna think about that now ;-)  Would enable me to easily decrease the
amount of connections I need to make to the news server.  Don't know
how my news server will like it if I throw like 20-30 cancels at once
at it without waiting for acknowledgements though ;-)

The other question you answered (about the prefixes) was to call that
part of the script through esc 1 control-i or something alike.  Since
you also answered the esc control-c part I'll probably just bind it to
those keys, using the default cancel key.

And when I'm done with that, I'm gonna write some email routine to
automagically notify the author of the original article so I don't
have to do that by hand.  And hmm then I'd like to make a dejanews
interface of sorts.  And hmmm then I'd like to be able to search my
news server from within slrn somehow because dejanews is delayed...
Being lazy is tiring sometimes ;-)


Thanks a lot for all your help,
Arjan

Re: [slrn/slang] selected article -=> viewed article?
#63705
Author: J.B. Nicholson-Owens
Date: Mon, 24 Jul 2000 00:00
32 lines
2052 bytes
Arjan Drieman wrote:
> Which is enough for me, thanks! :-)

Sure.

> Is there any good documentation available about the slrn internal
> functions?

Close, not anything as full as doc/slrnfuns.txt; your distribution of slrn
should have come with complete documentation including doc/slrn.rc which
contains descriptions by way of key definitions.  Also doc/changes.txt which
has some info.  Unfortunately there are quite a few side effects of internal
functions you probably won't find described anywhere but source code or user
experience.

I've written some macro extensions of internal & intrinsic functions if
you're interested (jumping through the high-scoring articles backwards,
header_prev_unread(), move_group_up_n(), move_group_down_n(), etc.).

> Unless slrn doesn't have the header yet, then the string is empty.

That's one case, another is when the article doesn't have the header you are
looking for, hence the ambiguity.  Maybe you could also track the last
article you downloaded, if you want to extract a header from it and it's not
visible.

> That's why I needed the other function, to display the article.  If
> slrn displays the article, it'll know the headers for sure.

Yes, it might already have the headers too.

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