Skip to content

Commit

Permalink
fixes #280 - use original file type when forwarding files
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Aug 31, 2024
1 parent e3c6e33 commit 8730ca4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "5.2.3"
#define NCHAT_VERSION "5.2.4"
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "August 2024" "nchat 5.2.3" "User Commands"
.TH NCHAT "1" "August 2024" "nchat 5.2.4" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down
14 changes: 11 additions & 3 deletions src/uimodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3775,12 +3775,20 @@ void UiModel::ForwardMessage()
selectedChatListItem.chatId.c_str());
}

// send copy of selected message
std::shared_ptr<SendMessageRequest> sendMessageRequest =
std::make_shared<SendMessageRequest>();
sendMessageRequest->chatId = selectedChatListItem.chatId;

// prepare a new FileInfo struct if original message has a file
if (!message.fileInfo.empty())
{
FileInfo fileInfo = ProtocolUtil::FileInfoFromHex(message.fileInfo);
fileInfo.fileType = FileUtil::GetMimeType(fileInfo.filePath);
sendMessageRequest->chatMessage.fileInfo = ProtocolUtil::FileInfoToHex(fileInfo);
}

// copy text and use selected chat
sendMessageRequest->chatMessage.text = message.text;
sendMessageRequest->chatMessage.fileInfo = message.fileInfo;
sendMessageRequest->chatId = selectedChatListItem.chatId;

SendProtocolRequest(selectedChatListItem.profileId, sendMessageRequest);

Expand Down

0 comments on commit 8730ca4

Please sign in to comment.