FAQ about patches | More patches | Main Page | MD5 sum for this patch

Define your own rules and make pine flexible!
 
This [patch] really rocks, a comment about this patch by a user.
 
Patch is available for versions:
pine 4.21 pine 4.30 pine 4.31 pine 4.32 pine 4.33 pine 4.40 pine 4.41 pine 4.42 pine 4.43 pine 4.44 pine 4.50 pine 4.51 pine 4.52 pine 4.53 pine 4.55 pine 4.56 pine 4.58 pine 4.60 pine 4.61 pine 4.62 pine 4.63 pine 4.64
 
This patch had an important UPDATE in version 4.64. See the text below to read the current update. This patch allows you to create specific hooks, so that operations that would normally be global in nature can be customized on a per message/folder/person basis. If you are new to this patch follow this link to read what you can do with it. This text describes changes and improvements to the patch.
 
If you are using a version of Pine earlier than 4.53, then you need to download two extra files, which are not included in the patch. The files are called "rules.c" and "rules.h". and must be copied into the directory where the source code of Pine is (usually called pine4.xx/pine/).
 
Here there is a small table showing the link to the correct files:
 
[Pine4.21 Pine4.30][Pine 4.30 Pine4.31 Pine4.32][Pine4.33][Pine4.40 Pine4.41 Pine4.42 Pine4.43][Pine4.44]
rules.crules.crules.crules.crules.c
rules.hrules.hrules.hrules.hrules.h

 
In Pine4.21 you must enter the definitions of your own rules in the variable "new-rules" in your configuration screen. In Pine 4.30 this variable does not exist anymore and is split in "index-rule", "replace-rule", "reply-leadin-rule", "reply-subject-rule", "sort-rule" and "startup-rule". This makes the execution of the rules faster and in nothing differs with the variable eliminated.
 
Alternatively you can get a compressed tar ball for Pine4.21 or Pine4.30 that contains the patch, as well as the two files rules.c and rules.h. You must decompress and untar this directory in the pine4.21 (respectively pine4.30) directory and then apply the patch.
 
Here you can find tips about how to improve the use of this patch.
 
There is also a new configuration option added recently which allows you to save automatically from the INBOX to any folder that you like upon exiting Pine. The configuration option is called:
 
[X] auto-move-read-msgs-using-rules

The patch works in the same way as auto-move-read-msgs and both of them should be activated for this feature to have an effect. Once they are both active your saving rules will be used to automatically save messages from your INBOX upon exiting Pine.
 
A new feature starting in Pine4.31 is the ability to save messages based on the value of its flags, now you can save all deleted messages automatically upon exiting your INBOX (it will also be possible to do it from incoming folders, but I haven't got around to it yet). All you need to do is define a rule like:
 
_FLAG_ >> {D} -> Trash

which will save messages marked deleted in your INBOX to the "Trash" folder. You can read an explanation of how the _FLAG_ token is created by following this link.
 
Pine4.31 also introduces new tokens, _COLLECTION_ and _SIGNATURE_. The first one contains the value of the name of the collection you are in, the second one is a function which determines the value of the signature file to be used for the message being composed. The _SIGNATURE_ function must be used in the compose-rules variable. An example of the use of these two tokens is.
 
_COLLECTION_ == {Mail} => _SIGNATURE_{/full/path/to/.signature}

Pine4.33 introduces the _SMTP_ function which allows you to select the smtp server the you are going to use to send the message that you are composing. The SMTP function must be used in the smtp-rules configuration option. For example, one can use it as follows:
 
_TO_ == {Peter Flinstones} => _SMTP_{smtp.bedrock.com}
_ADDRESSTO_ == {peter@bedrock.com} => _SMTP_{smtp.bedrock.com}

Also new in pine4.33 is the ability to change your reply-indent-string based on the person, folder, etc you are replying yo. The function to use is called "_RESTR_" (for REply STRing), an example of its use is
 
_FROM_ == {Peter Flinstones;Wilma Flinstones} => _RESTR_{"_INIT_ >"}

A new token _ROLE__ was also added in version 4.33, in particular it can be used to do "RESUB" and "TRIM". I guess it will be added more functionality later. It is in a test stage today.
 
Starting in Pine4.44, the patch will include new tokens LCC that includes the text of the of the Lcc field as it appears when you start composing a message, a new "forward-rules" configuration variable, and two new tokens FORWARDFROM and FORWARDADDRESS to be used in this configuration variable, which mean the address and the personal name of the person that you are forwarding the message from.
 
Also new in version 4.44 is the token _REXTRIM_. This token is similar to the token _TRIM_, but its argument is a regular expression.
 
Starting in version 4.60 there are two new variables that allow you to configure how threads look like in a per-folder or coolection basis. They are called threading-display-style-rule and threading-index-style-rule and they allow you to customize the values of the variables threading-display-style and threading-index-style.
 
Version 4.64 introduces the tokens _SCREEN_, _PKEY_ and _COMMAND_ which allow you to define macros, that is, keystrokes which when pressed execute a group of keystrokes. For example, one can associate sort by thread to the keystroke ~ by writing the following rule in the key-definition-rules variable
 
_SCREEN_ == {index} && _PKEY_ == {~} => _COMMAND_{"$h"}
 
The full documentation is included in the help text of the variable key-definition-rules.
 
Info for Version 4.40 and above Starting in this version Pine includes by default a screen to make possible to configure some of the rules that can be configured also with this patch. In order to have backwards compatibility this patch superseeds any rule that you define with the unpatched version of Pine, so if you define a rule (using this patch) that makes the startup rule to be "first-recent", then that definition will win over any other definition, but if you do not define it, then Pine will check for any other rule defined in the "Other Rules" configuration screen to determine which rule to use when opening the folder. Is this clear?

Last Updated 08:21:43 PDT Tue Oct 17 2006.