glirc-2.35: Console IRC client

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

Client.CApi

Contents

Description

Foreign interface to the IRC client via a simple C API and dynamically loaded modules.

Synopsis

Extension type

data ActiveExtension Source #

Information about a loaded extension including the handle to the loaded shared object, and state value returned by the startup callback, and the loaded extension record.

Constructors

ActiveExtension 

Fields

Extension callbacks

extensionSymbol :: String Source #

The symbol that is loaded from an extension object.

Extensions are expected to export:

struct galua_extension extension;

openExtension Source #

Arguments

:: ExtensionConfiguration

extension configuration

-> IO ActiveExtension 

Load the extension from the given path and call the start callback. The result of the start callback is saved to be passed to any subsequent calls into the extension.

startExtension Source #

Arguments

:: Ptr ()

client stable pointer

-> ExtensionConfiguration

extension configuration

-> ActiveExtension

active extension

-> IO (Ptr ())

extension state

deactivateExtension :: ActiveExtension -> IO () Source #

Call the stop callback of the extension if it is defined and unload the shared object.

notifyExtension Source #

Arguments

:: ActiveExtension

extension

-> Ptr FgnMsg

serialized IRC message

-> IO Bool

allow message

Call all of the process message callbacks in the list of extensions. This operation marshals the IRC message once and shares that across all of the callbacks.

Returns True to pass message to client. Returns 'False to drop message.

commandExtension Source #

Arguments

:: Text

command

-> ActiveExtension

extension to command

-> IO () 

Notify an extension of a client command with the given parameters.

chatExtension Source #

Arguments

:: ActiveExtension

extension

-> Ptr FgnChat

serialized chat message

-> IO Bool

allow message

Call all of the process chat callbacks in the list of extensions. This operation marshals the IRC message once and shares that across all of the callbacks.

Returns True to pass message to client. Returns 'False to drop message.

popTimer Source #

Arguments

:: ActiveExtension

extension

-> Maybe (UTCTime, TimerId, FunPtr TimerCallback, Ptr (), ActiveExtension)

earlier time, callback, callback state, updated extension

Find the earliest timer ready to run if any are available.

pushTimer Source #

Arguments

:: UTCTime

activation time

-> FunPtr TimerCallback

callback function

-> Ptr ()

callback state

-> ActiveExtension

extension

-> (Int, ActiveExtension) 

Schedue a new timer event for the given extension.

cancelTimer Source #

Arguments

:: Int

timer ID

-> ActiveExtension

extension

-> Maybe (Ptr (), ActiveExtension) 

Remove a timer from the schedule by ID

evalNestedIO :: NestedIO a -> IO a Source #

Return the bracket IO action.

withChat Source #

Arguments

:: Text

network

-> Text

target

-> Text

message

-> NestedIO (Ptr FgnChat) 

withRawIrcMsg Source #

Arguments

:: Text

network

-> RawIrcMsg

message

-> NestedIO (Ptr FgnMsg) 

Marshal a RawIrcMsg into a FgnMsg which will be valid for the remainder of the computation.