3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-12 05:02:33 +01:00

relay: fixes for NICK and TOPIC propogation

This commit is contained in:
James Lu 2015-07-15 11:48:26 -07:00
parent e3e643de54
commit bbe71e22ab

View File

@ -186,7 +186,7 @@ def initializeChannel(irc, channel):
topic = remoteirc.channels[relay[1]].topic
# XXX: find a more elegant way to do this
# Only update the topic if it's different from what we already have.
if topic != irc.channels[channel].topic:
if topic and topic != irc.channels[channel].topic:
irc.proto.topicServer(irc, irc.sid, channel, topic)
def handle_join(irc, numeric, command, args):
@ -213,7 +213,8 @@ def handle_nick(irc, numeric, command, args):
for netname, user in relayusers[(irc.name, numeric)].items():
remoteirc = utils.networkobjects[netname]
newnick = normalizeNick(remoteirc, irc.name, args['newnick'])
remoteirc.proto.nickClient(remoteirc, user, newnick)
if remoteirc.users[user].nick != newnick:
remoteirc.proto.nickClient(remoteirc, user, newnick)
utils.add_hook(handle_nick, 'NICK')
def handle_part(irc, numeric, command, args):
@ -374,7 +375,8 @@ def handle_topic(irc, numeric, command, args):
continue
remotechan = findRemoteChan(irc, remoteirc, channel)
if remotechan is None:
# 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)