mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
fix: do not subscribe to heartbeat if already subscribed via metadata
This commit is contained in:
@@ -1560,19 +1560,20 @@ impl Session {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if self.can_metadata() && self.can_push() {
|
||||||
let device_token_changed = context
|
let device_token_changed = context
|
||||||
.get_config(Config::DeviceToken)
|
.get_config(Config::DeviceToken)
|
||||||
.await?
|
.await?
|
||||||
.map_or(true, |config_token| device_token != config_token);
|
.map_or(true, |config_token| device_token != config_token);
|
||||||
|
|
||||||
if device_token_changed && self.can_metadata() && self.can_push() {
|
if device_token_changed {
|
||||||
let folder = context
|
let folder = context
|
||||||
.get_config(Config::ConfiguredInboxFolder)
|
.get_config(Config::ConfiguredInboxFolder)
|
||||||
.await?
|
.await?
|
||||||
.context("INBOX is not configured")?;
|
.context("INBOX is not configured")?;
|
||||||
|
|
||||||
let encrypted_device_token =
|
let encrypted_device_token = encrypt_device_token(&device_token)
|
||||||
encrypt_device_token(&device_token).context("Failed to encrypt device token")?;
|
.context("Failed to encrypt device token")?;
|
||||||
|
|
||||||
// We expect that the server supporting `XDELTAPUSH` capability
|
// We expect that the server supporting `XDELTAPUSH` capability
|
||||||
// has non-synchronizing literals support as well:
|
// has non-synchronizing literals support as well:
|
||||||
@@ -1607,6 +1608,7 @@ impl Session {
|
|||||||
// to be that large even after OpenPGP encryption.
|
// to be that large even after OpenPGP encryption.
|
||||||
warn!(context, "Device token is too long for LITERAL-, ignoring.");
|
warn!(context, "Device token is too long for LITERAL-, ignoring.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
context.push_subscribed.store(true, Ordering::Relaxed);
|
context.push_subscribed.store(true, Ordering::Relaxed);
|
||||||
} else if !context.push_subscriber.heartbeat_subscribed().await {
|
} else if !context.push_subscriber.heartbeat_subscribed().await {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user