This commit is contained in:
Mikhail Kilin
2026-01-31 03:48:50 +03:00
parent 1bf9b3d703
commit 644e36597d
37 changed files with 1070 additions and 600 deletions

View File

@@ -30,7 +30,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
app.status_message = Some("Загрузка закреплённых...".to_string());
match timeout(
Duration::from_secs(5),
app.td_client.get_pinned_messages(chat_id),
app.td_client.get_pinned_messages(ChatId::new(chat_id)),
)
.await
{
@@ -212,7 +212,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
if !query.is_empty() {
if let Ok(Ok(results)) = timeout(
Duration::from_secs(3),
app.td_client.search_messages(chat_id, &query),
app.td_client.search_messages(ChatId::new(chat_id), &query),
)
.await
{
@@ -233,7 +233,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
if let Some(chat_id) = app.get_selected_chat_id() {
if let Ok(Ok(results)) = timeout(
Duration::from_secs(3),
app.td_client.search_messages(chat_id, &query),
app.td_client.search_messages(ChatId::new(chat_id), &query),
)
.await
{
@@ -388,7 +388,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
match timeout(
Duration::from_secs(5),
app.td_client.delete_messages(
chat_id,
ChatId::new(chat_id),
vec![msg_id],
can_delete_for_all,
),
@@ -442,7 +442,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
Duration::from_secs(5),
app.td_client.forward_messages(
to_chat_id,
from_chat_id,
ChatId::new(from_chat_id),
vec![msg_id],
),
)
@@ -490,7 +490,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
app.message_scroll_offset = 0;
match timeout(
Duration::from_secs(10),
app.td_client.get_chat_history(chat_id, 100),
app.td_client.get_chat_history(ChatId::new(chat_id), 100),
)
.await
{
@@ -504,7 +504,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
// Загружаем последнее закреплённое сообщение
let _ = timeout(
Duration::from_secs(2),
app.td_client.load_current_pinned_message(chat_id),
app.td_client.load_current_pinned_message(ChatId::new(chat_id)),
)
.await;
// Загружаем черновик
@@ -572,7 +572,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
match timeout(
Duration::from_secs(5),
app.td_client.edit_message(chat_id, msg_id, text),
app.td_client.edit_message(ChatId::new(chat_id), msg_id, text),
)
.await
{
@@ -622,13 +622,13 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
// Отменяем typing status
app.td_client
.send_chat_action(chat_id, ChatAction::Cancel)
.send_chat_action(ChatId::new(chat_id), ChatAction::Cancel)
.await;
match timeout(
Duration::from_secs(5),
app.td_client
.send_message(chat_id, text, reply_to_id, reply_info),
.send_message(ChatId::new(chat_id), text, reply_to_id, reply_info),
)
.await
{
@@ -659,7 +659,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
app.message_scroll_offset = 0;
match timeout(
Duration::from_secs(10),
app.td_client.get_chat_history(chat_id, 100),
app.td_client.get_chat_history(ChatId::new(chat_id), 100),
)
.await
{
@@ -673,7 +673,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
// Загружаем последнее закреплённое сообщение
let _ = timeout(
Duration::from_secs(2),
app.td_client.load_current_pinned_message(chat_id),
app.td_client.load_current_pinned_message(ChatId::new(chat_id)),
)
.await;
// Загружаем черновик
@@ -795,7 +795,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
app.status_message = None;
app.needs_redraw = true;
} else {
app.enter_reaction_picker_mode(message_id, reactions);
app.enter_reaction_picker_mode(message_id.as_i64(), reactions);
app.status_message = None;
app.needs_redraw = true;
}
@@ -894,7 +894,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
if should_send_typing {
if let Some(chat_id) = app.get_selected_chat_id() {
app.td_client
.send_chat_action(chat_id, ChatAction::Typing)
.send_chat_action(ChatId::new(chat_id), ChatAction::Typing)
.await;
app.last_typing_sent = Some(Instant::now());
}
@@ -943,7 +943,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
.current_chat_messages()
.first()
.map(|m| m.id())
.unwrap_or(0);
.unwrap_or(MessageId::new(0));
if let Some(chat_id) = app.get_selected_chat_id() {
// Подгружаем больше сообщений если скролл близко к верху
if app.message_scroll_offset
@@ -952,7 +952,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
if let Ok(Ok(older)) = timeout(
Duration::from_secs(3),
app.td_client
.load_older_messages(chat_id, oldest_msg_id),
.load_older_messages(ChatId::new(chat_id), oldest_msg_id),
)
.await
{
@@ -1041,12 +1041,12 @@ fn format_message_for_clipboard(msg: &crate::tdlib::MessageInfo) -> String {
let mut result = String::new();
// Добавляем forward контекст если есть
if let Some(forward) = &msg.forward_from {
if let Some(forward) = msg.forward_from() {
result.push_str(&format!("↪ Переслано от {}\n", forward.sender_name));
}
// Добавляем reply контекст если есть
if let Some(reply) = &msg.reply_to {
if let Some(reply) = msg.reply_to() {
result.push_str(&format!("{}: {}\n", reply.sender_name, reply.text));
}