From: Camil Staps Date: Tue, 12 Sep 2017 20:39:14 +0000 (+0200) Subject: Merge branch 'master' into no-results-response X-Git-Url: https://git.martlubbers.net/?p=cloogle-irc.git;a=commitdiff_plain;h=40ef767249534be26a97a2aa615c758e992545ee;hp=-c Merge branch 'master' into no-results-response --- 40ef767249534be26a97a2aa615c758e992545ee diff --combined cloogleirc.icl index c9a464e,3e89acc..22a2193 --- a/cloogleirc.icl +++ b/cloogleirc.icl @@@ -56,7 -56,7 +56,7 @@@ shorten s 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,7 -67,6 +67,7 @@@ # 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) @@@ -191,6 -190,7 +191,7 @@@ Start | 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