3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

Merge branch 'master' into devel

This commit is contained in:
James Lu 2016-06-20 16:38:33 -07:00
commit 0b9691c3c6
5 changed files with 31 additions and 8 deletions

View File

@ -27,6 +27,12 @@ You can also link remote channels to take a different name on your network. (Thi
Also, to list the available channels: Also, to list the available channels:
- `/msg PyLink linked` - `/msg PyLink linked`
To remove a relay channel that you've created:
- `/msg PyLink destroy #channelname`
To delink a channel linked to another network:
- `/msg PyLink delink #channelname`
### Claiming channels ### Claiming channels
PyLink offers channel claims similarly to Janus, except that it is on by default when you create a channel on any network. Unless the claimed network list of a channel is EMPTY, oper override (MODE, KICK, TOPIC) will only be allowed from networks on that list. PyLink offers channel claims similarly to Janus, except that it is on by default when you create a channel on any network. Unless the claimed network list of a channel is EMPTY, oper override (MODE, KICK, TOPIC) will only be allowed from networks on that list.

View File

@ -45,7 +45,7 @@ oplevel_upass,,,,,,U
opmoderated,U (extras/m_opmoderated),z,z,,, opmoderated,U (extras/m_opmoderated),z,z,,,
owner,q (m_customprefix/m_chanprotect),,y (when enabled),q,, owner,q (m_customprefix/m_chanprotect),,y (when enabled),q,,
permanent,P (m_permchannels),P,P,P,,z permanent,P (m_permchannels),P,P,P,,z
private,p,p,p,p,,p private,p,,,p,,p
quiet,,q,q,,, quiet,,q,q,,,
redirect,L (m_redirect),f,f,L,,L redirect,L (m_redirect),f,f,L,,L
registered,r (m_services_account),,,r,r,R registered,r (m_services_account),,,r,r,R

1 Channel Mode / IRCd InspIRCd charybdis Elemental-IRCd UnrealIRCd IRCd-Hybrid Nefarious IRCu
45 opmoderated U (extras/m_opmoderated) z z
46 owner q (m_customprefix/m_chanprotect) y (when enabled) q
47 permanent P (m_permchannels) P P P z
48 private p p p p p
49 quiet q q
50 redirect L (m_redirect) f f L L
51 registered r (m_services_account) r r R

View File

@ -103,17 +103,22 @@ def normalizeNick(irc, netname, nick, separator=None, uid=''):
orig_nick = nick orig_nick = nick
protoname = irc.protoname protoname = irc.protoname
maxnicklen = irc.maxnicklen maxnicklen = irc.maxnicklen
if '/' not in separator or not protoname.startswith(('insp', 'unreal')):
# Charybdis doesn't allow / in usernames, and will SQUIT with # Charybdis, IRCu, etc. don't allow / in nicks, and will SQUIT with a protocol
# a protocol violation if it sees one. # violation if it sees one. Or it might just ignore the client introduction and
# cause bad desyncs.
protocol_allows_slashes = protoname.startswith(('insp', 'unreal')) or \
irc.serverdata.get('relay_force_slashes')
if '/' not in separator or not protocol_allows_slashes:
separator = separator.replace('/', '|') separator = separator.replace('/', '|')
nick = nick.replace('/', '|') nick = nick.replace('/', '|')
if nick.startswith(tuple(string.digits)): if nick.startswith(tuple(string.digits)):
# On TS6 IRCds, nicks that start with 0-9 are only allowed if # On TS6 IRCds, nicks that start with 0-9 are only allowed if
# they match the UID of the originating server. Otherwise, you'll # they match the UID of the originating server. Otherwise, you'll
# get nasty protocol violation SQUITs! # get nasty protocol violation SQUITs!
nick = '_' + nick nick = '_' + nick
tagnicks = True
suffix = separator + netname suffix = separator + netname
nick = nick[:maxnicklen] nick = nick[:maxnicklen]
@ -1390,7 +1395,8 @@ def destroy(irc, source, args):
channel, irc.getHostmask(source)) channel, irc.getHostmask(source))
irc.reply('Done.') irc.reply('Done.')
else: else:
irc.reply('Error: No such relay %r exists.' % channel) irc.reply("Error: No such channel %r exists. If you're trying to delink a channel from "
"another network, use the DESTROY command." % channel)
return return
@utils.add_cmd @utils.add_cmd
@ -1405,25 +1411,36 @@ def link(irc, source, args):
except IndexError: except IndexError:
irc.reply("Error: Not enough arguments. Needs 2-3: remote netname, channel, local channel name (optional).") irc.reply("Error: Not enough arguments. Needs 2-3: remote netname, channel, local channel name (optional).")
return return
try: try:
localchan = irc.toLower(args[2]) localchan = irc.toLower(args[2])
except IndexError: except IndexError:
localchan = channel localchan = channel
for c in (channel, localchan): for c in (channel, localchan):
if not utils.isChannel(c): if not utils.isChannel(c):
irc.reply('Error: Invalid channel %r.' % c) irc.reply('Error: Invalid channel %r.' % c)
return return
if remotenet == irc.name:
irc.reply('Error: Cannot link two channels on the same network.')
return
if source not in irc.channels[localchan].users: if source not in irc.channels[localchan].users:
irc.reply('Error: You must be in %r to complete this operation.' % localchan) irc.reply('Error: You must be in %r to complete this operation.' % localchan)
return return
irc.checkAuthenticated(source) irc.checkAuthenticated(source)
if remotenet not in world.networkobjects: if remotenet not in world.networkobjects:
irc.reply('Error: No network named %r exists.' % remotenet) irc.reply('Error: No network named %r exists.' % remotenet)
return return
localentry = getRelay((irc.name, localchan)) localentry = getRelay((irc.name, localchan))
if localentry: if localentry:
irc.reply('Error: Channel %r is already part of a relay.' % localchan) irc.reply('Error: Channel %r is already part of a relay.' % localchan)
return return
try: try:
entry = db[(remotenet, channel)] entry = db[(remotenet, channel)]
except KeyError: except KeyError:

View File

@ -259,7 +259,7 @@ class TS6Protocol(TS6BaseProtocol):
chary_cmodes = { # TS6 generic modes (note that +p is noknock instead of private): chary_cmodes = { # TS6 generic modes (note that +p is noknock instead of private):
'op': 'o', 'voice': 'v', 'ban': 'b', 'key': 'k', 'limit': 'op': 'o', 'voice': 'v', 'ban': 'b', 'key': 'k', 'limit':
'l', 'moderated': 'm', 'noextmsg': 'n', 'noknock': 'p', 'l', 'moderated': 'm', 'noextmsg': 'n', 'noknock': 'p',
'secret': 's', 'topiclock': 't', 'secret': 's', 'topiclock': 't', 'inviteonly': 'i',
# charybdis-specific modes: # charybdis-specific modes:
'quiet': 'q', 'redirect': 'f', 'freetarget': 'F', 'quiet': 'q', 'redirect': 'f', 'freetarget': 'F',
'joinflood': 'j', 'largebanlist': 'L', 'permanent': 'P', 'joinflood': 'j', 'largebanlist': 'L', 'permanent': 'P',

View File

@ -482,7 +482,7 @@ class UnrealProtocol(TS6BaseProtocol):
'nokick': 'Q', 'private': 'p', 'stripcolor': 'S', 'key': 'k', 'nokick': 'Q', 'private': 'p', 'stripcolor': 'S', 'key': 'k',
'op': 'o', 'voice': 'v', 'regonly': 'R', 'noinvite': 'V', 'op': 'o', 'voice': 'v', 'regonly': 'R', 'noinvite': 'V',
'banexception': 'e', 'nonick': 'N', 'issecure': 'Z', 'topiclock': 't', 'banexception': 'e', 'nonick': 'N', 'issecure': 'Z', 'topiclock': 't',
'nonotice': 'T', 'delayjoin': 'D'} 'nonotice': 'T', 'delayjoin': 'D', 'inviteonly': 'i'}
# Make a list of all our capability names. # Make a list of all our capability names.
self.caps += [arg.split('=')[0] for arg in args] self.caps += [arg.split('=')[0] for arg in args]