Re: Conditional From?
Matěj Cepl <[email protected]> Fri, 25 Sep 2015 14:14:21 +0200
| Newsgroups | gmane.network.slrn.user |
|---|---|
| Organization | <>< |
| Message-ID | <[email protected]> |
On 2015-01-08 Morten Bo Johansen wrote:
> > Sure, it was just an attempt at some quick solution, in case identity.sl
> needed too much of an update. The regexp matching could also be achieved
> simply by changing it to this
>
> define set_cond_from ()
> {
> set_string_variable ("username", "mbj");
> set_string_variable ("hostname", "spamcop.net");
>
> if (string_match (current_newsgroup, "<regexp>", 1))
> {
> set_string_variable ("username", "user");
> set_string_variable ("hostname", "hostname");
> ...
> (other variables)
> }
> }
>
> () = register_hook ("followup_hook", "set_cond_from");
> () = register_hook ("post_hook", "set_cond_from");
Unplesant surprise for me was that string_match doesn’t know OR in
regular expressions so my regexp
"\(rh\.corp\|rhat\|redhat\)\..*"
never matches.
I found out that slrn provides PCRE bindings (I think it should really
be built-in; which platforms don’t have libpcre present?), but I don’t
know how to do it properly. Everything works fine in slsh, but when I
try to write it into my ~/.slrn.sl (interpreted from ~/.slrnrc) as in
https://mcepl.fedorapeople.org/tmp/_slrn.sl I get error on startup of slrn:
$ slrn
slrn pre1.0.3-6
Loading /usr/share/slrn/slang/slrn.sl
Reading startup file /home/matej/.slrnrc.
Loading /usr/share/slrn/slang/search.sl
Loading /home/matej/.config/slrn/lynx_body.sl
Loading /usr/share/slsh/require.sl
Loading /usr/share/slrn/slang/mime.sl
Loading /home/matej/.slrn.sl
Loading /usr/share/slsh/pcre.sl
Loading /usr/share/slrn/slang/mime.sl
varable is undefined
/home/matej/.slrn.sl:21:<top-level>:Undefined Name
slrn fatal error:
/home/matej/.slrnrc: Error encountered processing line 616
interpret .slrn.sl
$
I guess, I should put that require("pcre"); somewhere else, but when I
tried to put it to the top of the set_cond_from function, I got the same
error. How to use pcre properly?
Best,
Matěj
--
http://www.ceplovi.cz/matej/, Jabber: mcepl<at>ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
Our lives are spectacles of powerlessness.
-- Richard Rohr
------------------------------------------------------------------------------
signature.asc
(application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iD8DBQFWBTqd4J/vJdlkhKwRAvaQAJ9ypMsgErSpcOR1LvtSLeXY1DpUVQCfZLe+ +asGu6fSY8HxwoAgyz92Gw8= =vr0l -----END PGP SIGNATURE-----