summaryrefslogtreecommitdiff
path: root/lib/irc/connection_handler.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc/connection_handler.ex')
-rw-r--r--lib/irc/connection_handler.ex50
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