package calculon
Module Calculon.CoreSource
Core IRC state
type privmsg = {nick : string;(*author: nick
*)to_ : string;(*target: nick or chan
*)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).
Is this a valid chan name?
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 loop_ssl :
?conn_info:string ->
connect:(unit -> Irc_client_lwt_ssl.connection_t option Lwt.t) ->
init:(t -> unit Lwt.t) ->
unit ->
unit Lwt.tFeed 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 :
?conn_info:string ->
connect:(unit -> Irc_client_lwt.connection_t option Lwt.t) ->
init:(t -> unit Lwt.t) ->
unit ->
unit Lwt.tFeed to Lwt_main.run. Same as loop_tls but with a cleartext connection (boo!).
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
Logs from Calculon should use this source.