SIEVE class - A Class that implements MANAGESIEVE in PHP4|5.
This program provides a handy interface into the Cyrus timsieved server under php4. It is tested with Sieve server included in Cyrus 2.0, but it has been upgraded (not tested) to work with older Sieve server versions.
All functions will return either true or false and will fill in $sieve->error with a defined error code like EC_QUOTA, raw server errors in $sieve->error_raw, and successful responses in $sieve->responses.
NOTE: a major change since version (0.0.5) is the inclusion of a standard method to retrieve server responses. All functions will return either true or false and will fill in $sieve->error with a defined error code like EC_QUOTA, raw server errors in $sieve->error_raw, and successful responses in $sieve->responses.
Usage is pretty simple. The basics is login, do what you need and logout. There are two sample files (which suck) test.php and testsieve.php. test.php allows you to create/delete/view scripts and testsieve.php is a very basic sieve server test.
Please let us know of any bugs, problems or ideas at sieve-php development list: sieve-php-devel@lists.sourceforge.net. A web interface to subscribe to this list is available at: https://lists.sourceforge.net/mailman/listinfo/sieve-php-devel
Located in /sieve-php.lib.php (line 76)
type of authentication attempted
a comma seperated list of allowed auth types, in order of preference
Initialization of the SIEVE class.
It will return false if it fails, true if all is well. This also loads some arrays up with some handy information:
string a string containing all the allowed authentication types allowed in order of preference, seperated by spaces. (ex. "PLAIN DIGEST-MD5 CRAM-MD5" The method the library will try first is PLAIN.) The default for this value is PLAIN.
Note: $user, if included, is the account name (and $pass will be the password) of an administrator account that can act on behalf of the user. If you are using Cyrus, you must make sure that the admin account has rights to admin the user. This is to allow admins to edit/view users scripts without having to know the user's password. Very handy.
Perform SASL authentication to SIEVE server.
Attempts to authenticate to SIEVE, using some SASL authentication method such as PLAIN or DIGEST-MD5.
get response
Tokenize a line of input by quote marks and return them as an array
Check availability of connection to the SIEVE server.
This function returns true or false based on whether the connection to the sieve server is still alive.
Attempt to delete the script requested.
If the script is currently active, the server will not have any active script after the deletion.
Return the contents of the requested script.
If you want to display the script, you will need to change all CrLf to '.'.
Return an array of available capabilities.
Check if there is enough space for a script to be uploaded.
This function returns true or false based on whether the sieve server will allow your script to be sent and your quota has not been exceeded. This function does not currently work due to a believed bug in timsieved. It could be my code too.
It appears the timsieved does not honor the NUMBER type. see lex.c in timsieved src. don't expect this function to work yet. I might have messed something up here, too.
List available scripts on the SIEVE server.
This function returns true or false. $sieve->response will be filled with the names of the scripts found. If a script is active, the $sieve->response["ACTIVE"] will contain the name of the active script.
Attemp to log in to the sieve server.
It will return false if it fails, true if all is well. This also loads some arrays up with some handy information:
capabilities["implementation"] contains the sieve version information
capabilities["auth"] contains the supported authentication modes by the SIEVE server.
capabilities["modules"] contains the built in modules like "reject", "redirect", etc.
capabilities["starttls"] , if is set and equal to true, will show that the server supports the STARTTLS extension.
capabilities["unknown"] contains miscellaneous/extraneous header info sieve may have sent
Log out of the sieve server.
Send the script contained in $script to the server.
It will return any error results it finds (in $sieve->error and $sieve->error_raw), and return true if it is successfully sent. The function does _not_ automatically make the script the active script.
Set the script active on the sieve server.
Parser for status responses.
This should probably be replaced by a smarter parser.
Documentation generated on Thu, 18 Dec 2003 15:18:54 +0200 by phpDocumentor 1.2.3