irc.client: Send password on connect if provided
parent
ca6cbbb2f9
commit
e3a8421f44
|
@ -85,6 +85,18 @@ M: mb-writer dispose drop ;
|
||||||
] with-irc
|
] with-irc
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
! Test connect with password
|
||||||
|
{ V{ "PASS password" "NICK factorbot" "USER factorbot hostname servername :irc.factor" } } [
|
||||||
|
"someserver" irc-port "factorbot" "password" <irc-profile> <irc-client>
|
||||||
|
[ 2drop <test-stream> ] >>connect
|
||||||
|
[
|
||||||
|
(connect-irc)
|
||||||
|
(do-login)
|
||||||
|
irc> stream>> out>> lines>>
|
||||||
|
(terminate-irc)
|
||||||
|
] with-irc
|
||||||
|
] unit-test
|
||||||
|
|
||||||
! Test join
|
! Test join
|
||||||
[ { "JOIN #factortest" } [
|
[ { "JOIN #factortest" } [
|
||||||
"#factortest" %join %pop-output-line
|
"#factortest" %join %pop-output-line
|
||||||
|
|
|
@ -16,6 +16,7 @@ IN: irc.client.internals
|
||||||
|
|
||||||
: /NICK ( nick -- ) "NICK " prepend irc-print ;
|
: /NICK ( nick -- ) "NICK " prepend irc-print ;
|
||||||
: /PONG ( text -- ) "PONG " prepend irc-print ;
|
: /PONG ( text -- ) "PONG " prepend irc-print ;
|
||||||
|
: /PASS ( password -- ) "PASS " prepend irc-print ;
|
||||||
|
|
||||||
: /LOGIN ( nick -- )
|
: /LOGIN ( nick -- )
|
||||||
dup /NICK
|
dup /NICK
|
||||||
|
@ -44,7 +45,11 @@ IN: irc.client.internals
|
||||||
in-messages>> [ irc-connected ] dip mailbox-put
|
in-messages>> [ irc-connected ] dip mailbox-put
|
||||||
] [ (terminate-irc) ] if* ;
|
] [ (terminate-irc) ] if* ;
|
||||||
|
|
||||||
: (do-login) ( -- ) irc> nick>> /LOGIN ;
|
: (do-login) ( -- )
|
||||||
|
irc>
|
||||||
|
[ profile>> password>> [ /PASS ] when* ]
|
||||||
|
[ nick>> /LOGIN ]
|
||||||
|
bi ;
|
||||||
|
|
||||||
GENERIC: initialize-chat ( chat -- )
|
GENERIC: initialize-chat ( chat -- )
|
||||||
M: irc-chat initialize-chat drop ;
|
M: irc-chat initialize-chat drop ;
|
||||||
|
|
Loading…
Reference in New Issue