Copyright | (c) Eric Mertens 2016 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
This module exports the C functions that extensions can used to query the state of the client.
C Extensions can include glirc-api.h
Synopsis
- type Glirc_send_message = Ptr () -> Ptr FgnMsg -> IO CInt
- glirc_send_message :: Glirc_send_message
- type Glirc_print = Ptr () -> MessageCode -> CString -> CSize -> IO CInt
- glirc_print :: Glirc_print
- type Glirc_list_networks = Ptr () -> IO (Ptr CString)
- glirc_list_networks :: Glirc_list_networks
- type Glirc_list_channels = Ptr () -> CString -> CSize -> IO (Ptr CString)
- glirc_list_channels :: Glirc_list_channels
- type Glirc_list_channel_users = Ptr () -> CString -> CSize -> CString -> CSize -> IO (Ptr CString)
- glirc_list_channel_users :: Glirc_list_channel_users
- type Glirc_my_nick = Ptr () -> CString -> CSize -> IO CString
- glirc_my_nick :: Glirc_my_nick
- type Glirc_user_account = Ptr () -> CString -> CSize -> CString -> CSize -> IO CString
- glirc_user_account :: Glirc_user_account
- type Glirc_user_channel_modes = Ptr () -> CString -> CSize -> CString -> CSize -> CString -> CSize -> IO CString
- glirc_user_channel_modes :: Glirc_user_channel_modes
- type Glirc_channel_modes = Ptr () -> CString -> CSize -> CString -> CSize -> IO (Ptr CString)
- glirc_channel_modes :: Glirc_channel_modes
- type Glirc_channel_masks = Ptr () -> CString -> CSize -> CString -> CSize -> CChar -> IO (Ptr CString)
- glirc_channel_masks :: Glirc_channel_masks
- type Glirc_identifier_cmp = CString -> CSize -> CString -> CSize -> IO CInt
- glirc_identifier_cmp :: Glirc_identifier_cmp
- type Glirc_is_channel = Ptr () -> CString -> CSize -> CString -> CSize -> IO CInt
- glirc_is_channel :: Glirc_is_channel
- type Glirc_is_logged_on = Ptr () -> CString -> CSize -> CString -> CSize -> IO CInt
- glirc_is_logged_on :: Glirc_is_logged_on
- type Glirc_mark_seen = Ptr () -> CString -> CSize -> CString -> CSize -> IO ()
- glirc_mark_seen :: Glirc_mark_seen
- type Glirc_clear_window = Ptr () -> CString -> CSize -> CString -> CSize -> IO ()
- glirc_clear_window :: Glirc_clear_window
- type Glirc_current_focus = Ptr () -> Ptr CString -> Ptr CSize -> Ptr CString -> Ptr CSize -> IO ()
- glirc_current_focus :: Glirc_current_focus
- type Glirc_set_focus = Ptr () -> CString -> CSize -> CString -> CSize -> IO ()
- glirc_set_focus :: Glirc_set_focus
- type Glirc_free_string = CString -> IO ()
- glirc_free_string :: Glirc_free_string
- type Glirc_free_strings = Ptr CString -> IO ()
- glirc_free_strings :: Glirc_free_strings
- type Glirc_inject_chat = Ptr () -> CString -> CSize -> CString -> CSize -> CString -> CSize -> CString -> CSize -> IO CInt
- glirc_inject_chat :: Glirc_inject_chat
- type Glirc_resolve_path = Ptr () -> CString -> CSize -> IO CString
- glirc_resolve_path :: Glirc_resolve_path
- type Glirc_set_timer = Ptr () -> CULong -> FunPtr TimerCallback -> Ptr () -> IO TimerId
- glirc_set_timer :: Glirc_set_timer
- type Glirc_cancel_timer = Ptr () -> TimerId -> IO (Ptr ())
- glirc_cancel_timer :: Glirc_cancel_timer
Extension entry-points
type Glirc_send_message Source #
Type of glirc_send_message
extension entry-point
glirc_send_message :: Glirc_send_message Source #
Entry-point into the client when an extern extension wants send an IRC command to a connected server.
type Glirc_print Source #
= Ptr () | api token |
-> MessageCode | enum message_code |
-> CString | message |
-> CSize | message length |
-> IO CInt | 0 on success |
Type of glirc_print
extension entry-point
glirc_print :: Glirc_print Source #
Entry-point for extensions to append a message to the client buffer.
The message_code
can be used to render the message normally or to
cause the client to draw attention to the message as an error.
type Glirc_list_networks Source #
Type of glirc_list_networks
extension entry-point
glirc_list_networks :: Glirc_list_networks Source #
This extension entry-point allocates a list of all the identifiers for
the active networks on the client. NULL
returned on failure.
The caller is responsible for freeing successful result with
glirc_free_strings
.
type Glirc_list_channels Source #
= Ptr () | api token |
-> CString | network |
-> CSize | network len |
-> IO (Ptr CString) | null terminated array of null terminated strings |
Type of glirc_list_channels
extension entry-point
glirc_list_channels :: Glirc_list_channels Source #
Generate a list of connected channels for the network identified in
the arguments. NULL
returned on failure. Caller is responsible for
freeing successful result with glirc_free_strings
.
type Glirc_list_channel_users Source #
= Ptr () | api token |
-> CString | network |
-> CSize | network len |
-> CString | channel |
-> CSize | channel len |
-> IO (Ptr CString) | null terminated array of null terminated strings |
Type of glirc_list_channel_users
extension entry-point
glirc_list_channel_users :: Glirc_list_channel_users Source #
Generate a list of IRC nicknames currently connected to the identified
channel on the identified network. NULL
returned on failure.
Caller is responsible for freeing successful result with
glirc_free_strings
.
type Glirc_my_nick Source #
Type of glirc_my_nick
extension entry-point
glirc_my_nick :: Glirc_my_nick Source #
Return the IRC nickname associated with the active network
connection identified in the arguments. NULL
returned on failure.
Caller is responsible for freeing successful result with
glirc_free_string
.
type Glirc_user_account Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network name length |
-> CString | nickname |
-> CSize | nickname length |
-> IO CString |
Type of glirc_user_account
extension entry-point
glirc_user_account :: Glirc_user_account Source #
Return the services account name associated with a nickname on
a server as tracked by the client. Caller is responsible for freeing
successful result with glirc_free_string
. If no account is
known, NULL
is returned.
type Glirc_user_channel_modes Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network name length |
-> CString | channel |
-> CSize | channel length |
-> CString | nickname |
-> CSize | nickname length |
-> IO CString |
Type of glirc_user_account
extension entry-point
glirc_user_channel_modes :: Glirc_user_channel_modes Source #
Return the sigils associated with a nickname on a particular channel.
Caller is responsible for freeing successful result with
glirc_free_string
. If user is on channel without any sigils an empty
string is returned. If user is not on channel NULL
is returned.
type Glirc_channel_modes Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network name length |
-> CString | channel |
-> CSize | channel length |
-> IO (Ptr CString) |
Type of glirc_channel_modes
extension entry-point
glirc_channel_modes :: Glirc_channel_modes Source #
Return all of the modes of a given channel. The first
letter of each string returned is the mode. Any remaining
characters are the mode argument.
Caller is responsible for freeing successful result with
glirc_free_strings
. If the user is not on a channel NULL
is returned. The modes might not be known to the client for
a particular channel which can result in an empty list of
modes being returned.
type Glirc_channel_masks Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network name length |
-> CString | channel |
-> CSize | channel length |
-> CChar | mode |
-> IO (Ptr CString) |
Type of glirc_channel_masks
extension entry-point
glirc_channel_masks :: Glirc_channel_masks Source #
Return all of the modes of a given channel. The first
letter of each string returned is the mode. Any remaining
characters are the mode argument.
Caller is responsible for freeing successful result with
glirc_free_strings
. If the user is not on a channel NULL
is returned. The modes might not be known to the client for
a particular channel which can result in an empty list of
modes being returned.
type Glirc_identifier_cmp Source #
= CString | identifier 1 |
-> CSize | identifier 1 len |
-> CString | identifier 2 |
-> CSize | identifier 2 len |
-> IO CInt |
Type of glirc_identifier_cmp
extension entry-point
glirc_identifier_cmp :: Glirc_identifier_cmp Source #
Case insensitive comparison suitable for use on channels and nicknames. Returns -1 if the first identifier is less than the second Returns 0 if the first identifier is equal to the second Returns 1 if the first identifier is greater than the second
type Glirc_is_channel Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network length |
-> CString | target name |
-> CSize | target length |
-> IO CInt | boolean |
Type of glirc_is_channel
extension entry-point
glirc_is_channel :: Glirc_is_channel Source #
Returns 1
when the given target on the given network is a channel
name, otherwise returns 0
.
If the given network is not currently active this returns 0
.
type Glirc_is_logged_on Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network length |
-> CString | target name |
-> CSize | target length |
-> IO CInt | boolean |
Type of glirc_is_logged_on
extension entry-point
glirc_is_logged_on :: Glirc_is_logged_on Source #
Returns 1
when the given target on the given network shares a
channel with the user, 0
otherwise.
If the given network is not currently active this returns 0
.
type Glirc_mark_seen Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network name length |
-> CString | channel name |
-> CSize | channel name length |
-> IO () |
Type of glirc_mark_seen
extension entry-point
glirc_mark_seen :: Glirc_mark_seen Source #
Mark a window as being seen, clearing the new message counter. To specify the client window send an empty network name. To specify a network window send an empty channel name.
type Glirc_clear_window Source #
= Ptr () | api token |
-> CString | network name |
-> CSize | network name length |
-> CString | channel name |
-> CSize | channel name length |
-> IO () |
Type of glirc_clear_window
extension entry-point
glirc_clear_window :: Glirc_clear_window Source #
Clear contents of a specified window. To specify the client window send an empty network name. To specify a network window send an empty channel name.
type Glirc_current_focus Source #
= Ptr () | api token |
-> Ptr CString | OUT: newly allocated network string |
-> Ptr CSize | OUT: network length |
-> Ptr CString | OUT: newly allocated target string |
-> Ptr CSize | OUT: target length |
-> IO () |
Type of glirc_current_focus
extension entry-point
glirc_current_focus :: Glirc_current_focus Source #
Find the network and target identifier associated with the currently focused window.
Free the allocated strings with glirc_free_string
.
Strings set to NULL
if there is no current network or no
current target.
type Glirc_set_focus Source #
= Ptr () | api token |
-> CString | network |
-> CSize | network length |
-> CString | target |
-> CSize | target length |
-> IO () |
Type of glirc_set_focus
extension entry-point
glirc_set_focus :: Glirc_set_focus Source #
Assign window focus to a new value.
Set to client window if network is empty.
Set to network window if channel is empty.
Set to chat window otherwise.
type Glirc_free_string Source #
Type of glirc_free_string
extension entry-point
glirc_free_string :: Glirc_free_string Source #
Free one of the heap allocated strings found as a return value
from the extension API. If argument is NULL
, nothing happens.
type Glirc_free_strings Source #
Type of glirc_free_strings
extension entry-point
glirc_free_strings :: Glirc_free_strings Source #
Free an array of heap allocated strings found as a return value
from the extension API. If argument is NULL
, nothing happens.
type Glirc_inject_chat Source #
= Ptr () | api token |
-> CString | network |
-> CSize | network length |
-> CString | source |
-> CSize | source length |
-> CString | target |
-> CSize | target length |
-> CString | message |
-> CSize | message length |
-> IO CInt | 0 on success |
Type of glirc_inject_chat
extension entry-point.
glirc_inject_chat :: Glirc_inject_chat Source #
Add a message to a chat window as if it was received directly from the IRC server. This is useful when implementing extensions that intercept incoming chat messages and transform them before showing the user.
type Glirc_resolve_path Source #
Type of glirc_resolve_path
extension entry-point
glirc_resolve_path :: Glirc_resolve_path Source #
Resolve the given string to an absolute path. This expands ~
for
the home directory and computes paths relative to the configuration
file.
Free the allocated string with glirc_free_string
.
type Glirc_set_timer Source #
= Ptr () | api token |
-> CULong | milliseconds delay |
-> FunPtr TimerCallback | function |
-> Ptr () | callback state |
-> IO TimerId | timer ID |
Type of glirc_set_timer
extension entry-point
glirc_set_timer :: Glirc_set_timer Source #
Register a function to be called after a given number of milliseconds of delay. The returned timer ID can be used to cancel the timer.
type Glirc_cancel_timer Source #
Type of glirc_cancel_timer
extension entry-point
glirc_cancel_timer :: Glirc_cancel_timer Source #
Register a function to be called after a given number of milliseconds of delay. The returned timer ID can be used to cancel the timer.