Hi Mark, many thanks for the reply, you are quite right I don't actually 
understand how to use the apis. php uses the api to perform imap functions 
and this was a sample program they sent me to say the problem was with the 
imap code rather than their use of it when I raised a bug with them to say 
that OP_PROTOTYPE causes a crash and may not be of use. They insisted the 
problem was with c-client and not their code.
Your response has been very helpful indeed and I now should be able to 
convince the php maintainers that they need to do something with their 
code.
It also has provided me with a bit more understanding of the code which is 
very useful, thanks for pointing me in the right direction.

Best regards

Dave Kelsey


m...@hsinghsing.panda.com wrote on 01/07/2009 19:14:05:

> Hi Dave -
> 
> This is not a bug.  Rather, you have misunderstood some important 
points.
> 
> There are three issues with your sample program.
> 
> [1] You SHOULD include c-client.h, and not mail.h directly.  mail.h has 
> most, but not all, of the consumer API definitions and prototypes.
> 
> [2] You MUST (repeat, MUST!!) include linkage.c at the start of your 
> main() function instead of calling mail_link() directly.
> 
> [3] A prototype stream is not something that can be given to 
> mail_close_full().
> 
> Without knowing why you are opening a prototype stream, it appears to me 

> that you do not understand what a prototype stream is and how/why it is 
> used; especially since this is an IMAP prototype stream, something which 

> is almost completely useless except for internal c-client purposes.
> 
> A prototype stream is not a stream.  The closest analog to a prototype 
> stream would be a factory object or class definition.  Internally, a 
> prototype stream is simply a pointer to a static area of constant memory 

> that has the dtb for that driver.
> 
> Prototype streams have VERY limited use to API consumers.  The primary 
> consumer use is that of a local filesystem format prototype stream as an 

> argument to mail_create() to force the created mailbox to be in that 
> format.  However, that use is deprecated in favor of the #driver.???/ 
> prefix; e.g.,
>     mail_create (NIL,"#driver.mix/newbox");
> is the preferred and more modern way of doing
>     mail_create (mail_open 
(NIL,existingmixmailbox,OP_PROTOTYPE),"newbox");
> 
> The prototype stream method is the way to create a new local filesystem 
> mailbox of the same format as an existing local filesystem mailbox, as 
> opposed to a specified format via the #driver.???/ syntax .  This is 
> therefore the 99% reason why any API consumer would use a prototype 
> stream.
> 
> Your use may be in the remaining 1% (it would have to be, given that 
it's 
> an IMAP prototype stream), but I suspect that it's really a case of your 

> not understanding what you are doing.
> 
> Getting back to the subject at hand; since it is a factory object (or 
> class definition), it is inappropriate to call non-factory methods on 
it. 
> For most API consumers, other than mail_create() with a local filesystem 

> driver prototype, the remaining uses are power tools for master 
sorcerers.
> 
> mail_close() and mail_close_full() are completely inappropriate methods 
to 
> use with a prototype stream, even for a master sorcerer.  A prototype 
> stream is not a stream, and is not something that can be closed.  When 
you 
> are finished with a prototype stream, you just drop the pointer.
> 
> -- Mark --
> 
> http://panda.com/mrc
> Democracy is two wolves and a sheep deciding what to eat for lunch.
> Liberty is a well-armed sheep contesting the vote.






Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU





_______________________________________________
Imap-uw mailing list
Imap-uw@u.washington.edu
http://mailman2.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to