James Lu
1e95f4b3df
main: Fix ImportError logging if a required library, and not the actual module is missing
...
The old message showed "the plugin/file could not be found" even if it's a library that couldn't be imported. "No module named X" is too broad to check for here!
2015-08-22 21:01:51 -07:00
James Lu
821f546f12
Make sure the PyLink client rejoins all relay channels on KILL
...
This adds a new internal hook, 'PYLINK_SPAWNMAIN', which is triggered whenever Irc().spawnMain() is called.
2015-08-18 05:44:36 -07:00
James Lu
18576ad488
Irc: fix the ping timeout/reconnection logic
...
- reset connection state and last ping time on reconnect
- move Ping timeout logic to somewhere where it'd actually run - the code for breaking out of the run() loop on a ping timeout could previously only run when a ping timeout hadn't occured yet
- consistently use log.warning() instead of log.warn()
This hopefully fixes PyLink going into a disconnect/reconnect loop sometimes instead of reconnecting properly.
2015-08-12 21:31:46 -07:00
James Lu
7bccb37ddf
Irc: catch OSError when reading SSL cert/key files
...
(ref: #80 )
2015-08-12 02:01:33 -07:00
James Lu
d9f5cdfeaf
Irc: optionally validate SSL cert fingerprints ( #80 )
2015-08-12 02:00:43 -07:00
James Lu
684eac9583
Irc: fix the logic checking for data in run()
2015-08-10 20:26:19 -07:00
James Lu
18cd3bdd88
Add SSL linking support ( #80 )
...
TODO: implement fingerprint checking (optional) and a genssl script to ease SSL certificate generation.
2015-08-10 20:24:55 -07:00
James Lu
042edb3e1c
Make default max nick length a config option
2015-08-03 19:42:26 -07:00
James Lu
fdcb58ba2c
Irc: reconnect instead of killing when an error is received
2015-08-03 19:29:30 -07:00
James Lu
f786242730
Support loading different config files from the command line
...
Closes #84 . Logs, PID files, and relay DBs will name themselves differently for every instance, to prevent conflicts. The default is always config.yml.
2015-08-03 19:27:19 -07:00
James Lu
120f6fb7f0
main: raise connect timeout, run initVars on connect and not disconnect
2015-08-03 04:41:00 -07:00
James Lu
ce822061d2
Irc: catch UnicodeDecodeError when parsing lines
...
TODO: respect other encodings too?
2015-07-29 04:02:03 -07:00
James Lu
5eee8000dd
Irc: catch OSError (bad file descriptor) errors; they usually mean we're disconnected
2015-07-25 22:51:00 -07:00
James Lu
ddefd38591
ts6: fix the broken mess of a JOIN handler, and 'parse_as' handling in irc.callHooks...
2015-07-25 20:43:26 -07:00
James Lu
f85fbd934b
main: write a PID file to pylink.pid
2015-07-25 16:57:21 -07:00
James Lu
3804e5e4f8
main: shut down immediately when handle_events errors
...
This is to prevent accidents from frying a server's CPU. For example, a nick collision loop due to a desync!
2015-07-25 16:11:41 -07:00
James Lu
024cf9d878
main: better INFO logging...
2015-07-23 14:19:12 -07:00
James Lu
1efc9018f3
main: raise fallback ping frequency to 30
2015-07-23 10:28:28 -07:00
James Lu
8a1f965303
Consistently use applyModes in spawnClient, so user modes are stored like ('o', None) instead of ('+o', None)
...
Drop the 'modes' argument in IrcUser, for this is incorrect.
2015-07-22 21:14:22 -07:00
James Lu
badbcf0507
Irc.callHooks: allow handlers to specify which hook to call via a special 'parse_as' key
...
For special cases such as "/join 0", where the PART handler has to be called instead of JOIN.
2015-07-20 21:19:15 -07:00
James Lu
6efb59b8b7
Irc: strip off \r from lines
2015-07-20 21:19:01 -07:00
James Lu
a10a18d9cc
Irc: make prefixmodes a dict mapping chars to their prefixes
...
This is needed by TS6 support (#40 ), which send the characters (@+) instead of modes
2015-07-20 16:48:59 -07:00
James Lu
06d17d578b
Irc: prevent rare UnicodeDecodeError by decoding individual lines, not the entire socket.recv() output
...
Such an error is rare, but it did occur twice since I've started developing this :)
2015-07-19 23:46:31 -07:00
James Lu
536366de99
main/coreplugin: use log.exception() instead of traceback.print_exc()
...
This fixes tracebacks only being sent to console, and not the log file.
2015-07-18 20:12:13 -07:00
James Lu
b6275130e1
Irc: catch AttributeError when self.socket doesn't exist (failed to establish initial connection)
2015-07-18 20:10:33 -07:00
James Lu
a51cfcb7b2
Fix fakeirc and tests for relay ( #56 )
2015-07-17 22:52:55 -07:00
James Lu
3f6f78be9a
relay + Irc: keep track of network disconnects
...
This introduces a new PYLINK_DISCONNECT meta-hook that is called when a network disconnects. Also, reset the state variables (i.e. servers, users, etc.) on disconnect! (this was missed before)
Closes #60 .
2015-07-17 16:57:08 -07:00
James Lu
bc9863d9e0
Make reconnecting a bit less... broken
2015-07-17 16:20:41 -07:00
James Lu
fdea348cbe
move hook calling out of pr/insp and into Irc
2015-07-17 16:09:50 -07:00
James Lu
df595c65a1
fix SQUIT not respecting autoconnect delay
2015-07-17 16:01:51 -07:00
James Lu
f41e1a2eb5
Fixes for connection handling?
...
XXX: using SQUIT on the PyLink server doesn't respect autoconnect delays; why?
2015-07-17 15:08:24 -07:00
James Lu
836d0e9701
Irc: wrap (re)connecting in a while loop instead of calling it recursively
...
Also, remove unnecessary comments / ENDBURST hook from relay.
Ping handling seems to work fine now! Closes #57 . Closes #42 .
2015-07-17 14:37:07 -07:00
James Lu
9bef93c341
More stuff for PINGing uplink and autoreconnect ( #42 #59 #57 )
...
Doesn't quite work yet; still blocks everything on disconnect for some reason...
2015-07-17 13:41:14 -07:00
James Lu
0aa2f98705
Move client spawning, command / KILL / KICK handling outside the protocol module
...
New plugin 'coreplugin' takes care of command/KILL/KICK handling, while client spawning is moved into Irc.spawnMain() and is used by the former.
Closes #33 .
2015-07-16 21:52:44 -07:00
James Lu
c6c24c242c
Irc: fixes in timeout detection
2015-07-16 19:34:05 -07:00
James Lu
f1ef6f9e15
Irc: catch ConnectionError in both run() and send()
...
Part of #42 .
2015-07-16 16:49:16 -07:00
James Lu
2106b8da3a
main: add a note about irc.connected.wait() and maxnicklen being set
2015-07-15 14:00:40 -07:00
James Lu
6e37e1c05d
make Irc.connected a threaded event object, setting it to True ONLY when we receive server capabilities from our uplink
...
The previous behavior set this to True as soon as we ran connect(), but this caused problems because the default capabilities (i.e. nicklen)
that Irc() initializes won't match the real value of the network.
2015-07-15 13:49:12 -07:00
James Lu
293bfff813
main: thread Irc.connect() and begin work on autoreconnection
2015-07-15 11:52:36 -07:00
James Lu
67f5bbba4b
add a utils.started threaded trigger, so plugins can ACTUALLY wait until all Irc objects have been initialized to do their work
2015-07-13 16:07:55 -07:00
James Lu
45cef19eaa
Make plugins global, not per IRC instance
2015-07-12 23:28:34 -07:00
James Lu
0dc0770d6d
relay: add LINK and DELINK commands; many fixes to checkers (WIP)
2015-07-12 17:59:09 -07:00
James Lu
5d5f556ee3
main: load plugins in a separate loop, and call the main() of loaded plugins if present
2015-07-11 20:21:10 -07:00
James Lu
149921ac47
main: remove incorrect usage of socket.shutdown, and raise socket timeout to something more reasonable
2015-07-11 20:21:10 -07:00
James Lu
11e27b9f36
main.Irc: only load plugins after the IRC object is initialized in utils.networkobjects
...
PyLink-Relay (#37 ) needs this in order to fetch the IRC objects of various networks at start.
2015-07-10 20:24:08 -07:00
James Lu
eec024bf9a
Second attempt at multinet support, by wrapping threading.Thread around Irc.run()
...
Closes #15 .
2015-07-09 18:29:00 -07:00
James Lu
e54e17a0ea
Irc.send: safeguard against newlines in input!
2015-07-09 17:25:10 -07:00
James Lu
8576778ddc
Make the 'bot' conf block available in Irc() as irc.botdata
...
Protocol modules shouldn't read conf directly, so that we can override the config in testing.
2015-07-08 13:56:17 -07:00
James Lu
2cbd6fd851
Tests for FMODE/FJOIN, and bugfixes
2015-07-05 19:19:49 -07:00
James Lu
211decd2aa
everything: Improve logging
2015-07-05 13:44:48 -07:00