irc.client: Fix strings>privmsg, add test
							parent
							
								
									5bfe50018e
								
							
						
					
					
						commit
						527b50fa56
					
				| 
						 | 
				
			
			@ -58,6 +58,11 @@ M: mb-writer dispose drop ;
 | 
			
		|||
                   string>irc-message forward-name ] unit-test
 | 
			
		||||
] with-irc
 | 
			
		||||
 | 
			
		||||
{ privmsg "#channel" "hello" } [
 | 
			
		||||
    "#channel" "hello" strings>privmsg
 | 
			
		||||
    [ class ] [ target>> ] [ trailing>> ] tri
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
! Test login and nickname set
 | 
			
		||||
[ { "factorbot2" } [
 | 
			
		||||
    ":some.where 001 factorbot2 :Welcome factorbot2" %push-line
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -313,7 +313,7 @@ DEFER: (connect-irc)
 | 
			
		|||
    [ forward-message ] [ process-message ] [ irc-end? not ] tri ;
 | 
			
		||||
 | 
			
		||||
: strings>privmsg ( name string -- privmsg )
 | 
			
		||||
    privmsg new [ (>>trailing) ] keep [ (>>target) ] keep ;
 | 
			
		||||
    " :" prepend append "PRIVMSG " prepend string>irc-message ;
 | 
			
		||||
 | 
			
		||||
: maybe-annotate-with-name ( name obj -- obj )
 | 
			
		||||
    { { [ dup string? ] [ strings>privmsg ] }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue