3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-23 18:54:05 +01:00

relay: add INVITE support (Closes #94)

This commit is contained in:
James Lu 2015-09-02 21:30:31 -07:00
parent 60dc3fe026
commit 320de2079a

View File

@ -1030,6 +1030,28 @@ def handle_spawnmain(irc, numeric, command, args):
initializeAll(irc) initializeAll(irc)
utils.add_hook(handle_spawnmain, 'PYLINK_SPAWNMAIN') utils.add_hook(handle_spawnmain, 'PYLINK_SPAWNMAIN')
def handle_invite(irc, source, command, args):
target = args['target']
channel = args['channel']
if isRelayClient(irc, target):
remotenet, remoteuser = getLocalUser(irc, target)
remoteirc = world.networkobjects[remotenet]
remotechan = findRemoteChan(irc, remoteirc, channel)
remotesource = getRemoteUser(irc, remoteirc, source, spawnIfMissing=False)
if remotesource is None:
utils.msg(irc, source, 'Error: You must be in a common channel '
'with %s to invite them to channels.' % \
irc.users[target].nick,
notice=True)
elif remotechan is None:
utils.msg(irc, source, 'Error: You cannot invite someone to a '
'channel not on their network!',
notice=True)
else:
remoteirc.proto.inviteClient(remoteirc, remotesource, remoteuser,
remotechan)
utils.add_hook(handle_invite, 'INVITE')
@utils.add_cmd @utils.add_cmd
def linkacl(irc, source, args): def linkacl(irc, source, args):
"""ALLOW|DENY|LIST <channel> <remotenet> """ALLOW|DENY|LIST <channel> <remotenet>