Commit graph

346 commits

Author SHA1 Message Date
Simon Ser
30a345298f Handle JOIN/PART in State.handleMessage 2021-06-04 18:53:06 +02:00
Simon Ser
2af58f8d0b Move createBuffer to State 2021-06-04 18:37:34 +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
4d988cafeb Move some state utilities to state.js 2021-06-04 18:03:03 +02:00
Simon Ser
791b742684 Allow config.server.ping to be a String
Workaround for existing config files in the wild.
2021-06-04 17:50:49 +02:00
Simon Ser
6e20ad872e Add support for STATUSMSG
Closes: https://todo.sr.ht/~emersion/gamja/65
2021-06-03 13:31:43 +02:00
Simon Ser
3b5b693403 Use bufName in addMessage, fix missing Client.isMyNick() 2021-06-03 13:29:32 +02:00
Simon Ser
283f8af4b1 lib/irc: rename IRC prefix utilities 2021-06-03 13:18:28 +02:00
Simon Ser
04c9f0211a Fix undefined server variable in BufferHeader 2021-06-03 13:10:44 +02:00
Simon Ser
fe9c483570 s/network/server/
Closes: https://todo.sr.ht/~emersion/gamja/46
2021-06-03 11:46:50 +02:00
Simon Ser
63a71e5f5d Add support for incoming INVITE messages 2021-06-03 11:04:32 +02:00
Simon Ser
a4294975a2 Add support for /ban without argument 2021-06-03 10:19:09 +02:00
Simon Ser
5004f6c89c components/help: document that / allows to start writing a command 2021-06-02 22:53:28 +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
Tom Lebreux
0bcd044f10 Linkify channel names 2021-06-01 09:37:35 +02:00
Simon Ser
958b6bf120 Set enterkeyhint in composer 2021-05-31 18:16:49 +02:00
Simon Ser
8c02cdc094 Hide server URL input if set in config or query
Closes: https://todo.sr.ht/~emersion/gamja/52
2021-05-31 18:13:44 +02:00
Simon Ser
04932317f6 Populate server URL in fillConnectParams 2021-05-31 18:11:33 +02:00
Simon Ser
4fff2b1b8d Unify connect params keys 2021-05-31 18:04:02 +02:00
Simon Ser
c632ef4339 Don't save default username/realname in local storage 2021-05-31 17:57:17 +02:00
Simon Ser
bc7162ebe2 Pretty-print buffer name in buffer header 2021-05-31 17:39:37 +02:00
Simon Ser
6e16163103 Re-fold HTML in BufferList 2021-05-31 17:34:36 +02:00
Simon Ser
ced63b0abc Print server status in header prior to RPL_MYINFO 2021-05-31 17:30:45 +02:00
Simon Ser
619f1db08f Introduce Client.who 2021-05-31 17:11:42 +02:00
Simon Ser
e271a3cd0e Add /who 2021-05-31 17:02:56 +02:00
Simon Ser
14dbb60aec Fix null membership on JOIN 2021-05-31 16:08:33 +02:00
Drew DeVault
be1ecf607d Display prefixes in member list
Closes: https://todo.sr.ht/~emersion/gamja/43
2021-05-31 15:56:08 +02:00
Simon Ser
2c1e4b7bea Fix commas in folded NICK messages 2021-05-31 14:08:30 +02:00
Simon Ser
ab11af3965 Init App.config 2021-05-31 12:26:57 +02:00
Simon Ser
b3d825c9d1 Hide composer when disconnected from server 2021-05-31 12:04:54 +02:00
Simon Ser
b0671fe336 Group folded events by type 2021-05-31 10:35:34 +02:00
Simon Ser
ce239e5785 Improve FoldGroup key and shouldComponentUpdate 2021-05-31 10:35:34 +02:00
Simon Ser
8b20b463ff Display last event time when folding messages 2021-05-31 10:35:34 +02:00
Simon Ser
2bc89a6655 Filter out PART → JOIN pairs 2021-05-31 10:35:34 +02:00
Simon Ser
64674bdd9f Fold unimportant messages together 2021-05-31 10:35:34 +02:00
Simon Ser
e080e87cb7 Pretty-print MOTD 2021-05-28 10:50:42 +02:00
Simon Ser
99ac0151a5 Use Client.isMyNick in NOTICE/PRIVMSG handling 2021-05-28 10:24:40 +02:00
Simon Ser
7b762b3e8a Unregister PING timer when destroying client 2021-05-28 09:58:06 +02:00
Drew DeVault
6491f7e915 composer: turn off browser autocomplete 2021-05-28 08:53:37 +02:00
Simon Ser
fc9dfa2dca Implement case-mapping for buffers and message handler 2021-05-27 23:40:08 +02:00
Simon Ser
06f7651bef Ignore TAGMSG messages
We get these from clients that support typing notifications, for
instance.
2021-05-27 21:58:37 +02:00
Drew DeVault
258b0b0a3c Restyle action buttons 2021-05-27 21:45:41 +02:00
Simon Ser
9567d56f53 Switch to channel buffer on /join
Closes: https://todo.sr.ht/~emersion/gamja/37
2021-05-27 19:10:42 +02:00
Drew DeVault
64900fbe80 Implement togglable sidebars for narrow viewports
Closed: https://l.sr.ht/96AD.jpg
Open:   https://l.sr.ht/gr_9.jpg
2021-05-27 19:00:11 +02:00
Drew DeVault
d612c91016 Implement optional opportunistic pings 2021-05-27 18:31:04 +02:00
Drew DeVault
a0c85c3372 Handle incoming MODE messages in appropriate buffer 2021-05-27 18:01:58 +02:00
Simon Ser
f36bba897e Fix cross-network mixups when handling QUIT and NICK
Only mutate buffers if they belong to our connection.
2021-05-27 15:19:28 +02:00
Simon Ser
b2cdab86aa Add case-mapping support for channel members
Make a buffer's members an irc.CaseMapMap.
2021-05-27 15:17:18 +02:00
Simon Ser
d880b23d32 Add hint to run /help in unknown command error message 2021-05-27 12:55:28 +02:00
Simon Ser
45c12fb684 Add nick URL param
Closes: https://todo.sr.ht/~emersion/gamja/40
2021-05-27 12:32:22 +02:00
Simon Ser
fa80817168 Accomodate for empty BOUNCER host
BOUNCER doesn't support describing UNIX domain socket connections.
2021-05-27 11:51:29 +02:00
Simon Ser
071c2626d5 Open error bubbles for IRC numeric errors 2021-05-27 11:34:23 +02:00
Simon Ser
b8c4bb3112 Improve command error reporting
state.error is expected to be a String, not an Error.
2021-05-27 11:26:42 +02:00
Drew DeVault
d34bff9ed6 Implement /kick and KICK handling in buffers 2021-05-27 10:58:57 +02:00
Simon Ser
08678ba57e Always parse autojoin channels from URL params
Even if connection parameters were previously saved to local storage.
2021-05-27 10:36:03 +02:00
Simon Ser
ac5bbafdc3 Fix config.json relative path
The path should be relative to index.html, not the JS file.
2021-05-26 23:17:23 +02:00
Simon Ser
17cd38f0b9 Read auto-join channels from browser URL hash
This is easier to type than trying to escape the # in ?channels=#XXX.
2021-05-26 22:57:49 +02:00
Simon Ser
695b02caaa Introduce store helper
Responsible for serializing/deserializing data to be saved in
localStorage. Add a prefix to all localStorage entries to avoid
conflicts with other webapps. Stop guarding against localStorage
not existing, browsers can just implement a dumb interface to
disable it.
2021-05-26 18:43:11 +02:00
Simon Ser
12a38ace90 Add support for IRCv3 setname 2021-05-25 20:22:21 +02:00
Simon Ser
92535fae24 Ignore BOUNCER NETWORK messages if we're already bound to a network 2021-05-25 17:11:06 +02:00
Simon Ser
1b21f5f076 Display bouncer network status 2021-05-25 17:01:57 +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
94fba920cd Fix close() for bouncer networks 2021-05-25 17:01:18 +02:00
Simon Ser
11642e1ab4 Add UI to edit/delete a network 2021-05-25 16:59:59 +02:00
Simon Ser
f84334c31e Add UI to add a new bouncer network 2021-05-25 16:59:57 +02:00
Simon Ser
4c62b7571e Indent channels and nicks in buffer list 2021-05-25 16:58:50 +02:00
Simon Ser
b429243573 Add support for the soju.im/bouncer-networks extension 2021-05-25 16:58:50 +02:00
Simon Ser
982a945932 Fix TypeError in handleBufferScrollTop
Fixes the following:

    TypeError: client is undefined
2021-05-25 14:28:48 +02:00
Simon Ser
ed92c3c61a Clear local storage when clicking "Disconnect" 2021-05-25 12:57:40 +02:00
Simon Ser
07c10b3b1f Only switch to autojoin channel once 2021-05-25 12:40:33 +02:00
Simon Ser
d261886199 Add support for config file
Closes: https://todo.sr.ht/~emersion/gamja/20
2021-05-25 12:33:22 +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
e242d5222e Fix TypeError in App.render()
Fixes the following error:

    Uncaught (in promise) TypeError: activeBuffer is undefined
2021-05-10 15:09:49 +02:00
Simon Ser
727331c859 Remove client from map on disconnect 2021-03-10 11:01:04 +01:00
Simon Ser
4991518ed5 Display error popup on FAIL 2021-03-09 21:48:04 +01:00
Simon Ser
97e75805fa Add some space between error message and close button 2021-03-09 21:47:39 +01:00
Simon Ser
88c0e5ae94 Break long tag attributes on multiple lines
Makes that stuff more readable.
2021-03-09 18:11:59 +01:00
Simon Ser
4257463b46 Rename Connect/Join to ConnectForm/JoinForm 2021-03-09 13:25:31 +01:00
Simon Ser
c83a74cc50 Cleanup compareBuffers 2021-03-09 12:04:12 +01:00
Simon Ser
56e705b6de Only switch buffer on connect if there's no active buffer 2021-03-09 09:38:55 +01:00
Simon Ser
bf30038b41 Fix whitespace issues 2021-03-09 09:17:01 +01:00
Simon Ser
7139e4511b Remove unused DEFAULT_NETWORK constant 2021-03-08 17:34:00 +01:00
Simon Ser
78f22fce4e Add help section for commands 2021-03-08 17:25:00 +01:00
Simon Ser
17a2d48b2e Add help dialog with keybindings reference 2021-03-08 17:05:48 +01:00
Simon Ser
30157383e8 Add dialog for join form 2021-03-08 16:23:16 +01:00
Simon Ser
996d7d06d4 Extract error message popup 2021-03-08 15:05:43 +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
3ece5f1ca5 Fix buffer not removed in close() 2021-03-03 09:59:40 +01:00
Simon Ser
72977b30b4 Log errors to console on command failure 2021-03-03 09:56:23 +01:00
Simon Ser
eaf3b0a5ac Fix TypeError when clicking on nick in buffer 2021-03-03 09:41:19 +01:00
Simon Ser
80e0175d36 Make all resource paths relative
Closes: https://todo.sr.ht/~emersion/gamja/17
2021-03-02 22:46:48 +01:00
Simon Ser
a5608a40d5 Fix server URL field not auto-populated 2021-03-02 22:46:15 +01:00
Simon Ser
525df515bc Fix messages in current buffer not marked as read 2021-03-02 21:29:13 +01:00
Simon Ser
a83d3f7425 Improve scroll position save/restore mechanism 2021-03-02 20:48:49 +01:00
Simon Ser
6c40561f61 Move join button to buffer header 2021-03-02 16:14:55 +01:00
Simon Ser
4d540d55ac Fix undefined CHATHISTORY_PAGE_SIZE 2021-01-23 12:19:40 +01:00
Simon Ser
bfc0960200 Use buffer ID in BufferItem.onBufferClick 2021-01-22 21:43:58 +01:00
Simon Ser
0e078932c0 Harmonise client connection params 2021-01-22 21:00:39 +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
2f70256037 Multiple clients per app 2021-01-22 17:36:53 +01:00
Simon Ser
95daea0ef7 Use buffer IDs in endOfHistory 2021-01-22 15:49:22 +01:00
Simon Ser
df2b46175a Fix composer not hidden in server buffer 2021-01-22 12:05:45 +01:00
Simon Ser
e6592d7d8b Print current connection status 2021-01-22 11:53:17 +01:00
Simon Ser
51523f4014 Extract network name from ISUPPORT 2021-01-22 11:43:47 +01:00
Simon Ser
b3f8b0c97d Add support for RPL_ISUPPORT 2021-01-22 11:34:04 +01:00
Simon Ser
4acacc1f22 Nuke DEFAULT_NETWORK 2021-01-22 10:49:08 +01:00
Simon Ser
6cb2dd59de Remove network from map when closing 2021-01-22 10:41:28 +01:00
Simon Ser
3975467764 Drop state.activeNetwork
Just grab it from state.activeBuffer's network.
2021-01-22 10:38:07 +01:00
Simon Ser
d2ff88d946 Sort buffers by network 2021-01-22 10:37:58 +01:00
Simon Ser
002b91a599 Take buffer ID in close 2021-01-22 10:26:53 +01:00
Simon Ser
ffed801b0e Take a buffer ID in switchBuffer 2021-01-21 22:15:33 +01:00
Simon Ser
dd35f1df95 Take a buffer ID in getBuffer 2021-01-21 22:02:53 +01:00
Simon Ser
50ea6e121e Introduce buffer IDs 2021-01-21 20:41:44 +01:00
Simon Ser
abc2fbcfb1 Add network to buffer state 2021-01-21 19:27:04 +01:00
Simon Ser
5a1e6ba813 Introduce state.networks 2021-01-21 19:01:50 +01:00
Simon Ser
f35f316577
Add disconnect/reconnect commands 2021-01-12 10:35:38 +01:00
Simon Ser
4b165054a4
Reconnect when loosing connection 2021-01-11 18:12:28 +01:00
Simon Ser
57ca2c44ad
Add unread message separator
Closes: https://todo.sr.ht/~emersion/gamja/4
2020-09-03 11:51:52 +02:00
Simon Ser
0b03f9d767
Ignore RPL_TOPICWHOTIME
We don't need this piece of information yet, and we don't want to
clutter the server buffer with channel messages.
2020-09-03 11:36:08 +02:00
Simon Ser
b23f55a840
Format NOTICE messages differently
Use dashes instead of angle brackets for NOTICE to be able to tell them
apart from regular PRIVMSG messages.
2020-08-17 15:08:37 +02:00
Simon Ser
0f2d1c3e71
Add date separators to buffer
Closes: https://todo.sr.ht/~emersion/gamja/5
2020-08-13 19:00:56 +02:00
Simon Ser
bce216b7fb
Parse all CTCP messages
We display them nicely, however we never reply to them.
2020-08-13 16:04:39 +02:00
Simon Ser
028382aab3
Strip ANSI sequences from notifications text 2020-08-13 15:38:12 +02:00
Simon Ser
8fa91f7c4a
Don't send CHATHISTORY command if server doesn't support it 2020-08-13 12:18:52 +02:00
Simon Ser
9cc44fbe98
Display messages with a highlight differently 2020-08-13 12:02:05 +02:00
Simon Ser
917b348992
lib/irc: make isHighlight operate on messages
Makes it easier to re-use elsewhere.
2020-08-13 11:44:41 +02:00
Simon Ser
c6c3c66fc4
Clear error when submitting connect form 2020-08-10 14:57:54 +02:00
bbworld1
16582a6592
Add error reporting on connect and main page 2020-08-08 10:34:45 +02:00
Simon Ser
96c890f1f5
Strip ANSI escape sequences
References: https://todo.sr.ht/~emersion/gamja/11
2020-08-04 14:25:05 +02:00
Simon Ser
b37dfb77fe
Fix inverted channel list sorting 2020-08-04 13:47:27 +02:00
Simon Ser
0157dd4cc6
Handle RPL_NOTOPIC 2020-08-03 18:59:54 +02:00
Simon Ser
6c93bd13d1
Sort buffers when inserting, not when rendering
This allows all state.buffers users to iterate over the list in the
correct order.
2020-08-03 15:43:20 +02:00
Simon Ser
ee8b40aae4
Fix wrong variable name App.close 2020-08-03 15:29:21 +02:00
Simon Ser
2951c7810f
Add keybinding infrastructure 2020-07-23 10:06:12 +02:00
Simon Ser
0d9f7f35f0
Add message URLs, unify URL generation 2020-07-15 18:47:33 +02:00
Simon Ser
36df984b09
Fetch all unread messages on reconnect 2020-07-15 18:21:09 +02:00
Simon Ser
a44ee8d170
Avoid sending multiple CHATHISTORY commands in parallel 2020-07-13 17:40:52 +02:00
Simon Ser
897e0977e2
Autocomplete commands 2020-07-13 17:28:49 +02:00
Simon Ser
476c135379
Extract commands to separate file 2020-07-13 17:22:24 +02:00
Simon Ser
9312edc20e
Linkify topic 2020-07-13 13:00:49 +02:00
Simon Ser
343455091c
Show offline user status
When the WHO reply is empty, it means user isn't connected to IRC.
2020-07-13 12:55:39 +02:00
Simon Ser
f284468aa6
Add shouldComponentUpdate to member list 2020-07-13 11:09:16 +02:00
Simon Ser
b40fc76e82
Use strict equality comparison in shouldComponentUpdate 2020-07-13 11:03:34 +02:00
Simon Ser
2941dc0076
Fix TypeError in Composer.focus
Uncaught (in promise) TypeError: this.textInput.current is null
2020-07-13 09:45:30 +02:00
Simon Ser
c9b07efc9c
Implement chathistory support 2020-07-10 14:37:38 +02:00
Simon Ser
8809fdcd6a
Optimize Buffer
Convert to classes and implement shouldComponentUpdate to avoid
re-rendering elements unnecessarily.
2020-07-09 23:36:03 +02:00
Simon Ser
0a825547a7
Don't use this in functional components
This works in preact, but doesn't with react.
2020-07-09 23:35:47 +02:00
Simon Ser
5cb38a9830
Implement /topic command 2020-07-09 17:36:28 +02:00
Simon Ser
44b1f28cb6
Handle QUIT messages 2020-07-08 18:39:24 +02:00
Simon Ser
c309d3cff6
Allow paths in server URL query param 2020-07-01 12:25:57 +02:00
Simon Ser
db13f34a40
Reply to PING 2020-07-01 12:12:56 +02:00
Simon Ser
1131ca05ee
Only nag about notifications in server buffer 2020-07-01 11:58:30 +02:00
Simon Ser
2eb1ed3dd2
Fix RPL_NAMREPLY handling with multiple nicks 2020-06-30 10:27:24 +02:00
Simon Ser
99004165f2
Print IRC error messages in red 2020-06-29 14:29:31 +02:00
Simon Ser
20be67503b
Add basic autocompletion 2020-06-29 12:36:17 +02:00
Simon Ser
2f284f183a
Open notification on new highlight 2020-06-29 11:50:42 +02:00
Simon Ser
abece1e3fd
Detect highlights 2020-06-29 11:08:47 +02:00
Simon Ser
b74fb90d47
Add button to join new channel 2020-06-29 10:12:46 +02:00
Simon Ser
73f14f38fa
Add key attr to log lines 2020-06-28 15:13:06 +02:00
Simon Ser
d1663315e3
Add reason arg to /part 2020-06-28 09:32:03 +02:00
Simon Ser
59b98d38ac
Implement /me 2020-06-28 09:29:39 +02:00
Simon Ser
15c51d9ec7
Rename sidebar and topbar 2020-06-26 15:16:07 +02:00
Simon Ser
1b0ac4339f
Listen to input evbent in composer
Avoids having the pending text removed when re-rendering the component.
2020-06-26 14:57:34 +02:00
Simon Ser
0aa8cca483
Enable echo-message 2020-06-26 14:50:29 +02:00
Simon Ser
9d7704ea54
Set key attr in buffer list items 2020-06-26 14:41:03 +02:00
Simon Ser
028c6fd8b3
Sort buffers and members 2020-06-26 14:40:27 +02:00
Simon Ser
806686bd49
Add member list 2020-06-26 14:32:56 +02:00
Simon Ser
0bd2e10631
Add away indicator 2020-06-26 12:45:27 +02:00
Simon Ser
1807f29d2d
Parse RPL_MYINFO 2020-06-26 12:08:14 +02:00
Simon Ser
57ed3a13a3
Send WHO query when opening nick buffer 2020-06-26 12:00:10 +02:00
Simon Ser
74b720c131
Convert server/channel/nick links to irc:// scheme 2020-06-26 11:07:01 +02:00
Simon Ser
6d3621e1be
Introduce buffer type 2020-06-26 10:35:38 +02:00
Simon Ser
5f30662fc0
Implement /buffer 2020-06-25 21:47:31 +02:00
Simon Ser
7a1d9c48cc
Fix unclickable nick in NICK message 2020-06-25 21:28:04 +02:00
Simon Ser
c05af5bb6d
Make nick links clickable 2020-06-25 18:45:41 +02:00
Simon Ser
4485950b67
Add missing buffer-header.js 2020-06-25 18:30:21 +02:00
Simon Ser
3e33999619
Add buffer header
Only for channels for now
2020-06-25 18:28:54 +02:00
Simon Ser
2bb8f68f6f
Linkify messages 2020-06-25 17:27:24 +02:00
Simon Ser
78002c22ee
Fix buffer and buffer list padding 2020-06-25 14:26:33 +02:00
Simon Ser
a475b6d844
Hide CAP and AUTHENTICATE messages in server buffer 2020-06-25 12:16:42 +02:00
Simon Ser
544303923c
Save and restore buffer scroll position 2020-06-25 12:03:26 +02:00
Simon Ser
9692f97c11
Set default connect params in App constructor
Fixes default params not populated in Connect component.
2020-06-24 18:14:46 +02:00
Simon Ser
34baafc77f
Fix TypeError when auto-filling server URL 2020-06-24 17:52:24 +02:00
Simon Ser
80fee31f2c
Fix unread indicator not showing up 2020-06-24 17:46:43 +02:00
Simon Ser
9223953e3a
Store message date in addMessage 2020-06-24 17:16:49 +02:00
Simon Ser
cbe76ab824
Mark buffers as unread on new message 2020-06-24 16:56:57 +02:00
Simon Ser
9ff1f164e0
Make setBufferState merge the new state with the prev one 2020-06-24 16:02:56 +02:00
Simon Ser
250d1c2ea7
Remove disconnect() 2020-06-24 15:57:21 +02:00
Simon Ser
c1c9aa261e
Implement /close 2020-06-24 15:56:30 +02:00
Simon Ser
df0981e8e0
Add isChannel 2020-06-24 15:52:33 +02:00
Simon Ser
f5106f1357
Fix missing channel name in setBufferState call 2020-06-24 15:45:55 +02:00
Simon Ser
61b0425128
Reset buffers on disconnect 2020-06-24 15:27:29 +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