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.
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?
This prevents things like non-relay PyLink clients being quit for "Left all shared channels", and allows kicks between internal clients to relay properly.
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.
- 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
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.
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!