39 lines
1.3 KiB
OCaml
39 lines
1.3 KiB
OCaml
|
open Irc_client
|
||
|
open Lwt
|
||
|
|
||
|
(** We distinguish between "big channels" (allowed to spam) and "smol channels" (shouldn't spam).
|
||
|
Thanks to nilaky for the terminology. *)
|
||
|
module Conn (C: CLIENT with type 'a Io.t = 'a Lwt.t) : sig
|
||
|
type t = C.connection_t
|
||
|
|
||
|
val smolchannels : string list ref
|
||
|
val bigchannels : string list ref
|
||
|
|
||
|
val send_msg : t -> is_big:bool -> ?channel:string -> string -> unit Lwt.t
|
||
|
(** Send a message to all the channels associated with the connection.
|
||
|
set `is_big` (default: false) if the message is for `big channels` only.
|
||
|
If `channel` is specified then send to that channel only. *)
|
||
|
|
||
|
val join_chan : t -> is_big:bool -> channel:string -> unit Lwt.t
|
||
|
(** Join a channel with and add it to the list. `is_big` default to false. *)
|
||
|
|
||
|
val register_callback :
|
||
|
prefix:string ->
|
||
|
callback:(t -> string -> string -> string -> unit Lwt.t) ->
|
||
|
unit
|
||
|
(** Register a callback for the prefix "!<prefix>". The arguments for
|
||
|
the callback are: connection nick (possible empty), channel, the rest of the
|
||
|
message. *)
|
||
|
|
||
|
val pls_connect :
|
||
|
realname:string ->
|
||
|
username:string ->
|
||
|
server:string ->
|
||
|
port:int ->
|
||
|
nick:string ->
|
||
|
logf:(string -> unit Lwt.t) ->
|
||
|
onconnect:(t -> unit Lwt.t) ->
|
||
|
unit Lwt.t
|
||
|
|
||
|
end
|