25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Implement gen_mod callback in ModPresenceDemo module

This commit is contained in:
Mickael Remond 2016-08-01 15:46:14 +02:00
parent 2ef58a33a9
commit 76eba3647a
No known key found for this signature in database
GPG Key ID: E6F6045D79965AA3

View File

@ -7,15 +7,20 @@ defmodule ModPresenceDemo do
Ejabberd.Hooks.add(:set_presence_hook, host, __ENV__.module, :on_presence, 50) Ejabberd.Hooks.add(:set_presence_hook, host, __ENV__.module, :on_presence, 50)
:ok :ok
end end
def stop(host) do def stop(host) do
info('Stopping ejabberd module Presence Demo') info('Stopping ejabberd module Presence Demo')
Ejabberd.Hooks.delete(:set_presence_hook, host, __ENV__.module, :on_presence, 50) Ejabberd.Hooks.delete(:set_presence_hook, host, __ENV__.module, :on_presence, 50)
:ok :ok
end end
def on_presence(user, _server, _resource, _packet) do def on_presence(user, _server, _resource, _packet) do
info('Receive presence for #{user}') info('Receive presence for #{user}')
:none :none
end end
# gen_mod callbacks
def depends(_host, _opts), do: []
def mod_opt_type(_), do: []
end end