text
stringlengths
0
357
}
}
sqlite3_finalize(stmt);
stmt = NULL;
int command = dc_param_get_int(factory->msg->param, DC_PARAM_CMD, 0);
if (command==DC_CMD_MEMBER_REMOVED_FROM_GROUP /* for added members, the list is just fine */) {
char* email_to_remove = dc_param_get(factory->msg->param, DC_PARAM_CMD_ARG, NULL);
char* self_addr = dc_sqlite3_get_config(context->sql, "configured_addr", "");
if (email_to_remove && strcasecmp(email_to_remove, self_addr)!=0)
{
if (clist_search_string_nocase(factory->recipients_addr, email_to_remove)==0)
{
clist_append(factory->recipients_names, NULL);
clist_append(factory->recipients_addr, (void*)email_to_remove);
}
}
free(self_addr);
}
if (command!=DC_CMD_AUTOCRYPT_SETUP_MESSAGE
&& command!=DC_CMD_SECUREJOIN_MESSAGE
&& dc_sqlite3_get_config_int(context->sql, "mdns_enabled", DC_MDNS_DEFAULT_ENABLED)) {
factory->req_mdn = 1;
}
}
stmt = dc_sqlite3_prepare(context->sql,
"SELECT mime_in_reply_to, mime_references FROM msgs WHERE id=?");
sqlite3_bind_int (stmt, 1, factory->msg->id);
if (sqlite3_step(stmt)==SQLITE_ROW) {
factory->in_reply_to = dc_strdup((const char*)sqlite3_column_text(stmt, 0));
factory->references = dc_strdup((const char*)sqlite3_column_text(stmt, 1));
}
sqlite3_finalize(stmt);
stmt = NULL;
success = 1;
factory->loaded = DC_MF_MSG_LOADED;
factory->timestamp = factory->msg->timestamp_sort;
factory->rfc724_mid = dc_strdup(factory->msg->rfc724_mid);
}
if (success) {
factory->increation = dc_msg_is_increation(factory->msg);
}
cleanup:
sqlite3_finalize(stmt);
return success;
}
int dc_mimefactory_load_mdn(dc_mimefactory_t* factory, uint32_t msg_id)
{
int success = 0;
dc_contact_t* contact = NULL;
if (factory==NULL) {
goto cleanup;
}
factory->recipients_names = clist_new();
factory->recipients_addr = clist_new();
factory->msg = dc_msg_new_untyped(factory->context);
if (!dc_sqlite3_get_config_int(factory->context->sql, "mdns_enabled", DC_MDNS_DEFAULT_ENABLED)) {
goto cleanup; /* MDNs not enabled - check this is late, in the job. the use may have changed its choice while offline ... */
}
contact = dc_contact_new(factory->context);
if (!dc_msg_load_from_db(factory->msg, factory->context, msg_id)
|| !dc_contact_load_from_db(contact, factory->context->sql, factory->msg->from_id)) {
goto cleanup;
}
if (contact->blocked
|| factory->msg->chat_id<=DC_CHAT_ID_LAST_SPECIAL/* Do not send MDNs trash etc.; chats.blocked is already checked by the caller in dc_markseen_msgs() */) {
goto cleanup;
}
if (factory->msg->from_id <= DC_CONTACT_ID_LAST_SPECIAL) {
goto cleanup;
}
clist_append(factory->recipients_names, (void*)((contact->authname&&contact->authname[0])? dc_strdup(contact->authname) : NULL));
clist_append(factory->recipients_addr, (void*)dc_strdup(contact->addr));
load_from(factory);
factory->timestamp = dc_create_smeared_timestamp(factory->context);
factory->rfc724_mid = dc_create_outgoing_rfc724_mid(NULL, factory->from_addr);
success = 1;
factory->loaded = DC_MF_MDN_LOADED;
cleanup:
dc_contact_unref(contact);
return success;
}