Avoid ChatId::is_unset for searching messages

Using a ChatId value of 0 to indicate global search is a left over
from C-land.  Refactor this to be an option instead.
This commit is contained in:
Floris Bruynooghe
2021-02-07 21:54:43 +01:00
parent 6aeda98c0a
commit 65fb2d791b
3 changed files with 52 additions and 39 deletions

View File

@@ -858,9 +858,9 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
ensure!(!arg1.is_empty(), "Argument <query> missing.");
let chat = if let Some(ref sel_chat) = sel_chat {
sel_chat.get_id()
Some(sel_chat.get_id())
} else {
ChatId::new(0)
None
};
let msglist = context.search_msgs(chat, arg1).await;