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+")
|
||||
|
||||
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):
|
||||
def __init__(self, bot, events):
|
||||
|
@ -173,12 +174,17 @@ class LineHandler(object):
|
|||
).call(channel=channel, setter=nickname, set_at=topic_time,
|
||||
server=event["server"])
|
||||
|
||||
# on-join user list with status symbols
|
||||
# /names response, also on-join user list
|
||||
def handle_353(self, event):
|
||||
channel = event["server"].get_channel(event["args"][2])
|
||||
nicknames = event["arbitrary"].split()
|
||||
for nickname in nicknames:
|
||||
if nickname.strip():
|
||||
username = None
|
||||
hostname = None
|
||||
if "userhost-in-names" in event["server"].capabilities:
|
||||
nickname, username, hostname = Utils.seperate_hostmask(
|
||||
event["prefix"])
|
||||
|
||||
modes = set([])
|
||||
|
||||
while nickname[0] in event["server"].mode_prefixes:
|
||||
|
@ -186,8 +192,12 @@ class LineHandler(object):
|
|||
nickname = nickname[1:]
|
||||
|
||||
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue