Merge branch 'irc' of git://www.tiodante.com/git/factor
						commit
						0a0ed4777f
					
				| 
						 | 
				
			
			@ -85,6 +85,18 @@ M: mb-writer dispose drop ;
 | 
			
		|||
    ] with-irc
 | 
			
		||||
] 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
 | 
			
		||||
[ { "JOIN #factortest" } [
 | 
			
		||||
      "#factortest" %join %pop-output-line
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@ IN: irc.client.internals
 | 
			
		|||
 | 
			
		||||
: /NICK ( nick -- ) "NICK " prepend irc-print ;
 | 
			
		||||
: /PONG ( text -- ) "PONG " prepend irc-print ;
 | 
			
		||||
: /PASS ( password -- ) "PASS " prepend irc-print ;
 | 
			
		||||
 | 
			
		||||
: /LOGIN ( nick -- )
 | 
			
		||||
    dup /NICK
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +45,11 @@ IN: irc.client.internals
 | 
			
		|||
        in-messages>> [ irc-connected ] dip mailbox-put
 | 
			
		||||
    ] [ (terminate-irc) ] if* ;
 | 
			
		||||
 | 
			
		||||
: (do-login) ( -- ) irc> nick>> /LOGIN ;
 | 
			
		||||
: (do-login) ( -- )
 | 
			
		||||
     irc>
 | 
			
		||||
     [ profile>> password>> [ /PASS ] when* ]
 | 
			
		||||
     [ nick>> /LOGIN ]
 | 
			
		||||
     bi ;
 | 
			
		||||
 | 
			
		||||
GENERIC: initialize-chat ( chat -- )
 | 
			
		||||
M: irc-chat         initialize-chat drop ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue