mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix some messages being saved with history disabled
This commit is contained in:
parent
7f34290129
commit
f2ba03b45f
|
@ -949,13 +949,23 @@ void ChatForm::SendMessageStr(QString msg)
|
|||
else
|
||||
rec = Core::getInstance()->sendMessage(f->getFriendID(), qt_msg);
|
||||
|
||||
auto* offMsgEngine = getOfflineMsgEngine();
|
||||
Nexus::getProfile()->getHistory()->addNewMessage(f->getToxId().publicKey, qt_msg_hist,
|
||||
Core::getInstance()->getSelfId().publicKey, timestamp, status, Core::getInstance()->getUsername(),
|
||||
[offMsgEngine,rec,ma](int64_t id)
|
||||
|
||||
Profile* profile = Nexus::getProfile();
|
||||
if (profile->isHistoryEnabled())
|
||||
{
|
||||
offMsgEngine->registerReceipt(rec, id, ma);
|
||||
});
|
||||
auto* offMsgEngine = getOfflineMsgEngine();
|
||||
profile->getHistory()->addNewMessage(f->getToxId().publicKey, qt_msg_hist,
|
||||
Core::getInstance()->getSelfId().publicKey, timestamp, status, Core::getInstance()->getUsername(),
|
||||
[offMsgEngine,rec,ma](int64_t id)
|
||||
{
|
||||
offMsgEngine->registerReceipt(rec, id, ma);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
/// TODO: Make faux-offline messaging work partially with the history disabled
|
||||
ma->markAsSent(QDateTime::currentDateTime());
|
||||
}
|
||||
|
||||
msgEdit->setLastMessage(msg); //set last message only when sending it
|
||||
|
||||
|
|
|
@ -1080,7 +1080,9 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message, bool
|
|||
QDateTime timestamp = QDateTime::currentDateTime();
|
||||
f->getChatForm()->addMessage(f->getToxId(), message, isAction, timestamp, true);
|
||||
|
||||
Nexus::getProfile()->getHistory()->addNewMessage(f->getToxId().publicKey, isAction ? "/me " + f->getDisplayedName() + " " + message : message,
|
||||
Profile* profile = Nexus::getProfile();
|
||||
if (profile->isHistoryEnabled())
|
||||
profile->getHistory()->addNewMessage(f->getToxId().publicKey, isAction ? "/me " + f->getDisplayedName() + " " + message : message,
|
||||
f->getToxId().publicKey, timestamp, true, f->getDisplayedName());
|
||||
|
||||
newFriendMessageAlert(friendId);
|
||||
|
|
Loading…
Reference in New Issue
Block a user