bug-mailutils
[Top][All Lists]
Advanced

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

Breaking mailutils to pieces


From: Alain Magloire
Subject: Breaking mailutils to pieces
Date: Mon, 14 May 2001 19:25:56 -0400 (EDT)

Bonjour

Intro:
  What's good about Free software is that you can break API without
having to worry about backward compatibility .. too much.
So time to break things 8-).

Goals:
  Having more consistency  in the mailbox library.

Rationale:
  After exchanging emails with Sam/Sergey/dxxxxxs and others and experimenting
myself with the lib, I acquired enough feedback to see the weakness
of the mailbox API.  Somethings must go:

1-
The owner will be nuke.  No unsafe "void *" pointers and typecasting
the owner of an object will be cast in stone. So
  header_t   -- own --> message_t
  body_t     -- own --> message_t
  envelope_t -- own --> message_t
  message_t  -- own --> mailbox_t
  mailbox_t  -- own --> folder_t
The hierarchy:
- Folder
        - mailbox
                - message
                        - envelope
                        - header
                        - body
        - auth
                - ticket (???)

The only problem is stream_t which is coming from pretty 
everybody, meaning a stream_t is "pure/virtual" interface that all the
objects can implement.  In java it will be something like

public class mailbox implements stream {..}
public class message implements stream {..}
... etc ..

There is no way to do this whithout involving some ugly
void * and casting.  But at least they will be cover
by stubs funcs for typecast safeness.

stream_get_mailbox ()
stream_get_message ()
....

2-
The mailbox will have a "stream carrier" and a stream.
This is important to distinguish the stream transport(the fd
return by connect()) from the stream of the mailbox i.e if I
do this on a POP mailbox:

mailbox_get_stream (mbox, &stream);
while (stream_readline (stream, ....)) { .. }

The stream implementation should map my calls
to RETR 1, RETR 2, RETR 3, etc depending where
my offsets is.  But someone may want a "bare/raw"
fd/stream to contact the server:

mailbox_get_carrier (mbox, &stream);
stream_write ("XTND XMIT\r\n"); /* Qpopper uses a POP3 extension call xmit to
                                   deliver mail.  */

3-
Some renaming, (not sure this is necessary) for consistency
header_lines() -- rename to --> header_get_lines ()
header_size() -- rename to --> header_get_size ()

body_lines() -- rename to --> body_get_lines ()
body_size() -- rename to --> body_get_size ()

mailbox_size -- rename to --> mailbox_get_size ()
etc ..

4-
???

Ok, I think this is it,  but if you guys have some suggestions
or things that I did not take into account, let me know.

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]