Commit graph

829 commits

Author SHA1 Message Date
jesopo
417c4f302e default to using a "data directory" for bitbot (~/.bitbot/) 2019-10-17 12:39:56 +01:00
jesopo
b895958f09 remove debug prints from IRCBot 2019-10-15 16:16:29 +01:00
jesopo
aa3906dfa3 fix type linting issues for client in Control.is_readable 2019-10-14 18:17:15 +01:00
jesopo
88ffa421c1 add bitbotctl reload command to reload all modules 2019-10-14 14:52:58 +01:00
jesopo
99b4663ce7 run Control callbacks on main thread
closes #180
2019-10-14 14:51:53 +01:00
jesopo
e50290046a remove safe arg from ModuleManager.load_modules() - try_reload_modules covers this now 2019-10-14 13:02:16 +01:00
jesopo
a9111c7241 add ModuleManager.try_reload_modules(), to try reloading in a transaction
if any of the modules fails to reload, rollback and use the already loaded modules. closes #179
2019-10-14 12:56:04 +01:00
jesopo
4940aff877 refactor out chosing loadable modules in to _list_valid_modules() 2019-10-14 11:37:04 +01:00
jesopo
2ca702b787 don't have version 'v' prefix in VERSION 2019-10-11 17:27:36 +01:00
jesopo
82f77472c6 'test_handler' -> 'hook_handler' 2019-10-11 17:17:43 +01:00
jesopo
14f5ec38ed hold current version in it's own file: VERSION 2019-10-11 17:03:14 +01:00
jesopo
85a8ddf2d1 kill bitbotctl connection after rehash 2019-10-11 15:58:47 +01:00
jesopo
6a4cdabc93 add "rehash" bitbotctl command 2019-10-11 15:54:43 +01:00
jesopo
22b6a19054 try/except Control socket writes 2019-10-11 15:16:39 +01:00
jesopo
de389b34b8 add first real cli functionality: showing log 2019-10-11 15:12:26 +01:00
jesopo
cefde48e42 first draft of infrastructure for unix domain control socket 2019-10-11 14:00:26 +01:00
jesopo
daeb37226a LockFile doesn't need to hold on to _database_location 2019-10-11 14:00:02 +01:00
jesopo
175f90f6a2 add "poll sources" - objects that can provide additional filenos for polling 2019-10-11 13:59:28 +01:00
jesopo
b7b045eadb Don't exit when there are no connected servers
closes #175
2019-10-11 13:06:52 +01:00
jesopo
fd0baff093 only .call() PollHooks when they're "due" 2019-10-10 14:12:58 +01:00
jesopo
1c792f0194 move PoolHook registrations to start.py 2019-10-10 13:58:45 +01:00
jesopo
e624292608 v1.12.0 release 2019-10-10 13:36:55 +01:00
jesopo
a2b73469e6 v1.12.0-rc2 release 2019-10-10 12:43:19 +01:00
jesopo
5be01a45c4 'server.conncect_time' -> 'server.connect_time' 2019-10-10 12:31:24 +01:00
jesopo
2c19bdb949 add a fairly basic file locking mechanism with src/LockFile.py
closes #96
2019-10-10 12:11:03 +01:00
jesopo
0331b763ff refactor multi-line-to-line normalisation to utils.parse.line_normalise(), use it in rss.py
closes #174
2019-10-10 10:33:18 +01:00
jesopo
51a4a4253c -V command line arg should still effect stdout 2019-10-09 17:54:12 +01:00
jesopo
f721cf848a stdout output should just be WARN - put INFO in to a daily file
this is because stdout, in something like systemd, will mess up journalctl output.
2019-10-09 17:36:17 +01:00
jesopo
ab2701837c we should be catching timer as the output of self._timers.add 2019-10-09 12:47:03 +01:00
jesopo
a0870ad118 v1.12.0-rc1 release 2019-10-09 12:42:22 +01:00
jesopo
6ee2b6cf27 self.timers -> self._timers 2019-10-08 21:51:58 +01:00
jesopo
f8662ad6e1 fix IRCChannel.topic_setter type hint 2019-10-08 14:55:46 +01:00
jesopo
7a5edccb98 transient timers shouldn't use the event system 2019-10-08 13:49:55 +01:00
jesopo
4c02c7c86a refactor anything that effects event poll timeout in to PollHook objects 2019-10-08 12:20:08 +01:00
jesopo
68aa89f16f commit FunctionSetting changes i forgot to commit yesterday 2019-10-08 11:38:56 +01:00
jesopo
257042ac2c combine find_user_settings() and find_user_settings_prefix() 2019-10-07 12:51:44 +01:00
jesopo
50d1eb6b8c combine find_setting() and find_setting_prefix() on user/channel/server/bot 2019-10-07 12:46:52 +01:00
jesopo
9ab817ca58 parse out content_type in Response ctor 2019-10-05 22:56:56 +01:00
jesopo
b2473a4ac4 parse content-type out in utils.http.request, put it on Response object 2019-10-04 13:07:09 +01:00
jesopo
3466a3c43e Allow utils.Setting_ parse functions to throw detailed errors 2019-10-04 10:25:48 +01:00
jesopo
f306213cb8 'is_localhost()' -> 'host_permitted()' 2019-09-30 15:15:20 +01:00
jesopo
b9c64b7cf1 use ipaddress is_loopback etc to do better forbidden ranges
closes #87
2019-09-30 15:12:01 +01:00
jesopo
8480309db2 only _kill() when there's no servers *and* the event queue is empty
this is so that bitbot doesn't exit when you !reconnect but only have 1 server
2019-09-30 11:52:07 +01:00
jesopo
a42a196720 only return IRCUser.hostmask() when all needed pieces are available 2019-09-27 16:21:59 +01:00
jesopo
82173a7d94 add external_modules directory 2019-09-27 16:03:06 +01:00
jesopo
16ba52f5dc forgot to commit kwargs for get_user() 2019-09-27 15:52:25 +01:00
jesopo
7db17c0962 add utils.parse.try_int() because .isdigit() isnt good enough 2019-09-26 13:44:38 +01:00
jesopo
accd127ce5 add IRCBuffer.find_many_from() 2019-09-26 13:44:21 +01:00
jesopo
2f49fb99e9 assume http fallback_encoding by content-type (utf8 for json) 2019-09-25 15:32:09 +01:00
jesopo
47d38c7d18 refactor all checks for channel_type to server.is_channel() 2019-09-20 14:52:41 +01:00
jesopo
72649a90c2 only BeautifulSoup for finding encoding when it's a html-ish type 2019-09-20 13:38:00 +01:00
jesopo
d609bfb16d cache calculated "next expiration" time 2019-09-20 11:47:57 +01:00
jesopo
efc0e197e5 Allow passing source Hostmask to IRCBatch 2019-09-19 18:16:10 +01:00
jesopo
e34259f967 log call was replaced with Exception but [] on args remained 2019-09-19 15:30:27 +01:00
jesopo
88a69aaa66 give Requests, use them in utils.http.request_many() 2019-09-19 14:54:44 +01:00
jesopo
d8e3a1c7ee utils.http.request_() has no self, let alone self.log 2019-09-19 14:02:48 +01:00
jesopo
b69c9146b2 should be using pair_start/pair_end throughout for 2019-09-19 13:51:27 +01:00
jesopo
cd0d39ee5e also show "bad" data in HTTPParsingException when a message is provided 2019-09-18 14:20:59 +01:00
jesopo
312f8906ae show "bad" data in HTTPParsingException message 2019-09-18 10:52:05 +01:00
jesopo
a003c97fba move q.close() to where it will be called even if deadline is hit 2019-09-18 10:24:01 +01:00
jesopo
dce6eee8c9 move _raise_deadline() out of except block to clean up printed stacktrace 2019-09-18 10:21:40 +01:00
jesopo
ee6360be22 don't check already-read data when checking for too-large requests
this check was here because the first read will return empty if it was an
invalid byte sequence for e.g. gzip because we needed to receive more data. the
second read will always return data (not decoded) so regardless of what the
already-read data is, the second read is the only criteria we need.
2019-09-17 17:33:23 +01:00
jesopo
1ac7f2697e log which URL caused an error in request_many 2019-09-17 17:09:19 +01:00
jesopo
98545a9fb4 only decode content-types in DECODE_CONTENT_TYPES 2019-09-17 16:12:03 +01:00
jesopo
8ca0d30fef Response.__init__() needs encoding now 2019-09-17 14:11:12 +01:00
jesopo
b7dd78ef1a restore 5 second (instead of default 10) deadline for http.request 2019-09-17 13:44:14 +01:00
jesopo
94c3ff962b use utils.deadline_process() in utils.http._request() so background threads can
call _request()
2019-09-17 13:41:11 +01:00
jesopo
fa95eaa9eb add .get() to CaseInsensitiveDict 2019-09-17 13:40:37 +01:00
jesopo
d454f9b732 use Queue.get() with timeout, not Process.join() for timeout
this was because the threads spawned by multiprocessing.Queue seemed to be
making Process.join() believe the subprocess had not exited.
2019-09-17 13:39:23 +01:00
jesopo
1ed14f9a17 first draft of multiprocess.Process deadline system 2019-09-17 11:56:30 +01:00
jesopo
c23530be89 add missing IRCLine import to IRCChannel 2019-09-17 10:21:31 +01:00
jesopo
334d580c57 'seperate_hostmask()' -> 'parse_hostmask()' 2019-09-16 18:43:57 +01:00
jesopo
03892d0ae3 topic_setter should be stored as a Hostmask 2019-09-16 18:38:46 +01:00
jesopo
a48aececfd EventRoot._hook's kwarg should be a list of tuples 2019-09-16 15:34:34 +01:00
jesopo
47735421b8 add json_body arg to Request to json-encode body, only return from body if
not null
2019-09-16 10:57:18 +01:00
jesopo
f9d13dc373 support '0' as an IntSetting value 2019-09-15 22:22:30 +01:00
jesopo
60ced118a0 get_user_status() -> get_user_modes(), filter in format_activity.py 2019-09-12 22:39:21 +01:00
jesopo
d950eb3660 add utils.SensitiveSetting, to .format() hide value 2019-09-12 12:17:31 +01:00
jesopo
ba0911f2e7 add utils.Setting.format() so subtypes can format differently 2019-09-12 12:17:09 +01:00
jesopo
9d33354d16 translate INVITE from [channel_name, target] to [target, channel_name] 2019-09-12 11:24:25 +01:00
jesopo
540c7b8c44 Revert "INVITE should be [channel_name, target]"
This reverts commit f3d8ffad2c.
2019-09-12 11:23:29 +01:00
jesopo
f3d8ffad2c INVITE should be [channel_name, target] 2019-09-12 11:21:29 +01:00
jesopo
77f50187c5 allow Requests to specify a useragent 2019-09-12 10:41:50 +01:00
jesopo
2c5a2d9db3 add IRCChannel.send_invite() 2019-09-12 10:24:02 +01:00
jesopo
2bd7d591c3 Revert "add IRCBot.http_client(), to allow modules to override default http client"
This reverts commit 81347fbba0.
2019-09-11 18:08:44 +01:00
jesopo
81347fbba0 add IRCBot.http_client(), to allow modules to override default http client 2019-09-11 17:54:24 +01:00
jesopo
9d6a3982ed add a helper utils.http.Client static object 2019-09-11 17:53:49 +01:00
jesopo
51dc26d113 add proxy to Request objects 2019-09-11 17:53:37 +01:00
jesopo
4a97c9eb0d refactor utils.http.requests to support a Request object 2019-09-11 17:44:07 +01:00
jesopo
8f8cf92ae2 automatically decode certain http content types 2019-09-11 15:28:13 +01:00
jesopo
8d8d9219b8 don't return "+" when a channel has no modes 2019-09-10 15:10:14 +01:00
jesopo
a9b106c6be Don't try to .decode non-html things, default iso-lat-1 for non-html too 2019-09-09 16:17:26 +01:00
jesopo
b83f5d9e30 add flag to disable encoding detection 2019-09-09 14:59:08 +01:00
jesopo
5ef2b7af27 'str.split' -> 's.split' 2019-09-09 14:53:11 +01:00
jesopo
1df82c1cb2 still default to iso-latin-1 if no on-page or in-header content-type is present 2019-09-09 14:48:26 +01:00
jesopo
0a67659637 only look for <meta>-related tags when there are meta tags 2019-09-09 14:39:19 +01:00
jesopo
0a1077c5cd add explicit None return for _find_encoding (mypy) 2019-09-09 14:25:01 +01:00
jesopo
ff9c82bf67 change utils.http.request to best-effort detect on-page encoding
closes #113
2019-09-09 14:11:18 +01:00
jesopo
dadefeb8f3 remove try-rejoin (on 477) logic. will move to a module later 2019-09-07 15:21:35 +01:00
jesopo
d973b547e1 add a create flag to IRCChannels.get_id() to optionally not create new ids 2019-09-05 14:13:58 +01:00