]> gitweb.factorcode.org Git - factor-unmaintained.git/commitdiff
irc-ui: move to irc.ui to match IN: declarations.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 22 Jan 2018 22:19:19 +0000 (14:19 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 22 Jan 2018 22:19:19 +0000 (14:19 -0800)
14 files changed:
irc-ui/authors.txt [deleted file]
irc-ui/commandparser/commandparser.factor [deleted file]
irc-ui/commands/commands.factor [deleted file]
irc-ui/ircui-rc [deleted file]
irc-ui/load/load.factor [deleted file]
irc-ui/summary.txt [deleted file]
irc-ui/ui.factor [deleted file]
irc/ui/authors.txt [new file with mode: 0644]
irc/ui/commandparser/commandparser.factor [new file with mode: 0644]
irc/ui/commands/commands.factor [new file with mode: 0644]
irc/ui/ircui-rc [new file with mode: 0644]
irc/ui/load/load.factor [new file with mode: 0644]
irc/ui/summary.txt [new file with mode: 0644]
irc/ui/ui.factor [new file with mode: 0644]

diff --git a/irc-ui/authors.txt b/irc-ui/authors.txt
deleted file mode 100644 (file)
index 9366723..0000000
+++ /dev/null
@@ -1 +0,0 @@
-William Schlieper
diff --git a/irc-ui/commandparser/commandparser.factor b/irc-ui/commandparser/commandparser.factor
deleted file mode 100644 (file)
index 43ea80c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-! Copyright (C) 2008 William Schlieper
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
-
-IN: irc.ui.commandparser
-
-: command ( string string -- string command )
-    [ "say" ] when-empty
-    dup "irc.ui.commands" lookup
-    [ nip ]
-    [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
-
-: parse-message ( string -- )
-    "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;
diff --git a/irc-ui/commands/commands.factor b/irc-ui/commands/commands.factor
deleted file mode 100644 (file)
index 93d1e2e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-! Copyright (C) 2008 William Schlieper
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: accessors kernel sequences arrays irc.client
-       irc.messages irc.ui namespaces ;
-
-IN: irc.ui.commands
-
-: say ( string -- )
-    irc-tab get
-    [ window>> client>> profile>> nickname>> <own-message> print-irc ]
-    [ chat>> speak ] 2bi ;
-
-: me ( string -- ) ! Placeholder until I make /me look different
-    "ACTION " 1 prefix prepend 1 suffix say ;
-
-: join ( string -- )
-    irc-tab get window>> join-channel ;
-
-: query ( string -- )
-    irc-tab get window>> query-nick ;
-
-: whois ( string -- )
-    "WHOIS" swap { } clone swap  <irc-client-message>
-    irc-tab get listener>> speak ;
-
-: quote ( string -- )
-    drop ; ! THIS WILL CHANGE
diff --git a/irc-ui/ircui-rc b/irc-ui/ircui-rc
deleted file mode 100644 (file)
index a1533c7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-! Default system ircui-rc file\r
-! Copy into .ircui-rc in your home directory and then change username and such\r
-! To find your home directory, type "home ." into a Factor listener\r
-\r
-USING: irc.client irc.ui ;\r
-\r
-"irc.freenode.org" 8001 "factor-irc" f ! server port nick password\r
-{ "#concatenative" "#terrorisland" } ! all the channels you want to autojoin\r
-server-open\r
diff --git a/irc-ui/load/load.factor b/irc-ui/load/load.factor
deleted file mode 100644 (file)
index 88c0d35..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-! Copyright (C) 2008 William Schlieper
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: kernel io.files io.pathnames parser editors sequences ;
-
-IN: irc.ui.load
-
-: file-or ( path path -- path ) [ [ exists? ] keep ] dip ? ;
-
-: personal-ui-rc ( -- path ) home ".ircui-rc" append-path ;
-
-: system-ui-rc ( -- path ) "extra/irc/ui/ircui-rc" resource-path ;
-
-: ircui-rc ( -- path ) personal-ui-rc system-ui-rc file-or ;
-
-: run-ircui ( -- ) ircui-rc run-file ;
diff --git a/irc-ui/summary.txt b/irc-ui/summary.txt
deleted file mode 100644 (file)
index 284672b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-A simple IRC client
\ No newline at end of file
diff --git a/irc-ui/ui.factor b/irc-ui/ui.factor
deleted file mode 100644 (file)
index d65817f..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-! Copyright (C) 2008 William Schlieper
-! See http://factorcode.org/license.txt for BSD license.
-
-USING: accessors kernel threads combinators concurrency.mailboxes
-       sequences strings hashtables splitting fry assocs hashtables colors
-       sorting unicode math.order
-       ui ui.gadgets ui.gadgets.panes ui.gadgets.editors
-       ui.gadgets.scrollers ui.commands ui.gadgets.frames ui.gestures
-       ui.gadgets.tabs ui.gadgets.grids ui.gadgets.packs ui.gadgets.labels
-       io io.styles namespaces calendar calendar.format models continuations
-       irc.client irc.client.private irc.messages
-       irc.ui.commandparser irc.ui.load vocabs.loader classes prettyprint ;
-
-RENAME: join sequences => sjoin
-
-IN: irc.ui
-
-SYMBOL: chat
-
-SYMBOL: client
-
-TUPLE: ui-window < tabbed client ;
-
-M: ui-window ungraft*
-    client>> terminate-irc ;
-
-TUPLE: irc-tab < frame chat client window ;
-
-: write-color ( str color -- )
-    foreground associate format ;
-CONSTANT: dark-red T{ rgba f 0.5 0.0 0.0 1 }
-CONSTANT: dark-green T{ rgba f 0.0 0.5 0.0 1 }
-CONSTANT: dark-blue T{ rgba f 0.0 0.0 0.5 1 }
-
-: dot-or-parens ( string -- string )
-    [ "." ]
-    [ "(" prepend ")" append ] if-empty ;
-
-GENERIC: write-irc ( irc-message -- )
-
-M: ping write-irc
-    drop "* Ping" blue write-color ;
-
-M: privmsg write-irc
-    "<" dark-blue write-color
-    [ irc-message-sender write ] keep
-    "> " dark-blue write-color
-    trailing>> write ;
-
-M: notice write-irc
-    [ type>> dark-blue write-color ] keep
-    ": " dark-blue write-color
-    trailing>> write ;
-
-TUPLE: own-message message nick timestamp ;
-
-: <own-message> ( message nick -- own-message )
-    now own-message boa ;
-
-M: own-message write-irc
-    "<" dark-blue write-color
-    [ nick>> bold font-style associate format ] keep
-    "> " dark-blue write-color
-    message>> write ;
-
-M: join write-irc
-    "* " dark-green write-color
-    irc-message-sender write
-    " has entered the channel." dark-green write-color ;
-
-M: part write-irc
-    "* " dark-red write-color
-    [ irc-message-sender write ] keep
-    " has left the channel" dark-red write-color
-    trailing>> dot-or-parens dark-red write-color ;
-
-M: quit write-irc
-    "* " dark-red write-color
-    [ irc-message-sender write ] keep
-    " has left IRC" dark-red write-color
-    trailing>> dot-or-parens dark-red write-color ;
-
-M: kick write-irc
-    "* " dark-red write-color
-    [ irc-message-sender write ] keep
-    " has kicked " dark-red write-color
-    [ who>> write ] keep
-    " from the channel" dark-red write-color
-    trailing>> dot-or-parens dark-red write-color ;
-
-M: mode write-irc
-    "* " dark-blue write-color
-    [ name>> write ] keep
-    " has applied mode " dark-blue write-color
-    [ mode>> write ] keep
-    " to " dark-blue write-color
-    parameter>> write ;
-
-M: nick write-irc
-    "* " dark-blue write-color
-    [ irc-message-sender write ] keep
-    " is now known as " blue write-color
-    trailing>> write ;
-
-M: unhandled write-irc
-    "UNHANDLED: " write
-    line>> dark-blue write-color ;
-
-M: irc-end write-irc
-    drop "* You have left IRC" dark-red write-color ;
-
-M: irc-disconnected write-irc
-    drop "* Disconnected" dark-red write-color ;
-
-M: irc-connected write-irc
-    drop "* Connected" dark-green write-color ;
-
-M: irc-chat-end write-irc
-    drop ;
-
-M: irc-message write-irc
-    "UNIMPLEMENTED" write
-    [ class pprint ] keep
-    ": " write
-    line>> dark-blue write-color ;
-
-GENERIC: time-happened ( message -- timestamp )
-
-M: irc-message time-happened timestamp>> ;
-
-M: object time-happened drop now ;
-
-: print-irc ( irc-message -- )
-    [ time-happened timestamp>hms write " " write ]
-    [ write-irc nl ] bi ;
-
-: send-message ( message -- )
-    [ print-irc ]
-    [ chat get speak ] bi ;
-
-GENERIC: handle-inbox ( tab message -- )
-
-: value-labels ( assoc val -- seq )
-    '[ nip _ = ] assoc-filter keys sort-strings [ <label> ] map ;
-
-: add-gadget-color ( pack seq color -- pack )
-    '[ _ >>color add-gadget ] each ;
-
-M: object handle-inbox
-    nip print-irc ;
-
-: display ( stream tab -- )
-    '[ _ [ [ t ]
-           [ _ dup chat>> hear handle-inbox ]
-           while ] with-output-stream ] "ircv" spawn drop ;
-
-: <irc-pane> ( tab -- tab pane )
-    <scrolling-pane>
-    [ <pane-stream> swap display ] 2keep ;
-
-TUPLE: irc-editor < editor outstream tab ;
-
-: <irc-editor> ( tab pane -- tab editor )
-    irc-editor new-editor
-    swap <pane-stream> >>outstream ;
-
-: editor-send ( irc-editor -- )
-    { [ outstream>> ]
-      [ [ irc-tab? ] find-parent ]
-      [ editor-string ]
-      [ "" swap set-editor-string ] } cleave
-     '[ _ irc-tab set _ parse-message ] with-output-stream ;
-
-irc-editor "general" f {
-    { T{ key-down f f "RET" } editor-send }
-    { T{ key-down f f "ENTER" } editor-send }
-} define-command-map
-
-: new-irc-tab ( chat ui-window class -- irc-tab )
-    new-frame
-    swap >>window
-    swap >>chat
-    <irc-pane> [ <scroller> @center grid-add ] keep
-    <irc-editor> <scroller> @bottom grid-add ;
-
-M: irc-tab graft*
-    [ chat>> ] [ window>> client>> ] bi attach-chat ;
-
-M: irc-tab ungraft*
-    chat>> detach-chat ;
-
-TUPLE: irc-channel-tab < irc-tab userlist ;
-
-: <irc-channel-tab> ( chat ui-window -- irc-tab )
-    irc-channel-tab new-irc-tab
-    <pile> [ <scroller> @right grid-add ] keep >>userlist ;
-
-: update-participants ( tab -- )
-    [ userlist>> [ clear-gadget ] keep ]
-    [ chat>> participants>> ] bi
-    [ +operator+ value-labels dark-green add-gadget-color ]
-    [ +voice+ value-labels blue add-gadget-color ]
-    [ +normal+ value-labels black add-gadget-color ] tri drop ;
-
-M: participant-changed handle-inbox
-    drop update-participants ;
-
-TUPLE: irc-server-tab < irc-tab ;
-
-: <irc-server-tab> ( chat -- irc-tab )
-    f irc-server-tab new-irc-tab ;
-
-: <irc-nick-tab> ( chat ui-window -- irc-tab )
-    irc-tab new-irc-tab ;
-
-M: irc-tab pref-dim*
-    drop { 480 480 } ;
-
-: join-channel ( name ui-window -- )
-    [ dup <irc-channel-chat> ] dip
-    [ <irc-channel-tab> swap ] keep
-    add-page ;
-
-: query-nick ( nick ui-window -- )
-    [ dup <irc-nick-chat> ] dip
-    [ <irc-nick-tab> swap ] keep
-    add-page ;
-
-: irc-window ( ui-window -- )
-    [ ]
-    [ client>> profile>> server>> ] bi
-    open-window ;
-
-: ui-connect ( profile -- ui-window )
-    <irc-client>
-    { [ [ <irc-server-chat> ] dip attach-chat ]
-      [ chats>> +server-chat+ swap at <irc-server-tab> dup
-        "Server" associate ui-window new-tabbed [ swap window<< ] keep ]
-      [ >>client ]
-      [ connect-irc ] } cleave ;
-
-: server-open ( server port nick password channels -- )
-    [ <irc-profile> ui-connect [ irc-window ] keep ] dip
-    [ over join-channel ] each drop ;
-
-: main-run ( -- ) run-ircui ;
-
-MAIN: main-run
-
-"irc.ui.commands" require
diff --git a/irc/ui/authors.txt b/irc/ui/authors.txt
new file mode 100644 (file)
index 0000000..9366723
--- /dev/null
@@ -0,0 +1 @@
+William Schlieper
diff --git a/irc/ui/commandparser/commandparser.factor b/irc/ui/commandparser/commandparser.factor
new file mode 100644 (file)
index 0000000..43ea80c
--- /dev/null
@@ -0,0 +1,15 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
+
+IN: irc.ui.commandparser
+
+: command ( string string -- string command )
+    [ "say" ] when-empty
+    dup "irc.ui.commands" lookup
+    [ nip ]
+    [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
+
+: parse-message ( string -- )
+    "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;
diff --git a/irc/ui/commands/commands.factor b/irc/ui/commands/commands.factor
new file mode 100644 (file)
index 0000000..93d1e2e
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel sequences arrays irc.client
+       irc.messages irc.ui namespaces ;
+
+IN: irc.ui.commands
+
+: say ( string -- )
+    irc-tab get
+    [ window>> client>> profile>> nickname>> <own-message> print-irc ]
+    [ chat>> speak ] 2bi ;
+
+: me ( string -- ) ! Placeholder until I make /me look different
+    "ACTION " 1 prefix prepend 1 suffix say ;
+
+: join ( string -- )
+    irc-tab get window>> join-channel ;
+
+: query ( string -- )
+    irc-tab get window>> query-nick ;
+
+: whois ( string -- )
+    "WHOIS" swap { } clone swap  <irc-client-message>
+    irc-tab get listener>> speak ;
+
+: quote ( string -- )
+    drop ; ! THIS WILL CHANGE
diff --git a/irc/ui/ircui-rc b/irc/ui/ircui-rc
new file mode 100644 (file)
index 0000000..a1533c7
--- /dev/null
@@ -0,0 +1,9 @@
+! Default system ircui-rc file\r
+! Copy into .ircui-rc in your home directory and then change username and such\r
+! To find your home directory, type "home ." into a Factor listener\r
+\r
+USING: irc.client irc.ui ;\r
+\r
+"irc.freenode.org" 8001 "factor-irc" f ! server port nick password\r
+{ "#concatenative" "#terrorisland" } ! all the channels you want to autojoin\r
+server-open\r
diff --git a/irc/ui/load/load.factor b/irc/ui/load/load.factor
new file mode 100644 (file)
index 0000000..88c0d35
--- /dev/null
@@ -0,0 +1,16 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: kernel io.files io.pathnames parser editors sequences ;
+
+IN: irc.ui.load
+
+: file-or ( path path -- path ) [ [ exists? ] keep ] dip ? ;
+
+: personal-ui-rc ( -- path ) home ".ircui-rc" append-path ;
+
+: system-ui-rc ( -- path ) "extra/irc/ui/ircui-rc" resource-path ;
+
+: ircui-rc ( -- path ) personal-ui-rc system-ui-rc file-or ;
+
+: run-ircui ( -- ) ircui-rc run-file ;
diff --git a/irc/ui/summary.txt b/irc/ui/summary.txt
new file mode 100644 (file)
index 0000000..284672b
--- /dev/null
@@ -0,0 +1 @@
+A simple IRC client
\ No newline at end of file
diff --git a/irc/ui/ui.factor b/irc/ui/ui.factor
new file mode 100644 (file)
index 0000000..d65817f
--- /dev/null
@@ -0,0 +1,250 @@
+! Copyright (C) 2008 William Schlieper
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: accessors kernel threads combinators concurrency.mailboxes
+       sequences strings hashtables splitting fry assocs hashtables colors
+       sorting unicode math.order
+       ui ui.gadgets ui.gadgets.panes ui.gadgets.editors
+       ui.gadgets.scrollers ui.commands ui.gadgets.frames ui.gestures
+       ui.gadgets.tabs ui.gadgets.grids ui.gadgets.packs ui.gadgets.labels
+       io io.styles namespaces calendar calendar.format models continuations
+       irc.client irc.client.private irc.messages
+       irc.ui.commandparser irc.ui.load vocabs.loader classes prettyprint ;
+
+RENAME: join sequences => sjoin
+
+IN: irc.ui
+
+SYMBOL: chat
+
+SYMBOL: client
+
+TUPLE: ui-window < tabbed client ;
+
+M: ui-window ungraft*
+    client>> terminate-irc ;
+
+TUPLE: irc-tab < frame chat client window ;
+
+: write-color ( str color -- )
+    foreground associate format ;
+CONSTANT: dark-red T{ rgba f 0.5 0.0 0.0 1 }
+CONSTANT: dark-green T{ rgba f 0.0 0.5 0.0 1 }
+CONSTANT: dark-blue T{ rgba f 0.0 0.0 0.5 1 }
+
+: dot-or-parens ( string -- string )
+    [ "." ]
+    [ "(" prepend ")" append ] if-empty ;
+
+GENERIC: write-irc ( irc-message -- )
+
+M: ping write-irc
+    drop "* Ping" blue write-color ;
+
+M: privmsg write-irc
+    "<" dark-blue write-color
+    [ irc-message-sender write ] keep
+    "> " dark-blue write-color
+    trailing>> write ;
+
+M: notice write-irc
+    [ type>> dark-blue write-color ] keep
+    ": " dark-blue write-color
+    trailing>> write ;
+
+TUPLE: own-message message nick timestamp ;
+
+: <own-message> ( message nick -- own-message )
+    now own-message boa ;
+
+M: own-message write-irc
+    "<" dark-blue write-color
+    [ nick>> bold font-style associate format ] keep
+    "> " dark-blue write-color
+    message>> write ;
+
+M: join write-irc
+    "* " dark-green write-color
+    irc-message-sender write
+    " has entered the channel." dark-green write-color ;
+
+M: part write-irc
+    "* " dark-red write-color
+    [ irc-message-sender write ] keep
+    " has left the channel" dark-red write-color
+    trailing>> dot-or-parens dark-red write-color ;
+
+M: quit write-irc
+    "* " dark-red write-color
+    [ irc-message-sender write ] keep
+    " has left IRC" dark-red write-color
+    trailing>> dot-or-parens dark-red write-color ;
+
+M: kick write-irc
+    "* " dark-red write-color
+    [ irc-message-sender write ] keep
+    " has kicked " dark-red write-color
+    [ who>> write ] keep
+    " from the channel" dark-red write-color
+    trailing>> dot-or-parens dark-red write-color ;
+
+M: mode write-irc
+    "* " dark-blue write-color
+    [ name>> write ] keep
+    " has applied mode " dark-blue write-color
+    [ mode>> write ] keep
+    " to " dark-blue write-color
+    parameter>> write ;
+
+M: nick write-irc
+    "* " dark-blue write-color
+    [ irc-message-sender write ] keep
+    " is now known as " blue write-color
+    trailing>> write ;
+
+M: unhandled write-irc
+    "UNHANDLED: " write
+    line>> dark-blue write-color ;
+
+M: irc-end write-irc
+    drop "* You have left IRC" dark-red write-color ;
+
+M: irc-disconnected write-irc
+    drop "* Disconnected" dark-red write-color ;
+
+M: irc-connected write-irc
+    drop "* Connected" dark-green write-color ;
+
+M: irc-chat-end write-irc
+    drop ;
+
+M: irc-message write-irc
+    "UNIMPLEMENTED" write
+    [ class pprint ] keep
+    ": " write
+    line>> dark-blue write-color ;
+
+GENERIC: time-happened ( message -- timestamp )
+
+M: irc-message time-happened timestamp>> ;
+
+M: object time-happened drop now ;
+
+: print-irc ( irc-message -- )
+    [ time-happened timestamp>hms write " " write ]
+    [ write-irc nl ] bi ;
+
+: send-message ( message -- )
+    [ print-irc ]
+    [ chat get speak ] bi ;
+
+GENERIC: handle-inbox ( tab message -- )
+
+: value-labels ( assoc val -- seq )
+    '[ nip _ = ] assoc-filter keys sort-strings [ <label> ] map ;
+
+: add-gadget-color ( pack seq color -- pack )
+    '[ _ >>color add-gadget ] each ;
+
+M: object handle-inbox
+    nip print-irc ;
+
+: display ( stream tab -- )
+    '[ _ [ [ t ]
+           [ _ dup chat>> hear handle-inbox ]
+           while ] with-output-stream ] "ircv" spawn drop ;
+
+: <irc-pane> ( tab -- tab pane )
+    <scrolling-pane>
+    [ <pane-stream> swap display ] 2keep ;
+
+TUPLE: irc-editor < editor outstream tab ;
+
+: <irc-editor> ( tab pane -- tab editor )
+    irc-editor new-editor
+    swap <pane-stream> >>outstream ;
+
+: editor-send ( irc-editor -- )
+    { [ outstream>> ]
+      [ [ irc-tab? ] find-parent ]
+      [ editor-string ]
+      [ "" swap set-editor-string ] } cleave
+     '[ _ irc-tab set _ parse-message ] with-output-stream ;
+
+irc-editor "general" f {
+    { T{ key-down f f "RET" } editor-send }
+    { T{ key-down f f "ENTER" } editor-send }
+} define-command-map
+
+: new-irc-tab ( chat ui-window class -- irc-tab )
+    new-frame
+    swap >>window
+    swap >>chat
+    <irc-pane> [ <scroller> @center grid-add ] keep
+    <irc-editor> <scroller> @bottom grid-add ;
+
+M: irc-tab graft*
+    [ chat>> ] [ window>> client>> ] bi attach-chat ;
+
+M: irc-tab ungraft*
+    chat>> detach-chat ;
+
+TUPLE: irc-channel-tab < irc-tab userlist ;
+
+: <irc-channel-tab> ( chat ui-window -- irc-tab )
+    irc-channel-tab new-irc-tab
+    <pile> [ <scroller> @right grid-add ] keep >>userlist ;
+
+: update-participants ( tab -- )
+    [ userlist>> [ clear-gadget ] keep ]
+    [ chat>> participants>> ] bi
+    [ +operator+ value-labels dark-green add-gadget-color ]
+    [ +voice+ value-labels blue add-gadget-color ]
+    [ +normal+ value-labels black add-gadget-color ] tri drop ;
+
+M: participant-changed handle-inbox
+    drop update-participants ;
+
+TUPLE: irc-server-tab < irc-tab ;
+
+: <irc-server-tab> ( chat -- irc-tab )
+    f irc-server-tab new-irc-tab ;
+
+: <irc-nick-tab> ( chat ui-window -- irc-tab )
+    irc-tab new-irc-tab ;
+
+M: irc-tab pref-dim*
+    drop { 480 480 } ;
+
+: join-channel ( name ui-window -- )
+    [ dup <irc-channel-chat> ] dip
+    [ <irc-channel-tab> swap ] keep
+    add-page ;
+
+: query-nick ( nick ui-window -- )
+    [ dup <irc-nick-chat> ] dip
+    [ <irc-nick-tab> swap ] keep
+    add-page ;
+
+: irc-window ( ui-window -- )
+    [ ]
+    [ client>> profile>> server>> ] bi
+    open-window ;
+
+: ui-connect ( profile -- ui-window )
+    <irc-client>
+    { [ [ <irc-server-chat> ] dip attach-chat ]
+      [ chats>> +server-chat+ swap at <irc-server-tab> dup
+        "Server" associate ui-window new-tabbed [ swap window<< ] keep ]
+      [ >>client ]
+      [ connect-irc ] } cleave ;
+
+: server-open ( server port nick password channels -- )
+    [ <irc-profile> ui-connect [ irc-window ] keep ] dip
+    [ over join-channel ] each drop ;
+
+: main-run ( -- ) run-ircui ;
+
+MAIN: main-run
+
+"irc.ui.commands" require