mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-28 05:29:25 +01:00
Merge branch 'master' into devel
This commit is contained in:
commit
c2ee9ef808
@ -41,7 +41,7 @@ def normalizeNick(irc, netname, nick, separator=None, uid=''):
|
|||||||
orig_nick = nick
|
orig_nick = nick
|
||||||
protoname = irc.proto.__name__
|
protoname = irc.proto.__name__
|
||||||
maxnicklen = irc.maxnicklen
|
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
|
# Charybdis doesn't allow / in usernames, and will SQUIT with
|
||||||
# a protocol violation if it sees one.
|
# a protocol violation if it sees one.
|
||||||
separator = separator.replace('/', '|')
|
separator = separator.replace('/', '|')
|
||||||
@ -255,11 +255,6 @@ def initializeChannel(irc, channel):
|
|||||||
log.debug('(%s) initializeChannel: relay pair found to be %s', irc.name, relay)
|
log.debug('(%s) initializeChannel: relay pair found to be %s', irc.name, relay)
|
||||||
queued_users = []
|
queued_users = []
|
||||||
if relay:
|
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 = db[relay]['links'].copy()
|
||||||
all_links.update((relay,))
|
all_links.update((relay,))
|
||||||
log.debug('(%s) initializeChannel: all_links: %s', irc.name, all_links)
|
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!
|
continue # They aren't connected, don't bother!
|
||||||
# Join their (remote) users and set their modes.
|
# Join their (remote) users and set their modes.
|
||||||
relayJoins(remoteirc, remotechan, rc.users, rc.ts)
|
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
|
topic = remoteirc.channels[remotechan].topic
|
||||||
# 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,
|
||||||
# and topic bursting is complete.
|
# and topic bursting is complete.
|
||||||
if remoteirc.channels[remotechan].topicset and topic != irc.channels[channel].topic:
|
if remoteirc.channels[remotechan].topicset and topic != irc.channels[channel].topic:
|
||||||
irc.proto.topicServer(irc, irc.sid, 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):
|
def handle_join(irc, numeric, command, args):
|
||||||
channel = args['channel']
|
channel = args['channel']
|
||||||
@ -713,7 +710,7 @@ def isRelayClient(irc, user):
|
|||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def relayJoins(irc, channel, users, ts):
|
def relayJoins(irc, channel, users, ts, burst=True):
|
||||||
for name, remoteirc in world.networkobjects.items():
|
for name, remoteirc in world.networkobjects.items():
|
||||||
queued_users = []
|
queued_users = []
|
||||||
if name == irc.name or not remoteirc.connected.is_set():
|
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,
|
log.debug('(%s) relayJoins: not joining %s to %s%s; they\'re already there!', irc.name,
|
||||||
u, remoteirc.name, remotechan)
|
u, remoteirc.name, remotechan)
|
||||||
if queued_users:
|
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)
|
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):
|
def relayPart(irc, channel, user):
|
||||||
for name, remoteirc in world.networkobjects.items():
|
for name, remoteirc in world.networkobjects.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user