1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-25 07:28:02 +02:00
Commit Graph

27 Commits

Author SHA1 Message Date
djcb
2aa299b3ac mu: add mu_msg_iter_is_(first|last)
This makes it a bit easier to process the output.
2018-11-11 12:11:06 +02:00
djcb
93c6ff1f85 mu: protect against overly long keys
We got some errors when some of the key values exceeded the Xapian
maximum; in particular the message-id.

So make all the key-methods check, and truncate the message-id if
necessary.
2018-08-14 21:57:33 +03:00
attila
a0640a0532 Fix call to c_str() that sometimes dumps core on OpenBSD i386-current
The core dump only seems to occur if mu4e-headers-include-related is
set to t.

Apparently, std::string's c_str() method is confusing to many
people, c.f.
  http://stackoverflow.com/questions/22330250/how-to-return-a-stdstring-c-str

The answer seems to be that the pointer c_str() returns may not be
valid past the current statement; returning it, or even using it
subsequently can have you sending a wild pointer into e.g. g_strdup().

In short, it seems idioms like this are okay:

    return g_strcmp0 (s1.c_str(), s2.c_str()) < 0;

Whereas idioms like this are not:

    const char *msgid (iter->msgid().c_str());

    return msgid ? g_strdup (msgid) : NULL;

At least in my environment by the time we get to g_strdup() the
pointer returned by c_str() is wild and points at garbage.  Since
g_strdup() returns NULL if passed NULL, it seems collapsing it into a
single line is not only possible but necessary.

I've looked at all of the calls to c_str() in mu and it appears to
me this was the one remaining one that was bad.
2015-07-02 15:14:29 -05:00
djcb
baebd53fb8 Fix a core dump under OpenBSD
Based on a patch by StAlphonsos
2015-03-06 00:12:34 +02:00
djcb
057fa6430e * mu: fix duplicate detection 2013-04-30 21:53:16 +03:00
djcb
3dc98724b3 * mu: provide fake-msgids for messages without; this fixes the problem where e.g. draft messages
were not visible when using --include-related
2013-04-09 21:20:25 +03:00
djcb
855e81db99 * update copyright years 2013-03-30 11:32:07 +02:00
djcb
342195a248 * mu: fix pre-condition warning when getting related messages without threads 2013-03-16 18:25:19 +02:00
djcb
70356a62f5 * mu-query/mu-msg-iter: when showing related message (--include-related),
favor the ones that were in the original set
2012-12-28 14:48:00 +02:00
djcb
3d875307e2 * mu-msg-iter: temporarily disable skipping duplicates when threading
(we need thread-info for all duplicates too, since we do not know which one
  will end up in the final result set)
2012-12-27 15:59:15 +02:00
djcb
05b04bdaed * mu-msg-iter.cc: don't skip dups on when threading
(due to sorting, we do not know if the same message are 'dup' or 'original'
  in the final results, so we need to calculate threading info for both)
2012-12-27 12:07:43 +02:00
djcb
99f473945e * mu-msg-iter: re-introduce MU_MSG_ITER_FLAG_THREADS, and special-case queries
with thread support
2012-12-27 11:07:52 +02:00
djcb
27a80dcb67 * handle the no-matches-found case correctly 2012-12-25 20:33:02 +02:00
djcb
f525c54356 * mu-msg-iter.cc: get /all/ matches on the first go, thread those, then return
maxnum

  in situations where the number of matches is significantly greater than
  maxnum, results are much better this way.
2012-12-25 18:49:14 +02:00
djcb
03921e6cf1 * mu-msg-iter: add mu_msg_iter_get_thread_id, make using threads non-optional 2012-12-25 17:32:43 +02:00
djcb
f366c0f680 * mu-msg-iter: add mu_msg_iter_get_msgid and mu_msg_iter_get_refs 2012-12-24 14:59:48 +02:00
djcb
836c932f2a * mu-msg-iter.cc: cleanup the skip-dup checking a bit; in particular, include
the first one
2012-12-24 12:06:09 +02:00
djcb
c36906a254 * mu-msg-iter.cc: if we're using threaded search results, get *all* matches,
calculate threads and then return maxnum matches
2012-12-23 16:42:44 +02:00
djcb
4c47b0b122 * mu-msg-iter.cc: improve dup checking 2012-12-22 21:12:11 +02:00
djcb
76adc694c0 * add basic support for skipping dups, unreadable messages in mu-msg-iter 2012-12-17 22:29:39 +02:00
djcb
8fdd82d549 * mu-msg-iter.{cc,h}: make flag names a bit clearer 2012-12-16 15:08:03 +02:00
djcb
50f5c7affb * mu-msg-iter: add basic implemenation of checking for msgid dups, msg file
existence
2012-12-16 14:17:58 +02:00
djcb
bc90df6c53 * cosmetics / minor 2012-10-23 20:29:24 +03:00
djcb
8ad01e4aa8 * lib: threading: pre-sort the threaded results, add some more comments 2012-10-17 17:59:33 +03:00
djcb
93171a5b90 * lib: try to reopen database when it got updated from the outside (for guile) 2012-08-19 09:57:49 +03:00
djcb
d92ad056e1 * cosmetics 2012-07-23 00:56:01 +03:00
djcb
46f10cfde9 * refactoring: split src/ into mu/ and lib/ 2012-05-21 09:25:53 +03:00