_notmuch_message_add_term (message, "tag", "encrypted");
for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {
- notmuch_status_t status;
GMimeObject *child;
if (GMIME_IS_MULTIPART_SIGNED (multipart)) {
/* Don't index the signature, but index its content type. */
continue;
}
child = g_mime_multipart_get_part (multipart, i);
- status = _notmuch_message_crypto_potential_payload (msg_crypto, child, part, i);
- if (status)
- _notmuch_database_log (notmuch_message_get_database (message),
- "Warning: failed to mark the potential cryptographic payload (%s).\n",
- notmuch_status_to_string (status));
+ (void) _notmuch_message_crypto_potential_payload (msg_crypto, child, part, i);
_index_mime_part (message, indexopts, child, msg_crypto);
}
return;
}
g_object_unref (decrypt_result);
}
- status = _notmuch_message_crypto_potential_payload (msg_crypto, clear, GMIME_OBJECT (encrypted_data), GMIME_MULTIPART_ENCRYPTED_CONTENT);
+ _notmuch_message_crypto_potential_payload (msg_crypto, clear, GMIME_OBJECT (encrypted_data), GMIME_MULTIPART_ENCRYPTED_CONTENT);
_index_mime_part (message, indexopts, clear, msg_crypto);
g_object_unref (clear);
static bool
_mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
{
- notmuch_status_t status;
-
/* Deal with the different types of parts */
if (GMIME_IS_PART (part)) {
node->part = part;
node_verify (node, part);
}
} else {
- status = _notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild);
- if (status)
- fprintf (stderr, "Warning: failed to record potential crypto payload (%s).\n", notmuch_status_to_string (status));
+ (void) _notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild);
}
return true;
#include "crypto.h"
#include <strings.h>
+#include "error_util.h"
#define unused(x) x __attribute__ ((unused))
#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
}
-notmuch_status_t
+bool
_notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto, GMimeObject *part, GMimeObject *parent, int childnum)
{
const char *protected_headers = NULL;
const char *forwarded = NULL;
const char *subject = NULL;
- if (! msg_crypto || ! part)
- return NOTMUCH_STATUS_NULL_POINTER;
+ if ((! msg_crypto) || (! part))
+ INTERNAL_ERROR ("_notmuch_message_crypto_potential_payload() got NULL for %s\n",
+ msg_crypto? "part" : "msg_crypto");
/* only fire on the first payload part encountered */
if (msg_crypto->payload_encountered)
- return NOTMUCH_STATUS_SUCCESS;
+ return false;
/* the first child of multipart/encrypted that matches the
* encryption protocol should be "control information" metadata,
if (ct && enc_type) {
const char *part_type = g_mime_content_type_get_mime_type (ct);
if (part_type && strcmp (part_type, enc_type) == 0)
- return NOTMUCH_STATUS_SUCCESS;
+ return false;
}
}
* envelope: */
if ((msg_crypto->decryption_status != NOTMUCH_MESSAGE_DECRYPTED_FULL) &&
(msg_crypto->sig_list == NULL))
- return NOTMUCH_STATUS_SUCCESS;
+ return false;
/* Verify that this payload has headers that are intended to be
* exported to the larger message: */
msg_crypto->payload_subject = talloc_strdup (msg_crypto, subject);
}
- return NOTMUCH_STATUS_SUCCESS;
+ return true;
}
/* call potential_payload during a depth-first-search on a message
* when encountering a message part that is not part of the envelope.
+ *
+ * Returns true if part is the root of the cryptographic payload of
+ * this message.
*/
-notmuch_status_t
+bool
_notmuch_message_crypto_potential_payload (_notmuch_message_crypto_t *msg_crypto, GMimeObject *part, GMimeObject *parent, int childnum);