3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 11:39:25 +01:00

Merge branch 'master' into devel

This commit is contained in:
James Lu 2015-09-02 18:15:34 -07:00
commit c2ee9ef808

View File

@ -41,7 +41,7 @@ def normalizeNick(irc, netname, nick, separator=None, uid=''):
orig_nick = nick
protoname = irc.proto.__name__
maxnicklen = irc.maxnicklen
if not protoname.startswith(('insp', 'unreal')):
if '/' not in separator or not protoname.startswith(('insp', 'unreal')):
# Charybdis doesn't allow / in usernames, and will SQUIT with
# a protocol violation if it sees one.
separator = separator.replace('/', '|')
@ -255,11 +255,6 @@ def initializeChannel(irc, channel):
log.debug('(%s) initializeChannel: relay pair found to be %s', irc.name, relay)
queued_users = []
if relay:
# Send our users and channel modes to the other nets
log.debug('(%s) initializeChannel: joining our users: %s', irc.name, c.users)
relayJoins(irc, channel, c.users, c.ts)
irc.proto.joinClient(irc, irc.pseudoclient.uid, channel)
all_links = db[relay]['links'].copy()
all_links.update((relay,))
log.debug('(%s) initializeChannel: all_links: %s', irc.name, all_links)
@ -276,13 +271,15 @@ def initializeChannel(irc, channel):
continue # They aren't connected, don't bother!
# Join their (remote) users and set their modes.
relayJoins(remoteirc, remotechan, rc.users, rc.ts)
relayModes(remoteirc, irc, remoteirc.sid, remotechan, rc.modes)
relayModes(irc, remoteirc, irc.sid, channel, c.modes)
topic = remoteirc.channels[remotechan].topic
# Only update the topic if it's different from what we already have,
# and topic bursting is complete.
if remoteirc.channels[remotechan].topicset and topic != irc.channels[channel].topic:
irc.proto.topicServer(irc, irc.sid, channel, topic)
# Send our users and channel modes to the other nets
log.debug('(%s) initializeChannel: joining our users: %s', irc.name, c.users)
relayJoins(irc, channel, c.users, c.ts)
irc.proto.joinClient(irc, irc.pseudoclient.uid, channel)
def handle_join(irc, numeric, command, args):
channel = args['channel']
@ -713,7 +710,7 @@ def isRelayClient(irc, user):
pass
return False
def relayJoins(irc, channel, users, ts):
def relayJoins(irc, channel, users, ts, burst=True):
for name, remoteirc in world.networkobjects.items():
queued_users = []
if name == irc.name or not remoteirc.connected.is_set():
@ -745,7 +742,13 @@ def relayJoins(irc, channel, users, ts):
log.debug('(%s) relayJoins: not joining %s to %s%s; they\'re already there!', irc.name,
u, remoteirc.name, remotechan)
if queued_users:
# Burst was explicitly given, or we're trying to join multiple
# users/someone with a prefix.
if burst or len(queued_users) > 1 or queued_users[0][0]:
remoteirc.proto.sjoinServer(remoteirc, remoteirc.sid, remotechan, queued_users, ts=ts)
relayModes(irc, remoteirc, remoteirc.sid, remotechan)
else:
remoteirc.proto.joinClient(remoteirc, queued_users[0][1], remotechan)
def relayPart(irc, channel, user):
for name, remoteirc in world.networkobjects.items():