Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Jul 24, 2023
2 parents d797de7 + d52f288 commit f930576
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions deltachat-jsonrpc/src/api/types/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct MessageObject {
quote: Option<MessageQuote>,
parent_id: Option<u32>,

text: Option<String>,
text: String,
has_location: bool,
has_html: bool,
view_type: MessageViewtype,
Expand Down Expand Up @@ -180,7 +180,7 @@ impl MessageObject {
from_id: message.get_from_id().to_u32(),
quote,
parent_id,
text: Some(message.get_text()).filter(|s| !s.is_empty()),
text: message.get_text(),
has_location: message.has_location(),
has_html: message.has_html(),
view_type: message.get_viewtype().into(),
Expand Down
1 change: 1 addition & 0 deletions deltachat-rpc-client/src/deltachat_rpc_client/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class EventType(str, Enum):
MSG_DELIVERED = "MsgDelivered"
MSG_FAILED = "MsgFailed"
MSG_READ = "MsgRead"
MSG_DELETED = "MsgDeleted"
CHAT_MODIFIED = "ChatModified"
CHAT_EPHEMERAL_TIMER_MODIFIED = "ChatEphemeralTimerModified"
CONTACTS_CHANGED = "ContactsChanged"
Expand Down
10 changes: 10 additions & 0 deletions deltachat-rpc-client/tests/test_something.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ async def test_account(acfactory) -> None:
assert await alice.get_fresh_messages()
assert await alice.get_next_messages()

# Test sending empty message.
assert len(await bob.wait_next_messages()) == 0
await alice_chat_bob.send_text("")
messages = await bob.wait_next_messages()
assert len(messages) == 1
message = messages[0]
snapshot = await message.get_snapshot()
assert snapshot.text == ""
await bob.mark_seen_messages([message])

group = await alice.create_group("test group")
await group.add_contact(alice_contact_bob)
group_msg = await group.send_message(text="hello")
Expand Down
19 changes: 9 additions & 10 deletions src/imap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,7 @@ impl Imap {
if uid_next < old_uid_next {
warn!(
context,
"The server illegally decreased the uid_next of folder {} from {} to {} without changing validity ({}), resyncing UIDs...",
folder, old_uid_next, uid_next, new_uid_validity,
"The server illegally decreased the uid_next of folder {folder:?} from {old_uid_next} to {uid_next} without changing validity ({new_uid_validity}), resyncing UIDs...",
);
set_uid_next(context, folder, uid_next).await?;
job::schedule_resync(context).await?;
Expand All @@ -628,7 +627,7 @@ impl Imap {
set_modseq(context, folder, 0).await?;

if mailbox.exists == 0 {
info!(context, "Folder \"{}\" is empty.", folder);
info!(context, "Folder {folder:?} is empty.");

// set uid_next=1 for empty folders.
// If we do not do this here, we'll miss the first message
Expand All @@ -646,7 +645,7 @@ impl Imap {
None => {
warn!(
context,
"IMAP folder has no uid_next, fall back to fetching"
"IMAP folder {folder:?} has no uid_next, fall back to fetching."
);
// note that we use fetch by sequence number
// and thus we only need to get exactly the
Expand Down Expand Up @@ -685,7 +684,7 @@ impl Imap {
}
info!(
context,
"uid/validity change folder {}: new {}/{} previous {}/{}",
"uid/validity change folder {}: new {}/{} previous {}/{}.",
folder,
new_uid_next,
new_uid_validity,
Expand All @@ -706,17 +705,17 @@ impl Imap {
fetch_existing_msgs: bool,
) -> Result<bool> {
if should_ignore_folder(context, folder, folder_meaning).await? {
info!(context, "Not fetching from {}", folder);
info!(context, "Not fetching from {folder:?}.");
return Ok(false);
}

let new_emails = self
.select_with_uidvalidity(context, folder)
.await
.with_context(|| format!("failed to select folder {folder}"))?;
.with_context(|| format!("Failed to select folder {folder:?}"))?;

if !new_emails && !fetch_existing_msgs {
info!(context, "No new emails in folder {}", folder);
info!(context, "No new emails in folder {folder:?}.");
return Ok(false);
}

Expand All @@ -742,7 +741,7 @@ impl Imap {
let headers = match get_fetch_headers(fetch_response) {
Ok(headers) => headers,
Err(err) => {
warn!(context, "Failed to parse FETCH headers: {}", err);
warn!(context, "Failed to parse FETCH headers: {err:#}.");
continue;
}
};
Expand Down Expand Up @@ -933,7 +932,7 @@ impl Imap {
if let Some(folder) = context.get_config(config).await? {
info!(
context,
"Fetching existing messages from folder \"{}\"", folder
"Fetching existing messages from folder {folder:?}."
);
self.fetch_new_messages(context, &folder, meaning, true)
.await
Expand Down

0 comments on commit f930576

Please sign in to comment.