Commit Graph

389 Commits

Author SHA1 Message Date
djcb 688507f193 lib: fix a few compiler warnings
WARN_C(XX)FLAGS is really strict.
2017-01-03 00:37:19 +02:00
djcb 72a1da9da8 mu: fix some compiler warnings 2016-12-28 16:32:39 +02:00
Hong Xu 887e75c4ee Child processes should be session leaders.
If not, when the session of mu is killed, these child processes are also
killed. This scenario shows up when using mu4e: a PDF attachment, for
example, is opened by Evince, but as soon as Emacs exits, Evince is also
killed.
2016-12-28 13:51:20 +02:00
djcb 30dab7c312 cfind: uniquify nicks
Ensure uniqueness of nicks by adding a numerical suffix when the root
nicks are not unique (up to 1000).

Fixes issue #987.
2016-12-27 16:21:10 +02:00
djcb 78275278cf mu: fix some compiler warnings 2016-12-11 18:33:31 +02:00
Stig Brautaset e9c6568a57 mu: swap begin and end if begin is _numerically_ bigger than end
The old behaviour would compare the strings, so would swap the start and end
ranges if start was 3K and end was 2M.

Fixes: 964
2016-12-03 23:19:27 +00:00
djcb 902d081c88 mu: mark some more inline parts as attachments
Recognize some more inline parts as attachments.
2016-11-24 22:51:23 +02:00
djcb 1494923472 mu: fix broken clear_links
clear_links as used for the --clear-links option had some broken
filename generation, causing garbage data at the end.

Clean up this old code, and fix this problem as a side-effect.

Fixes issue #951.
2016-11-19 16:30:09 +02:00
djcb 98505aa23b mu: fix mu_util_fputs_encode for non-utf8
mu_util_fputs_encode was aborting on behalf of the stack-guard on
OpenBSD (seemingly only when compile with optimization). It appears as
if the root cause of this was a differences in sizes of the parameters
to g_locale_from_utf8. Fix this.
2016-11-16 20:23:03 +02:00
djcb d30e0ab2ba mu: fix contacts callback return value
The callbacks for the contacts functions should return TRUE (or be
terminated early), but were void. Seems on Linux this usually still
worked, not so on OpenBSD at least (unit test broke). So, fix this.
2016-11-16 20:20:15 +02:00
djcb 01a47effb0 mu: include text-part attachments in body
Include text-like attachments parts in the message-body, too
2016-11-15 23:51:38 +02:00
djcb 10b3352565 mu: include patch/diff files in plain-text body
Some text/... parts can be show inline as part of the body text; for
instance patches. So, treat those specially.
2016-11-12 13:50:32 +02:00
djcb 7526f118ba mu: some cosmetics / minor cleanup 2016-10-26 22:36:40 +03:00
djcb c9f8ac5beb crypto: prefer gpg2
Can't say I fully understand what's going on, but it seems gpg-before-2
has some trouble with its agent, at least when using
gnome-session (which stopped using gnome-keyring as a gpg-agent since
Fedora 23 at least).

Sanity seems to be restored when preferring gpg2 instead. "gpg" is used
when gpg2 isn't there; and there's the MU_GPG_PATH env variable to
override all of that.
2016-07-24 16:00:04 +03:00
djcb 9477071e63 mu: add '--lazy-check' option for indexing
Add an option --lazy-check to ignore any directories that don't have
their ctime changed since the last indexing operation.

There are a few corner-cases (such as editing a message outside mu's
control) where this might miss a change, but apart from that, makes
indexing in for a maildir (and its sub-maildirs) almost a no-op if there
were no changes.
2016-07-23 21:33:10 +03:00
djcb 2a83b02ce2 mu: cosmetic 2016-07-23 19:14:13 +03:00
djcb 3e6267fd05 mu-maildir: ignore backup/temporary files
Ignore backup/temporary files, i.e., files ending in ~ or #.

Fixes #855.
2016-06-05 19:29:53 +03:00
Aaron LI 297df938d6 Use Unicode characters when cleaning up attachment filename
Improve the function ``cleanup_filename()`` of ``lib/mu-msg-part.c`` to
use Unicode characters when replacing the control characters, slashes
and colons with ``-``.

Originally, this function just use plain C characters (i.e., assuming
ASCII string) when checking each character is or not a control character,
slash or colon.  However, when the attachment filename contains non-ASCII
(e.g., Chinese characters), all the non-ASCII characters are replaced
with ``-``.

For example:
* Before:
```
> mu view test_chinese_attachment_filename.eml
From: Tester <tester@example.com>
To: Example <example@example.com>
Subject: Test email with attachment of Chinese filename
Date: Mon 23 May 2016 05:22:09 PM CST
Attachments: 'attachment-test.txt', '------------.txt', '-------test.txt'
Hello,

This is a simple test email with three attachments:

1. `attachment:test.txt`: filename is all English;
2. `测试附件.txt`: filename is all Chinese (exclude the extension);
3. `附件-test.txt`: filename mixes Chinese and English.
```

* After:
```
> ./build/mu/mu/mu view test_chinese_attachment_filename.eml
From: Tester <tester@example.com>
To: Example <example@example.com>
Subject: Test email with attachment of Chinese filename
Date: Mon 23 May 2016 05:22:09 PM CST
Attachments: 'attachment-test.txt', '测试附件.txt', '附件-test.txt'
Hello,

This is a simple test email with three attachments:

1. `attachment:test.txt`: filename is all English;
2. `测试附件.txt`: filename is all Chinese (exclude the extension);
3. `附件-test.txt`: filename mixes Chinese and English.
```
2016-05-23 19:26:04 +08:00
djcb a81270583f Add unit-test for multi-to/cc recipients
To check for the report in Issue #826.
2016-05-15 16:21:20 +03:00
Jun Hao f998a0ad1e mu: expose content id to attachment plist 2016-05-07 09:07:11 +08:00
djcb c46dda206f mu: fix a few mem leaks 2016-05-06 22:08:12 +03:00
djcb 66f205f6c5 mu: improve filename escaping
Sanitize attachment-names by replacing all control characters, '/' and
':'' by '-', but leave spaces alone.
2016-03-15 06:59:35 +02:00
djcb acd00a0b3f mu: add user-agent property to msg plist
Add a user-agent property to the full message sexps (i.e., the ones
available in mu4e-view). This property contains either the User-Agent or
X-Mailer string (and is absent otherwise)
2016-03-14 22:53:42 +02:00
djcb 68f5dc3973 mu: Change default max msg size to 500 Mb
Seems people are getting really big mails these days, so let's up the
default (which is also what mu4e uses) to 500 Mb (which should be enough
for everyone, always)
2016-03-13 19:07:49 +02:00
djcb 775eb3f715 mu: write contacts-cache a bit sooner
Write the changes to the cache file after any indexing operation, so `mu
cfind` gets new contacts a bit sooner.
2016-02-21 19:48:21 +02:00
djcb 02e26c9cb4 mu: attachment names are already quoted
Fixes #796.
2016-02-15 20:14:24 +02:00
djcb 8d4b866383 Fix some compiler warnings 2016-02-14 12:13:11 +02:00
Nicolas Richard f9d174af57 mu: escape the name of the part 2016-02-10 15:03:31 +01:00
djcb 413d0e1f49 fix make-dist
Silence a few tests that pass, but not with make-dist. Obviously, this
needs some more investigation.
2016-01-20 20:18:07 +02:00
djcb 02620af4c2 mu/mu4e: improve in contacts completion
mu: cleanup server side; make sure not to loose 'personal' flag when
    seeing same contact in non-personal context
mu4e: tweak the sorting algorithm a bit to take the personal flag into
    account
2015-12-30 15:33:27 +02:00
djcb b21eabf954 mu: overwrite duplicate target files
over write target files when moving (when they seem to be the
same). Should make the case where you have copies a bit smoother.
2015-12-24 16:06:51 +02:00
Ævar Arnfjörð Bjarmason f7245d2372 mu-store: Silence confusing code that's throwing a clang warning
Doing:

    !access(...) == 0

Is equivalent to:

    (!access(...)) == 0

Not:

    !(access(...) == 0)

And throws this warning under clang:

    mu-store.cc:77:6: warning: logical not is only applied to the left hand
    side of this comparison [-Wlogical-not-parentheses]
            if (!access(xpath, F_OK) == 0) {
                ^                    ~~
    mu-store.cc:77:6: note: add parentheses after the '!' to evaluate the
    comparison first
            if (!access(xpath, F_OK) == 0) {
                ^
                 (                       )
    mu-store.cc:77:6: note: add parentheses around left hand side expression
    to silence this warning
            if (!access(xpath, F_OK) == 0) {
                ^
                (                   )

It ends up doing what the author intended anyway since access() returns
-1 on error, and !-1 == 0, but just do the more obvious check and check
that we don't get 0 here with !=.
2015-12-15 12:40:40 +01:00
djcb 3cf96899ef mu: decode mailing-list headers
MIME-decode mailing list headers, too. Also add a unit test. This fixes
issue #728.
2015-12-15 07:21:26 +02:00
djcb 6df9322257 Fix typo near get_new_basename
And clear op the function a bit.
2015-11-18 15:55:34 +02:00
djcb 539bd9be19 Fix message file creation
Make sure we 0-pad the numeric parts in message file names; this was
breaking some unit test.
2015-11-18 09:50:36 +02:00
djcb fe8b3430c6 mu: optimize indexing (get_uid_term)
Some users were report seeing get_uid_term high in the profiles; so
optimize this:

- make mu_util_get_hash a static inline function (used by get_uid_term)
- don't use 'realpath' in get_uid_term, seem that's the main culprit
- some slight faster string handling there too.
2015-11-17 10:55:56 +02:00
djcb 50d25ce0e0 mu: use '.msgpart' as extension
We were using '.part', but some desktop software interprets that as a
partial download.
2015-10-24 11:45:50 +03:00
djcb 0678d31056 mu: special-case text/calendar parts
Set the name for (otherwise unnamed) mime-parts of type text/calendar to
"vcal-<n>.vcs"; this allows for easier processing with external tools.
2015-10-21 08:06:40 +03:00
djcb 67f74d44b0 cosmetic 2015-10-07 10:34:55 +03:00
djcb a350e2047d Change format for filenames
It seems some tools try to interpret the filename of message files,
even though they shouldn't:
   "Do not try to extract information from unique names."

In particular, they seem to interpret the first part of the name (before
the first dot) as the # of seconds since the Unix epoch (ie.,
time(NULL)). That's not what mu/mu4e put there.

So, let's conform a bit more to the expected filename (as per the
maildir spec), so we're not confusing those tools.
2015-10-02 17:43:38 +03:00
Dirk-Jan C. Binnema 4774429ad6 Merge pull request #668 from ptroja/minor
Minor whitespace and comment fixes
2015-09-26 10:29:11 +03:00
Adam Sampson b44039eda9 Ensure tests have unique names.
glib 2.46 complains if this isn't the case:
(test-mu-str:28790): GLib-ERROR **: duplicate test case path: /mu-str/mu-str-esc-to-list
2015-09-23 12:01:19 +01:00
djcb 518b160025 mu: fix `make distcheck`
We were not including some of the test files in the tarballs; add them.
2015-09-22 12:03:44 +03:00
Piotr Trojanek d35d21a812 Misleading comment removed
Removed a comment which seemed to be copy-pasted from
add_terms_values_str. It did not applied to add_terms_values_msgid.
2015-09-22 09:09:39 +01:00
Piotr Trojanek 804a25d668 minor whitespace fixes 2015-09-22 09:09:39 +01:00
djcb fd557aeac8 mu: add in-reply-to/references to non-body sexp
Add the in-reply-to and references fields to the header-only sexps.
2015-07-05 20:46:11 +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
attila f5a5cde965 Fix core dump in mu-server (at least) for cmd:extract index:0 ... 2015-06-30 16:28:26 -05:00
djcb 7eb244b3b0 mu: don't use __FUNCTION__, use __func__
__FUNCTION__ is deprecated and gives compilation warnings. __func__ is
standardized in c99.
2015-04-22 21:06:31 +03:00
djcb 455582401e date-parsing: don't lowercase date range strings
Allow them to be received unmolested in mu_date_parse_hdwmy
2015-03-22 10:24:14 +02:00