 : get-gif ( selector -- image )
     get-binary "gif" (image-class) load-image* ;
 
-: get-text ( selector query/f -- lines )
-    [ "\t" glue ] when* "\r\n" append
+: get-text ( selector -- lines )
+    "?" split1 [ "\t" glue ] when* "\r\n" append
     utf8 encode write flush
     input-stream get (stream-contents-by-block)
     utf8 decode string-lines
     "." over index [ head ] when* ;
 
 TUPLE: gopher-link type name selector host port ;
+
+M: gopher-link summary >url present ;
 
 : <gopher-link> ( item -- gopher-link )
     [ "" ] [

    ] if >url ;

: get-menu ( selector -- lines )
    f get-text [ <gopher-link> ] map ;

: get-selector ( selector -- stuff )
    "/" split1 "" or swap
    dup length 1 > [ string>number ] [ first ] if
    {
        { A_TEXT [ f get-text ] }
        { A_MENU [ get-menu ] }
        { A_INDEX [ get-menu ] }
        { A_GIF [ get-gif ] }

formatting fry images images.loader images.loader.private
images.viewer io io.encodings.binary io.encodings.string
io.encodings.utf8 io.sockets io.styles kernel make math
math.parser namespaces present prettyprint sequences splitting
summary urls vocabs ;

IN: gopher

