mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
Merge branch 'stable'
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -4958,14 +4958,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-tar"
|
name = "tokio-tar"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a50188549787c32c1c3d9c8c71ad7e003ccf2f102489c5a96e385c84760477f4"
|
checksum = "9d5714c010ca3e5c27114c1cdeb9d14641ace49874aa5626d7149e47aedace75"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"filetime",
|
"filetime",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall 0.2.16",
|
"redox_syscall 0.3.5",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"xattr",
|
"xattr",
|
||||||
@@ -5778,9 +5778,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xattr"
|
name = "xattr"
|
||||||
version = "0.2.3"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc"
|
checksum = "ea263437ca03c1522846a4ddafbca2542d0ad5ed9b784909d4b27b76f62bc34a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -259,3 +259,11 @@ class Account:
|
|||||||
)
|
)
|
||||||
fresh_msg_ids = sorted(await self._rpc.get_fresh_msgs(self.id))
|
fresh_msg_ids = sorted(await self._rpc.get_fresh_msgs(self.id))
|
||||||
return [Message(self, msg_id) for msg_id in fresh_msg_ids]
|
return [Message(self, msg_id) for msg_id in fresh_msg_ids]
|
||||||
|
|
||||||
|
async def export_backup(self, path, passphrase: str = "") -> None:
|
||||||
|
"""Export backup."""
|
||||||
|
await self._rpc.export_backup(self.id, str(path), passphrase)
|
||||||
|
|
||||||
|
async def import_backup(self, path, passphrase: str = "") -> None:
|
||||||
|
"""Import backup."""
|
||||||
|
await self._rpc.import_backup(self.id, str(path), passphrase)
|
||||||
|
|||||||
@@ -335,3 +335,13 @@ async def test_wait_next_messages(acfactory) -> None:
|
|||||||
assert len(next_messages) == 1
|
assert len(next_messages) == 1
|
||||||
snapshot = await next_messages[0].get_snapshot()
|
snapshot = await next_messages[0].get_snapshot()
|
||||||
assert snapshot.text == "Hello!"
|
assert snapshot.text == "Hello!"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio()
|
||||||
|
async def test_import_export(acfactory, tmp_path) -> None:
|
||||||
|
alice = await acfactory.new_configured_account()
|
||||||
|
await alice.export_backup(tmp_path)
|
||||||
|
|
||||||
|
files = list(tmp_path.glob("*.tar"))
|
||||||
|
alice2 = await acfactory.get_unconfigured_account()
|
||||||
|
await alice2.import_backup(files[0])
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ def test_echo_quit_plugin(acfactory, lp):
|
|||||||
lp.sec("creating a temp account to contact the bot")
|
lp.sec("creating a temp account to contact the bot")
|
||||||
(ac1,) = acfactory.get_online_accounts(1)
|
(ac1,) = acfactory.get_online_accounts(1)
|
||||||
|
|
||||||
botproc.await_resync()
|
|
||||||
|
|
||||||
lp.sec("sending a message to the bot")
|
lp.sec("sending a message to the bot")
|
||||||
bot_contact = ac1.create_contact(botproc.addr)
|
bot_contact = ac1.create_contact(botproc.addr)
|
||||||
bot_chat = bot_contact.create_chat()
|
bot_chat = bot_contact.create_chat()
|
||||||
@@ -54,8 +52,6 @@ def test_group_tracking_plugin(acfactory, lp):
|
|||||||
ac1.add_account_plugin(FFIEventLogger(ac1))
|
ac1.add_account_plugin(FFIEventLogger(ac1))
|
||||||
ac2.add_account_plugin(FFIEventLogger(ac2))
|
ac2.add_account_plugin(FFIEventLogger(ac2))
|
||||||
|
|
||||||
botproc.await_resync()
|
|
||||||
|
|
||||||
lp.sec("creating bot test group with bot")
|
lp.sec("creating bot test group with bot")
|
||||||
bot_contact = ac1.create_contact(botproc.addr)
|
bot_contact = ac1.create_contact(botproc.addr)
|
||||||
ch = ac1.create_group_chat("bot test group")
|
ch = ac1.create_group_chat("bot test group")
|
||||||
|
|||||||
@@ -682,13 +682,6 @@ class BotProcess:
|
|||||||
print("+++IGN:", line)
|
print("+++IGN:", line)
|
||||||
ignored.append(line)
|
ignored.append(line)
|
||||||
|
|
||||||
def await_resync(self):
|
|
||||||
self.fnmatch_lines(
|
|
||||||
"""
|
|
||||||
*Resync: collected * message IDs in folder INBOX*
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def tmp_db_path(tmpdir):
|
def tmp_db_path(tmpdir):
|
||||||
|
|||||||
@@ -462,10 +462,13 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
|
|||||||
|
|
||||||
progress!(ctx, 910);
|
progress!(ctx, 910);
|
||||||
|
|
||||||
if ctx.get_config(Config::ConfiguredAddr).await?.as_deref() != Some(¶m.addr) {
|
if let Some(configured_addr) = ctx.get_config(Config::ConfiguredAddr).await? {
|
||||||
|
if configured_addr != param.addr {
|
||||||
// Switched account, all server UIDs we know are invalid
|
// Switched account, all server UIDs we know are invalid
|
||||||
|
info!(ctx, "Scheduling resync because the address has changed.");
|
||||||
job::schedule_resync(ctx).await?;
|
job::schedule_resync(ctx).await?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// the trailing underscore is correct
|
// the trailing underscore is correct
|
||||||
param.save_as_configured_params(ctx).await?;
|
param.save_as_configured_params(ctx).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user