~singpolyma/haskell-gnutls

4edd87d2079544e5f5eb963a3190f5f2f543a091 — John Millikin 9 years ago 90aa9e3
Remove references to gnutls_certificate_type_set_priority.

This function was deprecated at some point in the distant past, and has
now been removed from gnutls upstream. There is no good replacement, and
no current users of the Haskell wrapper, so the easiest solution is to
remove setPriority from the binding.
2 files changed, 0 insertions(+), 26 deletions(-)

M lib/Network/Protocol/TLS/GNU.hs
M lib/Network/Protocol/TLS/GNU/Foreign.hs
M lib/Network/Protocol/TLS/GNU.hs => lib/Network/Protocol/TLS/GNU.hs +0 -23
@@ 36,10 36,6 @@ module Network.Protocol.TLS.GNU
	, Credentials
	, setCredentials
	, certificateCredentials
	
	, Prioritised
	, setPriority
	, CertificateType (..)
	) where

import           Control.Applicative (Applicative, pure, (<*>))


@@ 243,25 239,6 @@ certificateCredentials = do
	fp <- liftIO $ F.newForeignPtr F.gnutls_certificate_free_credentials_funptr ptr
	return $ Credentials (F.CredentialsType 1) fp

class Prioritised a where
	priorityInt :: a -> F.CInt
	priorityProc :: a -> F.Session -> F.Ptr F.CInt -> IO F.ReturnCode

data CertificateType = X509 | OpenPGP
	deriving (Show)

instance Prioritised CertificateType where
	priorityProc = const F.gnutls_certificate_type_set_priority
	priorityInt x = case x of
		X509 -> 1
		OpenPGP -> 2

setPriority :: Prioritised a => [a] -> TLS ()
setPriority xs = do
	let fake = head $ [undefined] ++ xs
	rc <- withSession $ F.withArray0 0 (map priorityInt xs) . priorityProc fake
	checkRC rc

withSession :: (F.Session -> IO a) -> TLS a
withSession io = do
	s <- getSession

M lib/Network/Protocol/TLS/GNU/Foreign.hs => lib/Network/Protocol/TLS/GNU/Foreign.hs +0 -3
@@ 195,9 195,6 @@ foreign import ccall safe "gnutls_certificate_type_get"
foreign import ccall safe "gnutls_certificate_type_list"
	gnutls_certificate_type_list :: IO (Ptr CertificateType)

foreign import ccall safe "gnutls_certificate_type_set_priority"
	gnutls_certificate_type_set_priority :: Session -> Ptr CInt -> IO ReturnCode

-- }}}

-- Credentials {{{