2015-01-29 18:43:47 +01:00
|
|
|
defmodule ModPresenceDemo do
|
2016-09-08 11:34:42 +02:00
|
|
|
use Ejabberd.Module
|
2015-01-29 18:43:47 +01:00
|
|
|
|
|
|
|
def start(host, _opts) do
|
|
|
|
info('Starting ejabberd module Presence Demo')
|
2016-09-08 11:34:42 +02:00
|
|
|
Ejabberd.Hooks.add(:set_presence_hook, host, __MODULE__, :on_presence, 50)
|
2015-01-29 18:43:47 +01:00
|
|
|
:ok
|
|
|
|
end
|
2016-08-01 15:46:14 +02:00
|
|
|
|
2015-01-29 18:43:47 +01:00
|
|
|
def stop(host) do
|
|
|
|
info('Stopping ejabberd module Presence Demo')
|
2016-09-08 11:34:42 +02:00
|
|
|
Ejabberd.Hooks.delete(:set_presence_hook, host, __MODULE__, :on_presence, 50)
|
2015-01-29 18:43:47 +01:00
|
|
|
:ok
|
|
|
|
end
|
2016-08-01 15:46:14 +02:00
|
|
|
|
2015-01-29 18:43:47 +01:00
|
|
|
def on_presence(user, _server, _resource, _packet) do
|
|
|
|
info('Receive presence for #{user}')
|
|
|
|
:none
|
2016-08-01 15:46:14 +02:00
|
|
|
end
|
2015-01-29 18:43:47 +01:00
|
|
|
end
|