Commit graph

427 commits

Author SHA1 Message Date
jesopo
bc772ef5cc Default IRCParsedLine.tags to empty dict, not None 2019-02-19 15:40:56 +00:00
jesopo
53e5a7fe7e contextualise JOIN key check, otherwise it doesn't send channel_name 2019-02-19 09:32:17 +00:00
jesopo
9f946e236d copy paste fail, batch end should be "-" not "+" 2019-02-19 08:25:25 +00:00
jesopo
81ae0cc889 Add make_batch and send_batch to IRCServer 2019-02-18 23:16:47 +00:00
jesopo
b76b153672 Add batch_start and batch_end to utils.irc.protocol 2019-02-18 23:11:36 +00:00
jesopo
509a7ff42e Default tags to null for utils.irc.protocol's message and notice 2019-02-18 23:06:41 +00:00
jesopo
07cb14d98c utils.irc.protocol.join()'s keys param should be typing.Optional 2019-02-18 23:03:21 +00:00
jesopo
3bb917b619 Add src/utils/irc/__init__.py that should have been added some commits ago 2019-02-18 23:00:50 +00:00
jesopo
cd97a653cc Don't try to use keys if we try to join a channel without any keys 2019-02-18 15:00:05 +00:00
jesopo
186b6b82a2 Shift formatting protocol data to it's own file: utils.irc.protocol 2019-02-18 14:58:27 +00:00
jesopo
d937145f93 Add missing : 2019-02-18 13:54:09 +00:00
jesopo
6da35a899b don't pass around has_arbitrary - we don't need it. 2019-02-18 12:42:52 +00:00
jesopo
cb0314da67 Put a helper function in utils to do iso8601 formatting. change IRCServer's
last-read setting to use it.
2019-02-17 14:15:40 +00:00
jesopo
be495344d4 How did this newline get here 2019-02-17 12:40:31 +00:00
jesopo
716568c21d 'src/IRCServer.capabilities' -> 'src/IRCServer.agreed_capabilities' 2019-02-16 09:12:43 +00:00
jesopo
23b0e58665 Send CAP REQ in 10-item chunks (src/IRCServer.py) 2019-02-16 08:21:42 +00:00
jesopo
ed99d66163 Don't add a space after a formatted tagmsg in _tag_str (src/IRCServer.py) 2019-02-14 21:59:26 +00:00
jesopo
8d97e51bf3 Add IRCServer.send_tagmsg, to send TAGMSG commands 2019-02-14 21:36:59 +00:00
jesopo
708ba2ddc7 Support one-shot event hooks (src/EventManager.py) 2019-02-14 10:36:11 +00:00
jesopo
1136162057 Fix 'Optional[str]!=str' type hinting issue in utils.irc line parsing 2019-02-13 11:00:22 +00:00
jesopo
e1de8cd9be We were just checking if arbitrary was falsey, thus losing empty trailing args
(' :' with nothing after it) (utils.irc)
2019-02-12 20:42:09 +00:00
jesopo
b4092a14ca Also strip \x01 off the start of CTCP commands, if it's there (utils.irc) 2019-02-12 16:49:24 +00:00
jesopo
86bc49a0a1 Only put a ":" on trailing args when it's required 2019-02-12 13:55:57 +00:00
jesopo
01a7c05687 Change arg types of constant_time_compare to typing.AnyStr (utils.security) 2019-02-12 11:59:55 +00:00
jesopo
9667b8a6e0 Move constant-time compare function to utils.security 2019-02-12 11:57:49 +00:00
jesopo
144182868c Upgrade resume.py to draft/resume-0.3 and support sending last-read timestamp 2019-02-12 11:14:36 +00:00
jesopo
8c9626f0a9 Put an strf format for ISO8601 in utils 2019-02-12 11:08:24 +00:00
jesopo
2f5a232c4e Hold on to tags and type for BATCHes 2019-02-11 22:15:12 +00:00
jesopo
b37a50ed7a IRCServer should handle ping_sent, not IRCSocket 2019-02-11 21:23:52 +00:00
jesopo
a8d9365442 last_read/last_send is now handled by IRCSocket.py 2019-02-11 20:49:53 +00:00
jesopo
6c6f1f9c2b socket.getpeername() can return more than 2 values (IRCSocket) 2019-02-11 20:34:15 +00:00
jesopo
137d5b1a58 connected status is now tracked by IRCSockets 2019-02-11 20:34:02 +00:00
jesopo
48fe6b7391 Add IRCSocket.connected_ip to hold on to the IP address we connected to (e.g.
so we know which IP we picked from a round robin DNS)
2019-02-11 16:10:23 +00:00
jesopo
9b44b6cd13 Shift socket.socket related logic to IRCSocket.py 2019-02-11 10:00:41 +00:00
jesopo
b6b7345764 We don't need to send writebuffer.empty event any more (src/IRCServer.py) 2019-02-11 00:00:58 +00:00
jesopo
63dc5009f7 Actually return str object from IRCLine.__str__ 2019-02-10 23:57:38 +00:00
jesopo
1d48f6f19d Add _char_limit return type hint, fix decoded_data return type hint
(src/IRCLine.py)
2019-02-10 23:52:25 +00:00
jesopo
ecb197858e Import IRCServer in IRCLine so type hint comment is valid (src/IRCLine.py) 2019-02-10 23:51:28 +00:00
jesopo
f8e6a55ada Add a comment as to why IRCLine's LINE_CUTOFF is 470, not 510 2019-02-10 22:52:23 +00:00
jesopo
fc5ade7112 Change LINE_CUTOFF to 470, now that we compute max char counts (src/IRCLine.py) 2019-02-10 20:54:12 +00:00
jesopo
bb4ec082dd Let IRCLine.Line handle truncating command output 2019-02-10 20:49:59 +00:00
jesopo
abf5679b68 Parse sent data in IRCServer._send, not IRCServer.send 2019-02-10 20:49:03 +00:00
jesopo
89f035fdcf Add IRCServer.hostmask() to construct our nick!user@host hostmask 2019-02-10 20:44:29 +00:00
jesopo
a3b9be3d3d Shift encoding/truncating IRC lines to src/IRCLine.py 2019-02-10 18:43:04 +00:00
jesopo
bd9eaad0b2 Return truncted data from encode_truncate and hold it in IRCLine.Line 2019-02-10 18:16:19 +00:00
jesopo
7952d4c366 Make use of utils.truncate_encode, to avoid cutting utf8 sequences in half 2019-02-10 16:48:08 +00:00
jesopo
f2c762a2d0 add utils.truncate_encode, to encode and truncate a string while respecting utf8 multi-byte encoding 2019-02-10 16:41:56 +00:00
jesopo
b744281e3d Don't send empty space with JOIN if key=="" (src/IRCServer.py) 2019-02-10 15:02:24 +00:00
jesopo
d62b8c79fd Return IRCLine object from IRCServer.send() (and functions that call .send()) 2019-02-10 14:21:14 +00:00
jesopo
8e03bc66af fix self.batches type hint (src/IRCServer.py) 2019-02-10 14:20:40 +00:00
jesopo
eb00f331e5 IRCLine's data should be bytes 2019-02-10 14:19:43 +00:00
jesopo
4772564115 Add missing src/IRCLine.py file 2019-02-10 14:18:33 +00:00
jesopo
28107292f5 now isn't defined now that throttle code has been separated out (src/IRCServer.py) 2019-02-10 14:12:39 +00:00
jesopo
7792be247c Track lines-to-be-sent up until they're completely sent, queue up more than 1
line at a time in write buffer if we've got space (src/IRCServer.py)
2019-02-10 14:09:27 +00:00
jesopo
7f7941f564 rename, 'IRCLine' -> 'IRCParsedLine' (utils.irc) 2019-02-10 14:08:59 +00:00
jesopo
23da45bebc Make line cutoff character count a const (src/IRCServer.py) 2019-02-10 14:08:07 +00:00
jesopo
41503ab5ae Add TimersContext.find_all 2019-02-10 13:01:52 +00:00
jesopo
7704de25b6 Add Timers.find_all, to find all timers of a certain name 2019-02-10 12:58:15 +00:00
jesopo
e558a7676b Abstract ssl socket wrapping away so we can reuse it 2019-02-10 12:36:52 +00:00
jesopo
1d807fefe0 Old copypaste fail - we were returning the most recent user id when creating channels
(Database.py)
2019-02-10 00:04:00 +00:00
jesopo
b44c456081 Set default values for various types of channel modes (src/IRCServer.py) 2019-02-09 18:52:59 +00:00
jesopo
84a3bf6135 Also capture channel setting-related modes (e.g. +f for flood settings) 2019-02-09 18:48:18 +00:00
jesopo
d86a0fc55c Return "0s" from utils.to_pretty_time when given 0 seconds 2019-02-07 22:47:03 +00:00
jesopo
bae98d1236 Send CAP LS after we send PASS (if applicable) (src/IRCServer.py) 2019-02-07 17:41:10 +00:00
jesopo
76fd67235a Add optional default param to Exports.get_one() (src/Exports.py) 2019-02-07 13:36:34 +00:00
jesopo
e124b8e79d Implement ExportsContext.get_one 2019-02-07 10:10:13 +00:00
jesopo
8c1c10b3c7 Implement Exports.get_one() 2019-02-07 10:02:27 +00:00
jesopo
f94f233eb3 Fix mypy typing issue with importspec loader Optionalness (src/ModuleManager.py) 2019-02-06 22:41:37 +00:00
jesopo
1895ac34d7 If a server has a hostname that's not an IP, use it as SNI server name 2019-02-06 18:11:19 +00:00
jesopo
70b29a345a Don't break if we try to "finish" a waiting CAP when it's already finished 2019-02-06 15:44:09 +00:00
jesopo
2f7937adc5 Don't .lower() nicknames in Database.py, it doesn't know about IRC casemapping 2019-02-06 11:25:20 +00:00
jesopo
cbbe6f1569 STARTTLS was removed long ago 2019-02-05 22:26:41 +00:00
jesopo
5991e02b0a Manually count ACK/NAK for REQed CAPs before ENDing CAP negotiation 2019-02-05 19:20:02 +00:00
jesopo
c311521a31 Switch to using __init__.py as main file of directory modules, so they behave
like a package (also put the modules manually in sys.modules
2019-02-05 15:53:11 +00:00
jesopo
607c6eddf9 Switch to a non-deprecated method of loading files by filename
(`importlib.util.spec_from_file_location`)
2019-02-05 13:34:13 +00:00
jesopo
5dda000c96 Add make_event(..) to EventHookContext 2019-01-30 19:37:52 +00:00
jesopo
72072bbd3d Make sure to call the specific hook we've decided is valid (commands.py) 2019-01-30 19:35:43 +00:00
jesopo
d10a6d94c1 Add a way to force success and force failure of a command permission check
(commands.py)
2019-01-28 23:29:52 +00:00
jesopo
cc8478c50c Only search messages from other users in find_from (src/IRCBuffer.py) 2019-01-26 15:58:57 +00:00
jesopo
e1e4fbf9bc Add find_from to IRCBuffer.Buffer, to find the most recent line from a given
user (src/IRCBuffer.py)
2019-01-26 15:46:20 +00:00
jesopo
8dcd6b2937 Make sure more than one hook can catch preprocess.send but still respect any
that return a change to the output (src/IRCServer.py)
2019-01-26 11:05:25 +00:00
jesopo
1a24f17375 IRCServer.Server.irc_lower should have a return type hint of str 2019-01-24 17:15:02 +00:00
jesopo
3df6b39228 Typo, IRCServer.Server.irc_equal -> IRCServer.Server.irc_equals 2019-01-24 17:13:51 +00:00
jesopo
301dd7378a Add irc_lower() and irc_equals() to IRCServer.Server so that no where else
in the code has to know about the server having a casemapping
2019-01-24 17:12:50 +00:00
jesopo
baeff58539 Fix incorrect indentation level in Logging.py 2019-01-18 16:28:09 +00:00
jesopo
69edf039b3 Support modules being in their own folder and move github.py to github/module.py 2019-01-18 12:49:11 +00:00
jesopo
4c5af0845c output of len() needs to have a -1 on it when matching it against indexes
within the given string (src/utils/irc.py)
2019-01-16 12:42:45 +00:00
jesopo
2331205368 Don't ignore a color code when it's right at the end of a message
(src/utils/irc.py)
2019-01-16 12:41:41 +00:00
jesopo
470f85b009 Pushing logging on to another thread was a ridiculous idea. it means CRITICAL
logs are in a race condition to write to file before the main thread exits.
2019-01-16 12:03:56 +00:00
jesopo
6405ee2582 Support removal of modes without args that we don't know about in a way that
doesn't push code execution down the wrong path (src/IRCChannel.py)
2019-01-16 11:59:36 +00:00
jesopo
aa40936ce6 Support a mode being removed from a channel, without an arg, that we weren't yet
aware of (src/IRCChannel.py)
2019-01-16 11:47:42 +00:00
jesopo
8ed89b3f31 Add src/utils/_consts_256_color.py that should have been added 2 commits ago 2019-01-16 11:25:40 +00:00
jesopo
3b75519fb0 Fix regression that caused only foreground to be parsed if there's foreground
AND background formatting (src.utils.irc)
2019-01-16 11:24:47 +00:00
jesopo
8f4312d002 Support IRC colors 16 through 98 2019-01-16 11:18:51 +00:00
jesopo
598fcb80b9 'to_ansi_colors(' -> 'parse_format(' as it's become a lot more than just colors.
strip \x08 (in case hexchat users paste it) (print_activity.py, src.utils.irc)
2019-01-13 21:56:36 +00:00
jesopo
97b7249989 don't consume 3 digits for a colour code when the first char is 0 and the second
two chars make up a valid colour code (src.utils.irc)
2019-01-13 01:54:02 +00:00
jesopo
9944f08acf Typo, '=' -> '==' (utils.irc) 2018-12-12 11:50:59 +00:00
jesopo
d5467aefe9 Support '99' as a 'transparent' irc color code 2018-12-12 11:49:42 +00:00
jesopo
85840a68dd Preserve logged exc_info across threads 2018-12-12 11:33:29 +00:00
jesopo
2d3bb2b5e8 Typo in utils.http.request, 'response_heders' -> 'response_headers' 2018-12-11 22:31:14 +00:00