Support IRCv3's userhost-in-names
This commit is contained in:
parent
3ca0230733
commit
dcba6d2c6e
1 changed files with 22 additions and 12 deletions
|
@ -8,7 +8,8 @@ RE_CHANTYPES = re.compile(r"\bCHANTYPES=(\W+)(?:\b|$)")
|
||||||
RE_MODES = re.compile(r"[-+]\w+")
|
RE_MODES = re.compile(r"[-+]\w+")
|
||||||
|
|
||||||
CAPABILITIES = {"message-tags", "multi-prefix", "chghost", "invite-notify",
|
CAPABILITIES = {"message-tags", "multi-prefix", "chghost", "invite-notify",
|
||||||
"account-tag", "account-notify", "extended-join", "away-notify"}
|
"account-tag", "account-notify", "extended-join", "away-notify",
|
||||||
|
"userhost-in-names"}
|
||||||
|
|
||||||
class LineHandler(object):
|
class LineHandler(object):
|
||||||
def __init__(self, bot, events):
|
def __init__(self, bot, events):
|
||||||
|
@ -173,23 +174,32 @@ class LineHandler(object):
|
||||||
).call(channel=channel, setter=nickname, set_at=topic_time,
|
).call(channel=channel, setter=nickname, set_at=topic_time,
|
||||||
server=event["server"])
|
server=event["server"])
|
||||||
|
|
||||||
# on-join user list with status symbols
|
# /names response, also on-join user list
|
||||||
def handle_353(self, event):
|
def handle_353(self, event):
|
||||||
channel = event["server"].get_channel(event["args"][2])
|
channel = event["server"].get_channel(event["args"][2])
|
||||||
nicknames = event["arbitrary"].split()
|
nicknames = event["arbitrary"].split()
|
||||||
for nickname in nicknames:
|
for nickname in nicknames:
|
||||||
if nickname.strip():
|
username = None
|
||||||
modes = set([])
|
hostname = None
|
||||||
|
if "userhost-in-names" in event["server"].capabilities:
|
||||||
|
nickname, username, hostname = Utils.seperate_hostmask(
|
||||||
|
event["prefix"])
|
||||||
|
|
||||||
while nickname[0] in event["server"].mode_prefixes:
|
modes = set([])
|
||||||
modes.add(event["server"].mode_prefixes[nickname[0]])
|
|
||||||
nickname = nickname[1:]
|
|
||||||
|
|
||||||
user = event["server"].get_user(nickname)
|
while nickname[0] in event["server"].mode_prefixes:
|
||||||
user.join_channel(channel)
|
modes.add(event["server"].mode_prefixes[nickname[0]])
|
||||||
channel.add_user(user)
|
nickname = nickname[1:]
|
||||||
for mode in modes:
|
|
||||||
channel.add_mode(mode, nickname)
|
user = event["server"].get_user(nickname)
|
||||||
|
if username and hostname:
|
||||||
|
user.username = username
|
||||||
|
user.hostname = hostname
|
||||||
|
user.join_channel(channel)
|
||||||
|
channel.add_user(user)
|
||||||
|
|
||||||
|
for mode in modes:
|
||||||
|
channel.add_mode(mode, nickname)
|
||||||
|
|
||||||
# on-join user list has finished
|
# on-join user list has finished
|
||||||
def handle_366(self, event):
|
def handle_366(self, event):
|
||||||
|
|
Loading…
Reference in a new issue