mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
Merge branch 'devel' into wip/admin-commands-loopback
Conflicts: plugins/relay.py
This commit is contained in:
commit
043a4bc27a
@ -145,7 +145,7 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True):
|
|||||||
u = remoteirc.proto.spawnClient(remoteirc, nick, ident=ident,
|
u = remoteirc.proto.spawnClient(remoteirc, nick, ident=ident,
|
||||||
host=host, realname=realname,
|
host=host, realname=realname,
|
||||||
modes=modes, ts=userobj.ts).uid
|
modes=modes, ts=userobj.ts).uid
|
||||||
remoteirc.users[u].remote = irc.name
|
remoteirc.users[u].remote = (irc.name, user)
|
||||||
away = userobj.away
|
away = userobj.away
|
||||||
if away:
|
if away:
|
||||||
remoteirc.proto.awayClient(remoteirc, u, away)
|
remoteirc.proto.awayClient(remoteirc, u, away)
|
||||||
@ -163,21 +163,10 @@ def getLocalUser(irc, user, targetirc=None):
|
|||||||
representing the original user on the target network, similar to what
|
representing the original user on the target network, similar to what
|
||||||
getRemoteUser() does."""
|
getRemoteUser() does."""
|
||||||
# First, iterate over everyone!
|
# First, iterate over everyone!
|
||||||
remoteuser = None
|
try:
|
||||||
for k, v in relayusers.items():
|
remoteuser = irc.users[user].remote
|
||||||
if k[0] == irc.name:
|
except (AttributeError, KeyError):
|
||||||
# We don't need to do anything if the target users is on
|
remoteuser = None
|
||||||
# the same network as us.
|
|
||||||
continue
|
|
||||||
if v.get(irc.name) == user:
|
|
||||||
# If the stored pseudoclient UID for the kicked user on
|
|
||||||
# this network matches the target we have, set that user
|
|
||||||
# as the one we're kicking! It's a handful, but remember
|
|
||||||
# we're mapping (home network, UID) pairs to their
|
|
||||||
# respective relay pseudoclients on other networks.
|
|
||||||
remoteuser = k
|
|
||||||
log.debug('(%s) getLocalUser: found %s to correspond to %s.', irc.name, v, k)
|
|
||||||
break
|
|
||||||
log.debug('(%s) getLocalUser: remoteuser set to %r (looking up %s/%s).', irc.name, remoteuser, user, irc.name)
|
log.debug('(%s) getLocalUser: remoteuser set to %r (looking up %s/%s).', irc.name, remoteuser, user, irc.name)
|
||||||
if remoteuser:
|
if remoteuser:
|
||||||
# If targetirc is given, we'll return simply the UID of the user on the
|
# If targetirc is given, we'll return simply the UID of the user on the
|
||||||
@ -436,9 +425,9 @@ def handle_kick(irc, source, command, args):
|
|||||||
remotechan, real_target, text)
|
remotechan, real_target, text)
|
||||||
|
|
||||||
if isRelayClient(irc, target) and not irc.users[target].channels:
|
if isRelayClient(irc, target) and not irc.users[target].channels:
|
||||||
irc.proto.quitClient(irc, target, 'Left all shared channels.')
|
|
||||||
remoteuser = getLocalUser(irc, target)
|
remoteuser = getLocalUser(irc, target)
|
||||||
del relayusers[remoteuser][irc.name]
|
del relayusers[remoteuser][irc.name]
|
||||||
|
irc.proto.quitClient(irc, target, 'Left all shared channels.')
|
||||||
|
|
||||||
utils.add_hook(handle_kick, 'KICK')
|
utils.add_hook(handle_kick, 'KICK')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user