]> gitweb.factorcode.org Git - factor.git/commitdiff
irc.client: Fix strings>privmsg, add test
authorBruno Deferrari <utizoc@gmail.com>
Sat, 7 Mar 2009 22:43:25 +0000 (20:43 -0200)
committerBruno Deferrari <utizoc@gmail.com>
Thu, 9 Apr 2009 02:13:17 +0000 (23:13 -0300)
extra/irc/client/client-tests.factor
extra/irc/client/client.factor

index 4f25531eeedeba866f8fa245291976ad36201943..07b9df2ab7f7d38453bb8bf328ceb13be8cf17b0 100644 (file)
@@ -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
index 7986a726ba4883412ab5504dd621304ba34aa179..c7e90eb802ebe8c72e9d29e91755986259effe95 100755 (executable)
@@ -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 ] }