Commit graph

9 commits

Author SHA1 Message Date
Carl Worth
cd4a8734d3 Rename private notmuch_message_t to notmuch_message_file_t
This is in preparation for a new, public notmuch_message_t.

Eventually, the public notmuch_message_t is going to grow enough
features to need to be file-backed and will likely need everything
that's now in message-file.c. So we may fold these back into one
object/implementation in the future.
2009-10-20 15:09:51 -07:00
Carl Worth
7f254fb603 message: Use g_hash_table_destroy instead of g_hash_table_unref
I'm trying to chase down 3 still-reachable pointers to glib hash
tables.

This change didn't help with that, but I think destroy might be a
better semantic match for what I actually want. (It shouldn't matter
though since I never take any additional references.)
2009-10-20 13:07:19 -07:00
Carl Worth
25aef82877 message.c: Free leaked memory in notmuch_message object
We were careful to free this memory when we finished parsing the
headers, but we missed it for the case of closing the message
without ever parsing all of the headers.
2009-10-20 12:48:14 -07:00
Carl Worth
ed6ee7330d notmuch_message_get_header: Fix bogus return of NULL header.
A simple bug meant that the correct value was being inserted into
the hash table, but a NULL value would be returned in some cases.
(If the value was already in the hash table at the beginning of
the call the the correct value would be returned, but if the
function had to parse to reach it then it would return NULL.)

This was tripping up the recently-added code to ignore messages
with NULL From:, Subject:, and To: headers, (which is fortunate
since otherwise the broken parsing might have stayed hidden for
longer).
2009-10-20 09:52:01 -07:00
Carl Worth
ad784f38ce notmuch: Ignore files that don't look like email messages.
This is helpful for things like indexes that other mail programs
may have left around. It also means we can make the initial
instructions much easier, (the user need not worry about moving
away auxiliary files from some other email program).
2009-10-19 23:16:05 -07:00
Carl Worth
371091139a Rework message parsing to use getline rather than mmap.
The line-based parsing can be a bit awkward when wanting to peek
ahead, (say, for folded header values), but it's so convenient
to be able to trust that a string terminator exists on every
line so it cleans up the code considerably.
2009-10-19 16:38:44 -07:00
Carl Worth
45f0d7bcab Don't hash headers we won't end up using.
Just saving a little work here.
2009-10-19 13:48:13 -07:00
Carl Worth
c5eea2b77e Document which pieces of glib we're still using.
Looks like we can copy in a hash-table implementation, (from cairo,
say), and then a few _ascii_ functions from glib, (we'll need to
switch a few current uses if things like isspace, etc. to locale-
independent versions as well). So not too hard to free ourselves
of glib for now, (until we add GMime back in later, of course).
2009-10-19 13:40:56 -07:00
Carl Worth
0e777a8f80 notmuch: Switch from gmime to custom, ad-hoc parsing of headers.
Since we're currently just trying to stitch together In-Reply-To
and References headers we don't need that much sophistication.
It's when we later add full-text searching that GMime will be
useful.

So for now, even though my own code here is surely very buggy
compared to GMime it's also a lot faster. And speed is what
we're after for the initial index creation.
2009-10-19 13:00:43 -07:00