Added MORE inlines
This commit is contained in:
@ -3,6 +3,7 @@ use tokio::task::spawn_blocking;
|
||||
|
||||
/// Gets the name of the master password, encryptes the account and adds it to the DB
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[inline]
|
||||
async fn get_master_pass(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Handles /cancel command when there's no active state
|
||||
#[inline]
|
||||
pub async fn cancel(bot: Throttle<Bot>, msg: Message) -> crate::Result<()> {
|
||||
bot.send_message(msg.chat.id, "Nothing to cancel")
|
||||
.reply_markup(deletion_markup())
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
#[inline]
|
||||
pub async fn delete(bot: Throttle<Bot>, msg: Message, db: DatabaseConnection) -> crate::Result<()> {
|
||||
let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
|
||||
|
||||
|
@ -5,6 +5,7 @@ use tokio::try_join;
|
||||
|
||||
/// Gets the master password, deletes the accounts and the master password from DB.
|
||||
/// Although it doesn't use the master password, we get it to be sure that it's the user who used that command
|
||||
#[inline]
|
||||
async fn get_master_pass(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -18,6 +18,7 @@ async fn decrypt_account(
|
||||
}
|
||||
|
||||
/// Gets the master password, decryptes the account and sends the json file to the user
|
||||
#[inline]
|
||||
async fn get_master_pass(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -14,6 +14,7 @@ const BUFFER_LENGTH: usize =
|
||||
MESSAGE_HEADER.len() + (PASSWORD_LENGTH + PASSWORD_PADDING_LENGTH) * AMOUNT_OF_PASSWORDS;
|
||||
|
||||
/// Handles /gen_password command by generating 10 copyable passwords and sending them to the user
|
||||
#[inline]
|
||||
pub async fn gen_password(bot: Throttle<Bot>, msg: Message) -> crate::Result<()> {
|
||||
let mut message: ArrayString<BUFFER_LENGTH> = MESSAGE_HEADER.try_into().unwrap();
|
||||
let passwords: PasswordArray = spawn_blocking(generate_passwords).await?;
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
#[inline]
|
||||
pub async fn get_account(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -4,6 +4,7 @@ use std::fmt::Write;
|
||||
use teloxide::types::ParseMode;
|
||||
|
||||
/// Handles /get_accounts command by sending the list of copyable account names to the user
|
||||
#[inline]
|
||||
pub async fn get_accounts(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -2,6 +2,7 @@ use crate::prelude::*;
|
||||
use teloxide::utils::command::BotCommands;
|
||||
|
||||
/// Handles the help command by sending the passwords descryptions
|
||||
#[inline]
|
||||
pub async fn help(bot: Throttle<Bot>, msg: Message) -> crate::Result<()> {
|
||||
bot.send_message(msg.chat.id, Command::descriptions().to_string())
|
||||
.reply_markup(deletion_markup())
|
||||
|
@ -26,6 +26,7 @@ async fn encrypt_account(
|
||||
}
|
||||
|
||||
/// Gets the master password, encryptes and adds the accounts to the DB
|
||||
#[inline]
|
||||
async fn get_master_pass(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
use tokio::task::spawn_blocking;
|
||||
|
||||
#[inline]
|
||||
pub async fn menu(bot: Throttle<Bot>, msg: Message, db: DatabaseConnection) -> crate::Result<()> {
|
||||
let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
|
||||
|
||||
|
@ -3,6 +3,7 @@ use cryptography::hashing::HashedBytes;
|
||||
use sea_orm::ActiveValue::Set;
|
||||
use tokio::task::spawn_blocking;
|
||||
|
||||
#[inline]
|
||||
async fn get_master_pass2(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
@ -66,6 +67,7 @@ async fn get_master_pass(
|
||||
}
|
||||
|
||||
/// Handles /set_master_pass command
|
||||
#[inline]
|
||||
pub async fn set_master_pass(
|
||||
bot: Throttle<Bot>,
|
||||
msg: Message,
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Handles /start command by sending the greeting message
|
||||
#[inline]
|
||||
pub async fn start(bot: Throttle<Bot>, msg: Message) -> crate::Result<()> {
|
||||
bot.send_message(
|
||||
msg.chat.id,
|
||||
|
Reference in New Issue
Block a user