Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 40 |
Nodes: | 6 (0 / 6) |
Uptime: | 09:58:13 |
Calls: | 291 |
Files: | 910 |
Messages: | 76,421 |
Scoring/Actions Syntax[end quoted plain text]
Scoring and actions is one of Dialog's most powerful features. The syntax
and actually most of the code is from Jurgen Haible's excellent local mail- >and newsserver Hamster.
What is Scoring?
Scoring is the process of assigning a number between -9999 and +9999 to a >message by applying scoring rules to the message. A scoring rule usually >analyzes one header field of the message and if it this header field matches >a certain text, a score value is assigned. For example, you can create a >scoring rule that assign the highest score value +9999 to all messages that >have your email address in the From header field, so that your messages >always receive a score of +9999.
The score value is shown in the header list in green for positive scores
and in red for negative scores:
Note that the list of headers can be sorted by score (with or without >threading), so scoring can be used to visually organize and separate >important from unimportant messages.
A scoring rule looks like this:
=+9999 From "Joe Average"
This simple scoring rule assigns the score +9999 to all articles that have >the term "Joe Average" in the From header field.
What are Actions?
Actions are an extension to scoring. While scoring rules simply assigns a >score value based on a condition, an action rule does something with or on >the message, e.g. there are actions to copy or move messages that meet a >certain condition to another folder.
While scoring rules start with =,- or +, action rules always start with !.
An action rule looks like this:
!copy(MyPosts) From "Joe Average"
This rule copies all articles that have the term "Joe Average" in the From >field header to the folder "MyPosts".
Processing
Usenet articles are scored twice in Dialog. When you get headers in a
group the scoring rules are applied to the available, limited number of >headers, however when you retrieve the complete body of the message, the >message is scored again and this time all headers can be scored.
The scoring and action rules are stored together in one file, the score
file, which you can access by selecting Settings, Scoring and actions from >Dialog's main menu.
When you edited the score file the changed rules are applied to newly >retrieved messages only. If you want to apply the new or changed rules to >existing groups, select Group, Apply scoring and actions to selected
groups from Dialog's main menu.
Note that the score file is Unicode aware. You can match on terms with >characters from the complete Unicode range.
Syntax by samples
The score file consists of separate sections, with each section having a >series of rules. The rules in a section are only applied to groups with
name matches the section identifier. The section identifier is written in >brackets.
Example:
[*]
=+9999 From "Joe Average"
[news.software.readers]
!copy(MyPosts) From "Joe Average"
The first scoring rule in this example is applied to all newsgroups, since >the section identifier is a wildcard, that matches all group names.
The second action rule in this example is only applied to the >news.software.readers group, but ignored for all other newsgroups.
Sample section identifiers:
[*] rules below this identifier are applied to all newsgroups
[**] rules below this identifier are applied to all newsgroups
and to incoming email
[email.*] rules below this identifier are applied to all incoming
emails (but not to newsgroups)
[email.private] rules below this identifier are applied to incoming
emails for the identity named "private"
[group.name.one group.name.two] rules below this identifier are
applied to group.name.one and
group.name.two only
[* -newusers] rules below this identifier are applied to all
newsgroups, except for groups that have the term
"newusers" in their name
A scoring rule start with =,+ or -. When an article is scored, it starts
with a score of 0 and a rule can either increase (+) or decrease (-) the >score or it can assign a score and stop processing any further scoring
rules (=).
Example:
[*]
+9999 From "Joe Average"
-1000 From "Joe Average" #Does this make sense?
=+8000 From "Joe Average"
=+7000 From "Joe Average"
Let's say a message from Joe Average is scored with the preceding score
file. What final score will the message receive? The message starts with a >score of 0, then 9999 is added, then 1000 is decreased, so after the first >two lines it has a score of +8999. The next line assigns a score +8000 to
the message, ignoring the score the message had previously and terminates
the processing of any further scoring rules, so the last line is ignored >completely and the message has a final score of +8000.
Note that all text after the character # is ignored in the score file.
Until now, we only scored on the From field of messages. When retrieving >article headers in an XOver operation you can score on the following
headers:
From The From header field
Subject The Subject of the message
Date The Date of the message
Message-ID The Message-ID of the message
References The contents of the References header field
Bytes The number of bytes of the message
Lines The number of lines of the message
XRef The contents of the XRef header field
XPost A virtual, numerical field holding the number of groups this
message was posted to.
Age A virtual, numerical field holding the age of the article in
numbers of days.
Score The score of the message
When scoring on fields that have numerical values you can compare if the >number is equal, greater or smaller using the percentage sign and the >following syntax:
-1000 Age %=2
-2000 Lines %>5000
+100 Bytes %<2000
The first rule above decreases the score by 1000 if the message is two
days old (but not if its older or newer!).
The second rule decreases the score by 2000 if the message has more than
5000 lines.
The third rule increases the score by 100 if the message is smaller than
2000 bytes.
When retrieving bodies for articles or when receiving emails all headers
are available for scoring. You can then additionally score on "Header".
The variable "Header" holds the complete list of header fields of the >message, separated by CRLF pairs. To score on this you might need to use >regular expressions.
Example:
=+9000 Header "X-MyUniqueXHeader:"
=+9000 Header {^(X-MyUniqueXHeader:)}
These two lines do basically the same. The first uses a plain string match
on "X-MyUniqueXHeader:" somewhere in the list of headers, while the second >uses a regular expression. The "^" in this regular expression makes sure
that "X-MyUniqueXHeader" is actually the first term on a line.
Regular expressions in the score file need to be written in braces as with >the preceding example.
Until now we only saw scoring rules, which assign or chang the score value
of messages.
Action rules do something with or on the article. Available action are:
!watch Sets the watch flag on the message
!ignore Sets the ignore flag on the message
!unsetwatchignore Unsets any ignore or watch flag
!retrieve Immediately retrieved the message body
!mark Marks the message for later retrieval
!unmark Removes any marked for retrieval flag
!keep Sets the keep flag on the message
!unkeep Unsets the keep flag on the message
!markread Marks the message read
!markunread Marks the message unread
!delete Deletes the message !setcolor(foreground_color;background_color) Sets the foreground and
background color of the message in the header list !move(target_folder) Moves the message to the target_folder !copy(target_folder) Copies the message to the target_folder
Note that multiple actions using the same condition can be separated by >commas.
Examples:
!watch,retrieve,keep From "Joe Average" # set the watch and keep flag
and retrieve the article !ignore,markread Lines %>200 # set the ignore flag and mark
the article read !setcolor(navy;aqua) From "Joe Average" # set the foreground color to
navy blue and background
color to aqua !setcolor(default;$F39CB5) From "Joe Average" # Don't change the foreground
color and change background
color to light
!copy(MyPosts) From "Joe Average" # Copy the message to the
MyPosts folder
!retrieve Score %>1000 # Retrieve the article is the
score is above 1000
Copy and Move actions
There is an extended syntax for copy and move action. Say you want to move >all emails from a mailing list to a separate folder. You can use:
[email.*]
!move(%X-Mailing-List%) Header {^(X-Mailing-List:)}
The section identifier here says that the following rule should be applied
to emails only.
The !move action itself looks for a X-Mailing-List: header in the message, >but instead of copying the message to a folder with a fixed name, it is >copied to a folder named after the value of the X-Mailing-List header
field itself. Say, e.g. you receive a message which has a "X-Mailing-List: >speedboats@yahoogroups.com" header, then this message is moved to the >"speedboats@yahoogroups.com" folder. By now, you might have noticed that
this is a very powerful rule for organizing mailing list into folders.
A variation of this is:
[email.*]
!move(@%X-Mailing-List%) Header {^(X-Mailing-List:)}
Notice the additional "@" in the target folder expression. If this @ is >present, the value of the header field is simply searched for the
character @ and only the text before the first found @ is used as the
target folder. Again, for a message which has a "X-Mailing-List: >speedboats@yahoogroups.com" header field, the message would be moved to the >"speedboats" folder, instead of the "speedboats@yahoogroups.com" folder. >Almost virtual groups
There are no virtual groups in Dialog, however you can simply copy or move >articles from one group to another manually or by using an action rule:
[a.binary.group]
!move(a.binary.group;NewsserverOne) bytes %>0
All previous examples used a folder as the target of the copy/move
operation. This rule uses a newsgroup as the target. Note that the name of >the target group and the name of the newsserver where this group is from
is separated by a semicolon.
Say, you are using two newsservers named "NewsserverOne" and
"NewsserverTwo". Both newsservers have the group "a.binary.group", but
while most of the messages are the same in this group on the two servers, >there are some that are not available on the other server.
The first line in the preceding sample makes sure that the following rule
is only applied to the "a.binary.group" newsgroup.
The rule itself simply says to move all articles (since the condition
"bytes %>0" is always met) to the group a.binary.group of NewsserverOne.
If you retrieve message headers for this group from server NewsserverOne,
the rule is ignored, since all articles go to the correct group anyway. If >you retrieve message headers from NewsserverTwo for this group though,
they will not show up in "a.binary.group (NewsserverTwo)", but in >"a.binary.group (NewsserverOne)".
The result is that you joined messages from the same group, but different >newsservers into one group in Dialog. This is especially useful for binary >groups to fill missing multipart postings.
Some further examples with inline comments
[*] # apply the following rules to all newsgroups =+9999 From "Your Name" # "my" articles get highest score
=+9999 Message-ID your.unique.fqdn
=+5000 References your.unique.fqdn # Load articles referencing one of
"my" articles:
=+1000 Subject "40tude dialog" # Certainly, we are very interested in
articles regarding 40tude dialog
=-1000 Subject "MAKE 40tude dialog FAST!!!!" # And certainly, we ignore
really silly suggestions
# (please notice, that this entry would never match, as subjects containing
# "40tude dialog" would match the "="-entry above)
# The examples below use group-specific score-entries by starting a new
# section in the scorefile with a "[...]"-line.
# Filter out "big" articles, that do not have "FAQ" in subject and are not
# posted in an announce-group:
[* -announce]
-10 Lines %>200
-10 Bytes %>10000
+20 Subject FAQ
-10 Xpost %>3 # Ignore articles posted to more than three groups [* -newusers -neubenutzer] # Ignore articles with subjects containing "!!!"
in all groups except the newusers-groups:
-1 Subject "!!!"
# Some groups may be more readable, if you filter out all articles and
# only load specific ones immediately, e.g.:
[group.name.one group.name.two group.name.three]
-1 Message-ID *
+1 Subject "interest1" "interest2" "interest3" "interest4"
+1 From "user1" "user2" "user3" "user4"
#Action examples
[*] # apply the following rules to all
groups
!watch,retrieve,keep From "Your Name" # set the watch and keep flag and
retrieve the article !ignore,markread Lines %>200 # set the ignore flag and mark the
article read
!setcolor(navy;aqua) From "Your Name" # set the foreground color to navy
blue and background color to aqua !setcolor(default;$F39CB5) From "Your Name" # Don't change the the
foreground color and change
background color to light
purple