You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

grendel overview
by Jamie Zawinski

    You may recall that in 1997, Netscape embarked on a project to rewrite Navigator/Communicator in Java. This project (code named ``Xena,'' but sometimes referred to by the press as ``Javagator'') was cancelled before completion.

    Some of us have been lobbying to give away the source to the whole project; this may yet happen, but navigating the legal issues involved has proven to be slow going.

    In the mean time, we have gotten permission to release the source to Grendel, the mail/news client component of the Xena project.

where it was.

    Grendel was pretty close to being a beta-level mail reader at the time the project was cancelled; we were disappointed that we didn't have the opportunity to finish it, but these things happen.

    Just before the end, we had:

    • A GUI with a three-pane view (of folders, message threads, and message bodies.)

    • A basic set of mail reading commands.

    • The ability to parse and display local (Berkeley mbox) mail folders.

    • The ability to fetch mail from POP3 servers.

    • The ability to display remote IMAP folders (if memory serves, this was too slow to use, but it didn't need too much more work.)

    • The ability to compose and deliver plain-text messages.

    • A full-featured extensible MIME parser and display module, capable of converting MIME messages to HTML for display.

    The most notable feature missing was the ability to display message bodies. That's because Grendel, like its predecessor Communicator, displayed messages by converting them to HTML for presentation, and then handing that off to an HTML displayer. Well, the Xena HTML displayer was farther from completion than Grendel was (in particular, it didn't work on Unix), so Grendel was only able to display messages in their raw state. However, conversion of message to HTML worked: it was just that there was no way to display the HTML.

where it is.

    The currently released Grendel source is not in as usable a state as what was described above. There are a few reasons for this:

    • Getting Grendel to build in the absence of the rest of the packages in the Xena project was a little tricky. I removed the dependencies from most of the back-end libraries, but extricating the GUI code proved harder, so most of the GUI stuff doesn't build right now.

    • Parts of Grendel were built on top of Sun's JavaMail API. However, when we were developing Grendel, JavaMail hadn't been released to the public yet; we had a pre-release version. Well, JavaMail 1.0 and 1.1 have since been released, and they are slightly incompatible with the pre-release we were working with. That pre-release is no longer available on Sun's web site. So I went through and tried to port the code to work with the released versions of the JavaMail API. I haven't tested it extensively, so chances are there are still problems. (I'd be especially suspicious of the code having to do with Flags.)

    • Since I didn't get the GUI stuff working, I don't know what other dependencies remain hidden beyond that. Without the GUI, most features are not terribly accessible, so they would have been hard to test.

    That said, there is a lot of good stuff in there, waiting for someone to pick it up and put it back together, especially the mailbox and MIME parsers, and the message-threading algorithm.

    Since this was my third rewrite of the MIME parser, it's structured a lot better than the existing Mozilla MIME library. It might even be worthwhile for someone to try and port Grendel's MIME parser from Java to C, so that it could be used in Mozilla.

other documentation.

downloading and building grendel.

    Currently the Grendel sources are only available via CVS. You can check out the source by doing

        cvs checkout mozilla/grendel

    Please see our CVS page for information on using our CVS server.

    We are only distributing .java files, not .class or .jar files, so you'll need a working Java compiler. There are gmake-style Makefiles included, but note that the dependencies are all wrong (since we don't know of a version of makedepend that understands Java.) Grendel requires JDK 1.1 or newer.

    You will also need to download these 3rd-party Java packages, and add them to your $CLASSPATH to compile or run Grendel:

    You will also probably need to add both the mozilla/ and mozilla/grendel/ directories to your $CLASSPATH.

    Now type gmake -k and watch all the errors scroll by. Remember when I said that the GUI stuff didn't build? Well, I haven't (yet) hacked the Makefiles to avoid trying to build the stuff that is unbuildable, so we need to suffer through it.

    The interesting stuff that does build is in the storage, view, and mime directories.

running grendel.

    If the GUI stuff was in a working state, you would launch it by doing:

      java grendel.Main

    but it's not, so you can't.

    I hacked together a rough demo that lets you point Grendel at a local mail folder, list the threaded contents, and select and extract a raw message from it. This demo isn't much to look at, but it does pass through several interesting pieces of code: the folder parser, the parsing and maintenance of the summary files, the message threading algorithm, and the folder-message-extractor. You can run this demo like so:

      java grendel.TestFolderViewer /full/path/of/mbox/file

    To demo the MIME parser, do this:

      java grendel.mime.TestMime input-file

    The input-file should contain a single message; an HTML presentation of that message will be written to stdout.

what now?

    Nobody is currently working on Grendel. Would you like to? There are several tasks one could take on:

    • Port the grendel.mime class from Java to C, so that it can be used in Mozilla. (It can't be used in Mozilla as-is, since Mozilla doesn't currently include a JVM.)

    • Get the GUI part of Grendel working again, or write a new one, resulting in a working Java mail reader.

    • Figure out how to get Grendel to display HTML (perhaps by borrowing from one of the other Java web browsers, or perhaps by writing an IMimeOperator that converts from MIME to text/plain instead of to text/html.

    • Build other Java-based mailbox-oriented tools on top of this, such as Intertwingle.

    There's a lot of good code in here; surely you can find something to do with it!

other relevant documents.