问题
Here I found the code:
erlc -I ~/ejabberd-2.1.13/lib/ejabberd-2.1.13/include -pa ~/ejabberd-2.1.13/lib/ejabberd-2.1.13/ebin mod_my.erl
But it did not work?
回答1:
Here are steps to add your custom module into ejabberd
- put your module into ejabberd/src folder.
- come to ejabberd directory in terminal and run command $ sudo make
- it will show you that your module is compiled. Now run $ sudo make install
- Add your module into config file at /etc/ejabberd/ejabberd.yml
- restart your ejabberd and your custom module will be running.
回答2:
These are the Instructions based on Ejabberd recommendation
1) Form the folder structure like below (refer any module from -- https://github.com/processone/ejabberd-contrib).
sources
│
│───conf
│ └───modulename.yml
│───src
│ └───modulename.erl
│───README.txt
│───COPYING
│───modulename.spec
2) Add your module folder structure to ejabberd user home directory (check ejabberdctl.cfg for CONTRIB_MODULES_PATH param).
3) Type command ejabberdctl modules_available it will list your module
4) Type ejabberdctl module_install module_name command
For Reference https://docs.ejabberd.im/developer/extending-ejabberd/modules/
回答3:
Just drop the module in the ejabberd's src/ folder then "make". Nothing special needed to compile it.
来源:https://stackoverflow.com/questions/18202550/ejabberd-how-to-compile-new-module