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

hybrid: implement outgoing host change in updateClient (#198)

This commit is contained in:
James Lu 2016-04-08 20:35:45 -07:00
parent 3b3080d199
commit 0be83449fb

View File

@ -128,18 +128,23 @@ class HybridProtocol(TS6Protocol):
modes=raw_modes, ip=ip, realname=realname)) modes=raw_modes, ip=ip, realname=realname))
return u return u
def updateClient(self, numeric, field, text): def updateClient(self, target, field, text):
"""Updates the ident, host, or realname of a PyLink client.""" """Updates the ident, host, or realname of a PyLink client."""
# https://github.com/ircd-hybrid/ircd-hybrid/blob/58323b8/modules/m_svsmode.c#L40-L103
# parv[0] = command
# parv[1] = nickname <-- UID works too -GLolol
# parv[2] = TS <-- Of the user, not the current time. -GLolol
# parv[3] = mode
# parv[4] = optional argument (services account, vhost)
field = field.upper() field = field.upper()
if field == 'IDENT':
self.irc.users[numeric].ident = text ts = irc.users[target].ts
self._send(numeric, 'SETIDENT %s' % text)
elif field == 'HOST': if field == 'HOST':
self.irc.users[numeric].host = text self.irc.users[target].host = text
self._send(numeric, 'SETHOST %s' % text) # On Hybrid, it appears that host changing is actually just forcing umode
elif field in ('REALNAME', 'GECOS'): # "+x <hostname>" on the target. -GLolol
self.irc.users[numeric].realname = text self._send(self.irc.sid, 'SVSMODE %s %s +x %s' % (target, ts, text))
self._send(numeric, 'SETNAME :%s' % text)
else: else:
raise NotImplementedError("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)