25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00
xmpp.chapril.org-ejabberd/lib/mod_presence_demo.ex

27 lines
681 B
Elixir
Raw Normal View History

2015-01-29 18:43:47 +01:00
defmodule ModPresenceDemo do
import Ejabberd.Logger # this allow using info, error, etc for logging
@behaviour :gen_mod
def start(host, _opts) do
info('Starting ejabberd module Presence Demo')
Ejabberd.Hooks.add(:set_presence_hook, host, __ENV__.module, :on_presence, 50)
: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, __ENV__.module, :on_presence, 50)
:ok
end
2015-01-29 18:43:47 +01:00
def on_presence(user, _server, _resource, _packet) do
info('Receive presence for #{user}')
:none
end
# gen_mod callbacks
def depends(_host, _opts), do: []
def mod_opt_type(_), do: []
2015-01-29 18:43:47 +01:00
end