mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
Store opertypes with spaces instead of underscores, and only change them back when sending OPERTYPE
Another "Janus sucks" commit - it should be always using underscores when sending OPERTYPE, but it doesn't...
This commit is contained in:
parent
82d129fed2
commit
f38958995c
@ -79,7 +79,7 @@ def handle_whois(irc, source, command, args):
|
||||
# only if they have umode +o.
|
||||
if ('o', None) in user.modes:
|
||||
if hasattr(user, 'opertype'):
|
||||
opertype = user.opertype.replace("_", " ")
|
||||
opertype = user.opertype
|
||||
else:
|
||||
opertype = "IRC Operator"
|
||||
# Let's be gramatically correct.
|
||||
|
@ -194,12 +194,11 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True):
|
||||
# If an opertype exists for the user, add " (remote)"
|
||||
# for the relayed clone, so that it shows in whois.
|
||||
# Janus does this too. :)
|
||||
# OPERTYPE uses underscores instead of spaces, FYI.
|
||||
log.debug('(%s) relay.getRemoteUser: setting OPERTYPE of client for %r to %s',
|
||||
irc.name, user, userobj.opertype)
|
||||
opertype = userobj.opertype + '_(remote)'
|
||||
opertype = userobj.opertype + ' (remote)'
|
||||
else:
|
||||
opertype = 'IRC_Operator_(remote)'
|
||||
opertype = 'IRC Operator (remote)'
|
||||
# Set hideoper on remote opers, to prevent inflating
|
||||
# /lusers and various /stats
|
||||
hideoper_mode = remoteirc.umodes.get('hideoper')
|
||||
@ -587,7 +586,8 @@ world.whois_handlers.append(relayWhoisHandler)
|
||||
def handle_operup(irc, numeric, command, args):
|
||||
newtype = args['text'] + '_(remote)'
|
||||
for netname, user in relayusers[(irc.name, numeric)].items():
|
||||
log.debug('(%s) relay.handle_opertype: setting OPERTYPE of %s/%s to %s', irc.name, user, netname, newtype)
|
||||
log.debug('(%s) relay.handle_opertype: setting OPERTYPE of %s/%s to %s',
|
||||
irc.name, user, netname, newtype)
|
||||
remoteirc = world.networkobjects[netname]
|
||||
remoteirc.users[user].opertype = newtype
|
||||
utils.add_hook(handle_operup, 'PYLINK_CLIENT_OPERED')
|
||||
|
@ -54,7 +54,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
modes=raw_modes, ip=ip, realname=realname,
|
||||
realhost=realhost))
|
||||
if ('o', None) in modes or ('+o', None) in modes:
|
||||
self._operUp(uid, opertype=opertype or 'IRC_Operator')
|
||||
self._operUp(uid, opertype=opertype or 'IRC Operator')
|
||||
return u
|
||||
|
||||
def joinClient(self, client, channel):
|
||||
@ -143,17 +143,17 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
and the change will be reflected here."""
|
||||
userobj = self.irc.users[target]
|
||||
try:
|
||||
otype = opertype or userobj.opertype or 'IRC_Operator'
|
||||
otype = opertype or userobj.opertype or 'IRC Operator'
|
||||
except AttributeError:
|
||||
log.debug('(%s) opertype field for %s (%s) isn\'t filled yet!',
|
||||
self.irc.name, target, userobj.nick)
|
||||
# whatever, this is non-standard anyways.
|
||||
otype = 'IRC_Operator'
|
||||
otype = 'IRC Operator'
|
||||
assert otype, "Tried to send an empty OPERTYPE!"
|
||||
log.debug('(%s) Sending OPERTYPE from %s to oper them up.',
|
||||
self.irc.name, target)
|
||||
userobj.opertype = otype
|
||||
self._send(target, 'OPERTYPE %s' % otype)
|
||||
self._send(target, 'OPERTYPE %s' % otype.replace(" ", "_"))
|
||||
|
||||
def _sendModes(self, numeric, target, modes, ts=None):
|
||||
"""Internal function to send mode changes from a PyLink client/server."""
|
||||
@ -163,7 +163,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
if ('+o', None) in modes and not utils.isChannel(target):
|
||||
# https://github.com/inspself.ircd/inspself.ircd/blob/master/src/modules/m_spanningtree/opertype.cpp#L26-L28
|
||||
# Servers need a special command to set umode +o on people.
|
||||
# Why isn't this documented anywhere, InspIRCd?
|
||||
self._operUp(target)
|
||||
utils.applyModes(self.irc, target, modes)
|
||||
joinedmodes = utils.joinModes(modes)
|
||||
@ -547,7 +546,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
# command sent for it.
|
||||
# <- :70MAAAAAB OPERTYPE Network_Owner
|
||||
omode = [('+o', None)]
|
||||
self.irc.users[numeric].opertype = opertype = args[0]
|
||||
self.irc.users[numeric].opertype = opertype = args[0].replace("_", " ")
|
||||
utils.applyModes(self.irc, numeric, omode)
|
||||
# OPERTYPE is essentially umode +o and metadata in one command;
|
||||
# we'll call that too.
|
||||
|
Loading…
Reference in New Issue
Block a user