]> the.earth.li Git - htag.git/commitdiff
Import Upstream version 0.0.23
authorJonathan McDowell <noodles@earth.li>
Fri, 26 Jul 2019 13:10:02 +0000 (10:10 -0300)
committerJonathan McDowell <noodles@earth.li>
Fri, 26 Jul 2019 13:10:02 +0000 (10:10 -0300)
29 files changed:
HtagPlugin/HtagPlugin.pm
README
build_util/addlicense.sh [changed mode: 0755->0644]
docs/AUTHORS
docs/BUGS
docs/Changelog.htag
docs/Changelog.htagplugin
docs/INSTALL
docs/MACRO_DESCRIPTION
docs/README
docs/README.Multiple_Configs [deleted file]
docs/TODO
docs/WRITING_SIGS [deleted file]
htag.pl
plugins/01checksigsep [new file with mode: 0644]
plugins/02catsig
plugins/06marknlard
plugins/07sesame
plugins/08uptime
plugins/09date
plugins/10simple
plugins/13substtag
plugins/15merge
plugins/20substsig
plugins/22reformat
plugins/25asktag
plugins/35tearline
plugins/80header
plugins/98append

index 4610874797fc63b0f0d96a1165b61d055f700528..58a4c6df5d6dd260835e20b6a6b7c91e65cd8bc6 100644 (file)
@@ -1,5 +1,5 @@
 # HtagPlugin.pm
 # HtagPlugin.pm
-# (C) Copyright 2000-2001 Simon Huggins <huggie@earth.li>
+# (C) Copyright 2000-2003 Simon Huggins <huggie@earth.li>
 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the Free
 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the Free
@@ -23,7 +23,7 @@ use Carp;
 # This version is the version of this module and not  the version of htag.
 # Plugins using functions only in new modules should really check the
 # version.
 # This version is the version of this module and not  the version of htag.
 # Plugins using functions only in new modules should really check the
 # version.
-$VERSION = '0.5';
+$VERSION = '0.6';
 
 # Do magic exporter stuff per mjd
 sub import {
 
 # Do magic exporter stuff per mjd
 sub import {
@@ -117,7 +117,7 @@ sub scansigfile($) {
        }
        close(SIG);
 
        }
        close(SIG);
 
-       while ($sig =~ s/(\@$char([1-9][0-9]*)([RC])?@)//) {
+       while ($sig =~ s/(\@$char(\*|(?:[1-9][0-9]*))([RC]?)\@)//) {
                my @array = ($1,$2);
                push @array, defined($3) ? $3 : "L";
                push @found, \@array;
                my @array = ($1,$2);
                push @array, defined($3) ? $3 : "L";
                push @found, \@array;
diff --git a/README b/README
index 82944e54a13b3956c27caf00340e43cfc98ee335..8998d427fea57d7a3aec915070215818569ebc7b 100644 (file)
--- a/README
+++ b/README
@@ -3,4 +3,4 @@ The real README and so on are in the docs/ subdir.
 Note if you package this please package all the files in the docs/ subdir.
 
 Simon Huggins <huggie@earth.li>
 Note if you package this please package all the files in the docs/ subdir.
 
 Simon Huggins <huggie@earth.li>
-Mon,  4 Jun 2001 22:18:35 +0200
+Wed Jun 18 23:08:46 BST 2003
old mode 100755 (executable)
new mode 100644 (file)
index 425ca37a875ca12f27836dbbdd30924f611e6e00..0f8902fa06f607e88ec42a801b0a7200381e509d 100644 (file)
@@ -12,3 +12,6 @@ who poked me a bit to do more work on it and to Lim Swee Tat who did
 likewise and also sent a patch which I rewrote to provide fortune support.
 
 Thanks to Jonathan McDowell again for packaging this up for Debian.
 likewise and also sent a patch which I rewrote to provide fortune support.
 
 Thanks to Jonathan McDowell again for packaging this up for Debian.
+
+Thanks to Alex Walker for installing it and sending me lots of mail about
+useful stuff he wanted to see in it.
index 32168db067207dd05aa4033fe57f7721463ccde9..8c0892d10c45d46e46ebc20b293b7aad8ee81a1e 100644 (file)
--- a/docs/BUGS
+++ b/docs/BUGS
@@ -3,7 +3,6 @@
   have a really twisted mind :)
   Bonus points will be awarded to the first person to use this feature for a
   useful purpose.
   have a really twisted mind :)
   Bonus points will be awarded to the first person to use this feature for a
   useful purpose.
-* There isn't enough documentation
 
 
 Mail me with any you find.
 
 
 Mail me with any you find.
index 272207dd457cba79f15f4ad58371ccb18567d5ea..83f3557a54813f3d8e3f7bdc345e3f5c47fd9297 100644 (file)
@@ -1,7 +1,31 @@
 HISTORY
 
 
 HISTORY
 
 
-04/06/2001
+2003-06-18
+       Oops, 25asktag always asked for a tag regardless of $cfg{'asktag'}
+       Thanks to Jasper Spaans for pointing that out.
+2002-06-04
+       Various bugfixes and cleanups.
+       Added a working 22reformat instead of just the template which has
+       been around for a while.
+2002-06-01
+       Add Noodles' patch from a while back to add an option to skip back to
+       asking about a sig from the asktag plugin.
+       A few miscellaneous cleanups.
+       Wrote a HOWTO which is at:
+       http://the.earth.li/~huggie/cgi-bin/moin/HtagHowto
+       Made @M*@ and so on work to insert things /without/ worrying about
+       their length.  This means they won't be padded and so is primarily
+       useful for the extra plugins and not taglines and allows you to put
+       text right up against them without worrying about extra spaces.  It
+       does also work with taglines so @*@ inserts the tag but with /no/
+       formatting. (Request from Alex Walker)
+       Added @NOTAG@ to stop any tagline being added.  Macros still get
+       expanded as do non-tag plugins. (Request from Alex Walker)
+       Added plugin to check for existing unquoted sigsep and allow user to
+       quit. (Request from Alex Walker)
+
+2001-06-04
        s/.pl$// in plugins and chmod 644 plugins/* since they don't really
        make sense separately from htag.
        Created TROUBLESHOOTING file.
        s/.pl$// in plugins and chmod 644 plugins/* since they don't really
        make sense separately from htag.
        Created TROUBLESHOOTING file.
@@ -10,20 +34,20 @@ HISTORY
        subdirectories and into the docs/ dir.  Move the sample config stuff
        into one place too.
 
        subdirectories and into the docs/ dir.  Move the sample config stuff
        into one place too.
 
-27/05/2001
+2001-05-27
        Change version number in HtagPlugin.pm to one that perl can check
        automagically and add a version to my use HtagPlugin line.
 
        Change version number in HtagPlugin.pm to one that perl can check
        automagically and add a version to my use HtagPlugin line.
 
-25/05/2001
+2001-05-25
        Fixed up the cases where either the configfile has an error (always
        set $override{'nicedie'}) or the plugins do htagdie.
        htagdie has now disappeared in favour of nicedie so I've bumped the
        versioning in HtagPlugin.pm and nicedie has moved to HtagPlugin.pm
 
        Fixed up the cases where either the configfile has an error (always
        set $override{'nicedie'}) or the plugins do htagdie.
        htagdie has now disappeared in favour of nicedie so I've bumped the
        versioning in HtagPlugin.pm and nicedie has moved to HtagPlugin.pm
 
-09/05/2001
+2001-05-09
        Changed s/|$// to s/\|$// in sample.htrc  Doh!
 
        Changed s/|$// to s/\|$// in sample.htrc  Doh!
 
-30/04/2001 - 0.0.18
+2001-04-30 - 0.0.18
        Yes, I should definitely have released 0.0.18 by now.  Ho hum.
 
        Added check of patterns used in changeheaders so if someone puts one
        Yes, I should definitely have released 0.0.18 by now.  Ho hum.
 
        Added check of patterns used in changeheaders so if someone puts one
@@ -31,7 +55,7 @@ HISTORY
 
        Rolled tarball - probably won't be uploaded til 2nd May.
 
 
        Rolled tarball - probably won't be uploaded til 2nd May.
 
-16/04/2001
+2001-04-16
        Oops, shouldn't I have released 0.0.18 by now?
 
        Checked status of 0.0.18 and cleaned it up a little.  Made multiple
        Oops, shouldn't I have released 0.0.18 by now?
 
        Checked status of 0.0.18 and cleaned it up a little.  Made multiple
@@ -61,7 +85,7 @@ HISTORY
        also doesn't parse the .dat files it just runs fortune(1) which is
        fairly icky really but hey.
 
        also doesn't parse the .dat files it just runs fortune(1) which is
        fairly icky really but hey.
 
-02/02/2001
+2001-02-02
        Feedback (oh my God other people use this? :)) led to a few changes:
        Change the cfgfile interface stuff so we eval just one file (~/.htrc
        or the file specified on the commandline with -c) then eval another
        Feedback (oh my God other people use this? :)) led to a few changes:
        Change the cfgfile interface stuff so we eval just one file (~/.htrc
        or the file specified on the commandline with -c) then eval another
@@ -71,21 +95,21 @@ HISTORY
        cases because they didn't really help and just caused config
        problems really.
 
        cases because they didn't really help and just caused config
        problems really.
 
-22/01/2001
+2001-01-22
        Check for UID/GID 0 before running.
 
        Check for UID/GID 0 before running.
 
-28/11/2000 - 0.0.17
+2000-11-28 - 0.0.17
        Put 01changeconf.pl into htag.pl instead.  Tried to think about the
        idea of having dependencies instead of just a plugin dir or indeed a
        plugin list instead but gave up simply because I can't be arsed.  I
        want to run all the plugins.  This is the idea.  Anyway,
        patches/ideas accepted.
 
        Put 01changeconf.pl into htag.pl instead.  Tried to think about the
        idea of having dependencies instead of just a plugin dir or indeed a
        plugin list instead but gave up simply because I can't be arsed.  I
        want to run all the plugins.  This is the idea.  Anyway,
        patches/ideas accepted.
 
-27/11/2000
+2000-11-27
        Fixed a strange bug due to a regexp in merge that meant that @B in a
        tagline wasn't expanding correctly sometimes.
 
        Fixed a strange bug due to a regexp in merge that meant that @B in a
        tagline wasn't expanding correctly sometimes.
 
-13/11/2000
+2000-11-13
        Fixed some of the eval code so it reports fatal errors.
 
        Made merge.pl remove spaces if there were only spaces between it and
        Fixed some of the eval code so it reports fatal errors.
 
        Made merge.pl remove spaces if there were only spaces between it and
@@ -93,15 +117,15 @@ HISTORY
        quick fix and gave in and used a negative look behind assertion in
        my regexp.  Requires perl 5.005 or higher I think.
 
        quick fix and gave in and used a negative look behind assertion in
        my regexp.  Requires perl 5.005 or higher I think.
 
-09/11/2000
+2000-11-09
        Upgraded to perl 5.6.0 and um didn't realise and ran htag.pl
        It seems to work with 5.6.0 :)
 
        Upgraded to perl 5.6.0 and um didn't realise and ran htag.pl
        It seems to work with 5.6.0 :)
 
-27/10/2000
+2000-10-27
        Moved substtag.pl so it was called *after* the tag had been chosen.
        Oops.  I should have more tags with substable bits in, yes.
        
        Moved substtag.pl so it was called *after* the tag had been chosen.
        Oops.  I should have more tags with substable bits in, yes.
        
-11/10/2000 - 0.0.16
+2000-10-11 - 0.0.16
        Fixed merge so that it works if a sig doesn't have any tagline bits.
        And so that multiple elements of the same plugin will work (e.g.
        having two separate @Uxx@ lines works now).
        Fixed merge so that it works if a sig doesn't have any tagline bits.
        And so that multiple elements of the same plugin will work (e.g.
        having two separate @Uxx@ lines works now).
@@ -115,14 +139,14 @@ HISTORY
        Moved 05* to 14* so that in the case where the tag doesn't fit and
        we have to go back we only go back one.
 
        Moved 05* to 14* so that in the case where the tag doesn't fit and
        we have to go back we only go back one.
 
-08/10/2000 - 0.0.16-pre-going-to-release-soon-honest (Eurostar :))
+2000-10-08 - 0.0.16-pre-going-to-release-soon-honest (Eurostar :))
        Implemented a "read and eval" parser for the plugins if they are in
        perl.  This may well break things.  Let me know if it does.
 
        Moved plugin_util to HtagPlugin.  (tab completion works better now
        so I'm less annoyed so I'll be more productive.  Or summat :))
 
        Implemented a "read and eval" parser for the plugins if they are in
        perl.  This may well break things.  Let me know if it does.
 
        Moved plugin_util to HtagPlugin.  (tab completion works better now
        so I'm less annoyed so I'll be more productive.  Or summat :))
 
-24/09/2000 - 0.0.16-pre
+2000-09-24 - 0.0.16-pre
        Changed htag.pl and all plugins not to call srand because since perl
        5.004 this is done automatically and uses a better random seed than
        I was giving it.
        Changed htag.pl and all plugins not to call srand because since perl
        5.004 this is done automatically and uses a better random seed than
        I was giving it.
@@ -134,7 +158,7 @@ HISTORY
        It allows multiple configs based on headers finally!
        See README.Multiple_Config
 
        It allows multiple configs based on headers finally!
        See README.Multiple_Config
 
-15/08/2000 - 0.0.15
+2000-08-15 - 0.0.15
        Changed HtagPlugin to only require three arguments (Message file,
        Cfg file and VERSION) which all need to come from htag.pl
 
        Changed HtagPlugin to only require three arguments (Message file,
        Cfg file and VERSION) which all need to come from htag.pl
 
@@ -147,7 +171,7 @@ HISTORY
 
        Added some new plugins (sesame, date, uptime) using this system.
 
 
        Added some new plugins (sesame, date, uptime) using this system.
 
-29/07/2000 - 0.0.14
+2000-07-29 - 0.0.14
        Changed HtagPlugin to return 254 when htagdie is called.
        Made htag.pl ask for keypress if exited with 254 but NOT if exited
        with 255 (i.e. user requested exit).
        Changed HtagPlugin to return 254 when htagdie is called.
        Made htag.pl ask for keypress if exited with 254 but NOT if exited
        with 255 (i.e. user requested exit).
@@ -160,44 +184,44 @@ HISTORY
 
        Added protocol version number and checking for same.
 
 
        Added protocol version number and checking for same.
 
-28/06/2000 - 0.0.13
+2000-06-28 - 0.0.13
        Changed HtagPlugin to cope with "Lastname, Firstname"
 
        Changed HtagPlugin to cope with "Lastname, Firstname"
 
-18/06/2000 - 0.0.12
+2000-06-18 - 0.0.12
        Fixed the subst* plugins to use the To: address not the From:
        address.  (Doh.)
 
        Put more common code into the HtagPlugin module.
 
        Fixed the subst* plugins to use the To: address not the From:
        address.  (Doh.)
 
        Put more common code into the HtagPlugin module.
 
-06/06/2000 - 0.0.11
+2000-06-06 - 0.0.11
        Early in the morning.
        Released the new one properly.
        Early in the morning.
        Released the new one properly.
-...
+       ...
        Converted to an init style plugins-invoked-in-order-of-number type
        thing to allow more flexibility.
 
        Converted to an init style plugins-invoked-in-order-of-number type
        thing to allow more flexibility.
 
-05/04/2000 - 0.0.8
+2000-04-05 - 0.0.8
        Allowed plugins to return the number to go back to...
 
        Infinite loops are protected against.
 
        exiting with 255 means quit htag.pl
 
        Allowed plugins to return the number to go back to...
 
        Infinite loops are protected against.
 
        exiting with 255 means quit htag.pl
 
-31/03/2000 - 0.0.7
+2000-03-31 - 0.0.7
        Made it like init.  (Runs plugins in numerical order randomly picks
        ones with same order).
 
        Made it like init.  (Runs plugins in numerical order randomly picks
        ones with same order).
 
-24/03/2000 - 0.0.6
+2000-03-24 - 0.0.6
        Backends for    - choosing tags.
 
        Backends for    - choosing tags.
 
-07/02/2000 - 0.0.5
+2000-02-07 - 0.0.5
        Fixed '-- ' thing.
 
        Fixed '-- ' thing.
 
-03/01/2000 - 0.0.4
+2000-01-03 - 0.0.4
        Fixed length "feature" of 0.0.3
        Will now only use tags that fit the sigs' @[0-9]+@ bits.
 
        Fixed length "feature" of 0.0.3
        Will now only use tags that fit the sigs' @[0-9]+@ bits.
 
-19/12/1999
+1999-12-19
        Released to the unsuspecting world...
 
 Started 6/10/1999
        Released to the unsuspecting world...
 
 Started 6/10/1999
index 53f5a2d4330f26e61d06869e117d510e9b7b32e5..91d7191f456364466ebea81283adfcf58d4766f2 100644 (file)
@@ -1,6 +1,8 @@
 HISTORY - HtagPlugin.pm
 
 
 HISTORY - HtagPlugin.pm
 
 
+01/06/2002 - 0.6
+       Changed scansigfile to cope with @M*@ style macros.
 27/05/2001 - 0.5
        Change to use perl style version number so it can be verified with
        "use HtagPlugin.pm 0.5;"
 27/05/2001 - 0.5
        Change to use perl style version number so it can be verified with
        "use HtagPlugin.pm 0.5;"
index bcacdc35b9a68c0ecdafdd20842ced3ae6e4112c..dea01d71320991f979b3eabc8ce5f68f862fd70f 100644 (file)
@@ -1,5 +1,5 @@
-htag-0.0.18
-16th April 2000
+htag-0.0.23
+18th June 2003
 
 1. Plugins
 ==========
 
 1. Plugins
 ==========
@@ -8,8 +8,6 @@ Htag.pl works on a plugin system.  All the plugins are in the (originally
 named) plugins directory.  They should be moved somewhere sensible and the
 path to them should be put in the $cfg{'plugindir'} variable in your ~/.htrc
 
 named) plugins directory.  They should be moved somewhere sensible and the
 path to them should be put in the $cfg{'plugindir'} variable in your ~/.htrc
 
-NOTE: Systemwide installation will get better.  Honest.
-
 If you're installing for the whole box put them in
 /usr/local/share/huggietag/plugins or some such.
 A system tagfile could live in /usr/local/share/huggietag too for instance.
 If you're installing for the whole box put them in
 /usr/local/share/huggietag/plugins or some such.
 A system tagfile could live in /usr/local/share/huggietag too for instance.
@@ -36,25 +34,19 @@ the advent of eval of plugins (Hooray!).
 NOTE:  This must be an absolute path if you're going to call it from random
 locations. 
 
 NOTE:  This must be an absolute path if you're going to call it from random
 locations. 
 
-When I write an install script it will do this for you.
+If I write an install script it will do this for you.
 
 3. Config file
 ==============
 
 Copy the sample.htrc to ~/.htrc and edit it lots.
 
 3. Config file
 ==============
 
 Copy the sample.htrc to ~/.htrc and edit it lots.
-If you want multiple config files then read README.Multiple_Config
+See http://the.earth.li/~huggie/cgi-bin/moin/HtagHowto for more information.
 
 4. Signatures
 =============
 
 Create your own sigs.  You can use some of the sigs I provide as templates.
 
 4. Signatures
 =============
 
 Create your own sigs.  You can use some of the sigs I provide as templates.
-You may find htag.pl -f useful when creating sigs with @xx[RC] macros since
-it will replace these just with spaces allowing you to get the spacing right
-as you're trying to line them up.
-
-Make sure you add at least one sig to the config file.
-
-Look in sigs for some of mine.
+See http://the.earth.li/~huggie/cgi-bin/moin/HtagHowto for more information.
 
 5. Using it
 ===========
 
 5. Using it
 ===========
index e733e8f2d3351caad6f3fefab9ce28ad2d251a92..bbaea990623b68ceb24101d8135d925d6c6d090b 100644 (file)
@@ -20,6 +20,9 @@ L - Last name
 N - Full name
 V - Version in the form x.y.z
 
 N - Full name
 V - Version in the form x.y.z
 
+@NOTAG@ is special and means that no tagline is to be appended to this sig
+but that it will still be parsed and have macros substituted etc.
+
 The name variants are only available if htag is passed a message with
 headers like "To: Simon Huggins <huggie@earth.li>".
 
 The name variants are only available if htag is passed a message with
 headers like "To: Simon Huggins <huggie@earth.li>".
 
index 4ec3153aa3f06b6c937267ed809be5e6db922e7d..fd09d3e8102bed2253d4e858c4d291a52a5633a2 100644 (file)
@@ -1,12 +1,12 @@
-htag.pl 0.0.18
+htag.pl 0.0.23
 Simon Huggins <huggie@earth.li>
 
 Description
 ===========
 
 Simon Huggins <huggie@earth.li>
 
 Description
 ===========
 
-       htag is a tagline adder but it has now been so over engineered that
-       it will also do anything you want it to[0], do lots of stuff I want
-       it to[1], and do stuff it wants to[2].
+       htag is a tagline and signature adder but it has now been so over
+       engineered that it will also do anything you want it to[0], do lots
+       of stuff I want it to[1], and do stuff it wants to[2].
 
 See the INSTALL        file for basic usage.
 See the TODO   file for some stuff that I need help with and stuff that
 
 See the INSTALL        file for basic usage.
 See the TODO   file for some stuff that I need help with and stuff that
@@ -14,13 +14,15 @@ will appear soon.
 
 You will probably find the other docs useful (in order of usefulness):
 README                 - This file!
 
 You will probably find the other docs useful (in order of usefulness):
 README                 - This file!
-INSTALL                        - how to install and use.
-README.Multiple_Configs        - How to use multiple config files (you probably
-                         want to use this to get any use of the
-                         power/configurability of htag)
+INSTALL                        - how to install htag for those not using a binary
+                         package.
 sample-config          - a bunch of sample config files useful to base
                          yours on.
 sample-config          - a bunch of sample config files useful to base
                          yours on.
-WRITING_SIGS           - tips for writing your own signatures.
+
+But really most of the docs are now at:
+http://the.earth.li/~huggie/cgi-bin/moin/HtagHowto
+
+Other docs are:
 TROUBLESHOOTING                - how to troubleshoot your own problems.
 MACRO_DESCRIPTION      - the reference for all the magic in sigs and tags.
 Changelog.htag         - the changes between versions of htag.
 TROUBLESHOOTING                - how to troubleshoot your own problems.
 MACRO_DESCRIPTION      - the reference for all the magic in sigs and tags.
 Changelog.htag         - the changes between versions of htag.
@@ -34,8 +36,6 @@ LICENSE                       - the license.
 
 Please mail me if you:
 * have written some cool/useful plugins
 
 Please mail me if you:
 * have written some cool/useful plugins
-* want to write docs
-* want me to write docs
 * want to write an installer
 * think it's good
 * want to show off your tags and sigs :)
 * want to write an installer
 * think it's good
 * want to show off your tags and sigs :)
diff --git a/docs/README.Multiple_Configs b/docs/README.Multiple_Configs
deleted file mode 100644 (file)
index c8903a7..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-Multiple Config Support
-=======================
-
-Please read the README/INSTALL before reading this document.
-
-In 0.0.18 this changed to eval your per header configs *after* the main
-config file as opposed to only evaluating one config file making it easier
-to see what is different about a particular config but breaking backward
-compatibility for those that used Multiple Config File support.  Sorry.
-Complain at me.
-
-Multiple Config Support allows that you can reply to different people or
-different newsgroups with different plugins.
-
-This is what htag.pl does when it starts up wrt configfiles:
-       - checks to see if one is specified on the commandline
-       - if not defaults the basecfgfile to ~/.htrc
-       - evaluates the basecfgfile
-       - checks to see if $cfg{'changeheaders'} is defined and if so checks
-         whether those patterns match the headers it has for the message.
-         If they match it runs this extra config file.
-
-So to get this working you just need to create one config file with your
-defaults and your changeheaders patterns and extra config file names.  Then
-create the extra config files you've mentioned in changeheaders.
-
-changeheaders syntax is something like:
-$cfg{'changeheaders'} = [
-       [ 'pattern_to_match', 'more optional patterns', 'config filename' ],
-       one or more lines like above
-       ];
-
-The patterns are ANDed together.  If you want OR just create multiple lines.
-
-$cfg{'changeheaders'} = [
-       [ '^From:.*support\@blackcatnetworks.co.uk', '~/.htagrc/support' ], 
-       [ '^Newsgroups:.* fr\.', 'From:.*huggie\@foo.com',
-         '~/.htagrc/fr-foo.com' ]
-       ];
-
-The first example matches all messages which I send out with a From: line of
-support@blackcatnetworks.co.uk so that I can append reassuring signatures to
-our customers - I don't actually do this ... yet :)
-The second is a contrived example which matches a Newsgroup line which has
-somewhere a group that starts with "fr." and where the From: line contains
-huggie@foo.com
-
-There is a way of having a config per address but still only having one
-rule.  Put a rule which has an empty config file and at least one rule which
-should (if it matches) produce the config file name in $1 (the first
-parenthesized match).
-e.g.
-       [ '^From:.*?(\w+)@earth.li','~/.htagrc/earth-li-$1' ],
-
-Then for every mail sent from something@earth.li it will use the config
-"~/.htagrc/earth-li-something".
-
-This could be used for instance to have a different config per From: address
-(i.e. when you send from company From: addresses, and from personal From:
-addresses and want to have different configs per address).
-
-This documentation was written when I hadn't had enough sleep.  Sorry.
-Corrections/clarifications/rewrites/chocolate welcomed.
-
-Simon Huggins <huggie@earth.li>
index 897b7216b16994251bc431696ac307ca5f862e54..c79b75cdb964e611481bb6c48794b4c7f781c799 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -10,15 +10,17 @@ me diffs or plugins or docs etc.
        And have the MAGIC do things like center or right align or
        possibly even put over two lines if it is needed.
 * Write more plugins that do random stuff as examples of what can be done.
        And have the MAGIC do things like center or right align or
        possibly even put over two lines if it is needed.
 * Write more plugins that do random stuff as examples of what can be done.
-* Write documentation
+* Keep updating the Wiki with more docs.
 * Fix bugs
 * Add more cunning things here.
 * Add an installer or very explicit Installation documentation. (paddy may
   do this)
 * Fix bugs
 * Add more cunning things here.
 * Add an installer or very explicit Installation documentation. (paddy may
   do this)
+* Allow searching for taglines by regexp and choosing them that way
 
 Done
 ====
 
 
 Done
 ====
 
+* I wrote some docs!  http://the.earth.li/~huggie/cgi-bin/moin/HtagHowto
 * Add docs on how to install a module if you are not the sysadmin (request
   from fudge)
 * Add a way (probably in a plugin) to differentiate between which plugins
 * Add docs on how to install a module if you are not the sysadmin (request
   from fudge)
 * Add a way (probably in a plugin) to differentiate between which plugins
diff --git a/docs/WRITING_SIGS b/docs/WRITING_SIGS
deleted file mode 100644 (file)
index 4b952aa..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-Simon Huggins <huggie@earth.li>
-
-Sigs are essentially just text files with special characters inside them.
-
-There are two (ish) types of special characters:
-       - those that just get substituted
-       - those that get padded and aligned
-
-For a full definition of reserved letters and macros that can exist please
-read MACRO_DESCRIPTION.  Yeah, I know there is overlap but this file is
-meant to help you write sigs and MACRO_DESCRIPTION is meant to be an
-authoritative reference file.
-
-See the end for the examples which are probably more interesting.
-
-Straight substitutions
-======================
-
-       Becomes
-@B     A newline.  This is a bit pointless for sigs - why have a macro to
-       insert a newline when you can just put one in yourself?
-       It's useful for taglines.
-@F     First name of person in To: line.
-@L     Last name of person in To: line.
-@N     Whole name of person in To: line.
-@V     Version of htag.pl (format x.y.z i.e. 0.0.17)
-
-Padding and Aligning
-====================
-
-Ok, substitutions of this sort are done to a set number of characters.
-
-They are of the form:
-@[A-Za-z]?[1-9][0-9]*[RC]?@
-
-That is:
-       - An @ symbol
-       - An optional letter
-               * If it's not there it means insert a bit of the tagline
-                 you've selected (multiple ones of these are replaced with
-                 multiple sections of tagline)
-               * If it does exist it means insert a bit of the plugin that
-                 deals with that particular letter (multiple ones of these
-                 are replaced each time with a new line from the plugin)
-       - A number
-               * This is the exact number of characters that will be
-                 inserted.
-       - An optional alignment
-               * R for right padded with spaces
-               * C for centered padded with spaces
-               * Nothing for left aligned padded with spaces on the right.
-       - An @ symbol
-
-
-What this all means
-===================
-
-It's probably best shown with examples:
-
-@40@ means insert 40 characters of the tagline chosen left aligned.
-@64R@ means right align over 64 characters part of the tagline.
-
-
-@20R@ @20@ means right align 20 characters of tagline and then put a space
-and then left align another 20.
-
-With letters:
-
-@U20@ means print in 20 characters the output of the uptime plugin
-(depending on the settings in htrc this is normally of the form:
-up 23 days, 3:41)
-
-@U1@ means give me an error message because I didn't give it enough space to
-put the uptime in.
-
-Here is one of my sigs:
-
--- 
-UK based domain, email and web hosting ***/ @28R@ /*
-http://www.blackcatnetworks.co.uk/     **/ @28R@ /**
-sales@blackcatnetworks.co.uk           */ @28R@ /***
-Black Cat Networks                     / @28R@ /****
-
-It just sticks the tagline inside the slanty bit right aligned.
-
-And another:
-
--- 
-Just another wannabie | @30C@ |  Just another fool
-----------------------+ @30C@ +-------------------
-This message was brought to you @S30@.
-htag.pl @V -- http://www.earth.li/projectpurple/progs/htag.html
-
-This puts the tagline in the middle over two lines and centers it.  It
-replaces S30 with by the letter A and the number 1 where A and 1 are
-randomly chosen letters using the sesame plugin and it replaces @V with the
-current version of htag.pl
-
-Hope that helped a bit.
-Send me any good sigs that you write :)
diff --git a/htag.pl b/htag.pl
index 235afef1d0f01f39bd16a4c5868b5325a0ab7c0f..5972d892524ee31e4cc1b2112a8cff202eb47ee2 100755 (executable)
--- a/htag.pl
+++ b/htag.pl
@@ -3,7 +3,7 @@
 use strict;
 
 # htag.pl - a tagline generator, sig manager and over engineered program.
 use strict;
 
 # htag.pl - a tagline generator, sig manager and over engineered program.
-# Copyright (C) 1999-2001 Simon Huggins
+# Copyright (C) 1999-2003 Project Purple, Simon Huggins
 
 # Simon Huggins <huggie@earth.li>
 # http://www.earth.li/projectpurple/progs/htag.html
 
 # Simon Huggins <huggie@earth.li>
 # http://www.earth.li/projectpurple/progs/htag.html
@@ -12,8 +12,7 @@ use strict;
  
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the Free
  
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option)
-# any later version.
+# Software Foundation; version 2 of the License only
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -35,9 +34,9 @@ if ($< == 0 or $> == 0 or $( == 0 or $) == 0) {
 # HtagPlugin lying around the system then uncomment the following with the
 # path to your local copy of HtagPlugin
 
 # HtagPlugin lying around the system then uncomment the following with the
 # path to your local copy of HtagPlugin
 
-# use lib '/home/huggie/htag/';
+# use lib '/home/huggie/perl/huggietag/htag-0.0.23/HtagPlugin';
 
 
-use HtagPlugin         0.5;
+use HtagPlugin         0.6;
 use Getopt::Long;
 use POSIX qw/tcgetpgrp/;
 
 use Getopt::Long;
 use POSIX qw/tcgetpgrp/;
 
@@ -57,25 +56,16 @@ my $cfgdebug=0;
 my $infinity = 80;
 
 ### Defines
 my $infinity = 80;
 
 ### Defines
-$override{'VERSION'} = $cfg{'VERSION'}    = "0.0.19";
+$override{'VERSION'} = $cfg{'VERSION'}    = "0.0.23";
 $override{'HOME'} = $cfg{'HOME'} = $ENV{"HOME"} || $ENV{"LOGDIR"}
        || (getpwuid($<))[7];
 $override{'HOME'} = $cfg{'HOME'} = $ENV{"HOME"} || $ENV{"LOGDIR"}
        || (getpwuid($<))[7];
+$cfg{'nicedie'} = 1;
 
 # srand(time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required
 
 
 # srand(time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required
 
-#sub nicedie($) {
-#      my $msg = shift;
-#      warn $msg;
-#      if ($cfg{'nicedie'}) {
-#              warn "Press <RETURN> to continue\n";
-#              my $throwaway=<STDIN>;
-#      }
-#      die "\n";
-#}
-
 sub print_header {
        print STDERR "Htag.pl $cfg{'VERSION'} -  Simon Huggins <huggie\@earth.li>  Released under GPL\n";
 sub print_header {
        print STDERR "Htag.pl $cfg{'VERSION'} -  Simon Huggins <huggie\@earth.li>  Released under GPL\n";
-       print STDERR "Copyright (C) 1999-2001 Project Purple. http://www.earth.li/projectpurple/\n\n";
+       print STDERR "Copyright (C) 1999-2002 Project Purple. http://www.earth.li/projectpurple/\n\n";
 }
 
 sub process_options {
 }
 
 sub process_options {
@@ -97,7 +87,7 @@ sub process_options {
                        "msgfile=s"     => \$cfg{'msgfile'},
                        "m=s"           => \$cfg{'msgfile'});
        if (not &GetOptions(%getopt)) {
                        "msgfile=s"     => \$cfg{'msgfile'},
                        "m=s"           => \$cfg{'msgfile'});
        if (not &GetOptions(%getopt)) {
-               print <<'EOF';
+               print STDERR <<'EOF';
 htag.pl - tagline and general sig adder.
  Usage:   htag.pl -t tagfile -c cfgfile -m msgfile
           htag.pl -h gives perldoc
 htag.pl - tagline and general sig adder.
  Usage:   htag.pl -t tagfile -c cfgfile -m msgfile
           htag.pl -h gives perldoc
@@ -349,11 +339,13 @@ sub choose_configfile() {
        my $file;
 
        if (defined $cfg{'changeheaders'}) {
        my $file;
 
        if (defined $cfg{'changeheaders'}) {
-               open(HANDLE, $cfg{'msgfile'});
                my (@headers,$match,@l);
                my (@headers,$match,@l);
-               while (my $line = <HANDLE>) {
-                       last if ($line =~ /^$/); # end of headers
-                       push @headers, $line;
+               if (open(HANDLE, $cfg{'msgfile'})) {
+                       while (my $line = <HANDLE>) {
+                               last if ($line =~ /^$/); # end of headers
+                               push @headers, $line;
+                       }
+                       close(HANDLE);
                }
                foreach (@{$cfg{'changeheaders'}}) {
                        $file = pop;
                }
                foreach (@{$cfg{'changeheaders'}}) {
                        $file = pop;
@@ -391,7 +383,6 @@ sub choose_configfile() {
 
                        }
                }
 
                        }
                }
-               close(HANDLE);
        }
 }
 
        }
 }
 
diff --git a/plugins/01checksigsep b/plugins/01checksigsep
new file mode 100644 (file)
index 0000000..fb70cff
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2000-2003 Simon Huggins
+# checksigsep checks for an existing sigsep and allows you to quit without
+# adding a new sig.
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
+use strict;
+
+return if ($cfg{'msgfile'} eq "-");
+
+my $msg="";
+open(MSG, "<$cfg{'msgfile'}") or return;
+while(<MSG>) {
+       $msg .= $_;
+}
+close(MSG);
+if (grep { /\n-- \n/ } $msg) {
+       my $oldmsg = $msg;
+       print STDERR "Looks like this message already has an unquoted sigsep:\n";
+       $oldmsg =~ s/.*(-- $)/$1/ms;
+       print STDERR $oldmsg;
+       print STDERR "\n\nAdd another? ([N]o/(y)es)\n";
+       $_ = <STDIN>;
+       return 255      if /^q(?:uit)?$/i;
+       return 255      if /^(?:no?|\n)$/i;
+}
+
index 62c5b72af57e1dfb53e3053f4853fcb537ac4343..dcbaca04c95976c762fe925986e3252c6e33f60d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # catsig deals with choosing a sig
 
 # This program is free software; you can redistribute it and/or modify it
 # catsig deals with choosing a sig
 
 # This program is free software; you can redistribute it and/or modify it
index a6c9c8259fb15abaf1bd2ba4f4b1e2f6d9a1cc68..291465cd0d810aa7b088e04c29ee1ae23946149d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # marknlard outputs Mark 'n Lard style attributions
 
 # This program is free software; you can redistribute it and/or modify it
 # marknlard outputs Mark 'n Lard style attributions
 
 # This program is free software; you can redistribute it and/or modify it
@@ -44,7 +44,10 @@ foreach my $f (@found) {
        while ($recursion < 30) {
                $recursion++;
                my $attr = pickone();
        while ($recursion < 30) {
                $recursion++;
                my $attr = pickone();
-               if (length $attr <= $f[1]) {
+               if ($f[1] eq "*") {
+                       print OUT $attr,"\n";
+                       $recursion = 255;
+               } elsif (length $attr <= $f[1]) {
                        print OUT chunksizealign($attr, $f[1], $f[2]),"\n";
                        $recursion = 255;
                }
                        print OUT chunksizealign($attr, $f[1], $f[2]),"\n";
                        $recursion = 255;
                }
index c532bf3342695f577268c893c09d71e3c9dc3ba7..f8ecfc9b22a7d1b7b462dd8ee5797fff494552ff 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # Sesame Street style brought to you "by the letter X and the number 1"
 
 # This program is free software; you can redistribute it and/or modify it
 # Sesame Street style brought to you "by the letter X and the number 1"
 
 # This program is free software; you can redistribute it and/or modify it
@@ -36,7 +36,10 @@ foreach my $f (@found) {
        while ($recursion < 30) {
                $recursion++;
                my $attr = pickone();
        while ($recursion < 30) {
                $recursion++;
                my $attr = pickone();
-               if (length $attr <= $f[1]) {
+               if ($f[1] eq "*") {
+                       print OUT $attr,"\n";
+                       $recursion = 255;
+               } elsif (length $attr <= $f[1]) {
                        print OUT chunksizealign($attr, $f[1], $f[2]),"\n";
                        $recursion = 255;
                }
                        print OUT chunksizealign($attr, $f[1], $f[2]),"\n";
                        $recursion = 255;
                }
index ffa34f643aba55c6ace5928db387c90d708fb4db..89e53ce934dab22a2b8a6a14c3f1a7f7a0921a6b 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # uptime merely calls uptime.  You can influence the output a bit.
 
 # This program is free software; you can redistribute it and/or modify it
 # uptime merely calls uptime.  You can influence the output a bit.
 
 # This program is free software; you can redistribute it and/or modify it
@@ -36,7 +36,9 @@ $uptime =~ s/^.*?(up (?:[0-9]+ days?,)?[^,]+),.*$/$1/ if $cfg{'uptime_time'};
 $uptime =~ s/[ ]+/ /g;
 foreach my $f (@found) {
        my @f = @{$f};
 $uptime =~ s/[ ]+/ /g;
 foreach my $f (@found) {
        my @f = @{$f};
-       if (length $uptime <= $f[1]) {
+       if ($f[1] eq "*") {
+               print OUT $uptime,"\n";
+       } elsif (length $uptime <= $f[1]) {
                print OUT chunksizealign($uptime, $f[1], $f[2]),"\n";
        } else {
                htagdie "Can't fit uptime in <= $f[1].\nPerhaps your space isn't big enough.\nAlternatively modify this script to give less information.\n";
                print OUT chunksizealign($uptime, $f[1], $f[2]),"\n";
        } else {
                htagdie "Can't fit uptime in <= $f[1].\nPerhaps your space isn't big enough.\nAlternatively modify this script to give less information.\n";
index d62eaf997acf1f8e4499aaf7de7012d0c41324bd..decdf26718a9003f6d05473ad5f81ceaa7ea4c3d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # date just calls date.  You may pass in a strftime compatible formatting
 # string.
 
 # date just calls date.  You may pass in a strftime compatible formatting
 # string.
 
@@ -35,8 +35,10 @@ reg_deletion("$cfg{'tmpdir'}/D");
 foreach my $f (@found) {
        my @f = @{$f};
        my $date = strftime($cfg{'date_format'} ? $cfg{'date_format'} : "%a %b %e %H:%M:%S %Y", localtime);
 foreach my $f (@found) {
        my @f = @{$f};
        my $date = strftime($cfg{'date_format'} ? $cfg{'date_format'} : "%a %b %e %H:%M:%S %Y", localtime);
-       if (length $date <= $f[1]) {
-               print OUT chunksizealign($date, $f[1], $f[2]);
+       if ($f[1] eq "*") {
+               print OUT $date,"\n";
+       } elsif (length $date <= $f[1]) {
+               print OUT chunksizealign($date, $f[1], $f[2]),"\n";
        } else {
                my $diemsg = "Can't fit your chosen date format (";
                if (defined $cfg{'date_format'}) {
        } else {
                my $diemsg = "Can't fit your chosen date format (";
                if (defined $cfg{'date_format'}) {
index 46825d684a7a1dedd0363768dd3c5485e21afde1..22e67c4ac8740a50665c7747a7b4262270cae21d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # simple just chooses a random tagline in the simplest possible way
 # or uses fortune(1)
 
 # simple just chooses a random tagline in the simplest possible way
 # or uses fortune(1)
 
@@ -24,6 +24,17 @@ my (@tags);
 
 # srand( time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required.
 
 
 # srand( time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required.
 
+my $sig="";
+open(SIG, "<$cfg{'tmpsigfile'}") or htagdie "$0: Could not open $cfg{'tmpsigfile'}: $!\n";
+while(<SIG>) {
+       $sig .= $_;
+}
+close(SIG);
+
+if (grep { /\@NOTAG\@/ } $sig) {
+       $cfg{'notag'}=1;
+       return 15;
+}
 
 htagdie <<EOF if (not defined $cfg{'tagfile'} and not defined $cfg{'tagfiles'} and not defined $cfg{'fortune'} and not defined $cfg{'tagdir'}); 
 No tagfile defined!  I'm good but I'm not psychic
 
 htagdie <<EOF if (not defined $cfg{'tagfile'} and not defined $cfg{'tagfiles'} and not defined $cfg{'fortune'} and not defined $cfg{'tagdir'}); 
 No tagfile defined!  I'm good but I'm not psychic
index 2110db09ad3173382b4a0d934778098edde3672a..039f667d8495147c411e9eeebdcec94e57c0f3d5 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # substtag performs substitutions on the tagline.
 
 # This program is free software; you can redistribute it and/or modify it
 # substtag performs substitutions on the tagline.
 
 # This program is free software; you can redistribute it and/or modify it
index 7b48711562969776490d7ff5d5e9807afdcbad09..801bcf0986ab6133e36aeb05b365163ec7bf38ea 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # merge merges the sig and the tag but also merges the sig and the new style
 # plugin things (i.e. all those silly files in $cfg{'tmpdir'}
 
 # merge merges the sig and the tag but also merges the sig and the new style
 # plugin things (i.e. all those silly files in $cfg{'tmpdir'}
 
@@ -52,7 +52,7 @@ sub merge($$) {
        my ($plugin,$len,$align,$wascr);
        $wascr=0;
 
        my ($plugin,$len,$align,$wascr);
        $wascr=0;
 
-       while ($sig =~ /@([A-Za-z]?)([1-9][0-9]*)([RC]?)@/) {
+       while ($sig =~ /@([A-Za-z]?)(\*|(?:[1-9][0-9]*))([RC]?)@/) {
                # Ick.
                if (defined $3) {
                        $plugin = $1;
                # Ick.
                if (defined $3) {
                        $plugin = $1;
@@ -77,53 +77,61 @@ print STDERR "plugin,len,type = #$plugin#,#$len#,#$align#\n" if $anal_merge_debu
                        $chunk = getplugin($plugin);
                        print STDERR "Got plugin $plugin and $chunk\n"
                                if $anal_merge_debug;
                        $chunk = getplugin($plugin);
                        print STDERR "Got plugin $plugin and $chunk\n"
                                if $anal_merge_debug;
+                       $len = quotemeta $len; # escape * if it is *
                        $sig =~ s/\@$plugin$len[RC]?@/$chunk/;
                        print STDERR "Sig is now:\n$sig" if $anal_merge_debug;
                        $chunk = "";
                } else {
                        my $extra;
                        $notag=0;
                        $sig =~ s/\@$plugin$len[RC]?@/$chunk/;
                        print STDERR "Sig is now:\n$sig" if $anal_merge_debug;
                        $chunk = "";
                } else {
                        my $extra;
                        $notag=0;
-                       $chunk =  substr $tag, 0, $len;
+                       if ($len ne "*") {
+                               $chunk =  substr $tag, 0, $len;
 print STDERR "chunk,tag = #$chunk#,#$tag#".length($tag)." ".length($chunk)."\n"
        if $anal_merge_debug;
 print STDERR "chunk,tag = #$chunk#,#$tag#".length($tag)." ".length($chunk)."\n"
        if $anal_merge_debug;
-                       if ($chunk =~ s/^([^\n]+)\n+(.*)$/$1/s) {
-                               $extra = $2;
-                               print STDERR "\$extra = [$extra]\n"
-                                       if $anal_merge_debug;
-                       }
-                       if (length($chunk) < $len) {
-                               print STDERR "length(chunk) < $len\n"
-                                       if $anal_merge_debug;
-                               $chunk=&chunksizealign($chunk,$len,$align);
-                               print STDERR "chunk = #$chunk#\n"
-                                       if $anal_merge_debug;
-                       }
-                       if (length($tag) < $len + 1) {
-                               $tag= $extra ? $extra : "";
+                               if ($chunk =~ s/^([^\n]+)\n+(.*)$/$1/s) {
+                                       $extra = $2;
+                                       print STDERR "\$extra = [$extra]\n"
+                                               if $anal_merge_debug;
+                               }
+                               if (length($chunk) < $len) {
+                                       print STDERR "length(chunk) < $len\n"
+                                               if $anal_merge_debug;
+                                       $chunk=&chunksizealign($chunk,$len,$align);
+                                       print STDERR "chunk = #$chunk#\n"
+                                               if $anal_merge_debug;
+                               }
+                               if (length($tag) < $len + 1) {
+                                       $tag= $extra ? $extra : "";
 print STDERR "length(tag) < $len + 1, tag now = #$tag#(extra = #$extra#)\n"
        if $anal_merge_debug;
 print STDERR "length(tag) < $len + 1, tag now = #$tag#(extra = #$extra#)\n"
        if $anal_merge_debug;
-                       } elsif (substr $tag, 0,  $len + 1 eq ' ') {
-                               $tag=substr $tag, $len + 1;
-                               $tag=$extra . $tag if defined $extra;
+                               } elsif (substr $tag, 0,  $len + 1 eq ' ') {
+                                       $tag=substr $tag, $len + 1;
+                                       $tag=$extra . $tag if defined $extra;
 print STDERR "substr tag, 0, $len + 1 was a space.  tag now = #$tag#\n"
        if $anal_merge_debug;
 print STDERR "substr tag, 0, $len + 1 was a space.  tag now = #$tag#\n"
        if $anal_merge_debug;
-                       } else {
-                               $tag=substr $tag, $len;
-                               ### Back up a word in $chunk
-                               $tag=$extra . $tag if defined $extra;
+                               } else {
+                                       $tag=substr $tag, $len;
+                                       ### Back up a word in $chunk
+                                       $tag=$extra . $tag if defined $extra;
 print STDERR "didn't break at space.  Backing up word.  tag now = #$tag#\n"
        if $anal_merge_debug;
 print STDERR "didn't break at space.  Backing up word.  tag now = #$tag#\n"
        if $anal_merge_debug;
-                               if ($chunk =~ s/(.*) (.*)$/$1/) {
-                                       $tag=$2 . $tag;
-                                       $chunk=&chunksizealign($chunk,$len,$align);
-                               }
+                                       if ($chunk =~ s/(.*) (.*)$/$1/) {
+                                               $tag=$2 . $tag;
+                                               $chunk=&chunksizealign($chunk,$len,$align);
+                                       }
 print STDERR "If space in chunk then change chunk and add word to tag.".
 "Reformat chunk now = #$chunk# (tag = #$tag#)\n" if $anal_merge_debug;
 print STDERR "If space in chunk then change chunk and add word to tag.".
 "Reformat chunk now = #$chunk# (tag = #$tag#)\n" if $anal_merge_debug;
+                               }
+                       } else {
+                               $chunk = $tag;
+                               $tag = "";
                        }
                        }
+                       $len = quotemeta $len; # escape * if it's *
                        $sig =~ s/\@$plugin$len[RC]?@/$chunk/;
                }
        }
        $sig =~ s/@([0-9]+)[RC]?@/" " x $1/eg;
                        $sig =~ s/\@$plugin$len[RC]?@/$chunk/;
                }
        }
        $sig =~ s/@([0-9]+)[RC]?@/" " x $1/eg;
+       $sig =~ s/@\*[RC]?@//g;
        $cfg{'notag'} = $notag;
        if ($tag and not $notag) {
                return undef;
        $cfg{'notag'} = $notag;
        if ($tag and not $notag) {
                return undef;
@@ -158,12 +166,19 @@ while(<SIG>) {
        $sig .= $_;
 }
 close(SIG);
        $sig .= $_;
 }
 close(SIG);
-open(TAG, "<$cfg{'tmptagfile'}") or htagdie "$1: Could not open $cfg{'tmptagfile'}: $!\n";
-while(<TAG>) {
-       $tag .= $_;
+my $ret = 0;
+if (grep { /\@NOTAG\@/ } $sig) {
+       $tag="";
+       $ret=26;
+       $sig =~ s/\@NOTAG\@\n//;
+} else {
+       open(TAG, "<$cfg{'tmptagfile'}") or htagdie "$1: Could not open $cfg{'tmptagfile'}: $!\n";
+       while(<TAG>) {
+               $tag .= $_;
+       }
+       close(TAG);
 }
 }
-close(TAG);
-if (defined $sig and $sig =~ /@[A-Za-z]?[1-9][0-9]*[RC]?@/) {
+if (defined $sig and $sig =~ /@[A-Za-z]?\*|(?:[1-9][0-9]*)[RC]?@/) {
        $sig =  merge($tag,$sig);
 } else {
        my $formatted_tag = Text::Wrap::wrap($cfg{'first'},$cfg{'leader'},$tag);
        $sig =  merge($tag,$sig);
 } else {
        my $formatted_tag = Text::Wrap::wrap($cfg{'first'},$cfg{'leader'},$tag);
@@ -176,7 +191,7 @@ if (defined $sig) {
        print SIG "\n" while $cfg{'newline'}--;
        print SIG $sig;
        close(SIG);
        print SIG "\n" while $cfg{'newline'}--;
        print SIG $sig;
        close(SIG);
-       return;
+       return $ret;
 } else {
        return(10);
 }
 } else {
        return(10);
 }
index d870b10c3352ccfa5b4f215d9f7ea350947a44b4..800fd27a9de370bcab183f7e0714ffa47c8e70a1 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # substsig substitutes parts of signatures 
 
 # This program is free software; you can redistribute it and/or modify it
 # substsig substitutes parts of signatures 
 
 # This program is free software; you can redistribute it and/or modify it
index 910c76850bbf21edc04736c1393bdefce0f774be..02c9518008f32df427768d7e08c2bf54fb9adf38 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # reformats longer lengths after the substitutions have taken place
 
 # This program is free software; you can redistribute it and/or modify it
 # reformats longer lengths after the substitutions have taken place
 
 # This program is free software; you can redistribute it and/or modify it
 # with this program; if not, write to the Free Software Foundation, Inc., 59
 # Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
 # with this program; if not, write to the Free Software Foundation, Inc., 59
 # Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
-return;
-
 use strict;
 use strict;
-use Text::Wrap;
-
-$Text::Wrap::columns=defined $cfg{'maxlinelen'} ? $cfg{'maxlinelen'} : 72;
-$cfg{'first'}  ||= "";
-$cfg{'leader'} ||= "";
+use vars qw($nomod);
 
 
-my $anal_merge_debug=0;
+BEGIN {
+       unless (eval "use Text::Balanced qw(gen_extract_tagged);1;") {
+               print STDERR "Text::Balanced not available, reformat plugin will not work\n";
+               $nomod=1;
+       }
+}
+return if $nomod;
 
 sub remove_space($) {
         my $text=shift;
 
 sub remove_space($) {
         my $text=shift;
@@ -42,14 +42,35 @@ sub remove_space($) {
         return $text;
 }
 
         return $text;
 }
 
-sub reformat($) {
-       my $sig = shift;
-# LRC
-#$chunk=&chunksizealign($chunk,$len,$align);
-       while ($sig =~ /\@(CENTER|RIGHT|LEFT)(\d+)?\@/) {
-       }
+sub reformat ($) {
+       my $text = shift;
+       my ($ext,$end,$beg,$otag,$ctag,$stuff);
+       my $process = gen_extract_tagged('<(?:CENTER|RIGHT|LEFT)\d+>',
+                       undef,
+                       '(?s).*(?=<(?:CENTER|RIGHT|LEFT)\d+>)',
+                       {reject => ['<(?:CENTER|RIGHT|LEFT)\d+>']} );
+       while (1) {
+               ($stuff, $end, $beg, $otag, $ext, $ctag) = &$process($text);
+               if (not defined $stuff) {
+                       if ($text =~ /<(?:CENTER|RIGHT|LEFT)\d+>/) {
+                               nicedie($@->{'error'});
+                       }
+               }
+               last if !$stuff;
 
 
-       return $sig;
+               my $size = $otag;
+               $size =~ s/<(?:CENTER|RIGHT|LEFT)//;
+               $size =~ s/>//;
+
+               my $align = $otag;
+               $align =~ s/^.(.).*$/$1/;
+
+               my $c = chunksizealign($ext, $size, $align);
+
+               $stuff=quotemeta($stuff);
+               $text =~ s/$stuff/$c/;
+       }
+       return $text;
 }
 
 my ($tag,$sig,$newsig);
 }
 
 my ($tag,$sig,$newsig);
@@ -60,7 +81,8 @@ while(<SIG>) {
 }
 close(SIG);
 if (defined $sig) {
 }
 close(SIG);
 if (defined $sig) {
-       $sig =  reformat($sig);
+       $sig = reformat($sig);
+       $sig = remove_space($sig);
        if (defined $sig) {
                open(SIG, ">$cfg{'tmpsigfile'}")
                        or htagdie
        if (defined $sig) {
                open(SIG, ">$cfg{'tmpsigfile'}")
                        or htagdie
index 8ee45f6d4f02bab3cf7c3102f99bdbf6107adab9..ef8339d280903350c3c2a4ce31ae04b0a3314aab 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # asktag chooses a tag like catsig chooses a sig.
 
 # This program is free software; you can redistribute it and/or modify it
 # asktag chooses a tag like catsig chooses a sig.
 
 # This program is free software; you can redistribute it and/or modify it
@@ -20,6 +20,7 @@
 use strict;
 
 return if $cfg{'notag'};
 use strict;
 
 return if $cfg{'notag'};
+return unless $cfg{'asktag'};
 
 open(SIG, "<$cfg{'tmpsigfile'}") or htagdie "$0: Could not open $cfg{'tmpsigfile'}: $!\n";
 my @sig=<SIG>;
 
 open(SIG, "<$cfg{'tmpsigfile'}") or htagdie "$0: Could not open $cfg{'tmpsigfile'}: $!\n";
 my @sig=<SIG>;
@@ -27,10 +28,11 @@ close(SIG);
 
 chomp $sig[-1];
 print STDERR @sig;
 
 chomp $sig[-1];
 print STDERR @sig;
-print STDERR "\n\nOK? ([Y]es/(n)ew Tag/(q)uit)\n";
+print STDERR "\n\nOK? ([Y]es/(n)ew Tag/(b)ack to start/(q)uit)\n";
 $_ = <STDIN>;
 $_ = <STDIN>;
-return 255 if /^q(?:uit)?/i;
-return     if /^(?:y(?:es)?|\n)/i;
+return 255     if /^q(?:uit)?/i;
+return 2       if /^b(?:ack)?/i;
+return         if /^(?:y(?:es)?|\n)/i;
 
 # Remove sig, and copy old sig (unmerged copy) back over the top
 unlink($cfg{'tmpsigfile'}) or htagdie "Could not remove $cfg{'tmpsigfile'}: $!\n";
 
 # Remove sig, and copy old sig (unmerged copy) back over the top
 unlink($cfg{'tmpsigfile'}) or htagdie "Could not remove $cfg{'tmpsigfile'}: $!\n";
index ef10d8fff25dfaa18ab57df9450d554765f1a63c..a2ec7fea9f5e55f37a4e7ae447d429c008b061c0 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # tearline is a hang over from Fidonet days where tagline adding programs
 # had tearlines.  It's probably no longer used by anyone anywhere but well I
 # live in hope that Fidonet will be reborn...
 # tearline is a hang over from Fidonet days where tagline adding programs
 # had tearlines.  It's probably no longer used by anyone anywhere but well I
 # live in hope that Fidonet will be reborn...
index 5f9c52acdac3f467a28e369e8a018e89c54be174..718c7232f656a191bbb02fdd6172d2b637313e2d 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # header adds headers to messages like "Hi @F"
 
 # This program is free software; you can redistribute it and/or modify it
 # header adds headers to messages like "Hi @F"
 
 # This program is free software; you can redistribute it and/or modify it
index f9f3661a0b15a8d116ffc17bf1652c8f6aa136ae..1d708b9269597e4cedfedb91c35a05318751e555 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
 #!/usr/bin/perl -w
 
-# Copyright (C) 2000-2001 Simon Huggins
+# Copyright (C) 2000-2003 Simon Huggins
 # Just appends the sig onto the message file
 
 # This program is free software; you can redistribute it and/or modify it
 # Just appends the sig onto the message file
 
 # This program is free software; you can redistribute it and/or modify it