Re: RFC mailbox interface



On 11.17.2001 03:02 M . Thielker wrote:
> Hi Pawel,
> 
> On 2001.11.17 10:55 Pawel Salek wrote:
>> 
>> On 2001.11.17 06:58 Kenneth Haley wrote:
>>> After following this thread I came up with the following interface.
>>> 
>>> typedef struct _Message {
>>> 	struct _Folder *Folder;
>>> 	Flags flags;
>>> 	//perhaps return a string instead?
>>> 	glist (*getHeaders)(const char[] hdrs);
>>> 	glist (*getAllHeaders)();
>>> 	char* (*getBody)();
>>> 	char* (*getAll)();
>>> };
>> 
>> Are these methods not specific to the mailbox that owns the Message?
>> I imagine that following scheme would be a better solution:
>> glist
>> lib_message_getHeaders(Message* msg)
>> { msg->folder->getHeaders(msg->folder, msg); }
> 
> Yes, right. That was in my original proposal, as a matter of fact, 
> except that I had separated the function pointers from the mailbox 
> struct initially, putting them into a mailboxTYPE struct that was 
> referenced by the mailbox struct. That way, they only need to be set 
> up once, not copied each time.
> There's no point in hving to drag along these pointers with each 
> message.
> 
> Melanie

You're right, it would be  better to move those functions into the 
Folder.  As for using a folder-type* instead of having the functions 
directly in the Folder I don't see that it makes a big difference.

Perhaps open and close should be changed to lock and unlock.  It would 
make more sense at this level.  After all you would not want to open an 
mbox file without locking it so....

I just thought of a problem with vfolders.  Remember that there is only 
one Message struct per source message.  What happens when a user deletes
a) the vfolder message
b) the source message



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]