package calculon

  1. Overview
  2. Docs

Core IRC state

type irc_msg = Irc_message.t
type privmsg = {
  1. nick : string;
    (*

    author: nick

    *)
  2. to_ : string;
    (*

    target: nick or chan

    *)
  3. message : string;
    (*

    actual content

    *)
}

A message sent on some IRC channel, or in query. The message content is message, its sender is nick (a nickname), and its target is to_ (either a nickname for private messages, or a channel name).

val is_chan : string -> bool

Is this a valid chan name?

val reply_to : privmsg -> string

find whom to reply to. If the message is in query, that is, not (is_chan msg.to_), then reply to msg.nick; otherwise reply on the channel msg.to_.

val nick : privmsg -> string

The author of the message

val privmsg_of_msg : irc_msg -> privmsg option

Try to parse a privmsg from a raw IRC message

val string_of_privmsg : privmsg -> string
module type S = sig ... end
type t = (module S)
val loop_ssl : connect:(unit -> Irc_client_lwt_ssl.connection_t option Lwt.t) -> init:(t -> unit Lwt.t) -> unit -> unit Lwt.t

Feed this to Lwt_main.run. It will connect using connect (which opens a TLS connection), create a new core object (of type t), call init on this core object (to initialize plugins, etc.) then loop on incoming messages. If the connection is closed for any reason, this will wait for some time and then re-connect and call init again, etc.

val loop_unsafe : connect:(unit -> Irc_client_lwt.connection_t option Lwt.t) -> init:(t -> unit Lwt.t) -> unit -> unit Lwt.t

Feed to Lwt_main.run. Same as loop_tls but with a cleartext connection (boo!).

val run : Config.t -> init:(t -> unit Lwt.t) -> unit -> unit Lwt.t

Main entry point: use config to pick the connection method, then call the appropriate auto-reconnection loop. Calls init every time a new connection is opened.

Logging

val logs_src : Logs.Src.t

Logs from Calculon should use this source.

  • since 0.6
OCaml

Innovation. Community. Security.