3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 19:49:24 +01:00
Commit Graph

742 Commits

Author SHA1 Message Date
James Lu
cb83db4c1c relay: don't allow creating a channel that's already part of a relay 2015-09-17 19:24:38 -07:00
James Lu
70227bf3e0 relay: use utils.checkAuthenticated() for checking oper status 2015-09-17 19:22:34 -07:00
James Lu
8faf86aa8f relay: rejoin killed users to the RIGHT channels 2015-09-17 19:15:51 -07:00
James Lu
10f3cd1fb8 bots: limit most commands to non-protected internal PyLink clients 2015-09-17 19:07:16 -07:00
James Lu
7011aa3b36 relay: send kick rejoins from CLAIM from the main relay server 2015-09-16 21:23:09 -07:00
James Lu
f92c2f731c relay: CLAIM command! Closes #51. 2015-09-16 20:59:32 -07:00
James Lu
04ca322154 relay: skip claim checks when claim list is empty for a channel 2015-09-16 20:59:08 -07:00
James Lu
b531a180dc commands: add a "showchan" command 2015-09-14 18:43:19 -07:00
James Lu
7ced47e9b3 bots: don't allow setting umode +o on InspIRCd users (forbidden and causes desync) 2015-09-14 18:09:39 -07:00
James Lu
b8d6e1e2ef bots: still allow setting modes on internal clients 2015-09-14 18:03:39 -07:00
James Lu
c5b6658200 bots: more validation in "MODE" to prevent bad things from happening
This adds a new "allow_forceset_usermodes" attribute to protocol modules, which determines whether the IRCd allows us to force usermode changes on other servers' clients.

Also, make sure our target is a valid nick/UID/channel, and that the parsed modes are not empty!
2015-09-14 17:46:20 -07:00
James Lu
78080bde6b relay: don't fail if oldchan is not given in MODE 2015-09-14 17:36:41 -07:00
James Lu
81628f9a6d relay: rename some internal functions to make more sense
getLocalUser => getOrigUser
findRemoteChan => getRemoteChan
findRelay => getRelay
2015-09-14 17:29:37 -07:00
James Lu
75de9c6be6 relay: sort code and document most internal functions 2015-09-14 17:25:17 -07:00
James Lu
1e6c5a231e relay.handle_topic: don't fail if we're bursting and no old topic exists 2015-09-13 17:58:39 -07:00
James Lu
4a4c9395d6 relay: remove broken logging line 2015-09-13 17:50:59 -07:00
James Lu
19530107d7 relay: enforce CLAIM checks in TOPIC too. 2015-09-13 14:23:27 -07:00
James Lu
9a139212dd relay/utils: make mode reversals work with mode changes that affect op statuses. 2015-09-13 13:48:14 -07:00
James Lu
fa4583c272 relay: basic CLAIM checking when setting modes (#51)
There's still some desyncs with checking op statuses, because hooks are only called AFTER the internal state updates. Fix for this will come soon.
2015-09-12 23:36:52 -07:00
James Lu
945306af34 relay: make CLAIM checking a shared function 2015-09-12 22:50:53 -07:00
James Lu
b3902c7711 relay: KILL war protection (#23)
TODO: possibly integrate this into core?
2015-09-12 17:41:49 -07:00
James Lu
1fcacd0d7c relay: more compact "showuser" output 2015-09-12 16:03:59 -07:00
James Lu
1c97927b5d relay: monitor SAVE floods by network, not by target nick 2015-09-12 16:03:47 -07:00
James Lu
95b70f3ebf relay: spawn a server for every linked network (Closes #105) 2015-09-12 12:08:02 -07:00
James Lu
7f526267ec relay: minor typo in error message 2015-09-09 20:53:04 -07:00
James Lu
9e73af050c relay: unpluralize "relayWhoisHandlers"
There's only one handler, why did I make it plural?
2015-09-06 22:39:40 -07:00
James Lu
9dc836d921 Merge remote-tracking branch 'origin/wip/document-everything' into devel 2015-09-06 22:31:41 -07:00
James Lu
62e7cc4fca move utils.msg() => classes.Irc.msg()
New function gets an extra (optional) "source" argument for specifying a sender UID. It's also shorter since no IRC object has to be passed to utils.
2015-09-06 22:23:44 -07:00
James Lu
57da0aa3b3 Classify all our protocol modules - why didn't I do this earlier 2015-09-05 18:00:57 -07:00
James Lu
2777b88d33 commands: Add a shutdown command (#82)
Sometimes exiting takes a little time, possibly from waiting for sockets to close?
2015-09-02 23:46:59 -07:00
James Lu
0404801b18 plugins/admin.py -> plugins/bots.py
- admin: Drop "showchan" command. It's not very useful, and doesn't handle long output strings at all.
- All the remaining commands are dedicated to spawning bots and playing with them anyways, so this new name fits better.
2015-09-02 23:24:58 -07:00
James Lu
c0f5bedbd3 Add new "networks" plugin, for controlling connections to networks
Daemonized threads are lovely; when all connections are closed, PyLink just exits :)

Closes #82.
2015-09-02 23:08:04 -07:00
James Lu
320de2079a relay: add INVITE support (Closes #94) 2015-09-02 21:30:31 -07:00
James Lu
60dc3fe026 relay: use "Channel delinked." part message when delinking channels 2015-09-02 20:46:21 -07:00
James Lu
9a47ff87af Merge branch 'master' into devel 2015-09-02 20:44:03 -07:00
James Lu
043fccf447 Fix previous commit (Closes #100) 2015-09-02 18:56:53 -07:00
James Lu
ace0ddf28c relay: use JOIN instead of SJOIN for non-burst joins
Closes #96.
2015-09-02 18:33:04 -07:00
James Lu
c2ee9ef808 Merge branch 'master' into devel 2015-09-02 18:15:34 -07:00
James Lu
708d949164 relay: join remote users before sending ours
This fixes race conditions where modes can be set on our joining users (e.g. auto-op by ChanServ), but are promptly erased as relay joins remote users and resets the channel TS.

Also, move relayModes() calls back into relayJoins(), with an optional "burst" argument.

Closes #102.
2015-09-02 18:08:39 -07:00
James Lu
19fa31d012 relay: fix incorrect logging in getSupportedUmodes() 2015-09-01 22:14:25 -07:00
James Lu
2f760c8c92 relay: Don't send empty user mode changes 2015-09-01 22:13:29 -07:00
James Lu
4f40faeaf0 relay: in logs, be a bit more specific why we're blocking KILLs and KICKs 2015-09-01 22:02:34 -07:00
James Lu
0b590d6ab3 relay/protocols: use utils.toLower() for channel names, respecting IRCd casemappings
Closes #102.
2015-09-01 22:01:22 -07:00
James Lu
8d44830d5c relay.handle_kill: prevent yet another RuntimeError
(cherry picked from commit 4525b8117e)

Conflicts:
	plugins/relay.py
2015-09-01 19:42:12 -07:00
James Lu
6d6606900e relay: coerse "/" to "|" in nicks if "/" isn't present in the separator
a.k.a. make J*anus* happy :)
2015-09-01 09:56:28 -07:00
James Lu
4525b8117e relay.handle_kill: prevent yet another RuntimeError 2015-08-31 15:04:06 -07:00
James Lu
26e102f01a Show oper types on WHOIS 2015-08-31 14:52:56 -07:00
James Lu
8d19057118 relay: set umode +H (hideoper) on all remote opered clients 2015-08-31 14:23:42 -07:00
James Lu
f9b4457ced Decorate relay clients, etc. with custom OPERTYPEs
New PyLink internal hook: PYLINK_CLIENT_OPERED, called (supposedly) when a client opers up.
2015-08-31 13:31:20 -07:00
James Lu
4a964b1595 Merge branch 'master' into devel 2015-08-31 10:58:47 -07:00
James Lu
9f0f4cb124 relay: burst the right set of modes
It's moments like this where I wonder what I'm even doing with my life...
2015-08-31 09:28:14 -07:00
James Lu
94f83eb33b relay.showuser: show home network/nick, and relay nicks regardless of oper status 2015-08-29 19:49:37 -07:00
James Lu
5503477646 commands: distinguish commands with multiple binds in 'list' 2015-08-29 19:29:49 -07:00
James Lu
8976322273 Replace admin.showuser with prettier whois-style cmds in 'commands' and 'relay' 2015-08-29 19:29:05 -07:00
James Lu
e1e31f64ad Allow multiple plugins to bind to one command name!
They will get called in a list, one after the other. The "help" command is able to distinguish with this too.
2015-08-29 19:25:07 -07:00
James Lu
973aba6de7 Move utils' global variables to world.py 2015-08-29 09:39:33 -07:00
James Lu
2fe9b624e7 Consistently capitalize errors and other messages 2015-08-25 20:55:39 -07:00
James Lu
bc7765b241 Let's use consistent "Unknown command" errors, right? 2015-08-25 20:51:13 -07:00
James Lu
d059bd4ff1 Move 'exec' command into its separate plugin 2015-08-25 20:47:21 -07:00
James Lu
3d621b00df Move checkAuthenticated() to utils, and give it and isOper() toggles for allowing oper/PyLink logins 2015-08-25 20:47:21 -07:00
James Lu
51389b96e2 relay: LINKACL command (Closes #88) 2015-08-25 20:18:14 -07:00
James Lu
0610783479 Merge branch 'devel' into wip/document-everything 2015-08-24 10:09:41 -07:00
James Lu
713ba1469b relay: log blocked KILLs/KICKs (Closes #95) 2015-08-22 21:43:25 -07:00
James Lu
20474dabac relay: fix many bugs with nick collision handling, and add flood prevention for fixing nicks
Closes #85. Nick collisions caused by internal clients are handled fine now, including the following cases:
- Abusing spawnClient to create a user with the same nick as a relay client, but with a lower TS.
- When both an UID (e.g. 42XAAAAAA) and a tagged UID (_42XAAAAAA) exist on the same network (the two will both try to take the same nick of _42XAAAAAA/net over the relay).

The case where changing NICK from a long cut-off nick to another long cut-off nick is also mitigated. somelongnick/net won't show nick changes to somelongnic//net if the old and new nicks have give the same normalized relay nick.

This introduces a new dependency, expiringdict, from https://pypi.python.org/pypi/expiringdict/1.1.2, which is used as a cache for flood prevention.
2015-08-22 21:01:51 -07:00
James Lu
c1d98838d7 plugins/admin: allow sending KICK from servers (#90) 2015-08-21 00:39:58 -07:00
James Lu
bd2bd55e89 relay: fix mode relaying when sender is a client but isn't in any shared channels 2015-08-20 22:13:28 -07:00
James Lu
834136e848 Merge branch 'devel' into wip/document-everything 2015-08-20 08:14:22 -07:00
James Lu
dde9539e77 relay: fix incorrect logging in normalizeNick 2015-08-20 03:04:40 -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
f93349ae1f relay: when restoring a user after KICK, join them to the *right* channel 2015-08-18 02:59:56 -07:00
James Lu
5704fddfb4 relay: ignore internal clients for CLAIM checks 2015-08-18 02:57:40 -07:00
James Lu
0d2fbc330d relay: fix "Left all shared channels" quits for KICK handling 2015-08-18 02:44:27 -07:00
James Lu
d6e6e56e03 relay: hotfix to fix KILL handling of relay clients 2015-08-17 21:15:44 -07:00
James Lu
de36c7a62a Merge branch 'wip/admin-commands-loopback' into devel
Conflicts:
	plugins/relay.py
2015-08-17 07:52:45 -07:00
James Lu
e7f187c672 relay: send modes once at init, not on every JOIN 2015-08-15 23:31:54 -07:00
James Lu
3b83c3d567 relay: fix TOPIC relaying when the source and target channels have different names 2015-08-15 23:05:09 -07:00
James Lu
4352a68357 Check for TS changes on SJOIN (both incoming and outgoing)
Restore relay to the devel branch; TS bursts shouldn't be handled there, but in the protocol modules.

TODO: fix prefixmodes being cleared after BURST, and never being reset?
2015-08-15 19:53:09 -07:00
James Lu
0d41e35d9c Merge branch 'devel' into wip/handle-ts-bursts
Conflicts:
	plugins/relay.py
2015-08-15 19:28:49 -07:00
James Lu
aec29d2aae relay: continue, not return
(fix SQUIT not rejoining relay users properly)
2015-08-15 19:23:41 -07:00
James Lu
043a4bc27a Merge branch 'devel' into wip/admin-commands-loopback
Conflicts:
	plugins/relay.py
2015-08-15 19:21:38 -07:00
James Lu
dd91b7e5a0 relay: more efficient getLocalUser
Set the .remote attribute of each relay client to the original netname, user pair.
2015-08-15 19:18:04 -07:00
James Lu
a1db4932e1 relay: Don't allow kicks/parts to the PyLink client to be relayed. 2015-08-15 06:05:12 -07:00
James Lu
6ebe6e7867 relay: check for whether clients are relay clients, instead of just internal clients
This prevents things like non-relay PyLink clients being quit for "Left all shared channels", and allows kicks between internal clients to relay properly.
2015-08-15 05:54:18 -07:00
James Lu
f63d17f945 relay: don't relay kicks if the target has no client on the remote network? 2015-08-15 05:54:05 -07:00
James Lu
cc7e52a190 relayJoins: remove check for whether the sender internal client
This is already done by the .remote attribute check.
2015-08-15 05:20:17 -07:00
James Lu
b2e1f9678f plugins/admin: make command sending loop via hooks
This should allow plugins like relay to relay messages, kicks, etc. sent from these admin commands to actually work, preventing desyncs.
2015-08-15 05:12:49 -07:00
James Lu
d3ee7ed918 plugins/admin: fix command help for 'mode' 2015-08-15 05:12:20 -07:00
James Lu
f53e818438 plugins/admin: add 'msg' command (#90) 2015-08-15 04:51:32 -07:00
James Lu
5daf38d880 relay: restore ability to message @#channels across the relay (#91) 2015-08-15 00:12:30 -07:00
James Lu
4382b22138 relay: warn users when messaging channels they aren't in / remote users w/o sharing a channel
Some refactoring of relay's PRIVMSG handling is done here:
- Messages to channels the sender isn't in are dropped, with a notice warning sent.
- Messaging a remote user without sharing a channel with them raises an error, and is dropped.

Closes #91.
2015-08-15 00:02:46 -07:00
James Lu
e5c7d438b1 relay: in handle_kick, only remove the target from the user cache after the kick has been relayed to all networks 2015-08-14 19:05:07 -07:00
James Lu
13b5377102 relay: Fix check for whether target user is on our target channel
Really closes #71; can I sleep now...
2015-08-14 19:02:51 -07:00
James Lu
65b8c9db8a relay: attempt to fix race conditions in getRemoteUser calls (#92) 2015-08-14 08:52:09 -07:00
James Lu
27edc81894 relay: fix error message when DELINK is called on a relay's origin network without arguments
tl;dr I'm a terrible writer
2015-08-12 07:03:49 -07:00
James Lu
3ee10a5d1e relay: also propagate AWAY status when spawning users 2015-08-12 04:40:49 -07:00
James Lu
486b56e255 relay: relay AWAY statuses 2015-08-12 04:18:20 -07:00
James Lu
b3c8929d17 relay: make logging less spammy 2015-08-12 01:20:32 -07:00
James Lu
14435f8f55 relay: run getLocalUser BEFORE quitting the user (in removeChannel)
This prevents KeyErrors from showing up on DELINK.
2015-08-12 01:19:30 -07:00
James Lu
7b69ff4733 Replace plugins/hooks.py with an example plugin in docs/ 2015-08-09 00:26:40 -07:00
James Lu
cdb0bb6707 relay: fix some dumb typos 2015-08-07 17:57:37 -07:00
James Lu
d23d1c3987 relay: don't wait for irc.connected anymoree
Not needed, as nick length is a config value now.
2015-08-05 21:56:52 -07:00
James Lu
bf3116d704 First attempt at handling channel TS @ burst (#93)
Doesn't quite work yet, more testing needed.
2015-08-05 06:14:34 -07:00
James Lu
411b6c4702 relay: allow opers to run SAVE too 2015-08-05 06:10:55 -07:00
James Lu
4d55c8ce73 relay: announce KILL blocks once, and only once 2015-08-05 05:43:31 -07:00
James Lu
f61ecf6d68 relay: only call initializeAll on ENDBURST for the uplink
This prevents unnecessary bursts being sent every time a server is introduced on any network.
2015-08-04 05:13:44 -07:00
James Lu
3f98af6f96 relay: a few bugfixes
- Only send messages for blocked kicks if the sender is a user
- getRemoteUser: only set the .remote attribute when spawning a new user (prevents KeyErrors)
- Kick handling: Check for +y too when checking whether the kicker has ops
2015-08-03 23:22:13 -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
55a4fcd8be Merge branch 'devel' of github.com:GLolol/PyLink into devel 2015-08-03 04:42:09 -07:00
James Lu
58e84a654c relay: prevent RuntimeError on handle_quit 2015-08-02 19:46:19 -07:00
James Lu
880b59c2c1 utils.isOper: check for both umode +o and login status
Also, make commands.status show this isOper result.
2015-08-02 19:41:40 -07:00
James Lu
3646930d34 relay: disable "you must in a share channel" messages; they're buggy 2015-07-29 04:02:45 -07:00
James Lu
7db1648438 relay: (possibly) block relaying events to disconnected networks 2015-07-25 22:56:34 -07:00
James Lu
4d7d7ce428 relay: Only block once per IRC object, ever.
Closes #59?
2015-07-25 22:54:02 -07:00
James Lu
a38fe1ab90 Fix #74 for real? 2015-07-25 22:11:41 -07:00
James Lu
e354ada838 relay: fix nick collision loop on SAVE + when both tagged UID and untagged UID exist on one net
This fixes a clash when for example: both 42XAAAAAA and _42XAAAAAA exist on a network, and PyLink tries to relay both nicks as _42XAAAAAA/network.

Also, this adds an oldnick argument to the SAVE protocol handler, which is then used by relay.normalizeNick to check whether the original pre-SAVE nick is also in use, in the event of nick collisions.
2015-07-25 18:27:30 -07:00
James Lu
c07cfb13df relay: fix checks of DELINK must having a network parameter on a relay's home network 2015-07-25 16:56:48 -07:00
James Lu
b681a675eb relay: only join users once, returning if there are no queued users at all
Closes #71, prevents op floods on multiple SJOIN being sent. Also, this squashes AssertionErrors raised by protocol modules in sjoinServer, when we try to join zero users to a channel!
2015-07-25 11:03:27 -07:00
James Lu
7daa595a7b relay: fix opmodes not actually being coersed properly
Modepair is set before the coersing phase and never updates; whoops!
2015-07-25 10:43:47 -07:00
James Lu
25da086a6b Merge branch 'master' into wip/relay-no-duplicate-modes 2015-07-25 10:18:08 -07:00
James Lu
ee1267f06e relay: fix use of incorrect variable in logging 2015-07-24 21:12:33 -07:00
James Lu
146ab5e444 ts6: support +AOS charybdis extension modes, warning if the IRCd doesn't support them
Also, add 'adminonly' (+A) to relay's whitelist.
2015-07-24 20:55:48 -07:00
James Lu
e4da670ae0 relay: propagate SAVE as NICK changes for non-relay users! 2015-07-24 18:29:59 -07:00
James Lu
a4da9b5324 protocol/relay: fix handling of KILLs sent to non-relay users 2015-07-24 18:26:31 -07:00
James Lu
007a1d9389 Merge branch 'master' into devel 2015-07-24 11:09:53 -07:00
James Lu
71a3464e8a relay: also quit users who aren't on any shared channels after KICK 2015-07-24 10:51:16 -07:00
James Lu
5c3466bf82 relay: briefly workaround #74 by reordering our user checks 2015-07-24 10:50:39 -07:00
James Lu
254797dcfd relay: remove servprotect from umode whitelist for now.. 2015-07-23 18:05:13 -07:00
James Lu
dc7edf542a relay: fix error on handle_part if remote network has no link 2015-07-23 14:34:56 -07:00
James Lu
d213429559 Revert "relay: when filtering modes, ignore internal mode-type lists (modenames starting with *)"
This reverts commit 4ce377944c.
2015-07-23 14:30:48 -07:00
James Lu
0575de1fac Support noctcp (+C) on charybdis, and wallops (+w) in relay 2015-07-23 13:45:38 -07:00
James Lu
4ce377944c relay: when filtering modes, ignore internal mode-type lists (modenames starting with *) 2015-07-23 13:36:40 -07:00
James Lu
254ccea0a3 remove some debugging cruft and unused imports 2015-07-23 11:46:45 -07:00
James Lu
83494482a2 relay: don't ever quit the main client or part it from autojoin channels 2015-07-23 11:44:38 -07:00
James Lu
cbe7fa539f relay: remove more spurious "you must be in channel" messages 2015-07-23 11:41:33 -07:00
James Lu
58a8d7134c Fix handling of inbound CHG* 2015-07-23 11:02:32 -07:00
James Lu
8799e1ccc8 spawnClient: add ts as opt. argument; relay: spawn pseudoclients w/ TS of original user 2015-07-23 00:11:24 -07:00
James Lu
44e07b0c2f relay: don't error if the WHOIS target isn't a relay user... oops 2015-07-23 00:10:54 -07:00
James Lu
a7f977aa3b Add whois handlers for channel lists, user modes, and signon time, and relay user information
New API: utils.whois_handlers allows one to add functions taking (irc, target) and returning (irc numeric, reply text)

Closes #72.
2015-07-23 00:01:51 -07:00
James Lu
8c1e1c18f1 relay: Factorize relayJoins usage in initializeChannel and truly fix #74.
Squashed commit of the following:

commit 4e481f15db372d5c07f30e92f6581ea93692695b
Author: James Lu <GLolol1@hotmail.com>
Date:   Wed Jul 22 19:28:34 2015 -0700

    relay: Factorize relayJoins usage in initializeChannel and truly fix #74.

    The real error was that queued_users was being defined in the wrong spot (outside of the for loop),
    so the user list would grow larger and larger with every network initialized.

    This reverts parts of the previous commit which weren't actually necessary.

commit 76cc6bfbc71439880f01891f944600a26ff81130
Author: James Lu <GLolol1@hotmail.com>
Date:   Wed Jul 22 13:34:47 2015 -0700

    Mark users as internal at the IrcUser level (attempt to fix #74)
2015-07-22 19:29:58 -07:00
James Lu
3eb54c479a admin: clearer command help? 2015-07-22 13:18:11 -07:00
James Lu
c889cf6513 relay: only check for duplicate modes if prefix is '+' 2015-07-21 23:58:28 -07:00
James Lu
48aa0c3160 relay: rebase "no duplicate modes" branch over devel
Conflicts:
	plugins/relay.py
2015-07-21 23:55:28 -07:00
James Lu
7b84bda11b relay: refactor getLocalUser to accept a targetirc argument; fix MODE and KICK relaying
Closes #76.
2015-07-21 23:53:59 -07:00
James Lu
a1fc6d6734 relay: attempt to fix kick relaying (#76) 2015-07-21 22:14:53 -07:00
James Lu
6abb56921e relay: fix DELINK delinking more networks than the current one 2015-07-21 20:18:35 -07:00
James Lu
a04bce99c1 fix 8f13ae77, again... 2015-07-21 20:13:43 -07:00
James Lu
e2738e3909 utils.applyModes: fix prefixmodes lists not being updated... 2015-07-21 19:57:22 -07:00
James Lu
3b79adf4e5 relay: Fix remoteuser being None for spawned pseudoclients
We're supposed to ignore these anyways... Closes #74.
2015-07-21 19:29:09 -07:00
James Lu
8f13ae778a Fix regression in 024ac165 that caused channel messages to only be sent to one other net, instead of all relay links 2015-07-21 19:27:41 -07:00
James Lu
ea7681502f fix some bugs, introduce others 2015-07-21 17:33:36 -07:00
James Lu
c0f82597a5 relay: don't spawn new pseudoclients for mode changes 2015-07-21 16:07:09 -07:00
James Lu
9b8ef0a45d make relay and ts6 a bit less, well, buggy 2015-07-21 12:44:01 -07:00
James Lu
73c41b4363 relay & ts6: miscellaneous fixes? 2015-07-20 23:36:26 -07:00
James Lu
72be5ca79c inspircd: make handle_part return a list of channels, not just one
Some IRCds, like TS6, allow sending multiple channels (as a comma-separated list) in PART.

Update relay accordingly.
2015-07-20 19:52:52 -07:00
James Lu
ef3aab69f2 relay: make '/' support in nicks explicit instead of implicit 2015-07-20 16:50:18 -07:00
James Lu
65ef27fd4b relay: initial nick collision handling via SAVE (Closes #61) 2015-07-20 14:37:04 -07:00
James Lu
ad34f6c4f9 relay: make separator a per-network config option 2015-07-20 14:36:47 -07:00
James Lu
2bc0a65128 relay: hack to support sending to @#channel, etc. 2015-07-20 13:45:15 -07:00
James Lu
b1e409ff3e relay: unbreak topic handling (closes #68)
Introducing a new .topicset attributing in IrcChannel denoting whether we've received a TOPIC for this channel from the uplink yet.
2015-07-20 13:18:04 -07:00
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
fd736b383f relay: add user mode handling based on a whitelist of modes
Closes #64.
2015-07-19 22:43:26 -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
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
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
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
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
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
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
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
35f1c88a4e relay: add hooks for CHGHOST / CHGIDENT / CHGNAME
Closes #49.
2015-07-16 11:53:40 -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
cd244ee89b relay: block until irc.maxnicklen is set, and remove check for "nick already in use" for internal clients
Closes #48. This fixes the edge case where, if a person with a long, cut-off nick changes to another long nick, and the resulting normalized nick is the same,
normalizeNick will start incrementing the separator anyway. The correct behavior is to NOT send any nick changes if the old (normalized) nick and the new nick
match.
2015-07-15 13:53:14 -07:00
James Lu
bbe71e22ab relay: fixes for NICK and TOPIC propogation 2015-07-15 11:48:26 -07:00
James Lu
e3e643de54 relay: don't try to spawn clients on disconnected networks (those raise errors) 2015-07-15 11:48:03 -07:00
James Lu
4c77ad93d7 relay: fix over-reaching behavior of delink #chan <remotenet> when you're the host 2015-07-15 11:47:06 -07:00
James Lu
0918b2f958 relay: missing line in initializeChannel 2015-07-14 23:29:03 -07:00
James Lu
3a9df57c39 relay: remove unused relay() function; what was that about? 2015-07-14 23:26:56 -07:00
James Lu
5999eedd98 relay: block kills, respawning their targets transparently
Closes #47.
2015-07-14 23:26:52 -07:00
James Lu
13e4cadf2b relay: add TOPIC support (experimental)
Closes #46.
2015-07-14 23:26:39 -07:00
James Lu
46e1538bd2 relay: fix #45 - cases when MODE/KICK is sent by a server, not a client 2015-07-14 22:37:50 -07:00
James Lu
7de8f1509d relay: factorize getLocalUser, introduce MODE (experimental) and PRIVMSG handler 2015-07-14 19:39:49 -07:00
James Lu
f74e704733 relay: whoops, check for claim properly 2015-07-14 18:27:26 -07:00
James Lu
28f1d4ba19 relay: add a working KICK handler
This should block kicks from non-opped remote users, and handle kicks across the relay properly by mapping our pseudoclients to the real targets.
2015-07-14 18:23:19 -07:00
James Lu
876cf34825 relay: Remove spawning a sub-server for each relay network
It introduced bugs, and made the relay code more complicated than it has to be :(
2015-07-14 17:42:17 -07:00
James Lu
a1299676f1 relay: factorize fetching of remote users/SIDs, spawning them if they don't exist 2015-07-14 12:04:05 -07:00
James Lu
59295f921b relay: part users on DELINK/DESTROY 2015-07-13 23:29:20 -07:00
James Lu
310a9201e2 relay: fix bugs with removing nonexistant channels in DELINK, and linking a channel multiple times in LINK 2015-07-13 22:54:51 -07:00
James Lu
1cbcec1001 relay: sync modes on initializeChannel as well 2015-07-13 22:42:50 -07:00
James Lu
c5298e3931 relay: fix joining users on initializeChannel 2015-07-13 21:46:05 -07:00
James Lu
235f169e54 relay: add quit, part, and nick handlers 2015-07-13 19:53:57 -07:00
James Lu
9bc8a35c25 relay: fix cases where a remote linked channel has different name 2015-07-13 19:46:24 -07:00
James Lu
a5e2beb566 relay: propogate prefix modes in relayJoins, if the remote net supports them 2015-07-13 18:23:58 -07:00
James Lu
d8cb3f1973 relay: spawn users on the right pseudoservers, and use SJOIN to introduce them if possible 2015-07-13 16:09:22 -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
b3528a2b04 relay: better channel initialization 2015-07-13 00:01:04 -07:00
James Lu
b3206822d2 relay: fix users being cloned on every JOIN 2015-07-12 23:31:26 -07:00
James Lu
6b9ec694b7 relay: basic JOIN handling 2015-07-12 23:28:54 -07:00
James Lu
3c2d0dbe3f relay: (de)initialize channels using shared initialize/removechannel() 2015-07-12 19:03:18 -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
6870e041bc relay: catch nicks that start with digits and add tests 2015-07-12 16:59:49 -07:00
James Lu
b538037e22 relay: add normalizeNick stub 2015-07-12 14:02:17 -07:00
James Lu
450584b963 relay: hack in utils.schedulers so that exportDB only gets queued once globally
Previously, exportDB would be queued once by every IRC object, which was the wrong behavior!
2015-07-12 13:09:35 -07:00
James Lu
e073f21417 relay: spawn servers, raise exportDB interval to 60; use main(irc) 2015-07-11 20:21:10 -07:00
James Lu
8d4a06b60e Initial PyLink-Relay stub, with CREATE and DESTROY commands using a pickle database.
ref #37.
2015-07-10 20:26:46 -07:00
James Lu
3156d83ec3 plugins/admin: rename quitclient -> quit 2015-07-10 16:43:16 -07:00
James Lu
070bba77cb admin.py: check to see if queried channels exist; sort output fields 2015-07-09 17:05:23 -07:00
James Lu
e7922be9fb plugins/commands.py: warn on failed login attempts 2015-07-08 23:21:01 -07:00
James Lu
27bb6af7f6 plugins/admin.py: add 'mode' and 'showchan' commands 2015-07-08 23:01:09 -07:00
James Lu
edfcacfdd1 plugins/admin.py: remove -client suffixes from commands, and fix argument checking 2015-07-08 22:50:19 -07:00
James Lu
211decd2aa everything: Improve logging 2015-07-05 13:44:48 -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
d23d34e316 Refactor hooks to send parsed arguments instead of raw args
ref #18.

- Command handlers that support hooks will now return parsed args, which are then sent to the hooks
- Hook commands are now stored in uppercase letters, consistent with the IRC spec
2015-07-04 19:00:29 -07:00
James Lu
6370ad492f Add basic command hooks (ref #18) 2015-06-23 19:08:43 -07:00
James Lu
0db5c4c209 plugins/admin.py: add 'showuser' command 2015-06-19 13:00:23 -07:00
James Lu
d8b562865d plugins/admin.py: this is an exec command, not eval 2015-06-19 10:44:25 -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
4d763288e5 rename utils._nicktoUid to utils.nickToUid
Consistency in function capitalization is a good thing!!
2015-06-07 19:36:21 -07:00
James Lu
43a46d3d99 Many fixes
- Move _nicktoUid to utils.py
- Make _sendFromUser arguments more consistent (irc, sendfrom, message) instead of (irc, message, sendfrom=None)
- Add admin only kickclient, partclient, and nickclient commands
- proto.joinClient: take UIDs instead of an IrcUser object, in order to be more consistent

Closes #4, Closes #12.
2015-06-07 19:31:56 -07:00
James Lu
86c7fd0db1 WIP admin commands 2015-06-07 13:40:18 -07:00
James Lu
6680942424 More code and broken shenanigans
- plugins/commands.py: add admin-only eval command
- add IrcChannel class and basic channel (FJOIN/QUIT) handling
- Move SQUIT/QUIT handling code to a shared removeClient function
    - Unfortunately, this causes a regression where the users and channels indexes aren't purged on a netsplit :(
2015-06-06 23:06:33 -07:00
James Lu
0ed1e13115 Remove plugins/hello.py
This was solely a testing module for the plugin/commands system, and serves no purpose anymore. commands.py provides basic commands that are both simple and actually useful.
2015-06-03 16:09:53 -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
0fcf5ead04 utils.py: Make _msg a shared function (Closes #3) 2015-05-30 23:00:39 -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
f2fdaf55a1 commands: add a command to print debug info to console 2015-04-24 23:04:33 -07:00
James Lu
6b79793336 cleanup, add commands.py plugin (incomplete) 2015-04-24 23:00:01 -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