mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 04:59:24 +01:00
Remove my old nickname from examples
This commit is contained in:
parent
ed1644a636
commit
da7f9611bc
@ -20,7 +20,7 @@ def handle_whois(irc, source, command, args):
|
|||||||
server = irc.get_server(target)
|
server = irc.get_server(target)
|
||||||
|
|
||||||
if user is None: # User doesn't exist
|
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
|
nick = target
|
||||||
f(401, source, "%s :No such nick/channel" % nick)
|
f(401, source, "%s :No such nick/channel" % nick)
|
||||||
else:
|
else:
|
||||||
@ -86,7 +86,7 @@ def handle_whois(irc, source, command, args):
|
|||||||
n = 'n' if opertype[0].lower() in 'aeiou' else ''
|
n = 'n' if opertype[0].lower() in 'aeiou' else ''
|
||||||
|
|
||||||
# Remove the "(on $network)" bit in relay oper types if the target network is the
|
# 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.
|
# (on OVERdrive-IRC) on OVERdrive-IRC" from showing.
|
||||||
# XXX: does this post-processing really belong here?
|
# XXX: does this post-processing really belong here?
|
||||||
opertype = opertype.replace(' (on %s)' % irc.get_full_network_name(), '')
|
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.
|
# Show botmode info in WHOIS.
|
||||||
f(335, source, "%s :is a bot" % nick)
|
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):
|
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))
|
f(317, source, "%s 0 %s :seconds idle (placeholder), signon time" % (nick, irc.start_ts))
|
||||||
|
|
||||||
|
@ -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}]`
|
- `['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'}]`
|
- `['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',
|
['001ZJZW01',
|
||||||
|
@ -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', ['+ol invalidnick'])`:
|
||||||
- `[]`
|
- `[]`
|
||||||
- `self.parse_modes('#chat', ['+o GLolol'])`:
|
- `self.parse_modes('#chat', ['+o jlu5'])`:
|
||||||
- `[('+o', '001ZJZW01')]`
|
- `[('+o', '001ZJZW01')]`
|
||||||
|
|
||||||
Afterwords, a parsed mode list can be applied to channel name or UID using `self.apply_modes(target, parsed_modelist)`.
|
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:
|
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)}
|
<@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)}
|
<@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`:
|
**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()}
|
<+PyLink-devel> {'op': set(), 'halfop': set(), 'voice': {'38QAAAAAA'}, 'owner': set(), 'admin': set()}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -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.
|
# 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
|
# 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:
|
if times_tagged >= 1:
|
||||||
suffix = "%s%s%s" % (separator[0]*times_tagged, separator[1:], netname)
|
suffix = "%s%s%s" % (separator[0]*times_tagged, separator[1:], netname)
|
||||||
allowedlength -= len(suffix)
|
allowedlength -= len(suffix)
|
||||||
@ -1355,7 +1355,7 @@ def handle_join(irc, numeric, command, args):
|
|||||||
modes = []
|
modes = []
|
||||||
for user in users:
|
for user in users:
|
||||||
# XXX: Find the diff of the new and old mode lists of the channel. Not pretty, but I'd
|
# 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:
|
try:
|
||||||
oldmodes = set(chandata.get_prefix_modes(user))
|
oldmodes = set(chandata.get_prefix_modes(user))
|
||||||
except KeyError:
|
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
|
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:
|
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:
|
Examples of setting modes:
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
"""
|
"""
|
||||||
Handles 353 / RPL_NAMREPLY.
|
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.
|
# Mark "@"-type channels as secret automatically, per RFC2812.
|
||||||
channel = args[2]
|
channel = args[2]
|
||||||
@ -779,10 +779,10 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
"""
|
"""
|
||||||
# parameter count: 0 1 2 3 4 5 6 7(-1)
|
# 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 ~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!
|
# with WHO %cuhsnfar (WHOX) - note, hopcount and realname are separate!
|
||||||
# 0 1 2 3 4 5 6 7 8(-1)
|
# 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]
|
channel = args[1]
|
||||||
ident = args[2]
|
ident = args[2]
|
||||||
host = args[3]
|
host = args[3]
|
||||||
@ -907,9 +907,9 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
Handles incoming JOINs, as well as JOIN acknowledgements for us.
|
Handles incoming JOINs, as well as JOIN acknowledgements for us.
|
||||||
"""
|
"""
|
||||||
# Classic format:
|
# Classic format:
|
||||||
# <- :GL|!~GL@127.0.0.1 JOIN #whatever
|
# <- :jlu5|!~jlu5@127.0.0.1 JOIN #whatever
|
||||||
# With extended-join:
|
# 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]
|
channel = args[0]
|
||||||
self._channels[channel].users.add(source)
|
self._channels[channel].users.add(source)
|
||||||
self.users[source].channels.add(channel)
|
self.users[source].channels.add(channel)
|
||||||
@ -940,7 +940,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
"""
|
"""
|
||||||
Handles incoming KICKs.
|
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]
|
channel = args[0]
|
||||||
target = self._get_UID(args[1], spawn_new=False)
|
target = self._get_UID(args[1], spawn_new=False)
|
||||||
|
|
||||||
@ -975,7 +975,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
|
|
||||||
def handle_mode(self, source, command, args):
|
def handle_mode(self, source, command, args):
|
||||||
"""Handles MODE changes."""
|
"""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
|
# <- :ice MODE ice :+Zi
|
||||||
target = args[0]
|
target = args[0]
|
||||||
if self.is_channel(target):
|
if self.is_channel(target):
|
||||||
@ -1000,8 +1000,8 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
def handle_324(self, source, command, args):
|
def handle_324(self, source, command, args):
|
||||||
"""Handles MODE announcements via RPL_CHANNELMODEIS (i.e. the response to /mode #channel)"""
|
"""Handles MODE announcements via RPL_CHANNELMODEIS (i.e. the response to /mode #channel)"""
|
||||||
# -> MODE #test
|
# -> MODE #test
|
||||||
# <- :midnight.vpn 324 GL #test +nt
|
# <- :midnight.vpn 324 jlu5 #test +nt
|
||||||
# <- :midnight.vpn 329 GL #test 1491773459
|
# <- :midnight.vpn 329 jlu5 #test 1491773459
|
||||||
channel = args[1]
|
channel = args[1]
|
||||||
modes = args[2:]
|
modes = args[2:]
|
||||||
log.debug('(%s) Got RPL_CHANNELMODEIS (324) modes %s for %s', self.name, modes, channel)
|
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):
|
def handle_nick(self, source, command, args):
|
||||||
"""Handles NICK changes."""
|
"""Handles NICK changes."""
|
||||||
# <- :GL|!~GL@127.0.0.1 NICK :GL_
|
# <- :jlu5|!~jlu5@127.0.0.1 NICK :jlu5_
|
||||||
newnick = args[0]
|
newnick = args[0]
|
||||||
|
|
||||||
if not self.connected.is_set():
|
if not self.connected.is_set():
|
||||||
@ -1060,7 +1060,7 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
|
|||||||
"""
|
"""
|
||||||
Handles incoming PARTs.
|
Handles incoming PARTs.
|
||||||
"""
|
"""
|
||||||
# <- :GL|!~GL@127.0.0.1 PART #whatever
|
# <- :jlu5|!~jlu5@127.0.0.1 PART #whatever
|
||||||
channels = args[0].split(',')
|
channels = args[0].split(',')
|
||||||
try:
|
try:
|
||||||
reason = args[1]
|
reason = args[1]
|
||||||
|
@ -131,8 +131,8 @@ class HybridProtocol(TS6Protocol):
|
|||||||
"""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
|
# https://github.com/ircd-hybrid/ircd-hybrid/blob/58323b8/modules/m_svsmode.c#L40-L103
|
||||||
# parv[0] = command
|
# parv[0] = command
|
||||||
# parv[1] = nickname <-- UID works too -GLolol
|
# parv[1] = nickname <-- UID works too -jlu5
|
||||||
# parv[2] = TS <-- Of the user, not the current time. -GLolol
|
# parv[2] = TS <-- Of the user, not the current time. -jlu5
|
||||||
# parv[3] = mode
|
# parv[3] = mode
|
||||||
# parv[4] = optional argument (services account, vhost)
|
# parv[4] = optional argument (services account, vhost)
|
||||||
field = field.upper()
|
field = field.upper()
|
||||||
@ -142,7 +142,7 @@ class HybridProtocol(TS6Protocol):
|
|||||||
if field == 'HOST':
|
if field == 'HOST':
|
||||||
self.users[target].host = text
|
self.users[target].host = text
|
||||||
# On Hybrid, it appears that host changing is actually just forcing umode
|
# 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))
|
self._send_with_prefix(self.sid, 'SVSMODE %s %s +x %s' % (target, ts, 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)
|
||||||
@ -255,7 +255,7 @@ class HybridProtocol(TS6Protocol):
|
|||||||
# Login sequence (tested with Anope 2.0.4-git):
|
# Login sequence (tested with Anope 2.0.4-git):
|
||||||
# A mode change +d accountname is used to propagate logins,
|
# A mode change +d accountname is used to propagate logins,
|
||||||
# before setting umode +r on the target.
|
# before setting umode +r on the target.
|
||||||
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +d GL
|
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +d jlu5
|
||||||
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +r
|
# <- :5ANAAAAAG SVSMODE 5HYAAAAAA 1460175209 +r
|
||||||
|
|
||||||
# Logout sequence:
|
# Logout sequence:
|
||||||
|
@ -762,7 +762,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_uid(self, numeric, command, args):
|
def handle_uid(self, numeric, command, args):
|
||||||
"""Handles incoming UID commands (user introduction)."""
|
"""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]
|
uid, ts, nick, realhost, host, ident, ip = args[0:7]
|
||||||
|
|
||||||
ts = int(ts)
|
ts = int(ts)
|
||||||
@ -846,10 +846,10 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
def handle_ftopic(self, source, command, args):
|
def handle_ftopic(self, source, command, args):
|
||||||
"""Handles incoming topic changes."""
|
"""Handles incoming topic changes."""
|
||||||
# insp2 (only used for server senders):
|
# 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):
|
# 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
|
# <- :3INAAAAAA FTOPIC #qwerty 1556828864 1556844248 :topic text
|
||||||
# chan creation time ^ ^ topic set time (the one we want)
|
# chan creation time ^ ^ topic set time (the one we want)
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
|||||||
|
|
||||||
if command == 'ENCAP':
|
if command == 'ENCAP':
|
||||||
# Special case for TS6 encapsulated commands (ENCAP), in forms like this:
|
# Special case for TS6 encapsulated commands (ENCAP), in forms like this:
|
||||||
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
# <- :00A ENCAP * SU 42XAAAAAC :jlu5
|
||||||
command = args[1]
|
command = args[1]
|
||||||
args = args[2:]
|
args = args[2:]
|
||||||
log.debug("(%s) Rewriting incoming ENCAP to command %s (args: %s)", self.name, command, args)
|
log.debug("(%s) Rewriting incoming ENCAP to command %s (args: %s)", self.name, command, args)
|
||||||
@ -507,7 +507,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# TS6-style kills look something like this:
|
# 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
|
# What we actually want is to format a pretty kill message, in the form
|
||||||
# "Killed (killername (reason))".
|
# "Killed (killername (reason))".
|
||||||
|
|
||||||
@ -530,9 +530,9 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
|||||||
# XXX: this does create a convoluted kill string if we want to forward kills
|
# XXX: this does create a convoluted kill string if we want to forward kills
|
||||||
# over relay.
|
# over relay.
|
||||||
# InspIRCd:
|
# InspIRCd:
|
||||||
# <- :1MLAAAAA1 KILL 0ALAAAAAC :Killed (GL (test))
|
# <- :1MLAAAAA1 KILL 0ALAAAAAC :Killed (jlu5 (test))
|
||||||
# ngIRCd:
|
# ngIRCd:
|
||||||
# <- :GL KILL PyLink-devel :KILLed by GL: ?
|
# <- :jlu5 KILL PyLink-devel :KILLed by jlu5: ?
|
||||||
killmsg = args[1]
|
killmsg = args[1]
|
||||||
|
|
||||||
return {'target': killed, 'text': killmsg, 'userdata': userdata}
|
return {'target': killed, 'text': killmsg, 'userdata': userdata}
|
||||||
@ -574,7 +574,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
|||||||
# <- :70MAAAAAA MODE 70MAAAAAA -i+xc
|
# <- :70MAAAAAA MODE 70MAAAAAA -i+xc
|
||||||
|
|
||||||
# P10:
|
# P10:
|
||||||
# <- ABAAA M GL -w
|
# <- ABAAA M jlu5 -w
|
||||||
# <- ABAAA M #test +v ABAAB 1460747615
|
# <- ABAAA M #test +v ABAAB 1460747615
|
||||||
# <- ABAAA OM #test +h ABAAA
|
# <- ABAAA OM #test +h ABAAA
|
||||||
target = self._get_UID(args[0])
|
target = self._get_UID(args[0])
|
||||||
@ -684,7 +684,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
|||||||
# TS6:
|
# TS6:
|
||||||
# <- :1SRAAGB4T QUIT :Quit: quit message goes here
|
# <- :1SRAAGB4T QUIT :Quit: quit message goes here
|
||||||
# P10:
|
# P10:
|
||||||
# <- ABAAB Q :Killed (GL_ (bangbang))
|
# <- ABAAB Q :Killed (jlu5_ (bangbang))
|
||||||
userdata = self._remove_client(numeric)
|
userdata = self._remove_client(numeric)
|
||||||
if userdata:
|
if userdata:
|
||||||
try:
|
try:
|
||||||
|
@ -117,7 +117,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
# Grab our server token; this is used instead of server name to denote where the client is.
|
# Grab our server token; this is used instead of server name to denote where the client is.
|
||||||
server_token = server.rsplit('@')[-1]
|
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,
|
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))
|
ident, host, server_token, self.join_modes(modes), realname))
|
||||||
return userobj
|
return userobj
|
||||||
@ -285,7 +285,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
"""
|
"""
|
||||||
Sets a server ban.
|
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 *@*"
|
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
|
||||||
self._send_with_prefix(source, 'GLINE *!%s@%s %s :%s' % (user, host, duration, reason))
|
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):
|
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
|
# 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:
|
# Basically, we expect messages of the forms:
|
||||||
# <- :GL JOIN #test\x07o
|
# <- :jlu5 JOIN #test\x07o
|
||||||
# <- :GL JOIN #moretest
|
# <- :jlu5 JOIN #moretest
|
||||||
for chanpair in args[0].split(','):
|
for chanpair in args[0].split(','):
|
||||||
# Normalize channel case.
|
# Normalize channel case.
|
||||||
try:
|
try:
|
||||||
@ -426,7 +426,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def handle_metadata(self, source, command, args):
|
def handle_metadata(self, source, command, args):
|
||||||
"""Handles various user metadata for ngIRCd (cloaked host, account name, etc.)"""
|
"""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])
|
target = self._get_UID(args[0])
|
||||||
|
|
||||||
if target not in self.users:
|
if target not in self.users:
|
||||||
@ -461,7 +461,7 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
"""
|
"""
|
||||||
if len(args) >= 2:
|
if len(args) >= 2:
|
||||||
# User introduction:
|
# 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]
|
nick = args[0]
|
||||||
assert source in self.servers, "Server %r tried to introduce nick %r but isn't in the servers index?" % (source, nick)
|
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)
|
self._check_nick_collision(nick)
|
||||||
@ -488,13 +488,13 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
'parse_as': 'UID', 'ip': '0.0.0.0'}
|
'parse_as': 'UID', 'ip': '0.0.0.0'}
|
||||||
else:
|
else:
|
||||||
# Nick changes:
|
# Nick changes:
|
||||||
# <- :GL NICK :GL_
|
# <- :jlu5 NICK :jlu5_
|
||||||
oldnick = self.users[source].nick
|
oldnick = self.users[source].nick
|
||||||
newnick = self.users[source].nick = args[0]
|
newnick = self.users[source].nick = args[0]
|
||||||
return {'newnick': newnick, 'oldnick': oldnick}
|
return {'newnick': newnick, 'oldnick': oldnick}
|
||||||
|
|
||||||
def handle_njoin(self, source, command, args):
|
def handle_njoin(self, source, command, args):
|
||||||
# <- :ngircd.midnight.local NJOIN #test :tester,@%GL
|
# <- :ngircd.midnight.local NJOIN #test :tester,@%jlu5
|
||||||
|
|
||||||
channel = args[0]
|
channel = args[0]
|
||||||
chandata = self._channels[channel].deepcopy()
|
chandata = self._channels[channel].deepcopy()
|
||||||
|
@ -198,7 +198,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def decode_p10_ip(ip):
|
def decode_p10_ip(ip):
|
||||||
"""Decodes a P10 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
|
if len(ip) == 6: # IPv4
|
||||||
# Pad the characters with two \x00's (represented in P10 B64 as AA)
|
# 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):
|
def kill(self, numeric, target, reason):
|
||||||
"""Sends a kill from a PyLink client/server."""
|
"""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 \
|
if (not self.is_internal_client(numeric)) and \
|
||||||
(not self.is_internal_server(numeric)):
|
(not self.is_internal_server(numeric)):
|
||||||
@ -463,7 +463,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def mode(self, numeric, target, modes, ts=None):
|
def mode(self, numeric, target, modes, ts=None):
|
||||||
"""Sends mode changes from a PyLink client/server."""
|
"""Sends mode changes from a PyLink client/server."""
|
||||||
# <- ABAAA M GL -w
|
# <- ABAAA M jlu5 -w
|
||||||
# <- ABAAA M #test +v ABAAB 1460747615
|
# <- ABAAA M #test +v ABAAB 1460747615
|
||||||
|
|
||||||
if (not self.is_internal_client(numeric)) and \
|
if (not self.is_internal_client(numeric)) and \
|
||||||
@ -494,7 +494,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
real_target = target
|
real_target = target
|
||||||
else:
|
else:
|
||||||
assert target in self.users, "Unknown mode target %s" % target
|
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
|
real_target = self.users[target].nick
|
||||||
|
|
||||||
self.apply_modes(target, modes)
|
self.apply_modes(target, modes)
|
||||||
@ -510,7 +510,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def nick(self, numeric, newnick):
|
def nick(self, numeric, newnick):
|
||||||
"""Changes the nick of a PyLink client."""
|
"""Changes the nick of a PyLink client."""
|
||||||
# <- ABAAA N GL_ 1460753763
|
# <- ABAAA N jlu5_ 1460753763
|
||||||
if not self.is_internal_client(numeric):
|
if not self.is_internal_client(numeric):
|
||||||
raise LookupError('No such PyLink client exists.')
|
raise LookupError('No such PyLink client exists.')
|
||||||
|
|
||||||
@ -523,7 +523,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
def numeric(self, source, numeric, target, text):
|
def numeric(self, source, numeric, target, text):
|
||||||
"""Sends raw numerics from a server to a remote client. This is used for WHOIS
|
"""Sends raw numerics from a server to a remote client. This is used for WHOIS
|
||||||
replies."""
|
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))
|
self._send_with_prefix(source, '%s %s %s' % (numeric, target, text))
|
||||||
|
|
||||||
def part(self, client, channel, reason=None):
|
def part(self, client, channel, reason=None):
|
||||||
@ -558,7 +558,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
|
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
|
||||||
|
|
||||||
# https://github.com/evilnet/nefarious2/blob/master/doc/p10.txt#L535
|
# 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())
|
currtime = int(time.time())
|
||||||
|
|
||||||
if duration == 0 or duration > GLINE_MAX_EXPIRE:
|
if duration == 0 or duration > GLINE_MAX_EXPIRE:
|
||||||
@ -747,7 +747,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def topic(self, source, target, text):
|
def topic(self, source, target, text):
|
||||||
"""Sends a TOPIC change from a PyLink client or server."""
|
"""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,
|
# First timestamp is channel creation time, second is current time,
|
||||||
if (not self.is_internal_client(source)) and (not self.is_internal_server(source)):
|
if (not self.is_internal_client(source)) and (not self.is_internal_server(source)):
|
||||||
raise LookupError('No such PyLink client/server exists.')
|
raise LookupError('No such PyLink client/server exists.')
|
||||||
@ -829,7 +829,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
# 4 <link TS>
|
# 4 <link TS>
|
||||||
# 5 <protocol>
|
# 5 <protocol>
|
||||||
# 6 <numeric of new server><max client numeric>
|
# 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>
|
# -1 <description of new server>
|
||||||
|
|
||||||
name = self.serverdata["hostname"]
|
name = self.serverdata["hostname"]
|
||||||
@ -918,7 +918,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
def handle_nick(self, source, command, args):
|
def handle_nick(self, source, command, args):
|
||||||
"""Handles the NICK command, used for user introductions and nick changes."""
|
"""Handles the NICK command, used for user introductions and nick changes."""
|
||||||
if len(args) > 2:
|
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]
|
nick = args[0]
|
||||||
self._check_nick_collision(nick)
|
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'}
|
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip, 'parse_as': 'UID'}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# <- ABAAA N GL_ 1460753763
|
# <- ABAAA N jlu5_ 1460753763
|
||||||
oldnick = self.users[source].nick
|
oldnick = self.users[source].nick
|
||||||
newnick = self.users[source].nick = args[0]
|
newnick = self.users[source].nick = args[0]
|
||||||
|
|
||||||
@ -1040,7 +1040,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
# -> X3 Z Channels.CollectiveIRC.Net 1460745823.89510 0 1460745823.089840
|
# -> X3 Z Channels.CollectiveIRC.Net 1460745823.89510 0 1460745823.089840
|
||||||
# Arguments of a PONG: our server hostname, the original TS of PING,
|
# Arguments of a PONG: our server hostname, the original TS of PING,
|
||||||
# difference between PING and PONG in seconds, the current TS.
|
# 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]
|
target = args[1]
|
||||||
sid = self._get_SID(target)
|
sid = self._get_SID(target)
|
||||||
@ -1216,7 +1216,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def handle_topic(self, source, command, args):
|
def handle_topic(self, source, command, args):
|
||||||
"""Handles TOPIC changes."""
|
"""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]
|
channel = args[0]
|
||||||
topic = args[-1]
|
topic = args[-1]
|
||||||
|
|
||||||
@ -1269,7 +1269,7 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
target = args[0]
|
target = args[0]
|
||||||
|
|
||||||
if self.serverdata.get('use_extended_accounts'):
|
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
|
# Logout: <- AA AC ABAAA U
|
||||||
|
|
||||||
# 1 <target user numeric>
|
# 1 <target user numeric>
|
||||||
|
@ -575,7 +575,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_euid(self, numeric, command, args):
|
def handle_euid(self, numeric, command, args):
|
||||||
"""Handles incoming EUID commands (user introduction)."""
|
"""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]
|
nick = args[0]
|
||||||
self._check_nick_collision(nick)
|
self._check_nick_collision(nick)
|
||||||
ts, modes, ident, host, ip, uid, realhost, accountname, realname = args[2:11]
|
ts, modes, ident, host, ip, uid, realhost, accountname, realname = args[2:11]
|
||||||
@ -644,7 +644,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
return
|
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)
|
return super().handle_server(numeric, command, args)
|
||||||
|
|
||||||
def handle_tmode(self, numeric, command, args):
|
def handle_tmode(self, numeric, command, args):
|
||||||
@ -662,7 +662,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_tb(self, numeric, command, args):
|
def handle_tb(self, numeric, command, args):
|
||||||
"""Handles incoming topic burst (TB) commands."""
|
"""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]
|
channel = args[0]
|
||||||
ts = args[1]
|
ts = args[1]
|
||||||
setter = args[2]
|
setter = args[2]
|
||||||
@ -673,7 +673,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_etb(self, numeric, command, args):
|
def handle_etb(self, numeric, command, args):
|
||||||
"""Handles extended topic burst (ETB)."""
|
"""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.
|
# Same as TB, with extra TS and extensions arguments.
|
||||||
channel = args[1]
|
channel = args[1]
|
||||||
ts = args[2]
|
ts = args[2]
|
||||||
@ -710,7 +710,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
the administrator that certain extensions should be loaded for the best
|
the administrator that certain extensions should be loaded for the best
|
||||||
compatibility.
|
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]
|
badmode = args[1]
|
||||||
reason = args[-1]
|
reason = args[-1]
|
||||||
setter = args[0]
|
setter = args[0]
|
||||||
@ -727,7 +727,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
"""
|
"""
|
||||||
Handles SU, which is used for setting login information.
|
Handles SU, which is used for setting login information.
|
||||||
"""
|
"""
|
||||||
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
# <- :00A ENCAP * SU 42XAAAAAC :jlu5
|
||||||
# <- :00A ENCAP * SU 42XAAAAAC
|
# <- :00A ENCAP * SU 42XAAAAAC
|
||||||
try:
|
try:
|
||||||
account = args[1] # Account name is being set
|
account = args[1] # Account name is being set
|
||||||
|
@ -218,7 +218,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def handle_nick(self, numeric, command, args):
|
def handle_nick(self, numeric, command, args):
|
||||||
"""Handles incoming NICK changes."""
|
"""Handles incoming NICK changes."""
|
||||||
# <- :70MAAAAAA NICK GL-devel 1434744242
|
# <- :70MAAAAAA NICK jlu5-devel 1434744242
|
||||||
oldnick = self.users[numeric].nick
|
oldnick = self.users[numeric].nick
|
||||||
newnick = self.users[numeric].nick = args[0]
|
newnick = self.users[numeric].nick = args[0]
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
|||||||
|
|
||||||
def handle_server(self, numeric, command, args):
|
def handle_server(self, numeric, command, args):
|
||||||
"""Handles the SERVER command, used for introducing older (TS5) servers."""
|
"""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()
|
servername = args[0].lower()
|
||||||
sdesc = args[-1]
|
sdesc = args[-1]
|
||||||
self.servers[servername] = Server(self, numeric, servername, desc=sdesc)
|
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']
|
# This is rewritten to SVSNICK with args ['902AAAAAB', 'Guest53593', '1468299404']
|
||||||
|
|
||||||
# UnrealIRCd:
|
# 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]}
|
return {'target': self._get_UID(args[0]), 'newnick': args[1]}
|
||||||
|
@ -21,7 +21,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
# I'm not sure what the real limit is, but the text posted at
|
# 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/jlu5/PyLink/issues/378 suggests 427 characters.
|
||||||
# https://github.com/unrealircd/unrealircd/blob/4cad9cb/src/modules/m_server.c#L1260 may
|
# 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
|
S2S_BUFSIZE = 427
|
||||||
_KNOWN_CMODES = {'ban': 'b',
|
_KNOWN_CMODES = {'ban': 'b',
|
||||||
'banexception': 'e',
|
'banexception': 'e',
|
||||||
@ -149,7 +149,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
# Now, strip the trailing \n and decode into a string again.
|
# Now, strip the trailing \n and decode into a string again.
|
||||||
encoded_ip = encoded_ip.strip().decode()
|
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} "
|
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {ident} {realhost} {uid} 0 {modes} "
|
||||||
"{host} * {ip} :{realname}".format(ts=ts, host=host,
|
"{host} * {ip} :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
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
|
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.
|
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 \
|
if (not self.is_internal_client(numeric)) and \
|
||||||
(not self.is_internal_server(numeric)):
|
(not self.is_internal_server(numeric)):
|
||||||
@ -379,7 +379,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
"""Sends a KNOCK from a PyLink client."""
|
"""Sends a KNOCK from a PyLink client."""
|
||||||
# KNOCKs in UnrealIRCd are actually just specially formatted NOTICEs,
|
# KNOCKs in UnrealIRCd are actually just specially formatted NOTICEs,
|
||||||
# sent to all ops in a channel.
|
# 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!"
|
assert self.is_channel(target), "Can only knock on channels!"
|
||||||
sender = self.get_server(numeric)
|
sender = self.get_server(numeric)
|
||||||
s = '[Knock] by %s (%s)' % (self.get_hostmask(numeric), text)
|
s = '[Knock] by %s (%s)' % (self.get_hostmask(numeric), text)
|
||||||
@ -451,8 +451,8 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
def handle_uid(self, numeric, command, args):
|
def handle_uid(self, numeric, command, args):
|
||||||
# <- :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
|
||||||
# <- :001 UID GL| 0 1441389007 gl 10.120.0.6 001ZO8F03 0 +iwx * 391A9CB9.26A16454.D9847B69.IP CngABg== :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,
|
# arguments: nick, hopcount?, ts, ident, real-host, UID, services account (0 if none), modes,
|
||||||
# displayed host, cloaked (+x) host, base64-encoded IP, and realname
|
# displayed host, cloaked (+x) host, base64-encoded IP, and realname
|
||||||
nick = args[0]
|
nick = args[0]
|
||||||
@ -539,7 +539,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
sdesc = args[-1].split(" ", 1)
|
sdesc = args[-1].split(" ", 1)
|
||||||
# Get our protocol version. I really don't know why the version and the server
|
# 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)
|
vline = sdesc[0].split('-', 1)
|
||||||
sdesc = " ".join(sdesc[1:])
|
sdesc = " ".join(sdesc[1:])
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
self.umodes['*D'] = ''.join(self._KNOWN_UMODES.values())
|
self.umodes['*D'] = ''.join(self._KNOWN_UMODES.values())
|
||||||
else:
|
else:
|
||||||
# Legacy (non-SID) servers can still be introduced using the SERVER command.
|
# 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)
|
return super().handle_server(numeric, command, args)
|
||||||
|
|
||||||
def handle_protoctl(self, numeric, command, args):
|
def handle_protoctl(self, numeric, command, args):
|
||||||
@ -601,7 +601,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_join(self, numeric, command, args):
|
def handle_join(self, numeric, command, args):
|
||||||
"""Handles the UnrealIRCd JOIN command."""
|
"""Handles the UnrealIRCd JOIN command."""
|
||||||
# <- :GL JOIN #pylink,#test
|
# <- :jlu5 JOIN #pylink,#test
|
||||||
if args[0] == '0':
|
if args[0] == '0':
|
||||||
# /join 0; part the user from all channels
|
# /join 0; part the user from all channels
|
||||||
oldchans = self.users[numeric].channels.copy()
|
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 Global 3 1456843578 services novernet.com services.novernet.com 0 +ioS * :Global Noticer
|
||||||
# & nick hopcount timestamp username hostname server service-identifier-token :realname
|
# & nick hopcount timestamp username hostname server service-identifier-token :realname
|
||||||
# With NICKIP and VHP enabled:
|
# 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:
|
# 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))
|
log.debug('(%s) got legacy NICK args: %s', self.name, ' '.join(args))
|
||||||
|
|
||||||
new_args = args[:] # Clone the old args list
|
new_args = args[:] # Clone the old args list
|
||||||
@ -739,15 +739,15 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
return self.handle_uid(servername, 'UID_LEGACY', new_args)
|
return self.handle_uid(servername, 'UID_LEGACY', new_args)
|
||||||
else:
|
else:
|
||||||
# Normal NICK change, just let ts6_common handle it.
|
# 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)
|
return super().handle_nick(numeric, command, args)
|
||||||
|
|
||||||
def handle_mode(self, numeric, command, args):
|
def handle_mode(self, numeric, command, args):
|
||||||
# <- :unreal.midnight.vpn MODE #test +bb test!*@* *!*@bad.net
|
# <- :unreal.midnight.vpn MODE #test +bb test!*@* *!*@bad.net
|
||||||
# <- :unreal.midnight.vpn MODE #test +q GL 1444361345
|
# <- :unreal.midnight.vpn MODE #test +q jlu5 1444361345
|
||||||
# <- :unreal.midnight.vpn MODE #test +ntCo GL 1444361345
|
# <- :unreal.midnight.vpn MODE #test +ntCo jlu5 1444361345
|
||||||
# <- :unreal.midnight.vpn MODE #test +mntClfo 5 [10t]:5 GL 1444361345
|
# <- :unreal.midnight.vpn MODE #test +mntClfo 5 [10t]:5 jlu5 1444361345
|
||||||
# <- :GL MODE #services +v GL
|
# <- :jlu5 MODE #services +v jlu5
|
||||||
|
|
||||||
# This seems pretty relatively inconsistent - why do some commands have a TS at the end while others don't?
|
# 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,
|
# 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).
|
# which is supported by atheme and Anope 2.x).
|
||||||
|
|
||||||
# Logging in (with account info, atheme):
|
# Logging in (with account info, atheme):
|
||||||
# <- :NickServ SVS2MODE GL +rd GL
|
# <- :NickServ SVS2MODE jlu5 +rd jlu5
|
||||||
|
|
||||||
# Logging in (without account info, anope 2.0?):
|
# Logging in (without account info, anope 2.0?):
|
||||||
# <- :NickServ SVS2MODE 001WCO6YK +r
|
# <- :NickServ SVS2MODE 001WCO6YK +r
|
||||||
|
|
||||||
# Logging in (without account info, anope 1.8):
|
# Logging in (without account info, anope 1.8):
|
||||||
# Note: ignore the timestamp.
|
# Note: ignore the timestamp.
|
||||||
# <- :services.abc.net SVS2MODE GLolol +rd 1470696723
|
# <- :services.abc.net SVS2MODE jlu5 +rd 1470696723
|
||||||
|
|
||||||
# Logging out (atheme):
|
# Logging out (atheme):
|
||||||
# <- :NickServ SVS2MODE GL -r+d 0
|
# <- :NickServ SVS2MODE jlu5 -r+d 0
|
||||||
|
|
||||||
# Logging out (anope 1.8):
|
# 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):
|
# Logging out (anope 2.0):
|
||||||
# <- :NickServ SVS2MODE 009EWLA03 -r
|
# <- :NickServ SVS2MODE 009EWLA03 -r
|
||||||
|
|
||||||
# Logging in to account from a different nick (atheme):
|
# Logging in to account from a different nick (atheme):
|
||||||
# Note: no +r is being set.
|
# 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):
|
# Logging in to account from a different nick (anope):
|
||||||
# <- :NickServ SVS2MODE 001SALZ01 +d GL
|
# <- :NickServ SVS2MODE 001SALZ01 +d jlu5
|
||||||
# <- :NickServ SVS2MODE 001SALZ01 +r
|
# <- :NickServ SVS2MODE 001SALZ01 +r
|
||||||
|
|
||||||
target = self._get_UID(args[0])
|
target = self._get_UID(args[0])
|
||||||
@ -917,13 +917,13 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_umode2(self, source, command, args):
|
def handle_umode2(self, source, command, args):
|
||||||
"""Handles UMODE2, used to set user modes on oneself."""
|
"""Handles UMODE2, used to set user modes on oneself."""
|
||||||
# <- :GL UMODE2 +W
|
# <- :jlu5 UMODE2 +W
|
||||||
target = self._get_UID(source)
|
target = self._get_UID(source)
|
||||||
return self._handle_umode(target, self.parse_modes(target, args))
|
return self._handle_umode(target, self.parse_modes(target, args))
|
||||||
|
|
||||||
def handle_topic(self, numeric, command, args):
|
def handle_topic(self, numeric, command, args):
|
||||||
"""Handles the TOPIC command."""
|
"""Handles the TOPIC command."""
|
||||||
# <- GL TOPIC #services GL 1444699395 :weeee
|
# <- jlu5 TOPIC #services jlu5 1444699395 :weeee
|
||||||
# <- TOPIC #services devel.relay 1452399682 :test
|
# <- TOPIC #services devel.relay 1452399682 :test
|
||||||
channel = args[0]
|
channel = args[0]
|
||||||
topic = args[-1]
|
topic = args[-1]
|
||||||
@ -962,14 +962,14 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_chgident(self, numeric, command, args):
|
def handle_chgident(self, numeric, command, args):
|
||||||
"""Handles CHGIDENT, used for denoting ident changes."""
|
"""Handles CHGIDENT, used for denoting ident changes."""
|
||||||
# <- :GL CHGIDENT GL test
|
# <- :jlu5 CHGIDENT jlu5 test
|
||||||
target = self._get_UID(args[0])
|
target = self._get_UID(args[0])
|
||||||
self.users[target].ident = newident = args[1]
|
self.users[target].ident = newident = args[1]
|
||||||
return {'target': target, 'newident': newident}
|
return {'target': target, 'newident': newident}
|
||||||
|
|
||||||
def handle_chghost(self, numeric, command, args):
|
def handle_chghost(self, numeric, command, args):
|
||||||
"""Handles CHGHOST, used for denoting hostname changes."""
|
"""Handles CHGHOST, used for denoting hostname changes."""
|
||||||
# <- :GL CHGHOST GL some.host
|
# <- :jlu5 CHGHOST jlu5 some.host
|
||||||
target = self._get_UID(args[0])
|
target = self._get_UID(args[0])
|
||||||
self.users[target].host = newhost = args[1]
|
self.users[target].host = newhost = args[1]
|
||||||
|
|
||||||
@ -981,14 +981,14 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def handle_chgname(self, numeric, command, args):
|
def handle_chgname(self, numeric, command, args):
|
||||||
"""Handles CHGNAME, used for denoting real name/gecos changes."""
|
"""Handles CHGNAME, used for denoting real name/gecos changes."""
|
||||||
# <- :GL CHGNAME GL :afdsafasf
|
# <- :jlu5 CHGNAME jlu5 :afdsafasf
|
||||||
target = self._get_UID(args[0])
|
target = self._get_UID(args[0])
|
||||||
self.users[target].realname = newgecos = args[1]
|
self.users[target].realname = newgecos = args[1]
|
||||||
return {'target': target, 'newgecos': newgecos}
|
return {'target': target, 'newgecos': newgecos}
|
||||||
|
|
||||||
def handle_tsctl(self, source, command, args):
|
def handle_tsctl(self, source, command, args):
|
||||||
"""Handles /TSCTL alltime requests."""
|
"""Handles /TSCTL alltime requests."""
|
||||||
# <- :GL TSCTL alltime
|
# <- :jlu5 TSCTL alltime
|
||||||
|
|
||||||
if args[0] == 'alltime':
|
if args[0] == 'alltime':
|
||||||
self._send_with_prefix(self.sid, 'NOTICE %s :*** Server=%s time()=%d' % (source, self.hostname(), time.time()))
|
self._send_with_prefix(self.sid, 'NOTICE %s :*** Server=%s time()=%d' % (source, self.hostname(), time.time()))
|
||||||
|
@ -137,7 +137,7 @@ class BaseProtocolTest(unittest.TestCase):
|
|||||||
assertT('{RACKETman}')
|
assertT('{RACKETman}')
|
||||||
assertT('bar|tender')
|
assertT('bar|tender')
|
||||||
assertT('\\bar|bender\\')
|
assertT('\\bar|bender\\')
|
||||||
assertT('GL|ovd')
|
assertT('jlu5|ovd')
|
||||||
assertT('B')
|
assertT('B')
|
||||||
assertT('`')
|
assertT('`')
|
||||||
assertT('Hello123')
|
assertT('Hello123')
|
||||||
@ -156,7 +156,7 @@ class BaseProtocolTest(unittest.TestCase):
|
|||||||
assertF('-test')
|
assertF('-test')
|
||||||
assertF('#lounge')
|
assertF('#lounge')
|
||||||
assertF('\\bar/bender\\')
|
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
|
assertF('100AAAAAC') # TS6 UID
|
||||||
|
|
||||||
self.assertFalse(self.p.is_nick('longnicklongnicklongnicklongnicklongnicklongnick', nicklen=20))
|
self.assertFalse(self.p.is_nick('longnicklongnicklongnicklongnicklongnicklongnick', nicklen=20))
|
||||||
|
Loading…
Reference in New Issue
Block a user