3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-12 05:02:33 +01:00

Fix handling of inbound CHG*

This commit is contained in:
James Lu 2015-07-23 11:01:12 -07:00
parent 1efc9018f3
commit 58a8d7134c
3 changed files with 8 additions and 7 deletions

View File

@ -434,8 +434,9 @@ def handle_chgclient(irc, source, command, args):
remoteirc = utils.networkobjects[netname]
try:
remoteirc.proto.updateClient(remoteirc, user, field, text)
except ValueError: # IRCd doesn't support changing the field we want
logging.debug('(%s) Error raised changing field %r of %s on %s (for %s/%s)', irc.name, field, user, target, remotenet, irc.name)
except NotImplementedError: # IRCd doesn't support changing the field we want
log.debug('(%s) Ignoring changing field %r of %s on %s (for %s/%s);'
'remote IRCd doesn\'t support it', irc.name, field, user, target, remotenet, irc.name)
continue
for c in ('CHGHOST', 'CHGNAME', 'CHGIDENT'):

View File

@ -276,16 +276,16 @@ def updateClient(irc, numeric, field, text):
Changes the <field> field of <target> PyLink PseudoClient <client numeric>."""
field = field.upper()
if field == 'IDENT':
handle_fident(irc, numeric, 'PYLINK_UPDATECLIENT_IDENT', [text])
irc.users[numeric].ident = text
_send(irc, numeric, 'FIDENT %s' % text)
elif field == 'HOST':
handle_fhost(irc, numeric, 'PYLINK_UPDATECLIENT_HOST', [text])
irc.users[numeric].host = text
_send(irc, numeric, 'FHOST %s' % text)
elif field in ('REALNAME', 'GECOS'):
handle_fname(irc, numeric, 'PYLINK_UPDATECLIENT_GECOS', [text])
irc.users[numeric].realname = text
_send(irc, numeric, 'FNAME :%s' % text)
else:
raise ValueError("Changing field %r of a client is unsupported by this protocol." % field)
raise NotImplementedError("Changing field %r of a client is unsupported by this protocol." % field)
def pingServer(irc, source=None, target=None):
source = source or irc.sid

View File

@ -217,7 +217,7 @@ def updateClient(irc, numeric, field, text):
Changes the <field> field of <target> PyLink PseudoClient <client numeric>."""
field = field.upper()
if field == 'HOST':
handle_chghost(irc, numeric, 'PYLINK_UPDATECLIENT_HOST', [text])
irc.users[numeric].host = text
_send(irc, irc.sid, 'CHGHOST %s :%s' % (numeric, text))
else:
raise NotImplementedError("Changing field %r of a client is unsupported by this protocol." % field)