glirc-2.33.1: Console IRC client

Copyright(c) Eric Mertens 2016
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Client.CApi.Types

Contents

Description

Marshaling types and functions for the C API

Synopsis

Extension record

data FgnExtension Source #

Information describing an extension's entry-points and metadata.

Constructors

FgnExtension 

Fields

type StartExtension Source #

Arguments

 = Ptr ()

api token

-> CString

path to extension

-> Ptr FgnStringLen

array of arguments

-> CSize

number of arguments

-> IO (Ptr ())

initialized extension state

typedef void *start(void *glirc, const char *path)

type StopExtension Source #

Arguments

 = Ptr ()

extension state

-> IO () 
typedef void stop(void *glirc, void *S)

type ProcessMessage Source #

Arguments

 = Ptr ()

extention state

-> Ptr FgnMsg

message to send

-> IO ProcessResult 
typedef enum process_result process_message(void *glirc, void *S, const struct glirc_message *)

type ProcessCommand Source #

Arguments

 = Ptr ()

extension state

-> Ptr FgnCmd

command

-> IO () 
typedef void process_command(void *glirc, void *S, const struct glirc_command *)

type ProcessChat Source #

Arguments

 = Ptr ()

extension state

-> Ptr FgnChat

chat info

-> IO ProcessResult 
typedef void process_chat(void *glirc, void *S, const struct glirc_chat *)

type TimerCallback Source #

Arguments

 = Ptr ()

timer state

-> TimerId

timer ID

-> IO () 

Callback function when timer triggers

type TimerId = Int64 Source #

Integer type of timer IDs

Strings

data FgnStringLen Source #

Pointer to UTF-8 encoded string and as string length. Strings are null-terminated. The null-terminator is not counted in the length.

Constructors

FgnStringLen !CString !CSize 

Messages

data FgnMsg Source #

struct glirc_message
Instances
Storable FgnMsg Source # 
Instance details

Defined in Client.CApi.Types

Commands

data FgnCmd Source #

Used to pass arguments from /extension EXT_NAME client command into an extension.

Constructors

FgnCmd 
Instances
Storable FgnCmd Source #
struct glirc_command
Instance details

Defined in Client.CApi.Types

Chat

data FgnChat Source #

Chat message data containing the source network, window target, and message body.

Instances
Storable FgnChat Source #
struct glirc_message
Instance details

Defined in Client.CApi.Types

Function pointer calling

type Dynamic a = FunPtr a -> a Source #

Type of dynamic function pointer wrappers. These convert C function-pointers into Haskell functions.

runTimerCallback :: Dynamic TimerCallback Source #

Dynamic import for timer callback

report message codes

newtype MessageCode Source #

Tag for describing the kind of message to display in the client as used in glirc_print. See normalMessage and errorMessage.

enum message_code;

Constructors

MessageCode Word32 
Instances
Eq MessageCode Source # 
Instance details

Defined in Client.CApi.Types

normalMessage :: MessageCode Source #

Normal client message. Unread counter increments, but no client bell or error status update.

errorMessage :: MessageCode Source #

Important client message. Unread counter increments, bell rings, and error status updates.

process message results

newtype ProcessResult Source #

Result used to determine what to do after processing a message with the ProcessMessage callback.

| enum process_result

Constructors

ProcessResult Word32 
Instances
Eq ProcessResult Source # 
Instance details

Defined in Client.CApi.Types

passMessage :: ProcessResult Source #

Allow the message to proceed through the client logic.

dropMessage :: ProcessResult Source #

Drop the message from further processing.

Marshaling helpers

withText0 :: Text -> (CStringLen -> IO a) -> IO a Source #

Marshal a text as a temporary null-terminated CStringLen

exportText :: Ptr CString -> Ptr CSize -> Text -> IO () Source #

Marshal a text as a malloced null-terminated CStringLen

poke' :: Storable a => Ptr a -> a -> IO () Source #

Like poke except it doesn't write to NULL