3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-26 04:04:22 +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 topic = remoteirc.channels[relay[1]].topic
# XXX: find a more elegant way to do this # XXX: find a more elegant way to do this
# Only update the topic if it's different from what we already have. # 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) irc.proto.topicServer(irc, irc.sid, channel, topic)
def handle_join(irc, numeric, command, args): 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(): for netname, user in relayusers[(irc.name, numeric)].items():
remoteirc = utils.networkobjects[netname] remoteirc = utils.networkobjects[netname]
newnick = normalizeNick(remoteirc, irc.name, args['newnick']) 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') utils.add_hook(handle_nick, 'NICK')
def handle_part(irc, numeric, command, args): def handle_part(irc, numeric, command, args):
@ -374,7 +375,8 @@ def handle_topic(irc, numeric, command, args):
continue continue
remotechan = findRemoteChan(irc, remoteirc, channel) 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 continue
# This might originate from a server too. # This might originate from a server too.
remoteuser = getRemoteUser(irc, remoteirc, numeric) remoteuser = getRemoteUser(irc, remoteirc, numeric)