Fix e_book_backend_summary_is_summary_query()

It didn't check on correct summary fields being used, but on a result
of the expression, which is not correct when there comes a 'not' in it.
This broke "Unmatched" filter in evolution's Contacts view, which is
testing nonexistence of a CATEGORIES attribute in a vCard.
Bug #682322 - SIGSEGV in pop3_folder_refresh_info_sync
Bug #697598 - [imapx] Freeze due to calling thread join from main thread
Allow automatic NTLM authentication unconditionally

As part of bug 703181 we retested imapx+NTLM authentication, and it seems
that the NTLM SASL mechanism wasn't allowing the ntlm_auth helper to be used
unless its ->try_empty_password_sync() method was called.

That made sense when this support was first added, since the logic in the
back end would go something like:

  if (try_empty_password())
    { /* Try it and return OK if it worked */ }
  demand_password_from_user()
  ...

However, the setup of the authentication is now different, and the imapx
back end (for example) doesn't even *care* about the password. Adding an
artificial call to camel_sasl_try_empty_password_sync() into the imapx code
seemed like the wrong thing to do; it should be enabled *automatically*.

So do that: try to set up the ntlm_auth helper in sasl_ntlm_challenge_sync()
if we are invoked with no password.

(cherry picked from commit 2645a6e1801c431a3a7d682747cc9db0918fa0de)
Bug #703053 - Error on setting reminder 'after start of appointment'

As EWS doesn't support setting 'after start' reminders, let's create
a new capability to help us when we should avoid to show the option
to the user
GError instance use-after-free in collection_backend_load_resources()

The function uses a shared GError instance in a cycle, and on error
freed the instance with g_error_free() which left the pointer set,
only populated with freed memory, thus the next round, when it eventually
loaded correct source, the function thought it ended with an error
and a GSlice allocator aborted on the g_error_free() call. Resetting
the error variable to NULL after free (by using g_clear_error()) fixes
the crash.
Bug #700894 - LDAP 'Copy for offline' blocks online searches
Bug #703194 - Custom alarm message is REMINDER
Avoid a crash in cal_backend_add_cached_timezone().

Apparently icaltimezone_get_tzid() can sometimes return NULL.  Check for
NULL before we use it in a hash table lookup, which crashes on NULL keys.

Add a similar check to ECalClient for consistency.

(cherry picked from commit 244003d568113a82628bc74b337274a6e8fee433)
[IMAPX] Server connection is not mandatory when searching folder content

In case the store is kept online, but the server cannot be reached,
like when it's hidden behind the VPN, the IMAPX folder should show
offline content, rather than nothing at all. After all, live server
connection is needed for body-contains only, and only that to not
download all messages in the folder.
e_book_backend_sqlitedb_has_contact() used nonexistent column

The function used partial_content column of a respective folder table,
but this is not available anymore, and references to this column are
also no-op these days, thus I made this use the 'uid' column instead.
The failure broke contact removal in evolution-ews.
CamelGpgContext: Be aware of gpg2

There can be installed only gpg2, without old gpg executable, but
CamelGpgContext was not aware of that and simply failed to do any
gpg operation due to missing gpg executable.

This was reported as: https://bugzilla.redhat.com/show_bug.cgi?id=985599
Bug #691526 - Memory corruption under e_book_backend_google_start_book_view()
Bug #704181 - Froze while filtering messages
Bug #692904 - Do not call camel_service_disconnect during connection phase
CamelGpgContext: Enclose email addresses in brackets.

The recipient list for encrypting can be specified by either key ID or
email address.  Enclose email addresses in brackets to ensure an exact
match, as per the gpg man page:

HOW TO SPECIFY A USER ID

       ...

       By exact match on an email address.
              This is indicated by enclosing the email address in the
              usual way with left and right angles.

         <heinrichh@uni-duesseldorf.de>

Without the brackets gpg uses a substring match, which risks selecting
the wrong recipient.

(cherry picked from commit 5d8b92c622f6927b253762ff9310479dd3ac627d)
Bug 704003 - IMAPX: Untagged BYE message while connecting is lost

Do not disconnect the service in imapx_untagged_bye() if we're still
connecting.  camel_service_disconnect_sync() will cancel the connect
operation and the server message will get replaced with a generic
"Operation was cancelled" message.

Also, check for and handle errors when calling imapx_untagged() from
imapx_connect_to_server().

(cherry picked from commit 9b444aa32e99329cd2e8f6479ea47f81178332cc)
Fix memory leak in camel_imapx_command_add_qresync_parameter().

(cherry picked from commit 7deff979b9e3bfe38ce8e4474d436a0804f1a4cd)
Do not use generic error codes in camel_getaddrinfo()/camel_getnameinfo()

It's too hard to distinguish from other provider errors when using
general error codes here, thus rather use CAMEL_SERVICE_ERROR_URL_INVALID.
e_cal_backend_notify_component_modified: 'old_component' can be NULL

The 'old_component' parameter can be NULL, but the function expects it
always an a valid ECalComponent object, which made notifications about
changes missing for such cases (like detaching a recurring event instance).