Commit graph

110 commits

Author SHA1 Message Date
Simon Ser
51883292f9 lib/client: fix caps with equal sign in value
CAP=a=b wouldn't parse correctly.
2021-07-04 22:26:31 +02:00
Simon Ser
c187eac3c8 lib/client: reject Client.roundtrip promise on disconnect 2021-06-21 00:18:17 +02:00
Simon Ser
02ba4be438 Don't try to reconnect if the network is down 2021-06-11 09:36:11 +02:00
Simon Ser
8972130252 s/var/let/ 2021-06-10 18:11:11 +02:00
Simon Ser
a952742d86 Make Client.roundtripChatHistory return an array of messages 2021-06-10 12:47:28 +02:00
Simon Ser
5b0bb43a24 Make Client.fetchBatch more reliable 2021-06-10 12:43:09 +02:00
Simon Ser
ba92b3f677 lib/client: fix batch cleanup 2021-06-10 12:10:08 +02:00
Simon Ser
dd8eca1cfe Switch to server buffer on server name click
Closes: https://todo.sr.ht/~emersion/gamja/68
2021-06-10 12:03:50 +02:00
Simon Ser
d2e41666ad lib/client: set a default server prefix
Set the default server prefix to "*". This allows the rest of the
code to assume all messages always have a prefix.
2021-06-10 11:53:53 +02:00
Simon Ser
41354d3035 lib/client: gracefully handle null in isMyNick/isChannel 2021-06-10 08:51:59 +02:00
Simon Ser
0705f4b182 lib/client: always populate prefix for incoming messages 2021-06-10 08:49:17 +02:00
Simon Ser
0dfb7623db Add support for labeled-response
It's just used to avoid mixing up messages coming from the server
so far.
2021-06-04 20:38:01 +02:00
Simon Ser
34078d5da7 Add support for draft/event-playback 2021-06-04 19:45:51 +02:00
Simon Ser
651e255ddb Use ISUPPORT CHANTYPES in Client.isChannel 2021-06-04 19:17:39 +02:00
Simon Ser
2c1bb4ce6a Introduce State.handleMessage
Takes an IRC message, updates the state.

Doesn't yet handle all messages, this will be a step-by-step process.
2021-06-04 18:27:21 +02:00
Simon Ser
63a71e5f5d Add support for incoming INVITE messages 2021-06-03 11:04:32 +02:00
Simon Ser
91208a6d47 Add support for CHATHISTORY TARGETS
The main motivation is to avoid missing direct messages coming from
other users.

A nice side-effect is that we no longer need to issue CHATHISTORY
queries for each channel we JOIN: instead, we can only fetch
history for targets known to have new messages available (as indicated
by CHATHISTORY TARGETS).

We use read receipts instead of delivery receipts, so that reloading
the webapp restores the exact same state (ie, unread messages are
re-fetched).

References: https://github.com/ircv3/ircv3-specifications/pull/450
2021-06-02 20:37:20 +02:00
Simon Ser
06ca812d06 Simplify Client.roundtrip callback arg 2021-05-31 17:14:46 +02:00
Simon Ser
619f1db08f Introduce Client.who 2021-05-31 17:11:42 +02:00
Simon Ser
02145b45ad Remove unused arg from Client.whois 2021-05-31 17:04:52 +02:00
Simon Ser
5a3edf4769 Fix WHOIS DB not using case-mapping fallback
In case the server advertises an unsupported case-mapping, we have
a fallback.
2021-05-28 09:59:51 +02:00
Simon Ser
7b762b3e8a Unregister PING timer when destroying client 2021-05-28 09:58:06 +02:00
Simon Ser
24fe62f1de Ensure msg.prefix is always populated 2021-05-28 09:49:21 +02:00
Simon Ser
fc9dfa2dca Implement case-mapping for buffers and message handler 2021-05-27 23:40:08 +02:00
Drew DeVault
121d7ec075 Add /whois command
This also rigs up some helpers in Client for handling the whois
response, which I will use for /ban and /quiet and such shortly.
2021-05-27 23:15:53 +02:00
Simon Ser
615e746ec5 lib/client: add Client.cm
This contains the current connection case-mapping, parsed from the
CASEMAPPING ISUPPORT token.
2021-05-27 15:14:03 +02:00
Simon Ser
1d983bd142 Downgrade IRC network logging to debug level 2021-05-27 10:39:24 +02:00
Simon Ser
12a38ace90 Add support for IRCv3 setname 2021-05-25 20:22:21 +02:00
Simon Ser
9dba1b3736 Add vendor prefix to bouncer-networks BATCH type 2021-05-25 17:03:29 +02:00
Simon Ser
6524dc5dd2 Add support for the soju.im/bouncer-networks-notify cap 2021-05-25 17:01:20 +02:00
Simon Ser
5165df718f Disconnect on BOUNCER BIND error 2021-05-25 16:59:59 +02:00
Simon Ser
b429243573 Add support for the soju.im/bouncer-networks extension 2021-05-25 16:58:50 +02:00
Simon Ser
f122e44e9b Use ISUPPORT CHATHISTORY to discover max page size 2021-05-11 16:10:50 +02:00
Simon Ser
305ffb569c Parse ISUPPORT tokens in client 2021-05-11 16:03:16 +02:00
Simon Ser
5fea13df0a Trigger client error if server doesn't support SASL 2021-03-09 09:44:48 +01:00
Simon Ser
194168c062 Display server messages in server buffer
References: https://todo.sr.ht/~emersion/gamja/21
2021-03-08 14:27:05 +01:00
Simon Ser
6430fa252a lib/client: log close code 2021-03-03 18:30:15 +01:00
Simon Ser
aa79067179 lib/client: extract fetchBatch function from roundtripChatHistory 2021-03-03 14:13:05 +01:00
Simon Ser
3536331f94 lib/client: throw error in send if disconnected 2021-03-03 09:37:26 +01:00
Simon Ser
8a5fa4d5c2 lib/client: reset state when websocket is closed 2021-03-03 09:36:48 +01:00
Simon Ser
b0a3cd23e4 Fix inverted condition in fetchHistoryBefore 2021-01-23 12:23:30 +01:00
Simon Ser
4d540d55ac Fix undefined CHATHISTORY_PAGE_SIZE 2021-01-23 12:19:40 +01:00
Simon Ser
1f640a4010 Log WebSocket constructor error in the console 2021-01-22 20:59:17 +01:00
Simon Ser
987f0b3389 Spread it like butter 2021-01-22 20:58:57 +01:00
Simon Ser
430373dd13 Move chat history operations into Client 2021-01-22 18:51:38 +01:00
Simon Ser
4e1f06b960 Move auto-reconnect logic into Client 2021-01-22 18:44:06 +01:00
Simon Ser
41cd2153cf Keep track of client status in Client 2021-01-22 18:29:22 +01:00
Simon Ser
0261bc11e7 Delay Client error event
Right now the caller won't receive the event, because it's triggered
before the function returns.
2021-01-22 17:50:52 +01:00
Simon Ser
06eb639ee9 Convert caps to lower case 2021-01-22 12:27:32 +01:00
Simon Ser
516de5b3ea
Better handle registration errors 2020-08-25 11:42:40 +02:00
Simon Ser
9df58971ea
Improve SASL error message 2020-08-10 15:01:48 +02:00
bbworld1
16582a6592
Add error reporting on connect and main page 2020-08-08 10:34:45 +02:00
Simon Ser
36df984b09
Fetch all unread messages on reconnect 2020-07-15 18:21:09 +02:00
Simon Ser
c9b07efc9c
Implement chathistory support 2020-07-10 14:37:38 +02:00
Simon Ser
db13f34a40
Reply to PING 2020-07-01 12:12:56 +02:00
Simon Ser
0aa8cca483
Enable echo-message 2020-06-26 14:50:29 +02:00
Simon Ser
0bd2e10631
Add away indicator 2020-06-26 12:45:27 +02:00
Simon Ser
c59a8ff63c
Request caps on CAP NEW 2020-06-26 12:37:45 +02:00
Simon Ser
b449ace4b4
Switch to react
Under the hood, preact is used to reduce dependency size. We still don't
have a build stage, so htm is used instead of JSX.
2020-06-24 14:37:49 +02:00
Simon Ser
62300746d3
Remove assets/ 2020-06-24 11:18:51 +02:00
Renamed from assets/client.js (Browse further)