25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-18 17:24:31 +01:00
xmpp.chapril.org-ejabberd/lib/mod_example.ex

34 lines
672 B
Elixir
Raw Normal View History

2015-01-29 18:43:47 +01:00
defmodule ModPresenceDemo do
use Ejabberd.Module
2015-01-29 18:43:47 +01:00
def start(host, _opts) do
info("Starting ejabberd module Presence Demo")
Ejabberd.Hooks.add(:set_presence_hook, host, __MODULE__, :on_presence, 50)
2015-01-29 18:43:47 +01:00
:ok
end
2015-01-29 18:43:47 +01:00
def stop(host) do
info("Stopping ejabberd module Presence Demo")
Ejabberd.Hooks.delete(:set_presence_hook, host, __MODULE__, :on_presence, 50)
2015-01-29 18:43:47 +01:00
:ok
end
2015-01-29 18:43:47 +01:00
def on_presence(user, _server, _resource, _packet) do
info("Receive presence for #{user}")
2015-01-29 18:43:47 +01:00
:none
end
2018-12-26 17:32:39 +01:00
def depends(_host, _opts) do
[]
end
def mod_options(_host) do
[]
end
def mod_doc() do
%{:desc => "This is just a demonstration."}
end
2015-01-29 18:43:47 +01:00
end