[imp] Fwd: [PHP-DEV] IMAP quota functionality
Jan Schneider
jan@horde.org
Mon, 22 Jul 2002 10:35:30 +0200
This message is in MIME format.
---------------------- multipart/mixed attachment
This might be interesting for anyone having problems with imap quotas.
Please send any feedback directly to Dan.
----- Weitergeleitete Nachricht von dank@deadmime.org -----
Datum: Thu, 18 Jul 2002 21:48:17 -0400 (EDT)
Von: Dan Kalowsky <dank@deadmime.org>
Antwort an: Dan Kalowsky <dank@deadmime.org>
Betreff: [PHP-DEV] IMAP quota functionality
An: PHP Development Mailing list <php-dev@lists.php.net>
Hey there php-dev readers,
Attached is a patch (based off of 4.2.1 release) for the IMAP system that
needs testing. It's been brought to my attention that the quota support
is sort of... well, not standards compliant. So I tried to fix that.
In the process I've also hopefully added in imap_get_quotaroot()
capabilities as well.
This patch NEEDS through testing, but would be nice to see in 4.3.
Unfortunately I have no access to an IMAP server with quota capabilities
turned on, so I can't really test.
imap_get_quota() should work the same, only now you will be returned the
name value as well, or whatever that is in quota name field (i.e. a
message). The qlist array now looks like:
[qlist] => [name]
=> [usage]
=> [limit]
imap_get_quotaroot() should not require the user to be run as a mail-admin
user, making this eventually much more useful. Here is an example using
it:
<?php
$mbx = imap_open( /* blah blah blah */);
$qroot = imap_get_quotaroot($mbx, "INBOX");
// this should retrieve the quota for the logged in users INBOX
if (!$qroot) {
print "We have nothing!";
} else {
foreach ($qroot as $name => $value)
print "$name and $value\n";
}
?>
As usual please test and send any comments back to me.
>---------------------------------------------------------------<
Dan Kalowsky "A little less conversation,
http://www.deadmime.org/~dank
a little more action."
dank@nospam-deadmime.org
- "A Little Less Conversation",
kalowsky@nospam-php.net
Elvis Presley
----- Ende der weitergeleiteten Nachricht -----
Jan.
--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft
---------------------- multipart/mixed attachment
T25seSBpbiBpbWFwOiAuZGVwcw0KT25seSBpbiBpbWFwOiBsaWJzLm1rDQpkaWZmIC11IGltYXA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