jesopo
c5785a2d14
implement @utils.kwarg() magic, use it for command.regex hooks
2019-06-26 14:37:41 +01:00
jesopo
7060a0ac67
Update IRCBot except queue.Empty
comment
2019-06-26 13:43:00 +01:00
jesopo
4bf5c4783b
Re-add EventManager check to prevent _call() outside main thread
2019-06-26 11:42:23 +01:00
jesopo
bb749b111f
Refactor EventManager to only hold hooks on a root object
2019-06-26 11:01:09 +01:00
jesopo
12181bfec6
Add system to have multiple url shorteners and chose which to use
2019-06-25 17:53:00 +01:00
jesopo
a1cc2e778c
Return 0 seconds if timeout seconds is negative
2019-06-24 17:22:08 +01:00
jesopo
ef0b3ec64c
move _check() after timeouted queue.get() so deadlines are met accurately
2019-06-23 20:50:40 +01:00
jesopo
dd1df4dc05
move get_poll_timeout() to event loop now that it is the one calling _check
2019-06-23 19:00:37 +01:00
jesopo
9673963a8d
shift _check() call to event loop function so read_loop needn't call trigger()
2019-06-23 18:53:25 +01:00
jesopo
102aa1dce1
v1.10.0 release
2019-06-23 14:45:56 +01:00
jesopo
afc287f020
Don't print BitBotPanic stacks when we don't need to
2019-06-23 10:01:15 +01:00
jesopo
7861210495
v1.10.0-rc2
2019-06-23 09:45:47 +01:00
jesopo
22574448da
until_read_timeout is a func - read_timed_out has always been returning false
2019-06-22 23:31:06 +01:00
jesopo
01bad3a76e
Don't needlessly call time.monotonic() when checking cache expirations
2019-06-22 23:30:15 +01:00
jesopo
7d49826b1a
v1.10.0-rc1
2019-06-22 22:41:17 +01:00
jesopo
f1abc5f10c
remove remove_own_mode( check - deferred_read.py better solves the issue.
...
the issue was getting a MODE line on irc.com prior to 001, thus we didn't know
what our nickname was thus we didn't know that the MODE was for us. not dying
when we saw +x was easy to do with this check but I think it's more correct to
actually parse that MODE after 001 so we know we have +x.
2019-06-22 22:23:05 +01:00
jesopo
3eac36d0f5
Restrict EventManager calls to the main thread
2019-06-22 12:21:44 +01:00
jesopo
a783e71ad4
return generated SentLine objects from IRCChannel.send_* functions
2019-06-21 18:25:21 +01:00
jesopo
90c90e5bbd
Implement dependency system for CAPs
2019-06-21 18:05:11 +01:00
jesopo
8a0d99f969
Adda system of aliases for CAPs, mostly for changeable draft specs and creating
...
dependence between moving specs
2019-06-21 17:15:46 +01:00
jesopo
bffc5b0ec4
WARN log when we try to remove a mode from ourselves that we didn't have
2019-06-21 11:16:53 +01:00
jesopo
01438f28f6
check we have a mode before trying to remove it
2019-06-21 11:14:10 +01:00
jesopo
e7b17f2ccd
give every ParsedLine a uuid4 .id for tracking purposes
2019-06-21 10:33:59 +01:00
jesopo
01ddc04bb9
fix hostmask_match_many type hinting
2019-06-20 17:58:49 +01:00
jesopo
b6e194a450
Implement hostmask_match_any, for more efficient matching of multiple hostmasks
2019-06-20 14:21:11 +01:00
jesopo
792a42be6e
Implement utils.irc.hostmask_match() as regex
2019-06-20 14:10:10 +01:00
jesopo
612c26ff7e
Differentiate between module "not found" and "not loaded"
2019-06-19 23:11:42 +01:00
jesopo
928f2f304d
Raise ModuleNotFoundException on failure to find_module()
2019-06-19 23:05:22 +01:00
jesopo
dc9cd2869f
Give requested module name to ModuleNotFoundException
2019-06-19 23:03:27 +01:00
jesopo
9457430c15
Add MessageTag.present, to see if a tag is present (even without value)
2019-06-19 22:36:42 +01:00
jesopo
938e1db963
add margin
arg to ParsedLine.truncate so commands/outs.py doesn't do it
...
manually and cause potential issues with multi-byte chars
2019-06-19 10:34:42 +01:00
jesopo
c463fa20a4
line_formatted
-> valid
so tags don't cause us to subvert truncation
2019-06-18 18:14:04 +01:00
jesopo
1cbc2ce31b
Tags should not be appended to pieces
now that they're counted separately
2019-06-18 17:56:20 +01:00
jesopo
aa4a15a6dc
Add IRCBot.URL ( https://bitbot.dev )
2019-06-18 17:33:54 +01:00
jesopo
51cac7d9b5
add has_tag() and get_tag() to IRCLine.ParsedLine
2019-06-18 15:18:44 +01:00
jesopo
31be78db81
message-tags count for a different character limit than the rest of the line
2019-06-18 14:33:51 +01:00
jesopo
621830c360
Simplify SentLine by shifting truncation to ParsedLine (and commands.outs)
2019-06-18 14:14:37 +01:00
jesopo
133ff1c0f6
only count "\n"s (not "\r\n") that hit the wire, incase \r\n gets cut in half
2019-06-17 18:23:38 +01:00
jesopo
d4391cc6c5
Fix Database.ChannelSettings.find SQL
2019-06-17 17:51:27 +01:00
jesopo
5c325d9b23
'break' instead of 'continue' so that things in the event queue get discarded
2019-06-17 16:19:20 +01:00
jesopo
72ce880478
Only panic()
when a server connection is part of bot init. closes #69
2019-06-17 14:20:11 +01:00
jesopo
9121a868a8
Make sure we exit event loop when there's no servers left
2019-06-17 14:07:06 +01:00
jesopo
dbe0b1f43b
Tell servers objects when they are the result of a reconnection
2019-06-17 13:53:17 +01:00
jesopo
ec733e200c
Default IRCBot.running to false, set to true at the top of .run()
2019-06-17 11:35:45 +01:00
jesopo
da5d48400d
Change panic() reason log from ERROR to CRITICAL
2019-06-17 11:12:04 +01:00
jesopo
9ea356bc49
Raise a BitBotPanic() exception in panic()
2019-06-17 11:11:35 +01:00
jesopo
f8fa529ca5
Add IRCBot.panic() - a nicer interface for killing the whole application
2019-06-17 11:06:03 +01:00
jesopo
ced59a0f74
Allow channel-access and channel-mode check for channels people are not in
2019-06-16 20:48:31 +01:00
jesopo
18004c23e1
Don't fail get_kwarg when self.kwarg[name] is falsey
2019-06-16 18:39:56 +01:00
jesopo
5fa3d66a39
Return all caps through received.cap.ls|new and check if valid in line_handler,
...
remove server.cap_started
2019-06-16 15:33:20 +01:00
jesopo
919a488e86
Implement client-to-server BATCHes
2019-06-16 09:52:54 +01:00
jesopo
055eed24fd
Type annotate ParsedLine.tags, add ParsedLine.add_tag()
2019-06-16 09:52:25 +01:00
jesopo
8ab4880c5c
Change from yield
checks to a func in events
that pass up EventErrors
2019-06-15 18:42:14 +01:00
jesopo
b5a467552f
CRITICAL log exceptions caught in _loop_catch()
2019-06-15 00:39:52 +01:00
jesopo
e0d99fe8b1
Fix utils.Check args
type hinting
2019-06-14 12:12:38 +01:00
jesopo
f05fc209b0
Add a way to __or__ utils.Check
s, as a "if one of these passes" thing
2019-06-14 12:01:55 +01:00
jesopo
d7fa2cfa24
Catch yield
s in command callbacks for e.g. permission checks
2019-06-14 11:42:12 +01:00
jesopo
0e5ba747a9
Wrap _read_loop() and _write_loop() in a try that kills the main thread
2019-06-13 17:11:46 +01:00
jesopo
795f6afbeb
Mode mode (and mode arg) parsing to IRCChannel.py, add IRCChannel.mode_str
2019-06-13 11:53:47 +01:00
jesopo
8135f871c3
Change send_*()
function return hints to be typing.Optional
2019-06-10 15:02:03 +01:00
jesopo
6c5dc958d0
Add .assure()
to ParsedLine, to make it immune from .valid()
2019-06-10 10:45:02 +01:00
jesopo
0fc03fd592
Allow preprocess.send callbacks to request a line not be sent at all
2019-06-10 10:11:31 +01:00
jesopo
512d844a5a
Update CHANGELOG, v1.9.2 release
2019-06-09 17:34:45 +01:00
jesopo
a31793c851
Put responsbility of self.running = False
on to the event loop
2019-06-09 14:59:28 +01:00
jesopo
e28a8d91ab
IRCServer.statusmsg type hint
2019-06-08 12:10:14 +01:00
jesopo
55fb9cee3b
v1.9.1 release
2019-06-08 11:03:18 +01:00
jesopo
d4ba98307f
We should look at ISUPPORT's STATUSMSG token instead of PREFIX
2019-06-08 10:59:52 +01:00
jesopo
16b9361371
Only request a CAP once. closes #66
2019-06-08 10:17:13 +01:00
jesopo
37c74da0f8
v1.9.0 release
2019-06-07 17:13:53 +01:00
jesopo
f822345976
Merge branch 'master' into feature/write-thread
2019-06-07 15:07:31 +01:00
jesopo
accd7a8941
Logging._log()'s params
arg should be typing.Optiona[]
2019-06-07 13:35:20 +01:00
jesopo
ea924df883
typehint for IRCBuffer._lines
2019-06-07 13:34:30 +01:00
jesopo
bc4a6debb5
Use a deque for temp chathistory storage (src/IRCBuffer.py)
2019-06-07 13:31:51 +01:00
jesopo
38a41a6404
We need to wait for _check to finish so read/writes can be triggered correctly
2019-06-07 11:05:55 +01:00
jesopo
09fbbae5e3
"send" event on SentLines should be run on the main thread
2019-06-07 11:05:43 +01:00
jesopo
b3b4d07e63
Call _check *after* read epoll call - to make sure timeouts are hit accurately
2019-06-07 10:39:31 +01:00
jesopo
f3b6d6df0a
Switch to using threading.Condition to trigger write thread
2019-06-07 10:39:19 +01:00
jesopo
1f1b63ea6d
Checking if we should enable write buffer should be in _fill_throttle()
2019-06-07 08:02:22 +01:00
jesopo
c89bd74a48
select.poll, as opposed to select.epoll, uses milliseconds not seconds for
...
timeout
2019-06-06 23:45:33 +01:00
jesopo
23d2993b9f
Remove debug print
2019-06-06 23:25:03 +01:00
jesopo
6d44f12193
Use .trigger (without triggering read/write threads) to call _check
2019-06-06 23:23:46 +01:00
jesopo
24ca7ed97f
use trigger_write() instead of a raw .send(b"")
2019-06-06 23:19:57 +01:00
jesopo
ef0c2c65e0
use _event_queue for _check, don't .disconnect() from outside of respective
...
loops
2019-06-06 22:36:56 +01:00
jesopo
ae6c65d743
remove _trigger_function code, it's not used any more
2019-06-06 21:43:21 +01:00
jesopo
d9de4fdec2
Lambda scopes are irritating
2019-06-06 21:03:25 +01:00
jesopo
539bebafea
select.epoll -> select.poll
2019-06-06 20:26:05 +01:00
jesopo
0f7b040165
call timer callbacks and expire cach objects on main thread
2019-06-06 20:22:56 +01:00
jesopo
5b7d8dea91
Only trigger read/write threads once
2019-06-06 19:21:18 +01:00
jesopo
05fcb33ff7
print lines as soon as they're read, don't wait for _post_send
2019-06-06 19:15:34 +01:00
jesopo
f96378ac07
move immediate-write-trigger to IRCServer.py, trigger _event_loop for
...
running=False
2019-06-06 17:58:35 +01:00
jesopo
35b97f836a
Merge branch 'master' into feature/write-thread
2019-06-06 17:20:30 +01:00
jesopo
59eeee1030
message-tags are joined by ";", not ","
2019-06-06 17:19:27 +01:00
jesopo
a1ebe8035e
Split read/write/process in to 3 different threads
2019-06-06 17:05:44 +01:00
jesopo
2ca4fd48f7
Make params
arg for logging functions optional
2019-06-06 12:59:47 +01:00
jesopo
eb7d90bb00
message_tag_escape() message-tag values when .format()ing IRCLine
2019-06-06 09:29:17 +01:00
jesopo
8fe5098739
Make 'circular dependency' WARN more explicitly about 1-to-1 dependencies
2019-06-05 19:13:44 +01:00
jesopo
67b4aa69e2
check_purge() after removing a context as it could make a hook purgable
2019-06-05 16:56:02 +01:00
jesopo
2d46fe0cbf
labels: Use BatchType to match, pass lines
not line
, batch ID isn't a label,
...
fire event on label response
2019-06-04 17:54:19 +01:00
jesopo
2470c1ec03
Add new BatchType object, to match like how Capability and MessageTag do
2019-06-04 17:51:55 +01:00
jesopo
8dbae6a5e9
Give SentLine (and preproc.send events) a new event object, to track events
...
related to a line after it is sent
2019-06-04 17:51:20 +01:00
jesopo
3ac01197f2
Send PING and PONG as 'immediate' lines
2019-06-04 14:31:34 +01:00
jesopo
4a4d0a37d7
Only return definitely-writen lines from IRCSocket._send, refactor in prep for
...
lines that request to be sent 'immediately'
2019-06-04 14:28:35 +01:00
jesopo
a802e66dcf
Defer decoding http payload bytestring until after checking ContentType
2019-06-04 13:47:03 +01:00
jesopo
ef221f4165
v1.8.0 release
2019-06-03 13:30:39 +01:00
jesopo
c212d70b68
Hold on to BATCH args, allow event hooks to manipulate batches
2019-06-02 15:18:36 +01:00
jesopo
5204ac3300
fix some CAP related type hints
2019-06-02 10:14:09 +01:00
jesopo
f9f637e084
Remove IRCSendBatch, fix some batch-related type hints
2019-06-02 10:13:51 +01:00
jesopo
20c027fd0b
check if we should enable write throttling before writing, clear _recent_sends
...
when we turn on throttling and only "turn on" throttling once
2019-06-01 22:28:57 +01:00
jesopo
b84d133500
add __str__ and __repr__ defs to IRCLine.ParsedLine
2019-06-01 22:28:37 +01:00
jesopo
e5c11f4aef
add 'module-blacklist/whitelist' to bot.conf - use that as well as DB setting
2019-06-01 15:06:57 +01:00
jesopo
5077bad522
list()-ify filter()
return, otherwise boolean checks against it are wrong
2019-06-01 15:05:57 +01:00
jesopo
c3454f2bfe
available_capability returns str
- fix type hint for this
2019-06-01 15:02:38 +01:00
jesopo
dc284bab4a
Only enable write throttling when _write_buffer is empty
...
closes #59
2019-05-31 15:49:34 +01:00
jesopo
f2cf86b8c0
More explicitly require throttle_done()
only for _queued_lines
2019-05-31 15:32:55 +01:00
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