sieveSIEVE 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)
sieve
sieve
($host $host, $port $port, $user $user, $pass $pass, [$auth $auth = ""], [$auth_types $auth_types = 'PLAIN'])
mixed
$auth_in_use
(line 88)
type of authentication attempted
mixed
$auth_types
(line 84)
a comma seperated list of allowed auth types, in order of preference
mixed
$capabilities
(line 99)
mixed
$error
(line 100)
mixed
$error_raw
(line 101)
mixed
$fh
(line 94)
mixed
$fp
(line 91)
mixed
$host
(line 77)
mixed
$len
(line 95)
mixed
$line
(line 90)
mixed
$loggedin
(line 98)
mixed
$pass
(line 80)
mixed
$port
(line 78)
mixed
$responses
(line 102)
mixed
$retval
(line 92)
mixed
$script
(line 96)
mixed
$tmpfile
(line 93)
mixed
$user
(line 79)
Constructor sieve (line 251)
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.
authenticate (line 627)
Perform SASL authentication to SIEVE server.
Attempts to authenticate to SIEVE, using some SASL authentication method such as PLAIN or DIGEST-MD5.
get_response (line 110)
get response
parse_for_quotes (line 279)
Tokenize a line of input by quote marks and return them as an array
sieve_alive (line 607)
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.
sieve_deletescript (line 567)
Attempt to delete the script requested.
If the script is currently active, the server will not have any active script after the deletion.
sieve_getscript (line 549)
Return the contents of the requested script.
If you want to display the script, you will need to change all CrLf to '.'.
sieve_get_capability (line 758)
Return an array of available capabilities.
sieve_havespace (line 518)
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.
sieve_listscripts (line 586)
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.
sieve_login (line 361)
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
sieve_logout (line 468)
Log out of the sieve server.
sieve_sendscript (line 489)
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.
sieve_setactivescript (line 531)
Set the script active on the sieve server.
status (line 313)
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