Commit graph

140 commits

Author SHA1 Message Date
jesopo
f8fa529ca5 Add IRCBot.panic() - a nicer interface for killing the whole application 2019-06-17 11:06:03 +01:00
jesopo
b5a467552f CRITICAL log exceptions caught in _loop_catch() 2019-06-15 00:39:52 +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
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
55fb9cee3b v1.9.1 release 2019-06-08 11:03:18 +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
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
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
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
a1ebe8035e Split read/write/process in to 3 different threads 2019-06-06 17:05:44 +01:00
jesopo
ef221f4165 v1.8.0 release 2019-06-03 13:30:39 +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
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
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
bea8556329 Bump version to v1.6.0 2019-05-17 13:39:55 +01:00
jesopo
a80eda614d Add IRCBot.SOURCE, use it in ctcp.py 2019-05-15 10:30:36 +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
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
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
34848324d5 Bump version to v1.4.0 2019-04-16 09:59:40 +01:00
jesopo
1fcbdd305c 'failed to connect' log line needs 2 "%s"s 2019-03-09 20:21:15 +00:00
jesopo
b3472c009a Only log exception message, not full stacktrace, when a connect fails 2019-03-08 10:12:01 +00:00
jesopo
5aaf6eb7df Bump version to v1.2.1 2019-02-25 21:47:36 +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
276d753711 Change --verbose short to -V, add --version/-v, add IRCBot.VERSION 2019-02-24 08:37:42 +00:00
jesopo
137d5b1a58 connected status is now tracked by IRCSockets 2019-02-11 20:34:02 +00:00
jesopo
9b44b6cd13 Shift socket.socket related logic to IRCSocket.py 2019-02-11 10:00:41 +00:00
jesopo
312293b221 Make block param of queue.get() explicitly refer to block 2018-12-10 13:34:53 +00:00
jesopo
50ced296d1 Clarify func_queue type (IRCBot.py) 2018-12-02 10:08:58 +00:00
jesopo
cbc3ae3432 Remove usage of sys.stderr in IRCBot.py, change disconnect logs from info to
`warn`
2018-12-02 09:43:57 +00:00
jesopo
9a311c88b6 Remove print calls from IRCBot.py, move received data logging to IRCServer 2018-12-02 09:41:21 +00:00
jesopo
e1cdd4a353 Add type hint for return type of IRCBot.trigger 2018-11-27 17:29:38 +00:00
jesopo
9d9deb28b5 Raise exceptions back up through .trigger() 2018-11-27 15:06:10 +00:00
jesopo
d13a5069e3 Grab response from functions asked to be executed on the main thread and feed
them back to the callers, allowing rest_api.py to take the main thread while
it's waiting for the response to give back to the requesting client
2018-11-27 14:25:12 +00:00
jesopo
72dca06626 Add a way to catch when a writebuffer is emptied so we can e.g. assure a QUIT is
sent before shutting down the bot
2018-11-27 11:56:03 +00:00
Evelyn
8cd7393d17 Regression: Don't connnect if a server's 'connect' setting is false 2018-11-24 12:14:36 +00:00
jesopo
99c2147512 Don't assume a reconnect timer event will always have connection_params 2018-11-14 13:08:57 +00:00
jesopo
0a70fda6dc Don't pass connection_params through to reconnect in normal circumstances 2018-11-05 20:51:51 +00:00
jesopo
ce3b319bee Only automatically reconnect to a server when we don't already have a server
with the same ID (to make reconnection work)
2018-11-05 20:33:45 +00:00
jesopo
d63115440d Fix the order of some connection params, add alias as a seperate argument to
IRCServer.Server
2018-11-05 18:30:39 +00:00
jesopo
6b8593a09b Pass connection parameters around in their own object (IRCConnectionParameters) 2018-11-05 18:23:02 +00:00
jesopo
aaf0c8cf2a Reschedule STS expiration on disconnect 2018-11-05 14:12:21 +00:00
jesopo
10130d7288 I forgot the "normal" event hook syntax! 2018-11-05 12:34:18 +00:00
jesopo
86bbd370fb 'self.events' -> 'self._events' in IRCBot 2018-11-05 12:29:13 +00:00
jesopo
fa3fc7e3fb @utils.hook doesn't work outside of modules! 2018-11-05 12:27:11 +00:00
jesopo
c2ebc7b5e4 Refactor IRCServer .connect() logic 2018-11-05 11:53:33 +00:00
jesopo
a4d8d1f855 Fix some non-explicit None returns, add type hints to important variables 2018-10-31 15:12:46 +00:00
jesopo
b543e31cd2 Fix/refactor issues brought up by type hint linting 2018-10-30 17:49:35 +00:00
jesopo
e07553c362 Add type/return hints throughout src/ and, in doing so, fix some cyclical
references.
2018-10-30 14:58:48 +00:00
jesopo
4796d4264c Print lines not [lines] in src/IRCBot.py 2018-10-17 17:36:01 +01:00
jesopo
819f4e0680 Pass context-wrapped timers to each module, add ModuleManager.BaseModule.on_load 2018-10-12 18:07:23 +01:00
jesopo
b144d5e37e Don't continue trying to use None data 2018-10-08 23:03:49 +01:00
jesopo
29d8549da1 clear _trigger_functions after we've called all the waiting functions 2018-10-07 08:06:41 +01:00
jesopo
a77a985d5d Optionally take a function in IRCBot.trigger, a function to be called on the
main thread
2018-10-07 08:01:54 +01:00
jesopo
472d745401 Socket on_read functions take 2 args (socket, string) 2018-10-07 07:56:11 +01:00
jesopo
bb533ab9e8 This is a far less complicated way of triggering epoll.poll 2018-10-07 07:54:10 +01:00
jesopo
825fb15c87 Add control-socket to bot.conf.example, only start up control socket is a unix
domain socket location is provided
2018-10-06 18:31:00 +01:00
jesopo
9458d9fee2 'control_socket_client' -> '_control_client' in src/IRCBot.py 2018-10-06 16:42:38 +01:00
jesopo
79aff93b5d Add a ControlSocket client to IRCBot.py, use it to trigger the epoll loop when a
github webhook has been caught!
2018-10-06 15:45:56 +01:00
jesopo
0794a5173a Add a way to track non-IRC sockets within the main epoll loop; use this for a
unix domain control socket!
2018-10-06 15:37:05 +01:00
jesopo
b00819d581 self.lock.acquire() should be after epoll.poll has returned 2018-10-04 14:44:50 +01:00
jesopo
6af738107b Implement client-side bindhost 2018-10-01 14:06:50 +01:00
jesopo
120acf54ec Add 'trace' logging level for src/Database.py and src/EventManager.py very
verbose debugging
2018-10-01 13:48:22 +01:00
jesopo
c87728a87d Move src/IRCLineHandler.py to modules/line_handler.py 2018-09-30 19:43:20 +01:00
jesopo
16dc2c39a9 Refactor modules/channel_op.py and add !tempban/!tempkickban 2018-09-30 13:28:26 +01:00
jesopo
47ec11bbef Add src/Cache.py, use it in modules/coins.py 2018-09-29 12:53:39 +01:00
jesopo
dfe5cb0be8 Add IRCBot.directory, in case we need it. 2018-09-29 09:24:26 +01:00
jesopo
a8bf3c9300 Remove cyclical references to IRCBot 2018-09-28 16:51:36 +01:00
jesopo
6b01c8bb04 Change IRCBot.reconnect to only pass server_id to IRCBot.add_server 2018-09-27 10:22:57 +01:00
jesopo
12f68f55a7 IRCBot.bot_directory is no longer used 2018-09-24 17:29:06 +01:00
jesopo
ecb9d7cb3f Move most code in root directory to src/ 2018-09-24 15:13:27 +01:00
Renamed from IRCBot.py (Browse further)