lots of small fixes from the reviews

This commit is contained in:
Hocuri
2020-06-12 10:00:05 +02:00
parent 8ebce0c861
commit 990c80cedf
4 changed files with 12 additions and 5 deletions

View File

@@ -4428,7 +4428,7 @@ void dc_event_unref(dc_event_t* event);
#define DC_STR_WELCOME_MESSAGE 71 #define DC_STR_WELCOME_MESSAGE 71
#define DC_STR_UNKNOWN_SENDER_FOR_CHAT 72 #define DC_STR_UNKNOWN_SENDER_FOR_CHAT 72
#define DC_STR_SUBJECT_FOR_NEW_CONTACT 73 #define DC_STR_SUBJECT_FOR_NEW_CONTACT 73
#define FAILED_SENDING_TO 74 #define DC_STR_FAILED_SENDING_TO 74
#define DC_STR_COUNT 74 #define DC_STR_COUNT 74

View File

@@ -769,7 +769,7 @@ impl MessageState {
MessageState::OutPreparing MessageState::OutPreparing
| MessageState::OutPending | MessageState::OutPending
| MessageState::OutDelivered | MessageState::OutDelivered
| MessageState::OutMdnRcvd => true, | MessageState::OutMdnRcvd => true, // OutMdnRcvd can still fail because it could be a group message and only some recipients failed.
_ => false, _ => false,
} }
} }
@@ -1328,7 +1328,10 @@ pub async fn mdn_from_ext(
if let Ok((msg_id, chat_id, chat_type, msg_state)) = res { if let Ok((msg_id, chat_id, chat_type, msg_state)) = res {
let mut read_by_all = false; let mut read_by_all = false;
if msg_state != MessageState::OutMdnRcvd && msg_state != MessageState::OutFailed { if msg_state == MessageState::OutPreparing
|| msg_state == MessageState::OutPending
|| msg_state == MessageState::OutDelivered
{
let mdn_already_in_table = context let mdn_already_in_table = context
.sql .sql
.exists( .exists(
@@ -1391,6 +1394,8 @@ pub async fn mdn_from_ext(
None None
} }
/// Marks a message as failed after an ndn (non-delivery-notification) arrived.
/// Where appropriate, also adds an info message telling the user which of the recipients of a group message failed.
pub(crate) async fn ndn_from_ext( pub(crate) async fn ndn_from_ext(
context: &Context, context: &Context,
failed: &FailedMsg, failed: &FailedMsg,

View File

@@ -933,7 +933,9 @@ impl MimeMessage {
None None
} }
/// Handle reports (only MDNs for now) /// Handle reports
/// (MDNs = Message Disposition Notification, the message was read
/// and NDNs = Non delivery notification, the message could not be delivered)
pub async fn handle_reports( pub async fn handle_reports(
&self, &self,
context: &Context, context: &Context,

View File

@@ -1242,7 +1242,7 @@ async fn open(
sql.set_raw_config_int(context, "dbversion", 63).await?; sql.set_raw_config_int(context, "dbversion", 63).await?;
} }
if dbversion < 64 { if dbversion < 64 {
info!(context, "[migration] v63"); info!(context, "[migration] v64");
sql.execute( sql.execute(
"ALTER TABLE msgs ADD COLUMN error TEXT DEFAULT '';", "ALTER TABLE msgs ADD COLUMN error TEXT DEFAULT '';",
paramsv![], paramsv![],