3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

relay: enforce CLAIM checks in TOPIC too.

This commit is contained in:
James Lu 2015-09-13 14:23:27 -07:00
parent 9c4e0107f3
commit 19530107d7

View File

@ -707,22 +707,27 @@ utils.add_hook(handle_mode, 'MODE')
def handle_topic(irc, numeric, command, args):
channel = args['channel']
oldtopic = args['oldtopic']
topic = args['topic']
for name, remoteirc in world.networkobjects.items():
if irc.name == name or not remoteirc.connected.is_set():
continue
if checkClaim(irc, channel, numeric):
for name, remoteirc in world.networkobjects.items():
if irc.name == name or not remoteirc.connected.is_set():
continue
remotechan = findRemoteChan(irc, remoteirc, channel)
# Don't send if the remote topic is the same as ours.
if remotechan is None or topic == remoteirc.channels[remotechan].topic:
continue
# This might originate from a server too.
remoteuser = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
if remoteuser:
remoteirc.proto.topicClient(remoteuser, remotechan, topic)
else:
rsid = getRemoteSid(remoteirc, irc)
remoteirc.proto.topicServer(rsid, remotechan, topic)
else: # Topic change blocked by claim.
irc.proto.topicClient(irc.pseudoclient.uid, channel, oldtopic)
remotechan = findRemoteChan(irc, remoteirc, channel)
# Don't send if the remote topic is the same as ours.
if remotechan is None or topic == remoteirc.channels[remotechan].topic:
continue
# This might originate from a server too.
remoteuser = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
if remoteuser:
remoteirc.proto.topicClient(remoteuser, remotechan, topic)
else:
rsid = getRemoteSid(remoteirc, irc)
remoteirc.proto.topicServer(rsid, remotechan, topic)
utils.add_hook(handle_topic, 'TOPIC')
def handle_kill(irc, numeric, command, args):