diff options
author | June McEnroe <june@causal.agency> | 2020-01-01 17:05:46 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-01-01 17:06:00 -0500 |
commit | fe029d311ef1abc6eba314930cbfbf71a48f1f13 (patch) | |
tree | 77ab05116dc3f8d130fd536c47aa6f18992b8dd6 | |
parent | Factor out hashing function (diff) | |
download | litterbox-fe029d311ef1abc6eba314930cbfbf71a48f1f13.tar.gz litterbox-fe029d311ef1abc6eba314930cbfbf71a48f1f13.zip |
Don't special case user being * in queries
It's a side-effect of imports that shouldn't surface elsewhere. Would be nice to have unscoop figure out how it can eliminate using * in more places.
-rw-r--r-- | litterbox.c | 14 | ||||
-rw-r--r-- | scoop.c | 5 |
2 files changed, 6 insertions, 13 deletions
diff --git a/litterbox.c b/litterbox.c index 88f342e..31d7198 100644 --- a/litterbox.c +++ b/litterbox.c @@ -200,13 +200,10 @@ static void querySearch(struct Message *msg) { WITH results AS ( SELECT contexts.name AS context, - date(events.time) || 'T' || time(events.time) || 'Z' AS time, + strftime('%Y-%m-%dT%H:%M:%SZ', events.time) AS time, events.type, names.nick, - CASE WHEN names.user = '*' - THEN names.nick - ELSE names.user - END, + names.user, events.target, highlight(search, 6, :bold, :bold), events.event @@ -217,10 +214,11 @@ static void querySearch(struct Message *msg) { WHERE contexts.network = :network AND coalesce(contexts.query = :query, true) AND search MATCH :search - ORDER BY events.time DESC, events.event DESC + ORDER BY time DESC, event DESC LIMIT :limit ) - SELECT * FROM results ORDER BY context, time, event; + SELECT * FROM results + ORDER BY time, event; ); dbPersist(&stmt, sql); dbBindText(stmt, ":bold", "\2"); @@ -229,8 +227,6 @@ static void querySearch(struct Message *msg) { dbBindText(stmt, ":network", network); if (searchQuery == Public) { dbBindInt(stmt, ":query", false); - } else { - dbBindNull(stmt, ":query"); } dbBindText(stmt, ":search", msg->params[1]); diff --git a/scoop.c b/scoop.c index 6caafe9..0bf3230 100644 --- a/scoop.c +++ b/scoop.c @@ -179,10 +179,7 @@ static const char *Inner = SQL( strftime(coalesce(:format, '%Y-%m-%dT%H:%M:%SZ'), events.time) AS time, events.type, names.nick, - CASE WHEN names.user = '*' - THEN names.nick - ELSE names.user - END, + names.user, names.host, events.target, highlight(search, 6, :open, :close), |