Fixing the logic for draft/account-registration=before-connect #7

Merged
pratyush merged 3 commits from before-connect into master 2023-03-20 08:10:59 +01:00
Showing only changes of commit 6ad857ed29 - Show all commits

View File

@ -37,12 +37,11 @@ def ircregister(userip, username, password, email="*"):
# Inform the server that we support
# CAP 3.2
_send(irctokens.build("CAP", ["LS", "302"]))
# REGISTER can be attempted before-connect if server supports
# but if the server responds with the corresponding FAIL we
# need to try again. We can also handle email-required using
# the same keys. How to access these key-value pairs?
# reference: https://github.com/ProgVal/ircv3-specifications/blob/register/extensions/account-registration.md#commands
# lines = d.push(s.recv(1024))
if 'draft/account-registration=before-connnect' in lines.params:
# add extra conditional for custom account and email-required
_send(irctokens.build("REGISTER" ["*", password]))
else:
# NICK and USER
_send(irctokens.build("USER", ["u", "0", "*", username]))