1 // This file is under GNU General Public License 3.0
4 #include "pEp_internal.h"
5 #include "message_api.h"
7 PEP_STATUS decorate_message(
17 if (!(msg && payload && size))
18 return PEP_ILLEGAL_VALUE;
20 bloblist_t *bl = bloblist_add(msg->attachments, payload, size,
21 "application/pEp.sync", "ignore_this_attachment.pEp");
25 msg->attachments = bl;
29 return PEP_OUT_OF_MEMORY;
32 PEP_STATUS prepare_message(
33 const pEp_identity *me,
34 const pEp_identity *partner,
40 PEP_STATUS status = PEP_STATUS_OK;
48 if (!(me && partner && payload && size && result))
49 return PEP_ILLEGAL_VALUE;
53 message *msg = new_message(PEP_dir_outgoing);
57 add_opt_field(msg, "pEp-auto-consume", "yes");
59 msg->from = identity_dup(me);
63 msg->to = new_identity_list(identity_dup(partner));
67 msg->shortmsg = strdup("p≡p synchronization message - please ignore");
68 assert(msg->shortmsg);
72 msg->longmsg = strdup("This message is part of p≡p's concept to synchronize.\n\n"
73 "You can safely ignore it. It will be deleted automatically.\n");
78 status = decorate_message(msg, payload, size);
79 if (status == PEP_STATUS_OK)
85 return PEP_OUT_OF_MEMORY;