[Devlog #001] The Ave Mail Client

Abner Coimbre
4 years ago
Dear Reader,

I'm happy to talk about Ave with you.

Since I announced a devlog on late April 2016, awesome developers have supported this personal mission but have also slapped me hard for not keeping anyone posted. Months later, and with several metaphoric bruises, I'm raring to discuss Ave—reaching a reasonable balance in my life where I may post monthly. The same goes for the show, I hope. Yesterday's first programming stream gives an overview, and is on my Twitch as a highlighted feature (should you prefer to look at curly hair..)

This devlog expands on that overview, and allows you to skip the stream.

A Mail Client?

There are several reasons why I selected e-mail as my handmade project.

  • Sean Barrett is an inspiration to me, and I’ve looked up to him for as long as my brain may remember. I strive to be a C programmer of his caliber. As a thankful developer, I’d like Ave to replace his e-mail client. The terminal version would not meet his needs, but Ave in GUI mode likely will.

  • For the past two years I’ve focused on protocols and how to meet them with specific implementations, but they’ve been internal to the NASA agency. These are implementations done in large teams of very capable people. I always wanted to see what it would be like to implement an open protocol instead, on my own, such as IMAP. I’m also fascinated by protocols in general, and most people don’t realize the incredible extent in which they are essential in computer science.

  • E-mail is an old, presumably reliable technology from the 60’s and 70’s and an integral part of our digital culture. Which is all the more terrifying as to why today’s mail clients suffer from being integrated into environments that slow this tech down, such as Gmail, for a variety of complicated software-is-fat-and-bloated reasons (which we could go into in future posts? Might be counterproductive). To my knowledge, there is no modern, slim, fast, out-of-your-way mail client that is solely focused on sending and receiving e-mail in a pleasant self-contained environment. We should have no excuse of why we can't make that happen. The closest case is Thunderbird. It is close to what I envision at the surface level, but let’s go ahead and tackle precisely what I want.

  • What I Want

    1. Slim Technology Stack – Ave is being developed as a bunch of ANSI C files on Linux. I’m implementing the protocols myself (so far only IMAP) in a style similar to libcurl but just for mail protocols, making it the core technology of Ave (libave). For terminal mode I use ncurses, which is available on every Linux distribution. For gui mode, I’m using Vurtun’s nuklear, which is highly customizable and ANSI C compatible; it allows me to choose my own rendering backend (e.g. Xlib).

    Ideally, you should be able to compile the whole of Ave with any C89 compiler and without the need to install extra libraries, and that portability is what I meant by self-contained environment.

    2.Minimalism – Both terminal and gui Ave should look good and modern, but their design should only reflect the functions at hand – reading and writing mail. The less you have to look at, the more you know it’s dead simple to navigate and get your job done. I’m also focusing on the functionality needed to meet the common operations required by a typical user. Anything extra would have to be strongly justified for its inclusion, and it cannot compromise ease-of-use.

    3. Speed – So far, accessing my mail has been incredibly fast, orders of magnitude faster than any web client I’ve ever used. I do not know what happens behind the scenes when you’re logging into your e-mail anywhere else, but I can now assuredly tell you it’s not just a simple IMAP request. I’m unaware of the final speed of Ave until it’s fully developed, I’ll grant you that, but staying fast is a central metric.

    How Has It Been So Far?

    The biggest lesson is that not everyone is RFC-compliant. It was a shock seeing some companies accept ill-formed e-mail addresses, developers showing their best-but-still-inaccurate regular expressions for compliance, and security agents from company’s mail servers trumping simple IMAP requests that should have yielded a proper response, but didn’t. Look, I always knew commercial software packages don’t fully adhere to a spec—not even language compilers achieve 100% accuracy—but seeing violations led to unfortunate wrinkles and hard-coding in specific recovery points when I try to talk to some servers.

    In fact, it was so difficult trying to define a proper e-mail address, that after a week of research, the best solution ended up being:

     * It seems no e-mail company completely adheres to the spec,
     * so I just check if an address is of the form:
     * [ch]@[ch]
     * Where there is at least one char before and after the at-symbol.
    static bool valid_email(char *addr)
        int sz;
        int at_cnt;
        if (!addr)
            return FALSE;
        sz = strlen(addr);
        at_cnt = 0;
        if (sz < 3 || *addr++ == '@')
            return FALSE;
            if (*addr++ == '@')
        } while (*addr);
        if (!at_cnt || at_cnt > 1 || *--addr == '@')
            return FALSE;
        return TRUE;

    [Note: I'm following the ncurses boolean system, where the data type is bool and the states are TRUE or FALSE.]

    When Do I Get To Use Ave?

    I have failed at giving proper deadlines time and again. I announced Ave here on April 2016, and 5 months later, I have a working prototype on terminal that is being redesigned to include the bird Ave in some unobtrusive animations (e.g. if you’re writing an e-mail, expect a small birdy flying on the bottom left to notify you have a new e-mail), and to provide a proper barrier between ncurses and application logic. I also have a very-unfinished GUI mode being worked on. It might be another 5 months before I reach a working prototype for that, and probably another two months of polish before I consider the possibility of releasing some build publicly. Thus, it’ll be a year or so into development before I think of opening it up, although having early testers may or may not be a good idea?

    What About Updates???

    I'd like to stream programming or make a devlog each month (or both), at least explaining why I can’t post an update at a given time. This month was just an overview of what I care for Ave, and your feedback means the world to me.

    Next Time

    Next time I'll attempt discussing Ave's attempts at achieving minimalism and how they're evolving, starting with the input system / navigation. If anything is more interesting that I should report though, I'll talk about that instead!
    4 years ago
    Thanks, you fabulous-haired chocolate man :)

    - Connor
    Ginger Bill
    4 years ago
    FINALLY! A dev log!
    Mārtiņš Možeiko
    4 years ago
    Your e-mail validation will reject valid e-mail addresses from RFC2822 spec. For example, it will flag "[email protected]" address as invalid. But according to RFC822 it is a valid e-mail address.
    Abner Coimbre
    4 years ago
    Your e-mail validation will reject valid e-mail addresses from RFC2822 spec.

    I should clarify my valid_email function is only used to warn the user that their address may be wrong. It's about checking for the known set of likely user mistakes. I don't do proper validation at all. Some mail servers allow non-standard addresses to bother myself with it.
    Log in to comment