diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-04-06 19:05:23 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-04-06 19:15:06 +0200 |
commit | 015c5d83d02c2e9300ac799671fb4a237fe37751 (patch) | |
tree | 97ff5c85192ec11e1c48ae25c1ceff06b6aa698b /src/database.c | |
parent | 3b2976c9cb740c5cbd45547e26e725f2bae847a2 (diff) | |
download | profani-tty-015c5d83d02c2e9300ac799671fb4a237fe37751.tar.gz |
db: get last messages sorted by timestamp
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c index e3026ea1..340f59b2 100644 --- a/src/database.c +++ b/src/database.c @@ -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; } |