module Network.XMMS.Config(
registerValue,
setValue,
getValue,
listValues,
broadcastValueChanged
)where
import Foreign
import Foreign.Ptr
import Foreign.C.Types
import Network.XMMS.UTF8Strings
import Foreign.ForeignPtr
import Foreign.Marshal.Alloc
import Network.XMMS.Utilities
import Network.XMMS.Constants
import Network.XMMS.Types
foreign import ccall unsafe "xmmsclient/xmmsclient.h xmmsc_config_register_value"
xmmsc_config_register_value :: Ptr C_xmmsc_connection -> CString -> CString -> IO (Ptr C_xmmsc_result)
registerValue :: Connection -> String -> String -> IO Result
registerValue connection key value = do
c_key <- newCString key
c_value <- newCString value
res <- wrapCallResult (\c -> xmmsc_config_register_value c c_key c_value) connection
free c_key
free c_value
return res
foreign import ccall unsafe "xmmsclient/xmmsclient.h xmmsc_config_set_value"
xmmsc_config_set_value :: Ptr C_xmmsc_connection -> CString -> CString -> IO (Ptr C_xmmsc_result)
setValue :: Connection -> String -> String -> IO Result
setValue connection key value = do
c_key <- newCString key
c_value <- newCString value
res <- wrapCallResult (\c -> xmmsc_config_set_value c c_key c_value) connection
free c_key
free c_value
return res
foreign import ccall unsafe "xmmsclient/xmmsclient.h xmmsc_config_get_value"
xmmsc_config_get_value :: Ptr C_xmmsc_connection -> CString -> IO (Ptr C_xmmsc_result)
getValue :: Connection -> String -> IO Result
getValue connection key = do
c_key <- newCString key
res <- wrapCallResult (\c -> xmmsc_config_get_value c c_key) connection
free c_key
return res
foreign import ccall unsafe "xmmsclient/xmmsclient.h xmmsc_config_list_values"
xmmsc_config_list_values :: Ptr C_xmmsc_connection -> IO (Ptr C_xmmsc_result)
listValues :: Connection -> IO Result
listValues = wrapCallResult xmmsc_config_list_values
foreign import ccall unsafe "xmmsclient/xmmsclient.h xmmsc_broadcast_config_value_changed"
xmmsc_broadcast_config_value_changed :: Ptr C_xmmsc_connection -> IO (Ptr C_xmmsc_result)
broadcastValueChanged :: Connection -> IO Result
broadcastValueChanged = wrapCallResult xmmsc_broadcast_config_value_changed