Skip to content

Commit

Permalink
tweak return type for integrate_for(); we can re-add Result<> as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Apr 19, 2024
1 parent fd5fe0d commit 2d4cdc7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/webxdc/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Context {
instance: Message,
status_update: StatusUpdateItem,
) -> Result<()> {
let chat_id = instance.webxdc_integrated_for()?;
let chat_id = instance.webxdc_integrated_for();
maps_integration::intercept_send_update(self, chat_id, status_update).await
}

Expand All @@ -85,22 +85,22 @@ impl Context {
instance: Message,
last_known_serial: StatusUpdateSerial,
) -> Result<String> {
let chat_id = instance.webxdc_integrated_for()?;
let chat_id = instance.webxdc_integrated_for();
maps_integration::intercept_get_updates(self, chat_id, last_known_serial).await
}
}

impl Message {
// Get chat the Webxdc is integrated for.
// This is the chat given to `init_webxdc_integration()`.
fn webxdc_integrated_for(&self) -> Result<Option<ChatId>> {
fn webxdc_integrated_for(&self) -> Option<ChatId> {
let raw_id = self.param.get_int(Param::WebxdcIntegrateFor).unwrap_or(0) as u32;
let chat_id = if raw_id > 0 {
Some(ChatId::new(raw_id))
} else {
None
};
Ok(chat_id)
chat_id
}
}

Expand Down

0 comments on commit 2d4cdc7

Please sign in to comment.