I am trying to make simple ejabberd
hooks or module. For this I follow these steps using eclipse
.
create Erlang project and I gives reference
to ejabberd
source code , which is I have download from github
.
Now I write code
%% @author anuj
%% @doc @todo Add description to hello_word.
-module(hello_word).
-behavior(gen_mod).
-export([start/2,stop/1]).
start(_Host, _Opt) ->
?INFO_MSG("Loading module 'mod_hello' ", []).
stop(_Host) ->
ok.
Now i am compile it using this command
(ErModule1_ejabberd@anuj)2> c(hello_word).
This gives this error message to me
hello_word.erl:11: undefined macro 'INFO_MSG/2'
hello_word.erl:8: function start/2 undefined
hello_word.erl:6: Warning: behaviour gen_mod undefined
error
Can anyone correct in this proccess how can i make a simple hook for ejabberd and compile it.
The INFO_MSG is a macro defined in logger.hrl
. You need to include it in your file:
-include("logger.hrl").