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:
parent
3b2976c9cb
commit
015c5d83d0
@ -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 `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");
|
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