3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-28 05:29:25 +01:00
Commit Graph

43 Commits

Author SHA1 Message Date
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
James Lu
54dff7a15a Convert print() calls to log calls, Round 1 2015-07-05 13:29:18 -07:00
James Lu
f06bcc7928 Merge commit 'bd755e137ffa034007a77d75fbd00d21e759163e' into wip/logger-module
Conflicts:
	proto.py
2015-07-05 13:22:17 -07:00
James Lu
3e86cbdd33 Better protocol capability negotiation
Respect our uplink's supported c/umodes, NICKLEN, and max channel name lengths.
2015-07-04 23:12:00 -07:00
James Lu
fed107b12b main.py: don't assign self.socket twice 2015-07-03 18:07:32 -07:00
James Lu
072cc72602 defaultdict for channels, fix user tracking in {join|part}Client, isInternal* to utils
- collections.defaultdict for simpler channel handling
- proto/inspircd: fix join/partClient not updating the channel's user list
- move isInternal* to utils
2015-06-23 19:29:53 -07:00
James Lu
f40cb7954a Allow dynamic protocol loading again, and make proto an attribute of Irc()
This should remove the need for plugins, etc. to import proto directly,
which wouldn't work because of dynamic naming.
2015-06-16 20:05:41 -07:00
James Lu
38df372471 main.py: catch ImportError nicely 2015-06-07 17:04:23 -07:00
James Lu
38bd58f7ff Actually check recvpass field (Closes #9) 2015-06-02 16:55:04 -07:00
James Lu
d9db7e1b9e It's almost June! Updates:
- Move config handling into separate module
- Implement identify and status commands, currently only supporting the admin account defined in the config. Closes #1.
- Move proto.add_cmd to utils.py, rename _msg() to msg()
- Allow sending the command name as an optional argument in add_cmd
- Add catch-all exception handling in plugins to prevent them from crashing the program!
2015-05-31 12:20:09 -07:00
James Lu
4ead81a66f remove unneeded imports 2015-05-30 22:35:31 -07:00
James Lu
17fc05cc9a WIP: use a proper logging module 2015-05-30 22:35:00 -07:00
James Lu
d158143cea This month's code dump... featuring:
- Server enumeration, with handlers for BURST (introduction to uplink), SERVER (introduction of uplink's other leaf servers), NICK, and SQUIT (closes #2)
- Store UIDs instead of nicks in the user database - this makes the protocol a lot easier to work with.
2015-05-30 22:15:19 -07:00
James Lu
9b4fb50f25 Today's code dump, featuring:
- PLUGIN SUPPORT and COMMAND HANDLING, wow!!!!!!!
- Restructuring of files so that there's only one protocol module (anything else is too much to maintain for now)
- Split protocol things into utils.py
- Bugfixes: don't go into an endless loop of text spamming when the remote host closes the connection!
2015-04-24 22:37:07 -07:00
James Lu
80a2ce1d0a more things 2015-04-17 22:11:49 -07:00
James Lu
c074d58052 Change of plans, we're now just a regular pseudoservice
- Remove multinet support
- Update config.yml.example
2015-04-17 19:55:48 -07:00
James Lu
b1a989c971 add a make-next-uid function and rename pylink-main.py -> main.py
The "I really hate Python imports" update.
2015-04-03 18:45:18 -07:00