@@ -18,8 +18,8 @@ defmodule M51.IrcConn.HandlerTest do
1818 use ExUnit.Case , async: false
1919 doctest M51.IrcConn.Handler
2020
21- @ cap_ls_302 ":server. CAP * LS :account-tag batch draft/account-registration=before-connect draft/channel-rename draft/chathistory draft/multiline=max-bytes=8192 echo-message extended-join labeled-response message-tags sasl=PLAIN server-time soju.im/account-required standard-replies userhost-in-names\r \n "
22- @ cap_ls ":server. CAP * LS :account-tag batch draft/account-registration draft/channel-rename draft/chathistory draft/multiline echo-message extended-join labeled-response message-tags sasl server-time soju.im/account-required standard-replies userhost-in-names\r \n "
21+ @ cap_ls_302 ":server. CAP * LS :account-tag batch draft/account-registration=before-connect draft/channel-rename draft/chathistory draft/multiline=max-bytes=8192 draft/sasl-ir echo-message extended-join labeled-response message-tags sasl=PLAIN server-time soju.im/account-required standard-replies userhost-in-names\r \n "
22+ @ cap_ls ":server. CAP * LS :account-tag batch draft/account-registration draft/channel-rename draft/chathistory draft/multiline draft/sasl-ir echo-message extended-join labeled-response message-tags sasl server-time soju.im/account-required standard-replies userhost-in-names\r \n "
2323 @ isupport "CASEMAPPING=rfc3454 CLIENTTAGDENY=*,-draft/react,-draft/reply CHANLIMIT= CHANTYPES=#! CHATHISTORY=1000 MAXTARGETS=1 MSGREFTYPES=msgid PREFIX= TARGMAX=JOIN:1,PART:1 UTF8ONLY :are supported by this server\r \n "
2424
2525 setup do
@@ -189,6 +189,33 @@ defmodule M51.IrcConn.HandlerTest do
189189 assert M51.IrcConn.State . gecos ( state ) == "My GECOS"
190190 end
191191
192+ test "Connection registration with SASL-IR" , % { state: state , handler: handler } do
193+ send ( handler , cmd ( "CAP LS 302" ) )
194+ assert_line ( @ cap_ls_302 )
195+
196+ send ( handler , cmd ( "CAP REQ sasl" ) )
197+ assert_line ( ":server. CAP * ACK :sasl\r \n " )
198+
199+ send ( handler , cmd ( "NICK foo:example.org" ) )
200+ send ( handler , cmd ( "USER ident * * :My GECOS" ) )
201+
202+ # foo:example.org\x00foo:example.org\x00correct password
203+ send ( handler , cmd ( "AUTHENTICATE PLAIN Zm9vOmV4YW1wbGUub3JnAGZvbzpleGFtcGxlLm9yZwBjb3JyZWN0IHBhc3N3b3Jk" )
204+ )
205+
206+ assert_line (
207+ ":server. 900 foo:example.org foo:[email protected] foo:example.org :You are now logged in as foo:example.org\r \n " 208+ )
209+
210+ assert_line ( ":server. 903 foo:example.org :Authentication successful\r \n " )
211+
212+ send ( handler , cmd ( "CAP END" ) )
213+ assert_welcome ( "foo:example.org" )
214+
215+ assert M51.IrcConn.State . nick ( state ) == "foo:example.org"
216+ assert M51.IrcConn.State . gecos ( state ) == "My GECOS"
217+ end
218+
192219 test "Connection registration with AUTHENTICATE before NICK" , % { state: state , handler: handler } do
193220 send ( handler , cmd ( "CAP LS 302" ) )
194221 assert_line ( @ cap_ls_302 )
0 commit comments