packages feed

phone-push 0.1.1 → 0.1.2

raw patch · 2 files changed

+14/−7 lines, 2 files

Files

phone-push.cabal view
@@ -1,5 +1,5 @@ name:             phone-push-version:          0.1.1+version:          0.1.2 copyright:        (c) 2013 David Fendrich license:          BSD3 license-file:     LICENSE
src/IOS.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} -module IOS (pushMess) where+module IOS (pushMessLive, pushMessTest) where  import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL@@ -19,12 +19,19 @@    {- show link to source--Sandbox choice -}   -pushMess :: FilePath -> FilePath -> BL.ByteString -> [B.ByteString] -> IO ()  -pushMess keyfile certfile payload tokens = withOpenSSL $ do+pushMessLive :: FilePath -> FilePath -> BL.ByteString -> [B.ByteString] -> IO ()+pushMessLive =+  pushMess "gateway.push.apple.com"+  +pushMessTest :: FilePath -> FilePath -> BL.ByteString -> [B.ByteString] -> IO ()+pushMessTest =+  pushMess "gateway.sandbox.push.apple.com"++  +pushMess :: String -> FilePath -> FilePath -> BL.ByteString -> [B.ByteString] -> IO ()  +pushMess server keyfile certfile payload tokens = withOpenSSL $ do   -- Prepare SSL context   ssl <- context   contextSetPrivateKeyFile ssl keyfile@@ -34,7 +41,7 @@    -- Open socket   proto <- (getProtocolNumber "tcp")-  he <- getHostByName "gateway.push.apple.com"+  he <- getHostByName server   sock <- socket AF_INET Stream proto   Network.Socket.connect sock (SockAddrInet 2195 (hostAddress he))