Re: Libmailcheck- take two




Hello,

On Sun, 28 Feb 1999, Russell Steinthal wrote:

> The mailbox registration interface would be used by the control 
> center to add or delete specific mailboxes from sets.  To answer 
> several people's questions, yes, I would envision including 
> POP3/IMAP/other mailbox formats in the library, and they would each 
> have their own registration function, which could potentially accept 
> whatever parameters they needed (hostname, username, password, etc).  
> (The suggestion to use fetchmail is intriguing, since it would remove 
> a good deal of code from the library which is already written better 
> than I could hope to.  But do we want to rely on it from inside of 
> gnome-libs?  I don't know enough about the architecture of the rest 
> of the GNOME libraries to know if that's a problem...)
> 
> gboolean gnome_mailcheck_register_mbox(gchar* fname, MailboxSet set);
> gboolean gnome_mailcheck_register_mhfolder(gchar* pathname, 
> MailboxSet set);
> gboolean gnome_mailcheck_register_pop3(gchar* host, gchar* user, 
> gchar* pass);
> 
> We can include as many other mailbox types as people can come up 
> with, just imagine similar functions.  There would also be 
> corresponding unregister_* functions to remove them from sets, of 
> course (omitted to save space in what is already a long message).

I think this could be much improved by having a base mailbox object (as
Maciej suggested earlier).  Then you might have an interface a bit like: 

MailBox *gnome_mailcheck_mbox_new (gchar *fname);
MailBox *gnome_mailcheck_pop3_new (gchar *server, ...);
MailBox *gnome_mailcheck_imap4_new (...blah...);
MailBox *gnome_mailcheck_set_new (...);
void     gnome_mailboxset_add (MailBoxSet *set, MailBox *mb);
void     gnome_mailbox_poll_time (MailBox *mb, int time);
int      gnome_mailbox_number_messages (MailBox *mb);
.. plus others...

MailBox is a GtkObject derivative from which POP3MailBox and DropMailBox
etc inherit and override the open(), poll(), close(), show_config_dialog()
etc methods.  From now nobody needs to know what sort of MailBox this
mailbox actually is (unless they want to)...

You may notice that I think MailBoxSet should actually inherit from
MailBox as well... you can consider it just to be a specialization of
MailBox that just happens to contain other mailboxes. 

>From the client side, the client would get a MailBox by corba methods, and
then just attach a signal to it like you normally would (signal's for
various events are defined by MailBox)... I think naming the MailBox's
would be the easiest way to allow clients to grab the MailBox they want. 
Remember that the MailBox they get might really be a MailBoxSet, but they
don't need to know this if they don't want to. 

Anyway, whatever the final API, I have a small bit of code that could form
the basis of an IMAP4MailBox object, if you need it....

Thanks,
Ian




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