kameloso.plugins.common.core

Contains the definition of an IRCPlugin and its ancilliaries, as well as mixins to fully implement it.

Event handlers can then be module-level functions, annotated with IRCEvent.Types.

Members

Classes

IRCPlugin
class IRCPlugin

Abstract IRC plugin class.

SpecialRequestImpl
class SpecialRequestImpl(T)

Concrete implementation of a SpecialRequest.

Enums

ChannelPolicy
enum ChannelPolicy

Whether an annotated function should be allowed to trigger on events in only home channels or in guest ones as well.

Enabler
enum Enabler

Annotation denoting that a variable enables and disables a plugin.

FilterResult
enum FilterResult

The tristate results from comparing a username with the admin or whitelist/elevated/operator/staff lists.

Permissions
enum Permissions

What level of permissions is needed to trigger an event handler.

PrefixPolicy
enum PrefixPolicy

In what way the contents of a IRCEvent must start (be "prefixed") for an annotated function to be allowed to trigger.

Settings
enum Settings

Annotation denoting that a struct variable or struct type is to be considered as housing settings for a plugin, and should thus be serialised and saved in the configuration file.

Timing
enum Timing

Declaration of what order event handler function should be given with respects to other functions in the same plugin module.

Functions

allowImpl
auto allowImpl(IRCPlugin plugin, IRCEvent event, Permissions permissionsRequired)

Judges whether an event may be triggered, based on the event itself and the annotated Permissions of the handler in question. Implementation function.

assertSaneStorageClasses
auto assertSaneStorageClasses(ParameterStorageClass storageClass, bool paramIsConst, bool inFiber, string module_, string typestring)

Statically asserts that a parameter storage class is not ref if inFiber, and neither ref nor out if not inFiber.

filterSender
auto filterSender(IRCEvent event, Permissions permissionsRequired, bool preferHostmasks)

Decides if a sender meets a Permissions and is allowed to trigger an event handler, or if a WHOIS query is needed to be able to tell.

prefixPolicyMatches
auto prefixPolicyMatches(IRCEvent event, PrefixPolicy policy, IRCPluginState state)

Evaluates whether or not the message in an event satisfies the PrefixPolicy specified, as fetched from a IRCEventHandler.Command or IRCEventHandler.Regex UDA.

sanitiseEvent
void sanitiseEvent(IRCEvent event)

Sanitise event, used upon UTF/Unicode exceptions.

specialRequest
SpecialRequest specialRequest(string context, CarryingFiber!T fiber)

Instantiates a SpecialRequestImpl in the guise of a SpecialRequest with the implicit type T as payload.

specialRequest
SpecialRequest specialRequest(string context, void delegate() dg)

Instantiates a SpecialRequestImpl in the guise of a SpecialRequest with the explicit type T as payload.

udaSanityCheckCTFE
void udaSanityCheckCTFE(IRCEventHandler uda)

Sanity-checks a plugin's IRCEventHandlers at compile time.

Interfaces

SpecialRequest
interface SpecialRequest

Embodies the notion of a special request a plugin issues to the main thread.

Mixin templates

IRCPluginImpl
mixintemplate IRCPluginImpl(Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)

Mixin that fully implements an IRCPlugin.

Structs

Configuration
struct Configuration

Annotation denoting that a variable is the basename of a configuration file or directory.

IRCEventHandler
struct IRCEventHandler

Aggregate to annotate event handler functions with, to control what they do and how they work.

IRCPluginState
struct IRCPluginState

An aggregate of all variables that make up the common state of plugins.

Replay
struct Replay

Embodies the notion of an event to be replayed, once we know more about a user (meaning after a WHOIS query response).

Resource
struct Resource

Annotation denoting that a variable is the basename of a resource file or directory.

Examples

import kameloso.plugins.common.core;
import kameloso.plugins.common.awareness;

@(IRCEventHandler()
    .onEvent(IRCEvent.Type.CHAN)
    .permissionsRequired(Permissions.anyone)
    .channelPolicy(ChannelPolicy.home)
    .addCommand(
        IRCEventHandler.Command()
            .word("foo")
            .policy(PrefixPolicy.prefixed)
    )
)
void onFoo(FooPlugin plugin, const ref IRCEvent event)
{
    // ...
}

mixin UserAwareness;
mixin ChannelAwareness;
mixin PluginRegistration!FooPlugin;

final class FooPlugin : IRCPlugin
{
    // ...

    mixin IRCPluginImpl;
}

See Also

Meta