Remove my old nickname from examples

This commit is contained in:
James Lu 2021-06-09 20:15:07 -07:00
parent ed1644a636
commit da7f9611bc
14 changed files with 97 additions and 97 deletions

View File

@ -20,7 +20,7 @@ def handle_whois(irc, source, command, args):
server = irc.get_server(target)
if user is None: # User doesn't exist
# <- :42X 401 7PYAAAAAB GL- :No such nick/channel
# <- :42X 401 7PYAAAAAB jlu5- :No such nick/channel
nick = target
f(401, source, "%s :No such nick/channel" % nick)
else:
@ -86,7 +86,7 @@ def handle_whois(irc, source, command, args):
n = 'n' if opertype[0].lower() in 'aeiou' else ''
# Remove the "(on $network)" bit in relay oper types if the target network is the
# same - this prevents duplicate text such as "GL/ovd is a Network Administrator
# same - this prevents duplicate text such as "jlu5/ovd is a Network Administrator
# (on OVERdrive-IRC) on OVERdrive-IRC" from showing.
# XXX: does this post-processing really belong here?
opertype = opertype.replace(' (on %s)' % irc.get_full_network_name(), '')
@ -109,7 +109,7 @@ def handle_whois(irc, source, command, args):
# Show botmode info in WHOIS.
f(335, source, "%s :is a bot" % nick)
# :charybdis.midnight.vpn 317 GL GL 1946 1499867833 :seconds idle, signon time
# :charybdis.midnight.vpn 317 jlu5 jlu5 1946 1499867833 :seconds idle, signon time
if irc.get_service_bot(target) and conf.conf['pylink'].get('whois_show_startup_time', True):
f(317, source, "%s 0 %s :seconds idle (placeholder), signon time" % (nick, irc.start_ts))

View File

@ -19,11 +19,11 @@ The command `:42XAAAAAB PRIVMSG #dev :test` would result in the following raw ho
- `['42XAAAAAB', 'PRIVMSG', {'target': '#dev', 'text': 'test', 'ts': 1451174041}]`
On UnrealIRCd, because SETHOST is mapped to CHGHOST, `:GL SETHOST blah` would return the raw hook data of this (with the nick converted into UID automatically by the protocol module):
On UnrealIRCd, because SETHOST is mapped to CHGHOST, `:jlu5 SETHOST blah` would return the raw hook data of this (with the nick converted into UID automatically by the protocol module):
- `['001ZJZW01', 'CHGHOST', {'ts': 1451174512, 'target': '001ZJZW01', 'newhost': 'blah'}]`
Some hooks, like MODE, are more complex and can include the entire state of a channel. This will be further described later. `:GL MODE #chat +o PyLink-devel` is converted into (pretty-printed for readability):
Some hooks, like MODE, are more complex and can include the entire state of a channel. This will be further described later. `:jlu5 MODE #chat +o PyLink-devel` is converted into (pretty-printed for readability):
```
['001ZJZW01',

View File

@ -207,7 +207,7 @@ Modes are stored not stored as strings, but lists of mode pairs in order to ease
- `self.parse_modes('#chat', ['+ol invalidnick'])`:
- `[]`
- `self.parse_modes('#chat', ['+o GLolol'])`:
- `self.parse_modes('#chat', ['+o jlu5'])`:
- `[('+o', '001ZJZW01')]`
Afterwords, a parsed mode list can be applied to channel name or UID using `self.apply_modes(target, parsed_modelist)`.
@ -217,16 +217,16 @@ Afterwords, a parsed mode list can be applied to channel name or UID using `self
Internally, modes are stored in `Channel` and `User` objects as sets, **with the `+` prefixing each mode character omitted**. These sets are accessed via the `modes` attribute:
```
<+GLolol> PyLink-devel, eval irc.users[source].modes
<+jlu5> PyLink-devel, eval irc.users[source].modes
<@PyLink-devel> {('i', None), ('x', None), ('w', None), ('o', None)}
<+GLolol> PyLink-devel, eval irc.channels['#chat'].modes
<+jlu5> PyLink-devel, eval irc.channels['#chat'].modes
<@PyLink-devel> {('n', None), ('t', None)}
```
**Exception**: the owner, admin, op, halfop, and voice channel prefix modes are stored separately as a dict of sets in `Channel.prefixmodes`:
```
<@GLolol> PyLink-devel, eval irc.channels['#chat'].prefixmodes
<@jlu5> PyLink-devel, eval irc.channels['#chat'].prefixmodes
<+PyLink-devel> {'op': set(), 'halfop': set(), 'voice': {'38QAAAAAA'}, 'owner': set(), 'admin': set()}
```

View File

@ -236,7 +236,7 @@ def normalize_nick(irc, netname, nick, times_tagged=0, uid=''):
# Track how many times the given nick has been tagged. If this is 0, no tag is used.
# If this is 1, a /network tag is added. Otherwise, keep adding one character to the
# separator: GLolol -> GLolol/net1 -> GLolol//net1 -> ...
# separator: jlu5 -> jlu5/net1 -> jlu5//net1 -> ...
if times_tagged >= 1:
suffix = "%s%s%s" % (separator[0]*times_tagged, separator[1:], netname)
allowedlength -= len(suffix)
@ -1355,7 +1355,7 @@ def handle_join(irc, numeric, command, args):
modes = []
for user in users:
# XXX: Find the diff of the new and old mode lists of the channel. Not pretty, but I'd
# rather not change the 'users' format of SJOIN just for this. -GL
# rather not change the 'users' format of SJOIN just for this. -jlu5
try:
oldmodes = set(chandata.get_prefix_modes(user))
except KeyError:
@ -2859,7 +2859,7 @@ def modedelta(irc, source, args):
Mode names are defined using PyLink named modes, and not IRC mode characters: you can find a
list of channel named modes and the characters they map to on different IRCds at:
https://raw.githack.com/GLolol/PyLink/devel/docs/modelists/channel-modes.html
https://raw.githack.com/jlu5/PyLink/devel/docs/modelists/channel-modes.html
Examples of setting modes:

View File

@ -698,7 +698,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
"""
Handles 353 / RPL_NAMREPLY.
"""
# <- :charybdis.midnight.vpn 353 ice = #test :ice @GL
# <- :charybdis.midnight.vpn 353 ice = #test :ice @jlu5
# Mark "@"-type channels as secret automatically, per RFC2812.
channel = args[2]
@ -779,10 +779,10 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
"""
# parameter count: 0 1 2 3 4 5 6 7(-1)
# <- :charybdis.midnight.vpn 352 ice #test ~pylink 127.0.0.1 charybdis.midnight.vpn ice H+ :0 PyLink
# <- :charybdis.midnight.vpn 352 ice #test ~gl 127.0.0.1 charybdis.midnight.vpn GL H*@ :0 realname
# <- :charybdis.midnight.vpn 352 ice #test ~jlu5 127.0.0.1 charybdis.midnight.vpn jlu5 H*@ :0 realname
# with WHO %cuhsnfar (WHOX) - note, hopcount and realname are separate!
# 0 1 2 3 4 5 6 7 8(-1)
# <- :charybdis.midnight.vpn 354 ice #test ~gl localhost charybdis.midnight.vpn GL H*@ GL :realname
# <- :charybdis.midnight.vpn 354 ice #test ~jlu5 localhost charybdis.midnight.vpn jlu5 H*@ jlu5 :realname
channel = args[1]
ident = args[2]
host = args[3]
@ -907,9 +907,9 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
Handles incoming JOINs, as well as JOIN acknowledgements for us.
"""
# Classic format:
# <- :GL|!~GL@127.0.0.1 JOIN #whatever
# <- :jlu5|!~jlu5@127.0.0.1 JOIN #whatever
# With extended-join:
# <- :GL|!~GL@127.0.0.1 JOIN #whatever accountname :realname
# <- :jlu5|!~jlu5@127.0.0.1 JOIN #whatever accountname :realname
channel = args[0]
self._channels[channel].users.add(source)
self.users[source].channels.add(channel)
@ -940,7 +940,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
"""
Handles incoming KICKs.
"""
# <- :GL!~gl@127.0.0.1 KICK #whatever GL| :xd
# <- :jlu5!~jlu5@127.0.0.1 KICK #whatever jlu5| :xd
channel = args[0]
target = self._get_UID(args[1], spawn_new=False)
@ -975,7 +975,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
def handle_mode(self, source, command, args):
"""Handles MODE changes."""
# <- :GL!~gl@127.0.0.1 MODE #dev +v ice
# <- :jlu5!~jlu5@127.0.0.1 MODE #dev +v ice
# <- :ice MODE ice :+Zi
target = args[0]
if self.is_channel(target):
@ -1000,8 +1000,8 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
def handle_324(self, source, command, args):
"""Handles MODE announcements via RPL_CHANNELMODEIS (i.e. the response to /mode #channel)"""
# -> MODE #test
# <- :midnight.vpn 324 GL #test +nt
# <- :midnight.vpn 329 GL #test 1491773459
# <- :midnight.vpn 324 jlu5 #test +nt
# <- :midnight.vpn 329 jlu5 #test 1491773459
channel = args[1]
modes = args[2:]
log.debug('(%s) Got RPL_CHANNELMODEIS (324) modes %s for %s', self.name, modes, channel)
@ -1037,7 +1037,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
def handle_nick(self, source, command, args):
"""Handles NICK changes."""
# <- :GL|!~GL@127.0.0.1 NICK :GL_
# <- :jlu5|!~jlu5@127.0.0.1 NICK :jlu5_
newnick = args[0]
if not self.connected.is_set():
@ -1060,7 +1060,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
"""
Handles incoming PARTs.
"""
# <- :GL|!~GL@127.0.0.1 PART #whatever
# <- :jlu5|!~jlu5@127.0.0.1 PART #whatever
channels = args[0].split(',')
try:
reason = args[1]

View File

@ -131,8 +131,8 @@ class HybridProtocol(TS6Protocol):
"""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[1] = nickname <-- UID works too -jlu5
# parv[2] = TS <-- Of the user, not the current time. -jlu5
# parv[3] = mode
# parv[4] = optional argument (services account, vhost)
field = field.upper()
@ -142,7 +142,7 @@ class HybridProtocol(TS6Protocol):
if field == 'HOST':
self.users[target].host = text
# On Hybrid, it appears that host changing is actually just forcing umode
# "+x <hostname>" on the target. -GLolol
# "+x <hostname>" on the target. -jlu5
self._send_with_prefix(self.sid, 'SVSMODE %s %s +x %s' % (target, ts, text))
else:
raise NotImplementedError("Changing field %r of a client is unsupported by this protocol." % field)
@ -255,7 +255,7 @@ class HybridProtocol(TS6Protocol):
# Login sequence (tested with Anope 2.0.4-git):
# A mode change +d accountname is used to propagate logins,
# before setting umode +r on the target.
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +d GL
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +d jlu5
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +r
# Logout sequence:

View File

@ -762,7 +762,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
def handle_uid(self, numeric, command, args):
"""Handles incoming UID commands (user introduction)."""
# :70M UID 70MAAAAAB 1429934638 GL 0::1 hidden-7j810p.9mdf.lrek.0000.0000.IP gl 0::1 1429934638 +Wioswx +ACGKNOQXacfgklnoqvx :realname
# :70M UID 70MAAAAAB 1429934638 jlu5 0::1 hidden-7j810p.9mdf.lrek.0000.0000.IP jlu5 0::1 1429934638 +Wioswx +ACGKNOQXacfgklnoqvx :realname
uid, ts, nick, realhost, host, ident, ip = args[0:7]
ts = int(ts)
@ -846,10 +846,10 @@ class InspIRCdProtocol(TS6BaseProtocol):
def handle_ftopic(self, source, command, args):
"""Handles incoming topic changes."""
# insp2 (only used for server senders):
# <- :70M FTOPIC #channel 1434510754 GLo|o|!GLolol@escape.the.dreamland.ca :Some channel topic
# <- :70M FTOPIC #channel 1434510754 jlu5!jlu5@escape.the.dreamland.ca :Some channel topic
# insp3 (used for server AND user senders):
# <- :3IN FTOPIC #qwerty 1556828864 1556844505 GL!gl@midnight-umk.of4.0.127.IP :1234abcd
# <- :3IN FTOPIC #qwerty 1556828864 1556844505 jlu5!jlu5@midnight-umk.of4.0.127.IP :1234abcd
# <- :3INAAAAAA FTOPIC #qwerty 1556828864 1556844248 :topic text
# chan creation time ^ ^ topic set time (the one we want)

View File

@ -343,7 +343,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
if command == 'ENCAP':
# Special case for TS6 encapsulated commands (ENCAP), in forms like this:
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
# <- :00A ENCAP * SU 42XAAAAAC :jlu5
command = args[1]
args = args[2:]
log.debug("(%s) Rewriting incoming ENCAP to command %s (args: %s)", self.name, command, args)
@ -507,7 +507,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
return
# TS6-style kills look something like this:
# <- :GL KILL 38QAAAAAA :hidden-1C620195!GL (test)
# <- :jlu5 KILL 38QAAAAAA :hidden-1C620195!jlu5 (test)
# What we actually want is to format a pretty kill message, in the form
# "Killed (killername (reason))".
@ -530,9 +530,9 @@ class IRCS2SProtocol(IRCCommonProtocol):
# XXX: this does create a convoluted kill string if we want to forward kills
# over relay.
# InspIRCd:
# <- :1MLAAAAA1 KILL 0ALAAAAAC :Killed (GL (test))
# <- :1MLAAAAA1 KILL 0ALAAAAAC :Killed (jlu5 (test))
# ngIRCd:
# <- :GL KILL PyLink-devel :KILLed by GL: ?
# <- :jlu5 KILL PyLink-devel :KILLed by jlu5: ?
killmsg = args[1]
return {'target': killed, 'text': killmsg, 'userdata': userdata}
@ -574,7 +574,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
# <- :70MAAAAAA MODE 70MAAAAAA -i+xc
# P10:
# <- ABAAA M GL -w
# <- ABAAA M jlu5 -w
# <- ABAAA M #test +v ABAAB 1460747615
# <- ABAAA OM #test +h ABAAA
target = self._get_UID(args[0])
@ -684,7 +684,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
# TS6:
# <- :1SRAAGB4T QUIT :Quit: quit message goes here
# P10:
# <- ABAAB Q :Killed (GL_ (bangbang))
# <- ABAAB Q :Killed (jlu5_ (bangbang))
userdata = self._remove_client(numeric)
if userdata:
try:

View File

@ -117,7 +117,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
# Grab our server token; this is used instead of server name to denote where the client is.
server_token = server.rsplit('@')[-1]
# <- :ngircd.midnight.local NICK GL 1 ~gl localhost 1 +io :realname
# <- :ngircd.midnight.local NICK jlu5 1 ~jlu5 localhost 1 +io :realname
self._send_with_prefix(server, 'NICK %s %s %s %s %s %s :%s' % (nick, self.servers[server].hopcount,
ident, host, server_token, self.join_modes(modes), realname))
return userobj
@ -285,7 +285,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
"""
Sets a server ban.
"""
# <- :GL GLINE *!*@bad.user 3d :test
# <- :jlu5 GLINE *!*@bad.user 3d :test
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
self._send_with_prefix(source, 'GLINE *!%s@%s %s :%s' % (user, host, duration, reason))
@ -380,8 +380,8 @@ class NgIRCdProtocol(IRCS2SProtocol):
def handle_join(self, source, command, args):
# RFC 2813 is odd to say the least... https://tools.ietf.org/html/rfc2813#section-4.2.1
# Basically, we expect messages of the forms:
# <- :GL JOIN #test\x07o
# <- :GL JOIN #moretest
# <- :jlu5 JOIN #test\x07o
# <- :jlu5 JOIN #moretest
for chanpair in args[0].split(','):
# Normalize channel case.
try:
@ -426,7 +426,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
def handle_metadata(self, source, command, args):
"""Handles various user metadata for ngIRCd (cloaked host, account name, etc.)"""
# <- :ngircd.midnight.local METADATA GL cloakhost :hidden-3a2a739e.ngircd.midnight.local
# <- :ngircd.midnight.local METADATA jlu5 cloakhost :hidden-3a2a739e.ngircd.midnight.local
target = self._get_UID(args[0])
if target not in self.users:
@ -461,7 +461,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
"""
if len(args) >= 2:
# User introduction:
# <- :ngircd.midnight.local NICK GL 1 ~gl localhost 1 +io :realname
# <- :ngircd.midnight.local NICK jlu5 1 ~jlu5 localhost 1 +io :realname
nick = args[0]
assert source in self.servers, "Server %r tried to introduce nick %r but isn't in the servers index?" % (source, nick)
self._check_nick_collision(nick)
@ -488,13 +488,13 @@ class NgIRCdProtocol(IRCS2SProtocol):
'parse_as': 'UID', 'ip': '0.0.0.0'}
else:
# Nick changes:
# <- :GL NICK :GL_
# <- :jlu5 NICK :jlu5_
oldnick = self.users[source].nick
newnick = self.users[source].nick = args[0]
return {'newnick': newnick, 'oldnick': oldnick}
def handle_njoin(self, source, command, args):
# <- :ngircd.midnight.local NJOIN #test :tester,@%GL
# <- :ngircd.midnight.local NJOIN #test :tester,@%jlu5
channel = args[0]
chandata = self._channels[channel].deepcopy()

View File

@ -198,7 +198,7 @@ class P10Protocol(IRCS2SProtocol):
@staticmethod
def decode_p10_ip(ip):
"""Decodes a P10 IP."""
# Many thanks to Jobe @ evilnet for the code on what to do here. :) -GL
# Many thanks to Jobe @ evilnet for the code on what to do here. :) -jlu5
if len(ip) == 6: # IPv4
# Pad the characters with two \x00's (represented in P10 B64 as AA)
@ -406,7 +406,7 @@ class P10Protocol(IRCS2SProtocol):
def kill(self, numeric, target, reason):
"""Sends a kill from a PyLink client/server."""
# <- ABAAA D AyAAA :nefarious.midnight.vpn!GL (test)
# <- ABAAA D AyAAA :nefarious.midnight.vpn!jlu5 (test)
if (not self.is_internal_client(numeric)) and \
(not self.is_internal_server(numeric)):
@ -463,7 +463,7 @@ class P10Protocol(IRCS2SProtocol):
def mode(self, numeric, target, modes, ts=None):
"""Sends mode changes from a PyLink client/server."""
# <- ABAAA M GL -w
# <- ABAAA M jlu5 -w
# <- ABAAA M #test +v ABAAB 1460747615
if (not self.is_internal_client(numeric)) and \
@ -494,7 +494,7 @@ class P10Protocol(IRCS2SProtocol):
real_target = target
else:
assert target in self.users, "Unknown mode target %s" % target
# P10 uses nicks in user MODE targets, NOT UIDs. ~GL
# P10 uses nicks in user MODE targets, NOT UIDs. ~jlu5
real_target = self.users[target].nick
self.apply_modes(target, modes)
@ -510,7 +510,7 @@ class P10Protocol(IRCS2SProtocol):
def nick(self, numeric, newnick):
"""Changes the nick of a PyLink client."""
# <- ABAAA N GL_ 1460753763
# <- ABAAA N jlu5_ 1460753763
if not self.is_internal_client(numeric):
raise LookupError('No such PyLink client exists.')
@ -523,7 +523,7 @@ class P10Protocol(IRCS2SProtocol):
def numeric(self, source, numeric, target, text):
"""Sends raw numerics from a server to a remote client. This is used for WHOIS
replies."""
# <- AB 311 AyAAA GL ~gl nefarious.midnight.vpn * :realname
# <- AB 311 AyAAA jlu5 ~jlu5 nefarious.midnight.vpn * :realname
self._send_with_prefix(source, '%s %s %s' % (numeric, target, text))
def part(self, client, channel, reason=None):
@ -558,7 +558,7 @@ class P10Protocol(IRCS2SProtocol):
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
# https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L535
# <- ABAAA GL * +test@test.host 30 1500300185 1500300215 :haha, you're banned now!!!!1
# <- ABAAA jlu5 * +test@test.host 30 1500300185 1500300215 :haha, you're banned now!!!!1
currtime = int(time.time())
if duration == 0 or duration > GLINE_MAX_EXPIRE:
@ -747,7 +747,7 @@ class P10Protocol(IRCS2SProtocol):
def topic(self, source, target, text):
"""Sends a TOPIC change from a PyLink client or server."""
# <- ABAAA T #test GL!~gl@nefarious.midnight.vpn 1460852591 1460855795 :blah
# <- ABAAA T #test jlu5!~jlu5@nefarious.midnight.vpn 1460852591 1460855795 :blah
# First timestamp is channel creation time, second is current time,
if (not self.is_internal_client(source)) and (not self.is_internal_server(source)):
raise LookupError('No such PyLink client/server exists.')
@ -829,7 +829,7 @@ class P10Protocol(IRCS2SProtocol):
# 4 <link TS>
# 5 <protocol>
# 6 <numeric of new server><max client numeric>
# 7 <flags> <-- Mark ourselves as a service with IPv6 support (+s & +6) -GLolol
# 7 <flags> <-- Mark ourselves as a service with IPv6 support (+s & +6) -jlu5
# -1 <description of new server>
name = self.serverdata["hostname"]
@ -918,7 +918,7 @@ class P10Protocol(IRCS2SProtocol):
def handle_nick(self, source, command, args):
"""Handles the NICK command, used for user introductions and nick changes."""
if len(args) > 2:
# <- AB N GL 1 1460673049 ~gl nefarious.midnight.vpn +iw B]AAAB ABAAA :realname
# <- AB N jlu5 1 1460673049 ~jlu5 nefarious.midnight.vpn +iw B]AAAB ABAAA :realname
nick = args[0]
self._check_nick_collision(nick)
@ -960,7 +960,7 @@ class P10Protocol(IRCS2SProtocol):
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip, 'parse_as': 'UID'}
else:
# <- ABAAA N GL_ 1460753763
# <- ABAAA N jlu5_ 1460753763
oldnick = self.users[source].nick
newnick = self.users[source].nick = args[0]
@ -1040,7 +1040,7 @@ class P10Protocol(IRCS2SProtocol):
# -> X3 Z Channels.CollectiveIRC.Net 1460745823.89510 0 1460745823.089840
# Arguments of a PONG: our server hostname, the original TS of PING,
# difference between PING and PONG in seconds, the current TS.
# Why is this the way it is? I don't know... -GL
# Why is this the way it is? I don't know... -jlu5
target = args[1]
sid = self._get_SID(target)
@ -1216,7 +1216,7 @@ class P10Protocol(IRCS2SProtocol):
def handle_topic(self, source, command, args):
"""Handles TOPIC changes."""
# <- ABAAA T #test GL!~gl@nefarious.midnight.vpn 1460852591 1460855795 :blah
# <- ABAAA T #test jlu5!~jlu5@nefarious.midnight.vpn 1460852591 1460855795 :blah
channel = args[0]
topic = args[-1]
@ -1269,7 +1269,7 @@ class P10Protocol(IRCS2SProtocol):
target = args[0]
if self.serverdata.get('use_extended_accounts'):
# Registration: <- AA AC ABAAA R GL 1459019072
# Registration: <- AA AC ABAAA R jlu5 1459019072
# Logout: <- AA AC ABAAA U
# 1 <target user numeric>

View File

@ -575,7 +575,7 @@ class TS6Protocol(TS6BaseProtocol):
def handle_euid(self, numeric, command, args):
"""Handles incoming EUID commands (user introduction)."""
# <- :42X EUID GL 1 1437505322 +ailoswz ~gl 127.0.0.1 127.0.0.1 42XAAAAAB * * :realname
# <- :42X EUID jlu5 1 1437505322 +ailoswz ~jlu5 127.0.0.1 127.0.0.1 42XAAAAAB * * :realname
nick = args[0]
self._check_nick_collision(nick)
ts, modes, ident, host, ip, uid, realhost, accountname, realname = args[2:11]
@ -644,7 +644,7 @@ class TS6Protocol(TS6BaseProtocol):
return
# <- :services.int SERVER a.bc 2 :(H) [GL] a
# <- :services.int SERVER a.bc 2 :(H) [jlu5] a
return super().handle_server(numeric, command, args)
def handle_tmode(self, numeric, command, args):
@ -662,7 +662,7 @@ class TS6Protocol(TS6BaseProtocol):
def handle_tb(self, numeric, command, args):
"""Handles incoming topic burst (TB) commands."""
# <- :42X TB #chat 1467427448 GL!~gl@127.0.0.1 :test
# <- :42X TB #chat 1467427448 jlu5!~jlu5@127.0.0.1 :test
channel = args[0]
ts = args[1]
setter = args[2]
@ -673,7 +673,7 @@ class TS6Protocol(TS6BaseProtocol):
def handle_etb(self, numeric, command, args):
"""Handles extended topic burst (ETB)."""
# <- :00AAAAAAC ETB 0 #test 1470021157 GL :test | abcd
# <- :00AAAAAAC ETB 0 #test 1470021157 jlu5 :test | abcd
# Same as TB, with extra TS and extensions arguments.
channel = args[1]
ts = args[2]
@ -710,7 +710,7 @@ class TS6Protocol(TS6BaseProtocol):
the administrator that certain extensions should be loaded for the best
compatibility.
"""
# <- :charybdis.midnight.vpn 472 GL|devel O :is an unknown mode char to me
# <- :charybdis.midnight.vpn 472 jlu5|devel O :is an unknown mode char to me
badmode = args[1]
reason = args[-1]
setter = args[0]
@ -727,7 +727,7 @@ class TS6Protocol(TS6BaseProtocol):
"""
Handles SU, which is used for setting login information.
"""
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
# <- :00A ENCAP * SU 42XAAAAAC :jlu5
# <- :00A ENCAP * SU 42XAAAAAC
try:
account = args[1] # Account name is being set

View File

@ -218,7 +218,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
def handle_nick(self, numeric, command, args):
"""Handles incoming NICK changes."""
# <- :70MAAAAAA NICK GL-devel 1434744242
# <- :70MAAAAAA NICK jlu5-devel 1434744242
oldnick = self.users[numeric].nick
newnick = self.users[numeric].nick = args[0]
@ -249,7 +249,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
def handle_server(self, numeric, command, args):
"""Handles the SERVER command, used for introducing older (TS5) servers."""
# <- :services.int SERVER a.bc 2 :(H) [GL] test jupe
# <- :services.int SERVER a.bc 2 :(H) [jlu5] test jupe
servername = args[0].lower()
sdesc = args[-1]
self.servers[servername] = Server(self, numeric, servername, desc=sdesc)
@ -272,5 +272,5 @@ class TS6BaseProtocol(IRCS2SProtocol):
# This is rewritten to SVSNICK with args ['902AAAAAB', 'Guest53593', '1468299404']
# UnrealIRCd:
# <- :services.midnight.vpn SVSNICK GL Guest87795 1468303726
# <- :services.midnight.vpn SVSNICK jlu5 Guest87795 1468303726
return {'target': self._get_UID(args[0]), 'newnick': args[1]}

View File

@ -21,7 +21,7 @@ class UnrealProtocol(TS6BaseProtocol):
# I'm not sure what the real limit is, but the text posted at
# https://github.com/jlu5/PyLink/issues/378 suggests 427 characters.
# https://github.com/unrealircd/unrealircd/blob/4cad9cb/src/modules/m_server.c#L1260 may
# also help. (but why BUFSIZE-*80*?) -GL
# also help. (but why BUFSIZE-*80*?) -jlu5
S2S_BUFSIZE = 427
_KNOWN_CMODES = {'ban': 'b',
'banexception': 'e',
@ -149,7 +149,7 @@ class UnrealProtocol(TS6BaseProtocol):
# Now, strip the trailing \n and decode into a string again.
encoded_ip = encoded_ip.strip().decode()
# <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
# <- :001 UID jlu5 0 1441306929 jlu5 localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {ident} {realhost} {uid} 0 {modes} "
"{host} * {ip} :{realname}".format(ts=ts, host=host,
nick=nick, ident=ident, uid=uid,
@ -259,7 +259,7 @@ class UnrealProtocol(TS6BaseProtocol):
Sends mode changes from a PyLink client/server. The mode list should be
a list of (mode, arg) tuples, i.e. the format of utils.parse_modes() output.
"""
# <- :unreal.midnight.vpn MODE #test +ntCo GL 1444361345
# <- :unreal.midnight.vpn MODE #test +ntCo jlu5 1444361345
if (not self.is_internal_client(numeric)) and \
(not self.is_internal_server(numeric)):
@ -379,7 +379,7 @@ class UnrealProtocol(TS6BaseProtocol):
"""Sends a KNOCK from a PyLink client."""
# KNOCKs in UnrealIRCd are actually just specially formatted NOTICEs,
# sent to all ops in a channel.
# <- :unreal.midnight.vpn NOTICE @#test :[Knock] by GL|!gl@hidden-1C620195 (test)
# <- :unreal.midnight.vpn NOTICE @#test :[Knock] by jlu5|!jlu5@hidden-1C620195 (test)
assert self.is_channel(target), "Can only knock on channels!"
sender = self.get_server(numeric)
s = '[Knock] by %s (%s)' % (self.get_hostmask(numeric), text)
@ -451,8 +451,8 @@ class UnrealProtocol(TS6BaseProtocol):
return {}
def handle_uid(self, numeric, command, args):
# <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
# <- :001 UID GL| 0 1441389007 gl 10.120.0.6 001ZO8F03 0 +iwx * 391A9CB9.26A16454.D9847B69.IP CngABg== :realname
# <- :001 UID jlu5 0 1441306929 jlu5 localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
# <- :001 UID jlu5| 0 1441389007 jlu5 10.120.0.6 001ZO8F03 0 +iwx * 391A9CB9.26A16454.D9847B69.IP CngABg== :realname
# arguments: nick, hopcount?, ts, ident, real-host, UID, services account (0 if none), modes,
# displayed host, cloaked (+x) host, base64-encoded IP, and realname
nick = args[0]
@ -539,7 +539,7 @@ class UnrealProtocol(TS6BaseProtocol):
sdesc = args[-1].split(" ", 1)
# Get our protocol version. I really don't know why the version and the server
# description aren't two arguments instead of one... -GLolol
# description aren't two arguments instead of one... -jlu5
vline = sdesc[0].split('-', 1)
sdesc = " ".join(sdesc[1:])
@ -561,7 +561,7 @@ class UnrealProtocol(TS6BaseProtocol):
self.umodes['*D'] = ''.join(self._KNOWN_UMODES.values())
else:
# Legacy (non-SID) servers can still be introduced using the SERVER command.
# <- :services.int SERVER a.bc 2 :(H) [GL] a
# <- :services.int SERVER a.bc 2 :(H) [jlu5] a
return super().handle_server(numeric, command, args)
def handle_protoctl(self, numeric, command, args):
@ -601,7 +601,7 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_join(self, numeric, command, args):
"""Handles the UnrealIRCd JOIN command."""
# <- :GL JOIN #pylink,#test
# <- :jlu5 JOIN #pylink,#test
if args[0] == '0':
# /join 0; part the user from all channels
oldchans = self.users[numeric].channels.copy()
@ -715,9 +715,9 @@ class UnrealProtocol(TS6BaseProtocol):
# <- NICK Global 3 1456843578 services novernet.com services.novernet.com 0 +ioS * :Global Noticer
# & nick hopcount timestamp username hostname server service-identifier-token :realname
# With NICKIP and VHP enabled:
# <- NICK GL32 2 1470699865 gl localhost unreal32.midnight.vpn GL +iowx hidden-1C620195 AAAAAAAAAAAAAAAAAAAAAQ== :realname
# <- NICK legacy32 2 1470699865 jlu5 localhost unreal32.midnight.vpn jlu5 +iowx hidden-1C620195 AAAAAAAAAAAAAAAAAAAAAQ== :realname
# to this:
# <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * hidden-1C620195 fwAAAQ== :realname
# <- :001 UID jlu5 0 1441306929 jlu5 localhost 0018S7901 0 +iowx * hidden-1C620195 fwAAAQ== :realname
log.debug('(%s) got legacy NICK args: %s', self.name, ' '.join(args))
new_args = args[:] # Clone the old args list
@ -739,15 +739,15 @@ class UnrealProtocol(TS6BaseProtocol):
return self.handle_uid(servername, 'UID_LEGACY', new_args)
else:
# Normal NICK change, just let ts6_common handle it.
# :70MAAAAAA NICK GL-devel 1434744242
# :70MAAAAAA NICK jlu5-devel 1434744242
return super().handle_nick(numeric, command, args)
def handle_mode(self, numeric, command, args):
# <- :unreal.midnight.vpn MODE #test +bb test!*@* *!*@bad.net
# <- :unreal.midnight.vpn MODE #test +q GL 1444361345
# <- :unreal.midnight.vpn MODE #test +ntCo GL 1444361345
# <- :unreal.midnight.vpn MODE #test +mntClfo 5 [10t]:5 GL 1444361345
# <- :GL MODE #services +v GL
# <- :unreal.midnight.vpn MODE #test +q jlu5 1444361345
# <- :unreal.midnight.vpn MODE #test +ntCo jlu5 1444361345
# <- :unreal.midnight.vpn MODE #test +mntClfo 5 [10t]:5 jlu5 1444361345
# <- :jlu5 MODE #services +v jlu5
# This seems pretty relatively inconsistent - why do some commands have a TS at the end while others don't?
# Answer: the first syntax (MODE sent by SERVER) is used for channel bursts - according to Unreal 3.2 docs,
@ -836,30 +836,30 @@ class UnrealProtocol(TS6BaseProtocol):
# which is supported by atheme and Anope 2.x).
# Logging in (with account info, atheme):
# <- :NickServ SVS2MODE GL +rd GL
# <- :NickServ SVS2MODE jlu5 +rd jlu5
# Logging in (without account info, anope 2.0?):
# <- :NickServ SVS2MODE 001WCO6YK +r
# Logging in (without account info, anope 1.8):
# Note: ignore the timestamp.
# <- :services.abc.net SVS2MODE GLolol +rd 1470696723
# <- :services.abc.net SVS2MODE jlu5 +rd 1470696723
# Logging out (atheme):
# <- :NickServ SVS2MODE GL -r+d 0
# <- :NickServ SVS2MODE jlu5 -r+d 0
# Logging out (anope 1.8):
# <- :services.abc.net SVS2MODE GLolol -r+d 1
# <- :services.abc.net SVS2MODE jlu5 -r+d 1
# Logging out (anope 2.0):
# <- :NickServ SVS2MODE 009EWLA03 -r
# Logging in to account from a different nick (atheme):
# Note: no +r is being set.
# <- :NickServ SVS2MODE somenick +d GL
# <- :NickServ SVS2MODE somenick +d jlu5
# Logging in to account from a different nick (anope):
# <- :NickServ SVS2MODE 001SALZ01 +d GL
# <- :NickServ SVS2MODE 001SALZ01 +d jlu5
# <- :NickServ SVS2MODE 001SALZ01 +r
target = self._get_UID(args[0])
@ -917,13 +917,13 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_umode2(self, source, command, args):
"""Handles UMODE2, used to set user modes on oneself."""
# <- :GL UMODE2 +W
# <- :jlu5 UMODE2 +W
target = self._get_UID(source)
return self._handle_umode(target, self.parse_modes(target, args))
def handle_topic(self, numeric, command, args):
"""Handles the TOPIC command."""
# <- GL TOPIC #services GL 1444699395 :weeee
# <- jlu5 TOPIC #services jlu5 1444699395 :weeee
# <- TOPIC #services devel.relay 1452399682 :test
channel = args[0]
topic = args[-1]
@ -962,14 +962,14 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_chgident(self, numeric, command, args):
"""Handles CHGIDENT, used for denoting ident changes."""
# <- :GL CHGIDENT GL test
# <- :jlu5 CHGIDENT jlu5 test
target = self._get_UID(args[0])
self.users[target].ident = newident = args[1]
return {'target': target, 'newident': newident}
def handle_chghost(self, numeric, command, args):
"""Handles CHGHOST, used for denoting hostname changes."""
# <- :GL CHGHOST GL some.host
# <- :jlu5 CHGHOST jlu5 some.host
target = self._get_UID(args[0])
self.users[target].host = newhost = args[1]
@ -981,14 +981,14 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_chgname(self, numeric, command, args):
"""Handles CHGNAME, used for denoting real name/gecos changes."""
# <- :GL CHGNAME GL :afdsafasf
# <- :jlu5 CHGNAME jlu5 :afdsafasf
target = self._get_UID(args[0])
self.users[target].realname = newgecos = args[1]
return {'target': target, 'newgecos': newgecos}
def handle_tsctl(self, source, command, args):
"""Handles /TSCTL alltime requests."""
# <- :GL TSCTL alltime
# <- :jlu5 TSCTL alltime
if args[0] == 'alltime':
self._send_with_prefix(self.sid, 'NOTICE %s :*** Server=%s time()=%d' % (source, self.hostname(), time.time()))

View File

@ -137,7 +137,7 @@ class BaseProtocolTest(unittest.TestCase):
assertT('{RACKETman}')
assertT('bar|tender')
assertT('\\bar|bender\\')
assertT('GL|ovd')
assertT('jlu5|ovd')
assertT('B')
assertT('`')
assertT('Hello123')
@ -156,7 +156,7 @@ class BaseProtocolTest(unittest.TestCase):
assertF('-test')
assertF('#lounge')
assertF('\\bar/bender\\')
assertF('GL/ovd') # Technically not valid, but some IRCds don't care ;)
assertF('jlu5/ovd') # Technically not valid, but some IRCds don't care ;)
assertF('100AAAAAC') # TS6 UID
self.assertFalse(self.p.is_nick('longnicklongnicklongnicklongnicklongnicklongnick', nicklen=20))