[Imapfilter-devel] Design Theory
Lefteris Chatzibarbas
lefcha at users.sourceforge.net
Sat Dec 15 21:54:24 EET 2001
On Wed, Dec 12, 2001 at 07:22:51PM -0500, Matt Cowger wrote:
> I have found when working on projects like this, befoer I statrt
> contributing code, it is useful to have in my head what the original
> coder was thinking. So, is there any chance Lefteris could write just a
> quick "Theory of Operation" so I could understand generally what
> imapfilter tries to do? Something like this would be invaluable - I
> know it helped me when I statrted working on the Netsaint project.
>
> Just somethig like "Think about it this way - we have this
> datastructure, and we go through it like this...."
When reading the imapfilterrc(5) manual page you can get a basic idea of the
program's data structure's. Basically, the main structures of IMAPFilter are:
account_t, mbox_t, mboxgrp_t, filter_t and mask_t. The contents of all these
can be examined, in detail, in the data.h header file.
What needs to be described is the way these data structures are linked
between them and how they are used in the end.
There are multiple accounts (account_t), with each of them containing a
number of mailboxes (mbox_t). There are, also, mailbox groups (mboxgrp_t)
that are created with the "folder" command and hold pointers to mailboxes
that are part of the group. On the other hand, you've got filters (filter_t)
that have a series of masks (mask_t), the searching criteria user specifies.
The "job" command is used to link which filters should be applied to which
group of mailboxes. In other words the program goes through the mailboxes
that belong to a mailbox group and creates pointers from the mailbox to
the filter. In the end you get accounts with mailboxes belonging to them,
filters with masks that are part of them, and pointers between mailboxes and
filters.
Finally, after IMAPFilter reads the configuration file and creates all
necessary data structures, it starts by going through the list of accounts.
It connects to the server specified, and then goes through the list of
mailboxes belonging to the server. For each mailbox it applies the filters
that were specified for it. This goes on, until the last account, mailbox
and filter.
Hope all that makes sense.
_______________________________________________
Imapfilter-devel mailing list
Imapfilter-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imapfilter-devel
More information about the Imapfilter-devel
mailing list