X-Git-Url: https://git.martlubbers.net/?p=cloogle-irc.git;a=blobdiff_plain;f=cloogleirc.icl;h=22a219319ae9d8441e9efa452ef2807c71a69ec6;hp=0fc25f9b2d06eab2460ddaef63d41c8abf024514;hb=40ef767249534be26a97a2aa615c758e992545ee;hpb=ad6f64c9f6b343f0e64eff1d3d7fa821cff203b0 diff --git a/cloogleirc.icl b/cloogleirc.icl index 0fc25f9..22a2193 100644 --- a/cloogleirc.icl +++ b/cloogleirc.icl @@ -56,7 +56,7 @@ shorten s w cloogle :: String *World -> (String, *World) cloogle data w -# (mer, w) = doHTTPRequestL +# (mer, w) = doHTTPRequestFollowRedirects { newHTTPRequest & req_path = "/api.php" , req_query = "?str=" + urlEncode data @@ -67,6 +67,7 @@ cloogle data w # resp = fromOk mer = case fromJSON $ fromString resp.HTTPResponse.rsp_data of Nothing = ("couldn't parse json", w) + Just {return=127} = ("No results for " + data, w) Just clr = ("Results for " + data + " -- https://cloogle.org/#" + replaceSubString "+" "%20" (urlEncode data) + "\n" + processResults clr, w) @@ -190,6 +191,7 @@ Start w | m.[0] == '!' # (msgs, w) = realProcess (split " " $ m % (1, size m)) w = (Just $ map reply msgs, w) + | m % (0,4) == "\001PING" = (Just [reply m], w) = (Just [], w) where reply = case (\(CSepList [t:_]) -> t.[0]) t of