Support ircv3's extended-join

This commit is contained in:
jesopo 2018-09-03 12:37:07 +01:00
parent dea6fbce0f
commit bbcc86dc24

View file

@ -8,7 +8,7 @@ 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"} "account-tag", "account-notify", "extended-join"}
class LineHandler(object): class LineHandler(object):
def __init__(self, bot, events): def __init__(self, bot, events):
@ -196,8 +196,16 @@ class LineHandler(object):
def join(self, event): def join(self, event):
nickname, username, hostname = Utils.seperate_hostmask( nickname, username, hostname = Utils.seperate_hostmask(
event["prefix"]) event["prefix"])
channel = event["server"].get_channel( account = None
event["arbitrary"] or event["args"][0]) realname = None
if len(event["args"]) == 2:
channel = event["server"].get_channel(event["args"][0])
if not event["args"] == "*":
account = event["args"][1]
realname = event["arbitrary"]
else:
channel = event["server"].get_channel(
event["arbitrary"] or event["args"][0])
if not event["server"].is_own_nickname(nickname): if not event["server"].is_own_nickname(nickname):
user = event["server"].get_user(nickname) user = event["server"].get_user(nickname)
@ -207,12 +215,13 @@ class LineHandler(object):
channel.add_user(user) channel.add_user(user)
user.join_channel(channel) user.join_channel(channel)
self.events.on("received").on("join").call(channel=channel, self.events.on("received").on("join").call(channel=channel,
user=user, server=event["server"]) user=user, server=event["server"], account=account,
realname=realname)
else: else:
if channel.name in event["server"].attempted_join: if channel.name in event["server"].attempted_join:
del event["server"].attempted_join[channel.name] del event["server"].attempted_join[channel.name]
self.events.on("self").on("join").call(channel=channel, self.events.on("self").on("join").call(channel=channel,
server=event["server"]) server=event["server"], account=account, realname=realname)
channel.send_mode() channel.send_mode()
# on user parting channel # on user parting channel