diff options
author | href <href@random.sh> | 2021-01-11 15:53:02 +0100 |
---|---|---|
committer | href <href@random.sh> | 2021-01-11 15:53:02 +0100 |
commit | 0f3f0e035b43eabd3f739c41964446962cf54208 (patch) | |
tree | 9279c54e100c92375c9d980e2031e0a153245025 /lib/irc/connection_handler.ex | |
parent | Some fixes (diff) |
Cont. wipmaster
Diffstat (limited to 'lib/irc/connection_handler.ex')
-rw-r--r-- | lib/irc/connection_handler.ex | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/irc/connection_handler.ex b/lib/irc/connection_handler.ex new file mode 100644 index 0000000..a5d5f3f --- /dev/null +++ b/lib/irc/connection_handler.ex @@ -0,0 +1,50 @@ +defmodule Irc.Connection.Handler do + @moduledoc """ + Handler behaviour + """ + + @type args :: Map.new() + + @doc """ + Initializes + """ + @callback init(args()) :: args() + + @doc """ + Capability negotiation. + + Allows the handler to request more capabilities from the server. + """ + @callback capabs(args()) :: [String.t()] + + @doc """ + Connected callback. + """ + @callback connected(conn :: Irc.Connection.t(), args()) :: {:ok, conn :: Irc.Connection.t()} + + @doc """ + An IRC line has been received. + """ + @callback line(conn :: Irc.Connection.t(), line :: Irc.Line.t()) :: {:ok, conn :: Irc.Connection.t()} + + @doc """ + An IRC batch has been received. + """ + @callback batch(conn :: Irc.Connection.t(), batch :: Irc.Batch.t()) :: {:ok, conn :: Irc.Connection.t()} + + @doc """ + Connection changed modes. + """ + @callback modes(conn :: Irc.Connection.t(), changes :: :todo, prev :: :todo) :: {:ok, conn :: Irc.Connection.t()} + + @doc """ + Connection changed nick. + """ + @callback nick(conn :: Irc.Connection.t(), prev_nick :: String.t, new_nick :: String.t) :: {:ok, conn :: Irc.Connection.t()} + + @doc """ + Disconnected callback. + """ + @callback disconnected(conn :: Irc.Connection.t(), reason :: atom()) :: any() + +end |