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>)
| 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. |
no test coverage detected