From 2293d1c129c4c7b4d5cc75005280f179a8f6784b Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 15 Jun 2021 20:34:50 +0200 Subject: [PATCH] Services: Update to the latest version of the draft/account-registration spec. --- plugins/Services/plugin.py | 8 ++++---- plugins/Services/test.py | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/Services/plugin.py b/plugins/Services/plugin.py index cdc5e976f..10fc39ca3 100644 --- a/plugins/Services/plugin.py +++ b/plugins/Services/plugin.py @@ -635,9 +635,9 @@ class Services(callbacks.Plugin): Raise=True ) - if "draft/register" not in otherIrc.state.capabilities_ls: + if "draft/account-registration" not in otherIrc.state.capabilities_ls: irc.error( - _("This network does not support draft/register."), + _("This network does not support draft/account-registration."), Raise=True ) @@ -665,7 +665,7 @@ class Services(callbacks.Plugin): # https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495 self._checkCanRegister(irc, otherIrc) - cap_values = (otherIrc.state.capabilities_ls["draft/register"] or "").split(",") + cap_values = (otherIrc.state.capabilities_ls["draft/account-registration"] or "").split(",") if "email-required" in cap_values and email is None: irc.error( _("This network requires an email address to register."), @@ -677,7 +677,7 @@ class Services(callbacks.Plugin): otherIrc.queueMsg(ircmsgs.IrcMsg( server_tags={"label": label}, command="REGISTER", - args=[email or "*", password], + args=["*", email or "*", password], )) register = wrap(register, ["owner", "private", "networkIrc", "something", optional("email")]) diff --git a/plugins/Services/test.py b/plugins/Services/test.py index a2e783d87..7febb45b3 100644 --- a/plugins/Services/test.py +++ b/plugins/Services/test.py @@ -192,7 +192,7 @@ class ExperimentalServicesTestCase(PluginTestCase): super().setUp() conf.supybot.protocols.irc.experimentalExtensions.setValue(True) self._initialCaps = self.irc.state.capabilities_ls.copy() - self.irc.state.capabilities_ls["draft/register"] = None + self.irc.state.capabilities_ls["draft/account-registration"] = None self.irc.state.capabilities_ls["labeled-response"] = None def tearDown(self): @@ -208,17 +208,17 @@ class ExperimentalServicesTestCase(PluginTestCase): "register p4ssw0rd", "error: This network does not support labeled-response.") - del self.irc.state.capabilities_ls["draft/register"] + del self.irc.state.capabilities_ls["draft/account-registration"] self.assertRegexp( "register p4ssw0rd", - "error: This network does not support draft/register.") + "error: This network does not support draft/account-registration.") finally: self.irc.state.capabilities_ls = old_caps def testRegisterRequireEmail(self): old_caps = self.irc.state.capabilities_ls.copy() try: - self.irc.state.capabilities_ls["draft/register"] = "email-required" + self.irc.state.capabilities_ls["draft/account-registration"] = "email-required" self.assertRegexp( "register p4ssw0rd", "error: This network requires an email address to register.") @@ -228,7 +228,7 @@ class ExperimentalServicesTestCase(PluginTestCase): def testRegisterSuccess(self): m = self.getMsg("register p4ssw0rd") label = m.server_tags.pop("label") - self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"])) + self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"])) self.irc.feedMsg(IrcMsg( server_tags={"label": label}, command="REGISTER", @@ -242,7 +242,7 @@ class ExperimentalServicesTestCase(PluginTestCase): # oragono replies with a batch m = self.getMsg("register p4ssw0rd") label = m.server_tags.pop("label") - self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"])) + self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"])) batch_name = "Services_testRegisterSuccessBatch" self.irc.feedMsg(IrcMsg( @@ -273,7 +273,7 @@ class ExperimentalServicesTestCase(PluginTestCase): m = self.getMsg("register p4ssw0rd foo@example.org") label = m.server_tags.pop("label") self.assertEqual(m, IrcMsg( - command="REGISTER", args=["foo@example.org", "p4ssw0rd"])) + command="REGISTER", args=["*", "foo@example.org", "p4ssw0rd"])) self.irc.feedMsg(IrcMsg( server_tags={"label": label}, command="REGISTER", @@ -286,7 +286,7 @@ class ExperimentalServicesTestCase(PluginTestCase): def testRegisterVerify(self): m = self.getMsg("register p4ssw0rd") label = m.server_tags.pop("label") - self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"])) + self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"])) self.irc.feedMsg(IrcMsg( server_tags={"label": label}, command="REGISTER", @@ -313,7 +313,7 @@ class ExperimentalServicesTestCase(PluginTestCase): def testRegisterVerifyBatch(self): m = self.getMsg("register p4ssw0rd") label = m.server_tags.pop("label") - self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"])) + self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"])) self.irc.feedMsg(IrcMsg( server_tags={"label": label}, command="REGISTER",