1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr815'

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-19 22:28:54 +01:00
commit ec20eef3e3
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 8 additions and 7 deletions

View File

@ -122,7 +122,7 @@ HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
if (idCur != idMax)
{
QString cmd = QString("INSERT INTO sent_status (id, status) VALUES (%1, 1)").arg(idMax);
QString cmd = QString("INSERT INTO sent_status (id, status) VALUES (%1, 1);").arg(idMax);
db->exec(cmd);
}
}
@ -147,12 +147,12 @@ int HistoryKeeper::addChatEntry(const QString& chat, const QString& message, con
int chat_id = getChatID(chat, ctSingle).first;
int sender_id = getAliasID(sender);
db->exec("BEGIN TRANSACTION");
db->exec(QString("INSERT INTO history (timestamp, chat_id, sender, message)") +
db->exec("BEGIN TRANSACTION;");
db->exec(QString("INSERT INTO history (timestamp, chat_id, sender, message) ") +
QString("VALUES (%1, %2, %3, '%4');")
.arg(dt.toMSecsSinceEpoch()).arg(chat_id).arg(sender_id).arg(wrapMessage(message)));
db->exec(QString("INSERT INTO sent_status (status) VALUES (%1)").arg(isSent));
db->exec("COMMIT TRANSACTION");
db->exec(QString("INSERT INTO sent_status (status) VALUES (%1);").arg(isSent));
db->exec("COMMIT TRANSACTION;");
messageID++;
return messageID;

View File

@ -743,8 +743,9 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
}
// Show each messages
MessageActionPtr ca = genMessageActionAction(ToxID::fromString(it.sender), it.message, false, msgDateTime);
if (it.isSent)
ToxID msgSender = ToxID::fromString(it.sender);
MessageActionPtr ca = genMessageActionAction(msgSender, it.message, false, msgDateTime);
if (it.isSent || !msgSender.isMine())
{
ca->markAsSent();
} else {