40 check Nothing = (B.empty, B.empty, Nothing) |
40 check Nothing = (B.empty, B.empty, Nothing) |
41 check (Just msgs) = let (a, b) = (filter isLegal msgs, filter isNonEmpty a) in (encode a, encode b, lft a) |
41 check (Just msgs) = let (a, b) = (filter isLegal msgs, filter isNonEmpty a) in (encode a, encode b, lft a) |
42 encode = B.pack . Base64.encode . BW.unpack . B.concat |
42 encode = B.pack . Base64.encode . BW.unpack . B.concat |
43 isLegal m = (B.length m > 1) && (flip Set.member legalMessages . B.head . B.tail $ m) |
43 isLegal m = (B.length m > 1) && (flip Set.member legalMessages . B.head . B.tail $ m) |
44 lft = foldr l Nothing |
44 lft = foldr l Nothing |
45 l m n = let m' = B.head $ B.tail m; tst = flip Set.member in |
45 l m n = let m' = B.head $ B.tail m; tst = flip Set.member in |
46 if not $ tst timedMessages m' then n |
46 if not $ tst timedMessages m' then n |
47 else if '+' /= m' then Just Nothing else Just . Just . B.pack . Base64.encode . BW.unpack $ m |
47 else if '+' /= m' then Just Nothing else Just . Just . B.pack . Base64.encode . BW.unpack $ m |
48 isNonEmpty = (/=) '+' . B.head . B.tail |
48 isNonEmpty = (/=) '+' . B.head . B.tail |
49 legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sNpPwtghbc12345" ++ slotMessages |
49 legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sNpPwtghbc12345" ++ slotMessages |
50 slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" |
50 slotMessages = "\128\129\130\131\132\133\134\135\136\137\138" |