🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #264709

Re: Dialog question

#264709
From: VanguardLH
Date: Thu, 25 Feb 2021 16:32
71 lines
5319 bytes
Jim S <jim@jimXscott.co.uk> wrote:

> I have used dialog for years, off and o,n and if push comes to shove,
> it would be my favourite. I know all about the ways to hide a mail
> and other markings and even how to set up scripts, but it still opens
> that damn window to tell me that I have plonked somebody (with or
> without their address)

Yep, the "Add PLONK rule ..." opens a dialog.  That's what the "..."
represents.  You are adding a new rule to the existing set of rules, and
are given the chance to check or edit before accepting it, or even to
click Cancel if you realize that wasn't what you wanted to plonk.  If
you don't get to see the rule, you don't know what the program added to
its rules list.  Defining blind any rules is for boobs, because they are
lazy.  That's also why any registry cleaners should present a list of
actions they intend to commit, but present the list to the user who is,
after all, that actual one responsible for making the choices.

Since you are familiar with writing scripts, why not write one for a
custom button that blindly adds a rule?  Under Settings -> Scripting ->
Scripting, create a Custom script.  Then add a toolbar button that runs
that script.  BernD might help you write the script.  Documenting the
functions and objects available at scope of user-defined scripts is not
something that Dialog's help ever provided.  Could be there is an object
available for the rules set along with functions to create/delete/modify
the filters defined in that data object.  If Dialog doesn't provide a
ruleslist object with functions to modify it then you're stuck with what
Dialog does provide for canned functionality.

Under Help -> Help contents -> Reference: Scripting, I did not see a
name for an object for the ruleset to which you could open a file handle
to read or write.  However, looks like the rules are stored in the
<installpath>\filters.dat file which is a text file.  So, you could use
the FileOpen(), FileRead(), FileWrite(), and FileClose() functions
available when writing a script to create/delete/modify rules in the
filters.dat file.  It's possible Dialog loads the filters.dat file into
memory for quick access rather than a slow open and read of the text
file every time each message is exercised against all filters.  If the
filters are cached into memory, you could edit the filters.dat file, but
the changes are not effected until you exit and reload Dialog.  The
PLONK dialog where you define filters could have a refresh function to
ensure any changes get reflected by loading the filters into memory
again.  That is, clicking Accept in the dialog could do the refresh that
you would have to manually instigate by reloading Dialog.  However, how
much time would you spend creating such a script and debugging it versus
the time to use "Add a PLONK rule ..." and simple click on Accept?

My old URL to Dialog's script library (to reuse/modify pre-written
scripts) is http://www.40tude.com/dialog/wiki/index.php/Script_Library
but that's not valid anymore.  Requires a login, but I suspect the
account no longer exists, plus the 40tude.com domain went dead (now
owned by a cybersquatter).  Easier to see if someone already wrote what
you want, or was close enough that you could adapt their script.  Don't
know if the script library survived xxx's abandonment of Dialog.

Just remember when using a script to write a new rule, you have to be
careful to which newsgroup(s) the rule applies.  The "[<newsgroup>]"
section title dictates under which newsgroup(s) a rule applies.  Before
your FileWrite(), you'll need to parse the filters.dat file to first
find the newsgroup section to where you want to apply your new rule.
Your script should ask if you want the new filter to apply only to the
currently selected newsgroup, to all newsgroups, or to which
newsgroup(s), which means you'll still get a prompt.  Of course, you
could default your plonk script to scan for "[<newsgroup>]" to match the
current newsgroup, and add your new rule there; however, <newsgroup>
could be a list of newsgroups, so you'll need to parse each newsgroup
section delimiter.  Also, you can wildcard newsgroups, like alt.politic*
or *.advocacy, so you'll have to check if the current newsgroup is
included under a wildcarded newsgroup section delimiter.

Blind editing of filters.dat is not so simple.
Technical Details
Message-ID: <y1gw3nsfxksh$.dlg@v.nguard.lh>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <16nwgad3dzis9.14cu6ky3jvhc6.dlg@40tude.net> <1x3tkvjg892i6$.dlg@v.nguard.lh> <ii5b7j3z1xms$.1qe2l6kb3hmxp$.dlg@40tude.net>

Show Full Headers
Complete Article Headers
Message-ID: <y1gw3nsfxksh$.dlg@v.nguard.lh>
Subject: Re: Dialog question
Date: Thu, 25 Feb 2021 10:32:19 -0600
From: VanguardLH <V@nguard.LH>
References: <16nwgad3dzis9.14cu6ky3jvhc6.dlg@40tude.net> <1x3tkvjg892i6$.dlg@v.nguard.lh> <ii5b7j3z1xms$.1qe2l6kb3hmxp$.dlg@40tude.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Cancel-Lock: sha1:UmWWzEQu8rXVMhV3H000dtb1I0o=
Organization: Usenet Elder
Reply-To: invalid@invalid.invalid
Content-Type: text/plain; charset="us-ascii"
Newsgroups: news.software.readers
Lines: 71
Keywords: VanguardLH VLH811
X-Trace: individual.net dzJesgUa0++H1hssM2IdrwtMnWhtcSDA2gsRZbAVECYBXSr+CW
User-Agent: 40tude_Dialog/2.0.15.41