mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
db: actually display the last 10 entries in correct order
This commit is contained in:
parent
015c5d83d0
commit
fb4f82b82c
@ -212,7 +212,7 @@ log_database_get_previous_chat(const gchar *const contact_barejid)
|
|||||||
sqlite3_stmt *stmt = NULL;
|
sqlite3_stmt *stmt = NULL;
|
||||||
char *query;
|
char *query;
|
||||||
|
|
||||||
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) {
|
if (asprintf(&query, "SELECT * FROM (SELECT `message`, `timestamp`, `from_jid` from `ChatLogs` WHERE `from_jid` = '%s' OR `to_jid` = '%s' ORDER BY `timestamp` DESC LIMIT 10) ORDER BY `timestamp` ASC;", contact_barejid, contact_barejid) == -1) {
|
||||||
log_error("log_database_get_previous_chat(): SQL query. could not allocate memory");
|
log_error("log_database_get_previous_chat(): SQL query. could not allocate memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user