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

check incoming data from DB

This commit is contained in:
apprb 2014-11-19 22:46:50 +09:00
parent 4d4067cf88
commit 451d0c7999
No known key found for this signature in database
GPG Key ID: B001911B5B22FB9B
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 {