[imp] failure notice (fwd)

Derick Rethans d.rethans@jdimedia.nl
Thu, 24 May 2001 00:32:14 +0200 (CEST)


On Wed, 23 May 2001, Chuck Hagenbuch wrote:

> Quoting jtaskine@hit.fi:
>
> > I think SRM would be the thing to use here.
> > If Anil (or someone else) is interested in writing a IMAP module for it I
> > will gladly help. But if he already has written such beast, nevermind. :)
> >
> > http://www.vl-srm.net/
>
> Can you give an example of what code might look like using this, that would
> also function without SRM? It looks useful, but not like something we can make
> an absolute requirement for IMP.

The best way is to use something like this:
(note that the API is subjected to changes)

function _imap_connect ($host, $user, $passwd)
{
	if (function_exists("srm_connect")) {
		srm_connect ("localhost", 7777);
// Option 1:
		$imap = srm_do_command ("imap_fetch_stream", $host, $user,
$passwd);
// Option 2:
		srm_do_command ("imap_connect", $host, $user, $passwd);
	}
	else
	{
		imap_connect ($host, $user, $passwd);
	}
}

In option 1, SRM merely returns the stored resource, which is not
supported by SRM at this moment, but it will be implemented.

The second option is to reimplement the php_imap extension as a SRM
module. this wont be hard, as modules in SRM are easier to implement than
extensions in PHP (IMO).

I like to have the first option, as this is the cleanest implementation.
However, at this moment this is not possible. (SRM is still in heavy
development).

Regards,

Derick Rethans

---------------------------------------------------------------------
        PHP: Scripting the Web - www.php.net - derick@php.net
             SRM: Site Resource Manager - www.vl-srm.net
---------------------------------------------------------------------