1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

db: get last messages sorted by timestamp

This commit is contained in:
Michael Vetter 2020-04-06 19:05:23 +02:00
parent 3b2976c9cb
commit 015c5d83d0

View File

@ -212,7 +212,7 @@ log_database_get_previous_chat(const gchar *const contact_barejid)
sqlite3_stmt *stmt = NULL;
char *query;
if (asprintf(&query, "SELECT `message`, `timestamp`, `from_jid` from `ChatLogs` WHERE `from_jid` = '%s' OR `to_jid` = '%s' ORDER BY `id` ASC LIMIT 10", contact_barejid, contact_barejid) == -1) {
if (asprintf(&query, "SELECT `message`, `timestamp`, `from_jid` from `ChatLogs` WHERE `from_jid` = '%s' OR `to_jid` = '%s' ORDER BY `timestamp` ASC LIMIT 10", contact_barejid, contact_barejid) == -1) {
log_error("log_database_get_previous_chat(): SQL query. could not allocate memory");
return NULL;
}