TS type assertions need to be avoided.
The following trivial example demonstrates why
```
type Person = {
name: string;
isBad: boolean;
};
function makePerson(): Person {
const p: Person = {name: 'whatever'} as Person
p.isBad = false
return p // theoretically we are now good, p is a Person
}
```
Should the type ever change though, TS will happily trot along
```
type Person = {
name: string;
isBad: boolean;
omgHowCouldYou: number;
};
function makePerson(): Person {
const p: Person = {name: 'whatever'} as Person
p.isBad = true
return p // p is *not* a Person, omgHowCouldYou is missing
}
```
But we pinky swore to the compiler that p is in fact a Person.
In other words, the types are now wrong and you will fail during
runtime.
Offset is eventually passed to sqlite as an OFFSET clause.
This works as follows:
sqlite> select num from seq limit 5 offset 0;
┌─────┐
│ num │
├─────┤
│ 1 │
│ 2 │
│ 3 │
│ 4 │
│ 5 │
└─────┘
sqlite> select num from seq limit 5 offset 5;
┌─────┐
│ num │
├─────┤
│ 6 │
│ 7 │
│ 8 │
│ 9 │
│ 10 │
└─────┘
However, the code currently emits a request for offset + 1, which ends
up skipping a message
sqlite> select num from seq limit 5 offset 5+1;
┌─────┐
│ num │
├─────┤
│ 7 │
│ 8 │
│ 9 │
│ 10 │
│ 11 │
└─────┘
Nachtalb put some infra in place that was never actually working.
It errors out when a user clicks on a message.
Remove the offending code, but keep it all in place so that we
can improve on it.
When we hit doSearch, we always reset the offset value to 0,
meaning we always hit the conditional (!0) and always set the
messageSearchInProgress flag to undefined.
This is wrong, we do want to set this flag when we initiate a search.
Currently the realname is set to an advertisement if it isn't explicitly
set by the user.
Some clients started to show the realname as a display name in their
UI, which makes this tedious as you'll end up with gazillion "The Lounge
User" entries.
To avoid this, set the realname to the nick on first connect, so that
it is useful.
Note that this isn't done on nick changes, but only on the initial
connect step.
Fixes: https://github.com/thelounge/thelounge/issues/4527
When a URL is prefixed with a TLS scheme, we should make sure
that the remote provides a valid cert, even just for prefetches.
Else MITM of such a site is trivial.
This probably breaks some people with self signed cert, but the
age where that was acceptable is past. We have free CAs now like
Let's Encrypt.
Make `thelounge install file:~/path/to/package` work rather than
erroring out that the folder doesn't exists.
Probably funny on Windows, but it doesn't hurt either
The message was ordered the wrong way in the TS rewrite.
Old:
+bookworm sent a CTCP request: "chadler" to version
New:
+bookworm sent a CTCP request: "version" to chadler
Our regex escape function escapes proper regexes, however
it isn't meant to be shoved into a char class via string interpolation.
We need to also escape '-' if we do so.