MCPcopy Create free account
hub / github.com/chatmail/core / sync_qr_code_tokens

Method sync_qr_code_tokens

src/sync.rs:183–199  ·  view source on GitHub ↗

Adds most recent qr-code tokens for the given group or self-contact to the list of items to be synced. If device synchronization is disabled, no tokens exist or the chat is unpromoted, the function does nothing. The caller should call `SchedulerState::interrupt_smtp()` on its own to trigger sending.

(&self, grpid: Option<&str>)

Source from the content-addressed store, hash-verified

181 /// no tokens exist or the chat is unpromoted, the function does nothing.
182 /// The caller should call `SchedulerState::interrupt_smtp()` on its own to trigger sending.
183 pub(crate) async fn sync_qr_code_tokens(&self, grpid: Option<&str>) -> Result<()> {
184 if !self.should_send_sync_msgs().await? {
185 return Ok(());
186 }
187 if let (Some(invitenumber), Some(auth)) = (
188 token::lookup(self, Namespace::InviteNumber, grpid).await?,
189 token::lookup(self, Namespace::Auth, grpid).await?,
190 ) {
191 self.add_sync_item(SyncData::AddQrToken(QrTokenData {
192 invitenumber,
193 auth,
194 grpid: grpid.map(|s| s.to_string()),
195 }))
196 .await?;
197 }
198 Ok(())
199 }
200
201 /// Adds deleted qr-code token to the list of items to be synced
202 /// so that the token also gets deleted on the other devices.

Callers 2

set_config_from_qrFunction · 0.80
get_securejoin_qrFunction · 0.80

Calls 3

lookupFunction · 0.85
should_send_sync_msgsMethod · 0.80
add_sync_itemMethod · 0.80

Tested by

no test coverage detected