Commit graph

590 commits

Author SHA1 Message Date
jesopo
a3a61d2e86 Log server name when we see a _send failure 2019-05-30 15:46:01 +01:00
jesopo
367eb1c60e Make labeled-resposnes it's own module, tag and track every sent line 2019-05-30 15:36:10 +01:00
jesopo
f0dee5ebd6 Immutable arg default values leads to weird data persistence 2019-05-30 15:30:15 +01:00
jesopo
b8f778d7bd Only try to send QUITs on ctrl+c when we're connected - sys.exit otherwise 2019-05-29 16:11:47 +01:00
jesopo
768059fcf4 Switch resume.py to use the last server-time it saw, not last .recv() 2019-05-29 15:53:20 +01:00
jesopo
0be9046669 Pass str object to BeautifulSoup, not bytes. closes #56 2019-05-28 10:22:35 +01:00
jesopo
69a780b596 append ".py" when doing find_module on ModuleType.FILE 2019-05-27 16:56:13 +01:00
jesopo
786f04ea16 set changed = True when we pop a module with no dependencies left 2019-05-27 14:50:15 +01:00
jesopo
ce3a0668c6 Throw an exception when we detect a complex circular dependency 2019-05-27 11:42:47 +01:00
jesopo
5b780672a8 Enable TCP keepalives 2019-05-27 07:58:24 +01:00
jesopo
2a93a8f1dd Only check for unknown dependencies once 2019-05-26 20:27:17 +01:00
jesopo
38dd69a71e Only iterate a module's deps, not all modules, when checking for circular deps 2019-05-26 14:47:05 +01:00
jesopo
4048f63538 'cicular' -> 'circular', words are hard 2019-05-26 11:25:52 +01:00
jesopo
9815ddac8a 'cycular' -> 'cicular' 2019-05-26 06:54:29 +01:00
jesopo
69a1f42ecc Add basic comments for dependency-sorting system 2019-05-25 21:47:28 +01:00
jesopo
bb475d5cc8 Implement ordering modules by depends-on hashflag 2019-05-25 21:43:32 +01:00
jesopo
eeee2458d3 Fix utils.parse.hashflags type hints 2019-05-25 21:42:42 +01:00
jesopo
552902d462 Refactor ModuleManager 2019-05-25 18:24:50 +01:00
jesopo
d0634bb54e Don't store hashflags as a dict before returning them - allow duplicate keys 2019-05-25 12:58:07 +01:00
jesopo
a3a2c1e5a4 Store IRCSocket connect_time, show bytes read/write per second in stats.py 2019-05-24 17:32:59 +01:00
jesopo
503969abfd Bump version to v1.7.1 2019-05-24 06:52:25 +01:00
jesopo
b12298135e Bump version to v1.7.0 2019-05-23 19:10:22 +01:00
jesopo
6678076490 Remove column from server.add SQL (leftover from removing 'ipv4' column) 2019-05-21 10:45:24 +01:00
jesopo
ab1074cf4d Remove mention of ipv4 - detect address family automatically 2019-05-21 10:11:09 +01:00
jesopo
db33e12c8c Remove Capability.enabled() - it's unused 2019-05-20 16:36:02 +01:00
jesopo
b12c38c326 typing.List -> typing.Sequence 2019-05-20 16:35:50 +01:00
jesopo
bdd161256d has_capability -> has_capability_str, add new has_capability 2019-05-20 16:33:32 +01:00
jesopo
3ad83655d5 ParsedLine already deals with preventing newlines 2019-05-20 16:19:37 +01:00
jesopo
e752b60f6c use fnmatchcase( so the strings are not case-"normalised" 2019-05-19 16:28:46 +01:00
jesopo
c607a0e67c Implement utils.irc.hostmask_match for glob-like hostmask matching 2019-05-19 16:24:38 +01:00
jesopo
58d6b16744 Remove _name and _draft_name (unused) and add Capability.copy() 2019-05-19 11:00:58 +01:00
jesopo
7671dd2086 Switch back to events.name defaulting to None, use typing.cast to fix linting
error
2019-05-18 21:14:28 +01:00
jesopo
105351d6f3 Add a timestamp to recent_sends for EACH line sent 2019-05-18 19:08:34 +01:00
jesopo
d64d12f8fd give EventCallbacks their event name 2019-05-18 18:35:23 +01:00
jesopo
eccd43d357 Add a way to not put spaces between docstring lines when stripping \n 2019-05-18 18:34:27 +01:00
jesopo
bea8556329 Bump version to v1.6.0 2019-05-17 13:39:55 +01:00
jesopo
7547eee96d Catch server version string, from RPL_MYINFO 2019-05-15 17:12:21 +01:00
jesopo
a80eda614d Add IRCBot.SOURCE, use it in ctcp.py 2019-05-15 10:30:36 +01:00
jesopo
38ba656bda Add type hints to utils.irc.MessageTag 2019-05-14 23:07:42 +01:00
jesopo
421d9c10c7 Add utils.irc.MessageTag and use it for both draft and ratified msgid 2019-05-14 13:02:45 +01:00
jesopo
1c296826d7 Move module black/white list to IRCBot, allow "safe" loading of all modules 2019-05-12 14:10:59 +01:00
jesopo
d291cd5063 Revamp how CAPs are tracked through REQ and ACK/NAK etc 2019-05-11 18:22:40 +01:00
jesopo
295f7a751c Refactor CAPs in to objects 2019-05-11 15:11:09 +01:00
jesopo
091818fa32 Hold context in EventCallback objects, add name<->context translation in
ModuleManager
2019-05-10 16:11:22 +01:00
jesopo
f7eae1a978 Tokenize IRC data as soon as it comes out of IRCServer 2019-05-09 10:36:33 +01:00
jesopo
920dce0221 Add IRCServer.has_user_id, to check if we've seen a user before 2019-05-05 00:16:37 +01:00
Patrick Nappa
2c344c9ddd forgot the beautiful % 2019-05-03 13:50:51 +10:00
Patrick Nappa
471c11e229 ensure that non-url characters not separated by whitespace aren't consumed 2019-05-03 13:43:08 +10:00
jesopo
e844004ba1 Fix reconnect() type hint issues 2019-05-01 17:13:55 +01:00
jesopo
aa1b457632 Change TRIGGER_RETURN and TRIGGER_EXCEPTION to an enum 2019-05-01 17:13:41 +01:00
jesopo
992ab15394 Bump version to v1.5.0 2019-04-30 12:05:59 +01:00
jesopo
280e647a84 Only pass through args from connection params when reconnecting 2019-04-30 12:05:36 +01:00
jesopo
0afe798b83 Support parsing iso8601 with microseconds 2019-04-28 12:11:48 +01:00
jesopo
74c16a1bbe Actually respect default return in Exports.get_one 2019-04-27 14:49:18 +01:00
jesopo
bdcb4b5db2 Add missing ":" 2019-04-25 17:50:41 +01:00
jesopo
1240b154cb Support interfaces that don't have AF_INET and/or AF_INET6 2019-04-25 17:48:51 +01:00
jesopo
7643a962bd Refuse to get the title for any url that points locall 2019-04-25 15:58:58 +01:00
jesopo
dffee4d223 Move REGEX_URL out of isgd.py and title.py in to utils.http 2019-04-24 15:46:54 +01:00
jesopo
e095c56f77 Record and show when a !to was created 2019-04-24 14:32:56 +01:00
jesopo
dc102f258d Add Database.servers.get_by_alias, move IRCBot.get_server to
IRCBot.get_server_by_id, add IRCBot.get_server_by_alias and change
!connect/!disconnect to take aliases instead of IDs
2019-04-24 12:07:30 +01:00
jesopo
bd4fdfdc7b Add UNIQUE constraint for alias on servers table 2019-04-24 11:49:54 +01:00
jesopo
032f6fbc3b IRCServer.alias is no longer optional 2019-04-24 11:45:21 +01:00
jesopo
87340bcbf9 change utils.iso8601_format to default to no milliseconds, switch to using
utils.iso8601 functions in badges.py
2019-04-23 21:27:43 +01:00
jesopo
ee8c7813f7 Add IRCServer.send_raw so modules don't have to parse messages before sending
them
2019-04-16 13:47:45 +01:00
jesopo
34848324d5 Bump version to v1.4.0 2019-04-16 09:59:40 +01:00
jesopo
272b60842e 'IRCChannels._get_id' -> 'IRCChannels.get_id' 2019-04-07 13:59:53 +01:00
jesopo
0eaeca8f83 Put spaces between units in output from utils.to_pretty_time 2019-03-21 17:59:42 +00:00
jesopo
10ca8a1219 Add IRCUser.hostmask() to format nick/user/host in to a hostmask 2019-03-12 10:39:54 +00:00
jesopo
5d7f017c9c Enum values shouldn't be all upper case 2019-03-10 13:14:25 +00:00
jesopo
1fcbdd305c 'failed to connect' log line needs 2 "%s"s 2019-03-09 20:21:15 +00:00
jesopo
5c5b4ef139 Handle negative (end-relative) indexes being given to IRCArgs.get 2019-03-08 23:35:52 +00:00
jesopo
f1348e5679 Handle IRCArgs being empty strings (e.g. 'PRIVMSG #test :') 2019-03-08 23:23:09 +00:00
jesopo
b3472c009a Only log exception message, not full stacktrace, when a connect fails 2019-03-08 10:12:01 +00:00
jesopo
6b59830a6e Only print ANSI reset characters when appropriate 2019-03-06 21:48:31 +00:00
jesopo
1b7a8bc896 Log content of lines that need fallback encoding 2019-03-06 17:19:37 +00:00
jesopo
c842c459f4 Specifically only catch UnicodeDecodeError in IRCSocket.read 2019-03-06 17:02:58 +00:00
jesopo
11c4d70156 add IRCServer.clear_send_buffer() to clear queued lines 2019-03-05 11:35:24 +00:00
jesopo
91c2ab03ba add IRCServer.send_enabled, to prevent sending after QUIT in signals.py 2019-03-05 11:29:46 +00:00
jesopo
b43a5a7c74 Add -N to start.py to disable to-file logging 2019-03-04 19:35:18 +00:00
jesopo
7a3db82300 Add IRCServer.has_capability and use it throughout line_handler 2019-03-03 22:38:34 +00:00
jesopo
197ae2e053 Raise a specific exception in utils.http.request for "wrong content type" 2019-02-28 23:28:45 +00:00
jesopo
948c86adbc Need to str() Hostmask objects in ParsedLine.format() 2019-02-28 16:22:17 +00:00
jesopo
9335ca5d16 Treat both a and a= as None for message-tags 2019-02-27 22:20:01 +00:00
jesopo
d16046fb49 Simplify ParsedLine._tag_str and ParsedLine.format() 2019-02-27 22:14:53 +00:00
jesopo
846b881e52 Throw ValueError when utils.http.request tries to soup non-html/xml data 2019-02-27 15:16:08 +00:00
jesopo
cfaf6864fc Don't try to parse non-html/xml stuff with BeautifulSoup 2019-02-26 11:18:50 +00:00
jesopo
5aaf6eb7df Bump version to v1.2.1 2019-02-25 21:47:36 +00:00
jesopo
56f6511ad3 Critical security fix: truncate IRCLine.ParsedLine.format() at newline 2019-02-25 21:46:23 +00:00
jesopo
d627ed49e2 Pull "is main thread" logic out to utils, force Database to be accessed on main
thread
2019-02-25 10:36:17 +00:00
jesopo
faa305f2e8 Add -m/-M args to ./start.py that call command_line on individual modules 2019-02-24 10:43:46 +00:00
jesopo
276d753711 Change --verbose short to -V, add --version/-v, add IRCBot.VERSION 2019-02-24 08:37:42 +00:00
jesopo
8d55319f56 Rename IRCLine.Line to IRCLine.SentLine, for clarity 2019-02-24 08:25:12 +00:00
jesopo
1473f41b03 Fire preprocess.send per-command - use this to only strip colors from ParsedLine
objects for PRIVMSG and NOTICE
2019-02-23 21:40:11 +00:00
jesopo
5baa688fbc Make IRCArgs mutable 2019-02-23 21:39:46 +00:00
jesopo
8c94bcf6ca Move utils.irc.IRCParsedLine to IRCLine.ParsedLine, improve truncation
mechanism, don't convert sent line from ParsedLine to text to ParsedLine for
line_handler handling
2019-02-23 21:33:04 +00:00
jesopo
c6699c509e .upper() command in IRCParsedLine.format() 2019-02-23 16:11:26 +00:00
jesopo
54218b747f Only allow the last arg of a formatted line to be :trailing 2019-02-23 16:07:20 +00:00
jesopo
8b54046ca4 Add target typehint on IRCServer.send_tagmsg, add send_tagmsg to IRCChannel/IRCUser 2019-02-22 22:34:54 +00:00
jesopo
9d72cbca73 Keep track of a user's away message, not just whether they're away or not 2019-02-22 22:26:50 +00:00
jesopo
8a0fd009e4 Also unload submodules within packages (ModuleManager.py) 2019-02-22 17:58:53 +00:00
jesopo
47c2cbb0fa Split line_handler.py out in to different files for different categories 2019-02-22 11:23:36 +00:00
jesopo
62eab40968 Revert "Treat both a and a= as having a value of None in message-tags (utils.irc)"
This reverts commit e7ec4b5716.
2019-02-21 07:29:19 +00:00
jesopo
e7ec4b5716 Treat both a and a= as having a value of None in message-tags (utils.irc) 2019-02-20 22:26:31 +00:00
jesopo
deedab7248 Add IRCServer.send_joins, a nicer interface than manually ",".joining 2019-02-20 17:08:30 +00:00
jesopo
ddb69685d3 again, r"\" isn't valid. 2019-02-20 16:53:40 +00:00
jesopo
e343bf3e6a Check throttle space when queueing more data not whether there's no queued data 2019-02-20 16:52:45 +00:00
jesopo
98215f66eb r"\" isn't valid - use "\\" (utils.irc) 2019-02-20 16:52:14 +00:00
jesopo
c1881fbafb Remove '\' from post-unescaped message-tags 2019-02-20 16:34:14 +00:00
jesopo
47841ed154 don't replace '\\' with '\\' with message-tag unescape 2019-02-20 16:33:48 +00:00
jesopo
81d82413d4 draft/message-tags-0.3 (JSON tags) was rejected 2019-02-20 14:46:40 +00:00
jesopo
577fae7cea Don't pass None around as tag default, fix some missing return type args 2019-02-19 15:57:00 +00:00
jesopo
3f8ac871ed typo, 'utls' -> 'utils' (utils.irc) 2019-02-19 15:44:23 +00:00
jesopo
114d1054a5 Add .message( and .notice( to IRCSendBatch 2019-02-19 15:41:17 +00:00
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