summaryrefslogtreecommitdiffstats
path: root/Pancake.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Pancake.hs')
-rw-r--r--Pancake.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Pancake.hs b/Pancake.hs
index 5420530..45fef50 100644
--- a/Pancake.hs
+++ b/Pancake.hs
@@ -283,6 +283,16 @@ command (GoTo t (RNumber i)) = do
if length (rLinks $ rendered st) > i
then command (GoTo t $ RURI $ rLinks (rendered st) !! i)
else putErrLn "No such link"
+command (GopherSearch i q) = do
+ st <- get
+ if length (rLinks $ rendered st) > i
+ then
+ let refURIString = uriToString id (rLinks (rendered st) !! i) ""
+ searchString = refURIString ++ "%09" ++ escapeURIString isUnreserved q
+ in maybe (putErrLn "Failed to compose a valid search URI")
+ (command . GoTo Nothing . RURI)
+ (parseURI searchString)
+ else putErrLn "No such link"
command Back = do
st <- get
case history st of