Pegasus Mail Logo

Pegasus Mail and Mercury Developer News
For archived developer news articles, click here.

June 2018 - Building Blocks

The release of WinPMail v4.73 gives me an opportunity to describe a little of the process that goes into developing a program like this - in particular, I'd like to provide a little insight into the new help system in v4.73, which is the first Pegasus Mail Version 5 feature to make it to release.

The new help system became a necessity when Microsoft retired the old WinHelp help format a few years ago, because they simply didn't replace it with anything suitable for developers like me who had an investment in it. The HTMLHelp program they provided was adequate for many developers, but suffered from a crucial flaw: because it depended on Internet Explorer for its HTML rendering, it could not load help files on shared volumes (IE won't do this, supposedly for security reasons). There's absolutely nothing worse than being stressed by a problem with a program, pulling up its help system, and seeing "Navigation Cancelled" instead of a help page, yet this is what happened if you tried to open an HTMLHelp help file that was installed on a server or NAS shared volume. There were mitigations for the problem, but they were poorly documented and technically demanding for anyone who wasn't a trained sysadmin.

So, after looking around to see what else was available and finding almost nothing, I began rolling my own using components I already had for Pegasus Mail. It was a long job - I estimate that developing the help compiler, the help display module, and the user interface for the help system took me about 400 hours over a period of years, and I know for a fact (having done it recently) that converting the old RTF source I used for the Pegasus Mail WinHelp help file to HTML for use in the new system took me 150 hours (yes, I was counting — it was a HORRIBLE job).

"But it's just a help system!" I can hear you saying; "it's just a little text and a window to display it in!". Well, the WinPMail help pages consist of more than 250 separate help files, all cross-indexed and linked, each formatted as consistently as possible: that's roughly 20,000 lines, or (for those of you who can recall my last developer update) about a third of a War-And-Peace, and that's just the basic text, without considering the markup, indexing and table of contents generation. The source code for the help compiler and the display module make up about another 15,000 lines of code - that's just the reality of working with a format as rich and complicated as HTML.

All of this just to replace something that Microsoft decided to remove because they couldn't be bothered keeping it up to date... That said, though, the result is pretty good, and I now have a help system that doesn't depend on anything outside my control, and that I can use in both Pegasus Mail and Mercury — I have only one piece of code to maintain, completely self-contained, unaffected by any changes to the programs that host it. And it is this that is really the goal of this update - to describe a process I am now applying to all my new development: code that stands on its own, can be used in either system, is available to extension developers, and requires minimal support in the long term.

This approach to developing things as building blocks gives flow-on benefits that can be guite interesting — so, as an example, the module I'm just finishing now that implements full S/MIME capability will allow Pegasus Mail to send and receive a full range of modern encrypted data, but will also allow Mercury to send out its list mail with digital signatures as proof of origin; in a similar fashion, the new Pegasus Mail Contact Manager (the replacement for the aging addressbook system) could easily serve as the basis for a Mercury vCard server — and there are countless other similar examples where having the one self-contained module will allow both programs to benefit: I'm expecting that there will even be crossovers I haven't anticipated yet.

Interesting times indeed.

All my very best to you all,

-- David --

[ Page modified 7 June 2018 | Content David Harris