(
&self,
account_id: u32,
chat_id: u32,
text: Option<String>,
file: Option<String>,
filename: Option<String>,
location: Option<(f64, f64)>,
| 2678 | /// use `misc_set_draft` and pass `Image` as the viewtype. |
| 2679 | #[expect(clippy::too_many_arguments)] |
| 2680 | async fn misc_send_msg( |
| 2681 | &self, |
| 2682 | account_id: u32, |
| 2683 | chat_id: u32, |
| 2684 | text: Option<String>, |
| 2685 | file: Option<String>, |
| 2686 | filename: Option<String>, |
| 2687 | location: Option<(f64, f64)>, |
| 2688 | quoted_message_id: Option<u32>, |
| 2689 | ) -> Result<(u32, MessageObject)> { |
| 2690 | let ctx = self.get_context(account_id).await?; |
| 2691 | let mut message = Message::new(if file.is_some() { |
| 2692 | Viewtype::File |
| 2693 | } else { |
| 2694 | Viewtype::Text |
| 2695 | }); |
| 2696 | message.set_text(text.unwrap_or_default()); |
| 2697 | if let Some(file) = file { |
| 2698 | message.set_file_and_deduplicate(&ctx, Path::new(&file), filename.as_deref(), None)?; |
| 2699 | } |
| 2700 | if let Some((latitude, longitude)) = location { |
| 2701 | message.set_location(latitude, longitude); |
| 2702 | } |
| 2703 | if let Some(id) = quoted_message_id { |
| 2704 | message |
| 2705 | .set_quote( |
| 2706 | &ctx, |
| 2707 | Some( |
| 2708 | &Message::load_from_db(&ctx, MsgId::new(id)) |
| 2709 | .await |
| 2710 | .context("message to quote could not be loaded")?, |
| 2711 | ), |
| 2712 | ) |
| 2713 | .await?; |
| 2714 | } |
| 2715 | let msg_id = chat::send_msg(&ctx, ChatId::new(chat_id), &mut message).await?; |
| 2716 | let message = MessageObject::from_msg_id(&ctx, msg_id) |
| 2717 | .await? |
| 2718 | .context("Just sent message does not exist")?; |
| 2719 | Ok((msg_id.to_u32(), message)) |
| 2720 | } |
| 2721 | |
| 2722 | // mimics the old desktop call, will get replaced with something better in the composer rewrite, |
| 2723 | // the better version should support: |
nothing calls this directly
no test coverage detected