Documentation

Ingo_Script_Procmail extends Ingo_Script_Base
in package

The Ingo_Script_Procmail class represents a Procmail script generator.

Tags
author

Brent J. Nordquist bjn@horde.org

author

Ben Chavet ben@horde.org

author

Jan Schneider jan@horde.org

category

Horde

license

http://www.horde.org/licenses/apache ASL

Table of Contents

$_actions  : array<string|int, mixed>
The list of actions allowed (implemented) for this driver.
$_categories  : array<string|int, mixed>
The categories of filtering allowed.
$_categoryFeatures  : array<string|int, mixed>
Which form fields are supported in each category by this driver?
$_features  : array<string|int, mixed>
A list of driver features.
$_generated  : bool
Have the recipes been generated yet?
$_params  : array<string|int, mixed>
The script class' additional parameters.
$_recipes  : array<string|int, mixed>
The recipes that make up the code.
$_special_types  : array<string|int, mixed>
A list of any special types that this driver supports.
$_tests  : array<string|int, mixed>
The list of tests allowed (implemented) for this driver.
$_types  : array<string|int, mixed>
The types of tests allowed (implemented) for this driver.
__construct()  : mixed
Constructor.
activate()  : mixed
Connects to the backend, uploads the scripts and sets them active.
availableActions()  : array<string|int, mixed>
Returns the available actions for this driver.
availableCategories()  : array<string|int, mixed>
Returns the available categories for this driver.
availableCategoryFeatures()  : array<string|int, mixed>
Returns the supported form fields for this driver.
availableTests()  : array<string|int, mixed>
Returns the available tests for this driver.
availableTypes()  : array<string|int, mixed>
Returns the available test types for this driver.
canPerform()  : bool
Is the perform() function available right now?
excludeRegexp()  : string
Returns a regular expression that should catch mails coming from most daemons, mailing list, newsletters, and other bulk.
generate()  : array<string|int, mixed>
Generates the scripts to do the filtering specified in the rules.
hasFeature()  : bool
Returns whether the script driver supports a certain feature.
perform()  : mixed
Performs the filtering specified in the rules.
setParams()  : Ingo_Script
Updates the parameters.
specialTypes()  : array<string|int, mixed>
Returns any test types that are special for this driver.
_addItem()  : mixed
Adds an item to the recipe list.
_generate()  : mixed
Generates the procmail scripts to do the filtering specified in the rules.
_generateBlacklist()  : mixed
Generates the procmail script to handle the blacklist specified in the rules.
_generateForward()  : mixed
Generates the procmail script to handle mail forwards.
_generateVacation()  : mixed
Generates the procmail script to handle vacation.
_generateWhitelist()  : mixed
Generates the procmail script to handle the whitelist specified in the rules.
_insertItem()  : mixed
Inserts an item into the recipe list.
_perform()  : mixed
_validRule()  : bool
Is this a valid rule?

Properties

$_actions

The list of actions allowed (implemented) for this driver.

protected array<string|int, mixed> $_actions = array('Ingo_Rule_User_Discard', 'Ingo_Rule_User_Keep', 'Ingo_Rule_User_Move', 'Ingo_Rule_User_Redirect', 'Ingo_Rule_User_RedirectKeep', 'Ingo_Rule_User_Reject')

$_categories

The categories of filtering allowed.

protected array<string|int, mixed> $_categories = array('Ingo_Rule_System_Blacklist', 'Ingo_Rule_System_Forward', 'Ingo_Rule_System_Vacation', 'Ingo_Rule_System_Forward')

$_categoryFeatures

Which form fields are supported in each category by this driver?

protected array<string|int, mixed> $_categoryFeatures = array()

This is an associative array with the keys taken from $_categories, each value is a list of strings with the supported feature names. An absent key is interpreted as "all features supported".

$_features

A list of driver features.

protected array<string|int, mixed> $_features = array( /* Can tests be case sensitive? */ 'case_sensitive' => \true, /* Does the driver support setting IMAP flags? */ 'imap_flags' => \false, /* Can this driver perform on demand filtering? */ 'on_demand' => \false, /* Does the driver require a script file to be generated? */ 'script_file' => \true, /* Does the driver support the stop-script option? */ 'stop_script' => \false, /* Does the driver support vacation start and end on time level? */ 'vacation_time' => \true, )

$_generated

Have the recipes been generated yet?

protected bool $_generated = \false

$_params

The script class' additional parameters.

protected array<string|int, mixed> $_params = array()

$_recipes

The recipes that make up the code.

protected array<string|int, mixed> $_recipes = array()

$_special_types

A list of any special types that this driver supports.

protected array<string|int, mixed> $_special_types = array('Destination')

$_tests

The list of tests allowed (implemented) for this driver.

protected array<string|int, mixed> $_tests = array('contains', 'not contain', 'begins with', 'not begins with', 'ends with', 'not ends with', 'regex')

$_types

The types of tests allowed (implemented) for this driver.

protected array<string|int, mixed> $_types = array(\Ingo_Rule_User::TEST_HEADER, \Ingo_Rule_User::TEST_BODY)

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

A hash containing parameters needed.

Return values
mixed

activate()

Connects to the backend, uploads the scripts and sets them active.

public activate([bool $activate = true ][, bool $auto_update = true ]) : mixed
Parameters
$activate : bool = true

Activate the script?

$auto_update : bool = true

Only update if auto_update is active?

Tags
throws
Ingo_Exception
Return values
mixed

availableActions()

Returns the available actions for this driver.

public availableActions() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of available actions.

availableCategories()

Returns the available categories for this driver.

public availableCategories() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of categories.

availableCategoryFeatures()

Returns the supported form fields for this driver.

public availableCategoryFeatures(mixed $category) : array<string|int, mixed>
Parameters
$category : mixed
Return values
array<string|int, mixed>

An array with the supported field names of the requested category.

availableTests()

Returns the available tests for this driver.

public availableTests() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of tests actions.

availableTypes()

Returns the available test types for this driver.

public availableTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of test types.

canPerform()

Is the perform() function available right now?

public canPerform() : bool

This is not a duplication of hasFeature() because drivers might override this to do real-time checks if on-demand filtering is not only available theoretically but practically in this very moment.

Return values
bool

True if perform() is available, false if not.

excludeRegexp()

Returns a regular expression that should catch mails coming from most daemons, mailing list, newsletters, and other bulk.

public excludeRegexp() : string

This is the expression used for procmail's FROM_DAEMON, including all mailinglist headers.

Return values
string

A regular expression.

generate()

Generates the scripts to do the filtering specified in the rules.

public generate() : array<string|int, mixed>
Return values
array<string|int, mixed>

The scripts.

hasFeature()

Returns whether the script driver supports a certain feature.

public hasFeature(string $feature) : bool
Parameters
$feature : string

A feature name.

Tags
see

$_features

Return values
bool

True if this feature is supported.

perform()

Performs the filtering specified in the rules.

public perform([int $change = null ]) : mixed
Parameters
$change : int = null

The timestamp of the latest rule change during the current session (uses session value if null).

Return values
mixed

setParams()

Updates the parameters.

public setParams([array<string|int, mixed> $params = array() ]) : Ingo_Script
Parameters
$params : array<string|int, mixed> = array()

A hash containing parameters.

Return values
Ingo_Script

This object, for chaining.

specialTypes()

Returns any test types that are special for this driver.

public specialTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of special types

_addItem()

Adds an item to the recipe list.

protected _addItem(int $rule, Ingo_Script_Item $item[, string $name = null ]) : mixed
Parameters
$rule : int

One of the Ingo::RULE_* constants.

$item : Ingo_Script_Item

An item to add to the recipe list.

$name : string = null

A script name.

Return values
mixed

_generate()

Generates the procmail scripts to do the filtering specified in the rules.

protected _generate() : mixed
Return values
mixed

_generateBlacklist()

Generates the procmail script to handle the blacklist specified in the rules.

protected _generateBlacklist(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_generateForward()

Generates the procmail script to handle mail forwards.

protected _generateForward(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_generateVacation()

Generates the procmail script to handle vacation.

protected _generateVacation(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_generateWhitelist()

Generates the procmail script to handle the whitelist specified in the rules.

protected _generateWhitelist(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_insertItem()

Inserts an item into the recipe list.

protected _insertItem(int $rule, Ingo_Script_Item $item[, string $name = null ], mixed $position) : mixed
Parameters
$rule : int

One of the Ingo::RULE_* constants.

$item : Ingo_Script_Item

An item to add to the recipe list.

$name : string = null

A script name.

$position : mixed
Tags
þaram

integer $position Where to add the item.

Return values
mixed

_perform()

protected _perform(mixed $change) : mixed
Parameters
$change : mixed
Tags
see
perform()
Return values
mixed

_validRule()

Is this a valid rule?

protected _validRule(Ingo_Rule $rule) : bool
Parameters
$rule : Ingo_Rule

The rule object.

Return values
bool

Whether the rule is valid for this driver.

Search results