kameloso.main

The main module, housing startup logic and the main event loop.

No module (save kameloso.entrypoint) should be importing this.

Members

Functions

checkInitialisationMessages
auto checkInitialisationMessages(Kameloso instance, ShellReturnValue retval)

Checks for any initialisation messages that may have been sent by plugins during their initialisation.

echoQuitMessage
void echoQuitMessage(Kameloso instance, string reason)

Echos the quit message to the local terminal, to fake it being sent verbosely to the server. It is sent, but later, bypassing the message fiber which would otherwise do the echoing.

listenAttemptToNext
auto listenAttemptToNext(Kameloso instance, ListenAttempt attempt)

Translates the ListenAttempt.State received from a Generator into a Next, while also providing warnings and error messages.

logPluginActionException
void logPluginActionException(Exception base, IRCPlugin plugin, IRCEvent event, string fun)

Logs an exception thrown by a plugin action.

mainLoop
auto mainLoop(Kameloso instance)

This loops creates a Generator Fiber to loop over the connected Socket.

postInstanceSetup
void postInstanceSetup()

Sets up the program (terminal) environment.

prettyPrintStartScreen
void prettyPrintStartScreen(Kameloso instance, string arg0)

Prints a pretty start screen.

printEventDebugDetails
void printEventDebugDetails(IRCEvent event, string raw, Flag!"eventWasInitialised" eventWasInitialised)

Print what we know about an event, from an error perspective.

printSummary
void printSummary(Kameloso instance)

Prints a summary of the connection(s) made and events parsed this execution.

processAwaitingDelegates
void processAwaitingDelegates(IRCPlugin plugin, IRCEvent event)

Processes the awaiting delegates of an IRCPlugin.

processAwaitingFibers
void processAwaitingFibers(IRCPlugin plugin, IRCEvent event)

Processes the awaiting Fibers of an IRCPlugin.

processDeferredActions
void processDeferredActions(Kameloso instance, IRCPlugin plugin)

Iterates through a plugin's array of DeferredActions. Depending on what their fiber member (which is in actually a CarryingFiber) can be cast to, it prepares a payload, assigns it to the CarryingFiber, and calls it.

processLineFromServer
void processLineFromServer(Kameloso instance, string raw, long nowInUnix)

Processes a line read from the server, constructing an IRCEvent and dispatches it to all plugins.

processMessages
auto processMessages(Kameloso instance)

Processes messages and performs action based on them.

processPendingReplays
void processPendingReplays(Kameloso instance, IRCPlugin plugin)

Takes a queue of pending Replay objects and issues WHOIS queries for each one, unless it has already been done recently (within Timeout.whoisRetry seconds).

processReadyReplays
void processReadyReplays(Kameloso instance, IRCPlugin plugin)

Handles the queue of ready-to-replay objects, re-postprocessing events from the current (main loop) context, outside of any plugin.

processScheduledDelegates
void processScheduledDelegates(IRCPlugin plugin, long nowInHnsecs)

Processes the queued ScheduledDelegates of an IRCPlugin.

processScheduledFibers
void processScheduledFibers(IRCPlugin plugin, long nowInHnsecs)

Processes the queued ScheduledFibers of an IRCPlugin.

propagateWhoisTimestamp
void propagateWhoisTimestamp(Kameloso instance, string nickname, long nowInUnix)

Propagates a single update to the the kameloso.kameloso.Kameloso.previousWhoisTimestamps associative array to all plugins.

propagateWhoisTimestamps
void propagateWhoisTimestamps(Kameloso instance)

Propagates the kameloso.kameloso.Kameloso.previousWhoisTimestamps associative array to all plugins.

resetSignals
void resetSignals()

Resets signal handlers to the system default.

resolvePaths
void resolvePaths(Kameloso instance)

Resolves resource directory private key/certificate file paths semi-verbosely.

run
auto run(string[] args)

Entry point of the program.

sendLines
auto sendLines(Kameloso instance)

Sends strings to the server from the message buffers.

setDefaultDirectories
void setDefaultDirectories(CoreSettings settings)

Sets default directories in the passed CoreSettings.

setupSignals
void setupSignals()

Registers some process signals to redirect to our own signalHandler, so we can (for instance) catch Ctrl+C and gracefully shut down.

signalHandler
void signalHandler(int sig)

Called when a signal is raised, usually SIGINT.

startBot
auto startBot(Kameloso instance)

Main connection logic.

tryConnect
auto tryConnect(Kameloso instance)

Tries to connect to the IPs in Kameloso.conn.ips by leveraging connectFiber, reacting on the ConnectionAttempts it yields to provide feedback to the user.

tryGetopt
auto tryGetopt(Kameloso instance)

Attempt handling getopt, wrapped in try-catch blocks.

tryResolve
auto tryResolve(Kameloso instance, Flag!"firstConnect" firstConnect)

Tries to resolve the address in Kameloso.parser.server to IPs, by leveraging resolveFiber, reacting on the ResolveAttempts it yields to provide feedback to the user.

verifySettings
auto verifySettings(Kameloso instance)

Verifies some settings and returns whether the program should continue executing (or whether there were errors such that we should exit).

Manifest constants

gcOptions
enum gcOptions;

A value line for rt_options to fine-tune the garbage collector.

Static variables

rt_options
string[] rt_options;

Fine-tune the garbage collector.

Structs

RunState
struct RunState

Aggregate of state values used in an execution of the program.

Variables

signalRaised
int signalRaised;

The value of the signal, when the process was sent one that meant it should abort. This determines the shell exit code to return.

See Also

Meta