3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-05 01:19:32 +01:00
Commit Graph

3736 Commits

Author SHA1 Message Date
James Lu
e76d31d14e relay: fixes to KICK handling, don't allow spawning new pseudoclients for trivial tasks like TOPIC or PART
This introduces a new spawnIfMissing option in getRemoteUser, which defaults to True and toggles spawning new pseudoclients if one is not found for a certain network.
In the case of TOPIC or PART being sent, we'll want this turned off because we can either 1) route these through our PyLink server SID, or 2) ignore these entirely.

For KICK handling, this commit fixes kicks sent from servers or clients that don't have a pseudoclient on the target network, by tagging them in the message and routing them through our main PyLink SID.
Normal kicks still behave as usual:

* You have been kicked from #endlessvoid by GLo|o|/ovd (test)
* You have been kicked from #endlessvoid by pylink-devel.overdrive.pw ((ChanServ/ovd) (GLo|o| (GLolol)) test)
* You have been kicked from #endlessvoid by pylink-devel.overdrive.pw ((some.server.name/ovd) No reason given)
2015-07-19 23:49:50 -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
fe9c317f2c inspircd: make channel user tracking more fault tolerant (in sjoinServer / handle_part) 2015-07-19 23:46:19 -07:00
James Lu
fd736b383f relay: add user mode handling based on a whitelist of modes
Closes #64.
2015-07-19 22:43:26 -07:00
James Lu
8cde2ddce7 utils.applyModes: don't crash if existing modelist is a list, not a set 2015-07-19 22:42:04 -07:00
James Lu
bf444f3f6a pr/insp: Servers should use FTOPIC, not TOPIC to send topics 2015-07-19 17:27:53 -07:00
James Lu
4078cef3e4 relay: base mode relaying off a whitelist (closes #54)
Modes that aren't standard/safe (e.g. ojoin +Y, permchan +P, various anti-flood modes) are simply ignored.
2015-07-19 16:53:51 -07:00
James Lu
0cb9065d53 pr/insp: coerse 'reginvite' named mode to 'regonly' 2015-07-19 16:53:51 -07:00
James Lu
0540e10d50 relay: don't add bans that don't match nick!user@host
Closes #55.
2015-07-19 16:53:51 -07:00
James Lu
fbc2fbf595 log: replace existing log files instead of appending 2015-07-19 16:52:58 -07:00
James Lu
57e9bf601e Log command usage, 'exec' usage, successful logins, and access denied to commands in admin.py
Closes #66.
2015-07-19 15:01:49 -07:00
James Lu
1b09a00ea9 utils: add getHostmask 2015-07-19 15:01:49 -07:00
James Lu
c00da49477 relay: add 'save' command, make rescheduling optional in exportDB() 2015-07-19 15:01:49 -07:00
James Lu
688675d484 relay: don't relay messages sent to the PyLink client 2015-07-19 11:27:57 -07:00
James Lu
00e28047f7 Make sure log/ exists 2015-07-18 20:13:53 -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
61804b1ecd log: also log to $curdir/log/pylink.log
Closes #52.
2015-07-18 20:11:29 -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
024ac165a8 relay: Only allow messaging users in common channels / channels that you're in
The old behavior, which iterated over the pseudoclients representing the sender, dropped messages to clients without a common channel without any warning. Now, the sender will get a lovely notice from the PyLink client.

Trying to send to a '-n' channel without being in it:
	-PyLink-devel- Error: You must be in '#channel' in order to send messages.

Trying to message a user without sharing a common channel:
	-PyLink-devel- Error: You must be in a common channel with 'GLolol/testnet' in order to send messages.

Closes #62.
2015-07-18 12:24:12 -07:00
James Lu
d30890c5cd relay: fix "RuntimeError: dictionary changed size during iteration" in handle_part 2015-07-18 12:21:46 -07:00
James Lu
ccf759679b relay: fix the wrong modes being propagated to the wrong channels
tl;dr, this was two bugs in one! Closes #53.
2015-07-18 12:06:58 -07:00
James Lu
64adb79120 example conf: mention pingfreq and disabling autoconnect 2015-07-17 23:44:52 -07:00
James Lu
a51cfcb7b2 Fix fakeirc and tests for relay (#56) 2015-07-17 22:52:55 -07:00
James Lu
4553eda6ec plugins/admin & relay: Add help for commands 2015-07-17 22:35:34 -07:00
James Lu
50665ec601 commands: remove 'debug', it's useless now that 'exec', 'showchan', and 'showuser' exist 2015-07-17 22:21:57 -07:00
James Lu
6508cb3c38 commands: add a 'help' command (closes #8)
Fetch the docstring of the command function if it exists, and format appropriately.
2015-07-17 22:21:16 -07:00
James Lu
bbcd70b175 relay: add 'linked' command (closes #65) 2015-07-17 22:00:25 -07:00
James Lu
49943a7992 relay: only join PyLink to channels & set topics if there's actually a relay on the network 2015-07-17 21:51:30 -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
95853924ad Revert "protocols/: thread calls to each event hook to prevent blocking globally"
This reverts commit 99fd6060a7, which caused a bunch of race conditions in relay :/

Ref #59.
2015-07-17 15:13:57 -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
99fd6060a7 protocols/: thread calls to each event hook to prevent blocking globally
Closes #59.
2015-07-17 14:35:02 -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
73c625a429 pr/insp: don't raise KeyError when removing channel from user fails 2015-07-16 16:48:54 -07:00
James Lu
2a586a6dba relay: don't send empty MODE commands if there are no supported modes left after filtering 2015-07-16 16:27:17 -07:00
James Lu
cf32461d8e relay: Only spawn clients if they share a channel, and quit them when they leave all shared channels
Closes #50.
2015-07-16 12:25:42 -07:00
James Lu
40fd9e37a0 relay: don't spawn tagged clones for the internal PyLink client 2015-07-16 12:25:33 -07:00
James Lu
d97fce8205 IrcUser & pr/insp: Implement user channel tracking 2015-07-16 12:20:40 -07:00
James Lu
35f1c88a4e relay: add hooks for CHGHOST / CHGIDENT / CHGNAME
Closes #49.
2015-07-16 11:53:40 -07:00
James Lu
f9d82153bb pr/insp: map FIDENT/FHOST/FNAME hooks to their CHG* counterparts 2015-07-15 23:23:46 -07:00
James Lu
643218efce README: fix link to issue tracker 2015-07-15 23:15:08 -07:00
James Lu
2f38b2b38d relay: handle squit, quitting the relevant relay pseudoclients with a fake netsplit message
This is hardcoded to *.net *.split, but it may change to show the split servers in the future...
2015-07-15 19:09:10 -07:00
James Lu
e413a21e68 pr/insp: send the list of affected users in handle_squit 2015-07-15 19:08:49 -07:00