{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Soup.Structs.ClientContext
(
ClientContext(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveClientContextMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ClientContextGetAddressMethodInfo ,
#endif
clientContextGetAddress ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetAuthDomainMethodInfo ,
#endif
clientContextGetAuthDomain ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetAuthUserMethodInfo ,
#endif
clientContextGetAuthUser ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetGsocketMethodInfo ,
#endif
clientContextGetGsocket ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetHostMethodInfo ,
#endif
clientContextGetHost ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetLocalAddressMethodInfo ,
#endif
clientContextGetLocalAddress ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetRemoteAddressMethodInfo ,
#endif
clientContextGetRemoteAddress ,
#if defined(ENABLE_OVERLOADING)
ClientContextGetSocketMethodInfo ,
#endif
clientContextGetSocket ,
#if defined(ENABLE_OVERLOADING)
ClientContextStealConnectionMethodInfo ,
#endif
clientContextStealConnection ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import qualified GI.Gio.Objects.Socket as Gio.Socket
import qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import {-# SOURCE #-} qualified GI.Soup.Objects.Address as Soup.Address
import {-# SOURCE #-} qualified GI.Soup.Objects.AuthDomain as Soup.AuthDomain
import {-# SOURCE #-} qualified GI.Soup.Objects.Socket as Soup.Socket
newtype ClientContext = ClientContext (SP.ManagedPtr ClientContext)
deriving (ClientContext -> ClientContext -> Bool
(ClientContext -> ClientContext -> Bool)
-> (ClientContext -> ClientContext -> Bool) -> Eq ClientContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientContext -> ClientContext -> Bool
$c/= :: ClientContext -> ClientContext -> Bool
== :: ClientContext -> ClientContext -> Bool
$c== :: ClientContext -> ClientContext -> Bool
Eq)
instance SP.ManagedPtrNewtype ClientContext where
toManagedPtr :: ClientContext -> ManagedPtr ClientContext
toManagedPtr (ClientContext ManagedPtr ClientContext
p) = ManagedPtr ClientContext
p
foreign import ccall "soup_client_context_get_type" c_soup_client_context_get_type ::
IO GType
type instance O.ParentTypes ClientContext = '[]
instance O.HasParentTypes ClientContext
instance B.Types.TypedObject ClientContext where
glibType :: IO GType
glibType = IO GType
c_soup_client_context_get_type
instance B.Types.GBoxed ClientContext
instance B.GValue.IsGValue ClientContext where
toGValue :: ClientContext -> IO GValue
toGValue ClientContext
o = do
GType
gtype <- IO GType
c_soup_client_context_get_type
ClientContext -> (Ptr ClientContext -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ClientContext
o (GType
-> (GValue -> Ptr ClientContext -> IO ())
-> Ptr ClientContext
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr ClientContext -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO ClientContext
fromGValue GValue
gv = do
Ptr ClientContext
ptr <- GValue -> IO (Ptr ClientContext)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr ClientContext)
(ManagedPtr ClientContext -> ClientContext)
-> Ptr ClientContext -> IO ClientContext
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr ClientContext -> ClientContext
ClientContext Ptr ClientContext
ptr
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ClientContext
type instance O.AttributeList ClientContext = ClientContextAttributeList
type ClientContextAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "soup_client_context_get_address" soup_client_context_get_address ::
Ptr ClientContext ->
IO (Ptr Soup.Address.Address)
{-# DEPRECATED clientContextGetAddress ["Use 'GI.Soup.Structs.ClientContext.clientContextGetRemoteAddress', which returns","a t'GI.Gio.Objects.SocketAddress.SocketAddress'."] #-}
clientContextGetAddress ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe Soup.Address.Address)
clientContextGetAddress :: ClientContext -> m (Maybe Address)
clientContextGetAddress ClientContext
client = IO (Maybe Address) -> m (Maybe Address)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Address) -> m (Maybe Address))
-> IO (Maybe Address) -> m (Maybe Address)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr Address
result <- Ptr ClientContext -> IO (Ptr Address)
soup_client_context_get_address Ptr ClientContext
client'
Maybe Address
maybeResult <- Ptr Address -> (Ptr Address -> IO Address) -> IO (Maybe Address)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Address
result ((Ptr Address -> IO Address) -> IO (Maybe Address))
-> (Ptr Address -> IO Address) -> IO (Maybe Address)
forall a b. (a -> b) -> a -> b
$ \Ptr Address
result' -> do
Address
result'' <- ((ManagedPtr Address -> Address) -> Ptr Address -> IO Address
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Address -> Address
Soup.Address.Address) Ptr Address
result'
Address -> IO Address
forall (m :: * -> *) a. Monad m => a -> m a
return Address
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe Address -> IO (Maybe Address)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Address
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetAddressMethodInfo
instance (signature ~ (m (Maybe Soup.Address.Address)), MonadIO m) => O.MethodInfo ClientContextGetAddressMethodInfo ClientContext signature where
overloadedMethod = clientContextGetAddress
#endif
foreign import ccall "soup_client_context_get_auth_domain" soup_client_context_get_auth_domain ::
Ptr ClientContext ->
IO (Ptr Soup.AuthDomain.AuthDomain)
clientContextGetAuthDomain ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe Soup.AuthDomain.AuthDomain)
clientContextGetAuthDomain :: ClientContext -> m (Maybe AuthDomain)
clientContextGetAuthDomain ClientContext
client = IO (Maybe AuthDomain) -> m (Maybe AuthDomain)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe AuthDomain) -> m (Maybe AuthDomain))
-> IO (Maybe AuthDomain) -> m (Maybe AuthDomain)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr AuthDomain
result <- Ptr ClientContext -> IO (Ptr AuthDomain)
soup_client_context_get_auth_domain Ptr ClientContext
client'
Maybe AuthDomain
maybeResult <- Ptr AuthDomain
-> (Ptr AuthDomain -> IO AuthDomain) -> IO (Maybe AuthDomain)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr AuthDomain
result ((Ptr AuthDomain -> IO AuthDomain) -> IO (Maybe AuthDomain))
-> (Ptr AuthDomain -> IO AuthDomain) -> IO (Maybe AuthDomain)
forall a b. (a -> b) -> a -> b
$ \Ptr AuthDomain
result' -> do
AuthDomain
result'' <- ((ManagedPtr AuthDomain -> AuthDomain)
-> Ptr AuthDomain -> IO AuthDomain
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AuthDomain -> AuthDomain
Soup.AuthDomain.AuthDomain) Ptr AuthDomain
result'
AuthDomain -> IO AuthDomain
forall (m :: * -> *) a. Monad m => a -> m a
return AuthDomain
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe AuthDomain -> IO (Maybe AuthDomain)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe AuthDomain
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetAuthDomainMethodInfo
instance (signature ~ (m (Maybe Soup.AuthDomain.AuthDomain)), MonadIO m) => O.MethodInfo ClientContextGetAuthDomainMethodInfo ClientContext signature where
overloadedMethod = clientContextGetAuthDomain
#endif
foreign import ccall "soup_client_context_get_auth_user" soup_client_context_get_auth_user ::
Ptr ClientContext ->
IO CString
clientContextGetAuthUser ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe T.Text)
clientContextGetAuthUser :: ClientContext -> m (Maybe Text)
clientContextGetAuthUser ClientContext
client = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
CString
result <- Ptr ClientContext -> IO CString
soup_client_context_get_auth_user Ptr ClientContext
client'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetAuthUserMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.MethodInfo ClientContextGetAuthUserMethodInfo ClientContext signature where
overloadedMethod = clientContextGetAuthUser
#endif
foreign import ccall "soup_client_context_get_gsocket" soup_client_context_get_gsocket ::
Ptr ClientContext ->
IO (Ptr Gio.Socket.Socket)
clientContextGetGsocket ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe Gio.Socket.Socket)
clientContextGetGsocket :: ClientContext -> m (Maybe Socket)
clientContextGetGsocket ClientContext
client = IO (Maybe Socket) -> m (Maybe Socket)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Socket) -> m (Maybe Socket))
-> IO (Maybe Socket) -> m (Maybe Socket)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr Socket
result <- Ptr ClientContext -> IO (Ptr Socket)
soup_client_context_get_gsocket Ptr ClientContext
client'
Maybe Socket
maybeResult <- Ptr Socket -> (Ptr Socket -> IO Socket) -> IO (Maybe Socket)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Socket
result ((Ptr Socket -> IO Socket) -> IO (Maybe Socket))
-> (Ptr Socket -> IO Socket) -> IO (Maybe Socket)
forall a b. (a -> b) -> a -> b
$ \Ptr Socket
result' -> do
Socket
result'' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Socket -> Socket
Gio.Socket.Socket) Ptr Socket
result'
Socket -> IO Socket
forall (m :: * -> *) a. Monad m => a -> m a
return Socket
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe Socket -> IO (Maybe Socket)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Socket
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetGsocketMethodInfo
instance (signature ~ (m (Maybe Gio.Socket.Socket)), MonadIO m) => O.MethodInfo ClientContextGetGsocketMethodInfo ClientContext signature where
overloadedMethod = clientContextGetGsocket
#endif
foreign import ccall "soup_client_context_get_host" soup_client_context_get_host ::
Ptr ClientContext ->
IO CString
clientContextGetHost ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe T.Text)
clientContextGetHost :: ClientContext -> m (Maybe Text)
clientContextGetHost ClientContext
client = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
CString
result <- Ptr ClientContext -> IO CString
soup_client_context_get_host Ptr ClientContext
client'
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetHostMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.MethodInfo ClientContextGetHostMethodInfo ClientContext signature where
overloadedMethod = clientContextGetHost
#endif
foreign import ccall "soup_client_context_get_local_address" soup_client_context_get_local_address ::
Ptr ClientContext ->
IO (Ptr Gio.SocketAddress.SocketAddress)
clientContextGetLocalAddress ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe Gio.SocketAddress.SocketAddress)
clientContextGetLocalAddress :: ClientContext -> m (Maybe SocketAddress)
clientContextGetLocalAddress ClientContext
client = IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe SocketAddress) -> m (Maybe SocketAddress))
-> IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr SocketAddress
result <- Ptr ClientContext -> IO (Ptr SocketAddress)
soup_client_context_get_local_address Ptr ClientContext
client'
Maybe SocketAddress
maybeResult <- Ptr SocketAddress
-> (Ptr SocketAddress -> IO SocketAddress)
-> IO (Maybe SocketAddress)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr SocketAddress
result ((Ptr SocketAddress -> IO SocketAddress)
-> IO (Maybe SocketAddress))
-> (Ptr SocketAddress -> IO SocketAddress)
-> IO (Maybe SocketAddress)
forall a b. (a -> b) -> a -> b
$ \Ptr SocketAddress
result' -> do
SocketAddress
result'' <- ((ManagedPtr SocketAddress -> SocketAddress)
-> Ptr SocketAddress -> IO SocketAddress
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress) Ptr SocketAddress
result'
SocketAddress -> IO SocketAddress
forall (m :: * -> *) a. Monad m => a -> m a
return SocketAddress
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe SocketAddress -> IO (Maybe SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SocketAddress
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetLocalAddressMethodInfo
instance (signature ~ (m (Maybe Gio.SocketAddress.SocketAddress)), MonadIO m) => O.MethodInfo ClientContextGetLocalAddressMethodInfo ClientContext signature where
overloadedMethod = clientContextGetLocalAddress
#endif
foreign import ccall "soup_client_context_get_remote_address" soup_client_context_get_remote_address ::
Ptr ClientContext ->
IO (Ptr Gio.SocketAddress.SocketAddress)
clientContextGetRemoteAddress ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m (Maybe Gio.SocketAddress.SocketAddress)
clientContextGetRemoteAddress :: ClientContext -> m (Maybe SocketAddress)
clientContextGetRemoteAddress ClientContext
client = IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe SocketAddress) -> m (Maybe SocketAddress))
-> IO (Maybe SocketAddress) -> m (Maybe SocketAddress)
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr SocketAddress
result <- Ptr ClientContext -> IO (Ptr SocketAddress)
soup_client_context_get_remote_address Ptr ClientContext
client'
Maybe SocketAddress
maybeResult <- Ptr SocketAddress
-> (Ptr SocketAddress -> IO SocketAddress)
-> IO (Maybe SocketAddress)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr SocketAddress
result ((Ptr SocketAddress -> IO SocketAddress)
-> IO (Maybe SocketAddress))
-> (Ptr SocketAddress -> IO SocketAddress)
-> IO (Maybe SocketAddress)
forall a b. (a -> b) -> a -> b
$ \Ptr SocketAddress
result' -> do
SocketAddress
result'' <- ((ManagedPtr SocketAddress -> SocketAddress)
-> Ptr SocketAddress -> IO SocketAddress
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr SocketAddress -> SocketAddress
Gio.SocketAddress.SocketAddress) Ptr SocketAddress
result'
SocketAddress -> IO SocketAddress
forall (m :: * -> *) a. Monad m => a -> m a
return SocketAddress
result''
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Maybe SocketAddress -> IO (Maybe SocketAddress)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SocketAddress
maybeResult
#if defined(ENABLE_OVERLOADING)
data ClientContextGetRemoteAddressMethodInfo
instance (signature ~ (m (Maybe Gio.SocketAddress.SocketAddress)), MonadIO m) => O.MethodInfo ClientContextGetRemoteAddressMethodInfo ClientContext signature where
overloadedMethod = clientContextGetRemoteAddress
#endif
foreign import ccall "soup_client_context_get_socket" soup_client_context_get_socket ::
Ptr ClientContext ->
IO (Ptr Soup.Socket.Socket)
{-# DEPRECATED clientContextGetSocket ["use 'GI.Soup.Structs.ClientContext.clientContextGetGsocket', which returns","a t'GI.Gio.Objects.Socket.Socket'."] #-}
clientContextGetSocket ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m Soup.Socket.Socket
clientContextGetSocket :: ClientContext -> m Socket
clientContextGetSocket ClientContext
client = IO Socket -> m Socket
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Socket -> m Socket) -> IO Socket -> m Socket
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr Socket
result <- Ptr ClientContext -> IO (Ptr Socket)
soup_client_context_get_socket Ptr ClientContext
client'
Text -> Ptr Socket -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"clientContextGetSocket" Ptr Socket
result
Socket
result' <- ((ManagedPtr Socket -> Socket) -> Ptr Socket -> IO Socket
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Socket -> Socket
Soup.Socket.Socket) Ptr Socket
result
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
Socket -> IO Socket
forall (m :: * -> *) a. Monad m => a -> m a
return Socket
result'
#if defined(ENABLE_OVERLOADING)
data ClientContextGetSocketMethodInfo
instance (signature ~ (m Soup.Socket.Socket), MonadIO m) => O.MethodInfo ClientContextGetSocketMethodInfo ClientContext signature where
overloadedMethod = clientContextGetSocket
#endif
foreign import ccall "soup_client_context_steal_connection" soup_client_context_steal_connection ::
Ptr ClientContext ->
IO (Ptr Gio.IOStream.IOStream)
clientContextStealConnection ::
(B.CallStack.HasCallStack, MonadIO m) =>
ClientContext
-> m Gio.IOStream.IOStream
clientContextStealConnection :: ClientContext -> m IOStream
clientContextStealConnection ClientContext
client = IO IOStream -> m IOStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOStream -> m IOStream) -> IO IOStream -> m IOStream
forall a b. (a -> b) -> a -> b
$ do
Ptr ClientContext
client' <- ClientContext -> IO (Ptr ClientContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ClientContext
client
Ptr IOStream
result <- Ptr ClientContext -> IO (Ptr IOStream)
soup_client_context_steal_connection Ptr ClientContext
client'
Text -> Ptr IOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"clientContextStealConnection" Ptr IOStream
result
IOStream
result' <- ((ManagedPtr IOStream -> IOStream) -> Ptr IOStream -> IO IOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr IOStream -> IOStream
Gio.IOStream.IOStream) Ptr IOStream
result
ClientContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr ClientContext
client
IOStream -> IO IOStream
forall (m :: * -> *) a. Monad m => a -> m a
return IOStream
result'
#if defined(ENABLE_OVERLOADING)
data ClientContextStealConnectionMethodInfo
instance (signature ~ (m Gio.IOStream.IOStream), MonadIO m) => O.MethodInfo ClientContextStealConnectionMethodInfo ClientContext signature where
overloadedMethod = clientContextStealConnection
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveClientContextMethod (t :: Symbol) (o :: *) :: * where
ResolveClientContextMethod "stealConnection" o = ClientContextStealConnectionMethodInfo
ResolveClientContextMethod "getAddress" o = ClientContextGetAddressMethodInfo
ResolveClientContextMethod "getAuthDomain" o = ClientContextGetAuthDomainMethodInfo
ResolveClientContextMethod "getAuthUser" o = ClientContextGetAuthUserMethodInfo
ResolveClientContextMethod "getGsocket" o = ClientContextGetGsocketMethodInfo
ResolveClientContextMethod "getHost" o = ClientContextGetHostMethodInfo
ResolveClientContextMethod "getLocalAddress" o = ClientContextGetLocalAddressMethodInfo
ResolveClientContextMethod "getRemoteAddress" o = ClientContextGetRemoteAddressMethodInfo
ResolveClientContextMethod "getSocket" o = ClientContextGetSocketMethodInfo
ResolveClientContextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveClientContextMethod t ClientContext, O.MethodInfo info ClientContext p) => OL.IsLabel t (ClientContext -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif