[][src]Crate hexchat

A safe API for creating HexChat plugins.

To get started, create a struct representing your plugin, and implement Plugin for it. Then, call plugin! on the struct.

All plugins should be built as cdylibs, or if for some reason you have no other choice, dylibs. Do not attempt to define a main() symbol; Plugin::new is your plugin's 'entry point'. For that matter, do not attempt to define the HexChat C docs' described extern fns - this is taken care of for you by the plugin! macro.

If window manipulation is desired, the window feature should be enabled.

Static variables holding heap resources are discouraged and will cause memory leaks. This crate provides a safe_static! macro for this purpose. Please note that any thread that you create that accesses a safe static must be killed in your plugin's Drop implementation, and it's undefined not to. You should kill them anyway even if you don't use this, because they'll be a memory leak too otherwise.

Modules

reply

Server responses for use with add_server_response_listener.

server_event

Server events for use with add_server_event_listener.

Macros

plugin

This macro will set up your plugin's actual callability from HexChat.

safe_static

A macro for creating SafeLazys and SafeUninits.

Structs

ChannelFlags

Various boolean flags about a ChannelInfo.

ChannelInfo

A full set of information about an IRC channel.

ChannelRef

A channel reference, for identification purposes only. Use into_info to request channel information.

Command

A handle to a registered command.

DccTransferInfo

A full set of information about a DCC transfer.

FakePlugin

A handle to a fake plugin entry in the plugin list.

IgnoreEntry

An entry in HexChat's ignore list.

IgnoreType

All the message types that can be present in an IgnoreEntry.

IrcIdent

An IRC identifier. Mainly used for its Ord implementation.

IrcIdentRef

An IRC identifier. Mainly used for its Ord implementation.

NotifyEntry

An entry in HexChat's notify list.

PrintEvent

Represents a 'print event' in HexChat, i.e. an invocation of one of a hundred and fifty different format strings corresponding to any possible action.

PrintEventListener

A handle to a registered print event listener.

Priority

The priority of an event listener or command.

RawServerEventListener

A handle to a registered raw server event listener.

ReplyListener

A handle to a registered reply listener.

SafeLazy

A lazily-evaluated resource that is safe to use in a HexChat plugin.

SafeUninit

An initially uninitialized resource that is safe to use in a HexChat plugin.

ServerEventListener

A handle to a registered server event listener.

TimerTask

A handle to a registered timer task.

UserInfo

Information about another user.

UserMask

Represents a user mask, typically formatted like nick!user@address, where any of the components can be replaced with a *.

UserString

Represents a userstring, typically formatted like nick!user@address.

WindowEvent

An event corresponding to a window action.

WindowEventListener

A handle to a registered window event listener.

Enums

ChannelType

An enumeration of different channel types.

DccTransferStatus

The various statuses that can describe a DccTransferInfo.

DccTransferType

An enumeration of all possible DCC transfer types.

EatMode

Represents who to hide an event or command from.

GlobalPreferenceValue

Possible values from get_global_pref.

Traits

Plugin

This trait must be implemented on a type before the type is passed to plugin!.

Functions

add_fake_plugin

Adds a fake plugin to the plugin list.

add_modes

Adds a user mode char to one or more users in the current channel.

add_modes_in_channel

Adds a user mode char to one or more users in the specified channel.

add_print_event_listener

Adds a listener for a particular PrintEvent; see PrintEvent's documentation for more details.

add_raw_server_event_listener

Adds a listener for raw server events, i.e. commands coming straight from the server.

add_reply_listener

Adds a listener for server replies, i.e. the numeric RPL_* messages.

add_reply_listener_once

Adds a reply listener as defined in add_reply_listener, and removes it after receiving a single reply.

add_reply_listener_until

Adds a reply listener as defined in add_reply_listener, and removes it after receiving the first U.

add_server_event_listener

Adds a listener for server events, i.e. commands coming from the server.

add_timer_task

Registers a task to be run repeatedly with a specified interval.

add_window_event_listener

Adds a listener for a particular WindowEvent. See WindowEvent's docs for more details.

delete_pref

Deletes a plugin preference from the preferences file.

deregister_command

Deregisters a command registered by register_command.

get_all_channels

Gets all channels currently open.

get_away_reason

Gets the client's currently set away reason.

get_channel

Gets the first channel with the specified name in the specified server.

get_channel_mode_string

Gets the channel mode string for the current channel.

get_channel_name

Gets the name of the current channel.

get_channel_topic

Gets the topic of the current channel.

get_charset

Gets the current charset in use.

get_config_dir

Gets HexChat's configuration directory.

get_current_channel

Gets the current channel context.

get_current_dcc_transfers

Gets all DCC transfers currently active.

get_cursor_pos

Gets the current cursor position in the text box, or None if it's deselected.

get_event_format_string

Gets the format string that gets printed to the window when the specified PrintEvent is fired.

get_first_channel

Gets the first channel with the specified name in any server.

get_focused_channel

Gets the channel that's currently focused in the HexChat window.

get_focused_channel_in_server

Gets the frontmost channel in a particular server.

get_global_pref

Gets a HexChat user preference by name.

get_hexchat_library_dir

Gets HexChat's library directory, also known as the plugin directory.

get_hexchat_version

Gets the version string of the build of Hexchat you're running on.

get_hostname

Gets the client's current hostname.

get_ignore_entries

Gets all entries in the ignore list.

get_inputbox_contents

Gets the current contents of the input box.

get_network_name

Gets the name of the current server network.

get_nickname

Gets the nickname in use on the current server.

get_nickserv_password

Gets the NickServ password for the current server.

get_notify_users

Gets all entries in the notify list.

get_pref_int

Gets a plugin preference integer from file.

get_pref_string

Gets a plugin preference string from file.

get_prefs

Gets every plugin preference name that has been saved.

get_server_id

Gets the unique ID of the current server, or None if unknown.

get_server_name

Gets the name of the current server.

get_users_in_channel

Gets all the users in a specific channel.

get_users_in_current_channel

Gets all the users in the current channel.

is_away

Gets whether or not the client is currently away.

name_cmp

Compares two names (nicks, channel names, etc.) according to IRC comparison rules.

print_event

Prints a specific print event to the current tab.

print_event_at

Prints a specific print event to the current tab with a specified timestamp.

print_event_to_channel

Prints a specific print event to a particular ChannelRef.

print_event_to_channel_at

Prints a specific print event to a particular channel with a specified timestamp.

print_plain

Prints plain text to the current tab.

register_command

Registers a new command accessible to the user via /<COMMAND> [args]. Returns a corresponding object that can be passed to deregister_command.

remove_fake_plugin

Removes a fake plugin entry from the plugin list added by add_fake_plugin.

remove_modes

Removes a user mode char from one or more users in the current channel.

remove_modes_in_channel

Removes a user mode char from one or more users in the specified channel.

remove_print_event_listener

Removes a listener added by add_print_event_listener.

remove_raw_server_event_listener

Removes a listener added by add_raw_server_event_listener.

remove_reply_listener

Removes a reply listener added by add_reply_listener.

remove_server_event_listener

Removes a server event listener added by add_server_event_listener.

remove_timer_task

Removes a timer task added by add_timer_task.

remove_window_event_listener

Removes a listener added by add_window_event_listener.

send_command

Executes a command as though it were typed in HexChat's input box.

set_pref_int

Saves a plugin preference integer to file.

set_pref_string

Saves a plugin preference string to file.

strip_attributes

Strips non-color formatting characters from a string.

strip_attributes_in_place

Strips non-color formatting characters from a string and puts the result back into the string.

strip_colors

Strips color characters from a string.

strip_colors_in_place

Strips color characters from a string and puts the result back into the string. Returns Ok if it succeeded or Err if the color characters are malformed.

strip_formatting

Strips all formatting characters from a string.

strip_formatting_in_place

Strips all formatting characters from a string and puts the result back into the string.