Open eduardogoncalves opened 8 years ago
I think this mod dont work on new YML file config.
Hello! Are there plans to actualize the mod_filter to support new YML file configs?
Thanks!
I merged @JohnBrodie's branch. Should support YML config files.
Hi @knobo , thanks for the reply I'm using ejabberd-17.07 on Mageia Linux 5 x8664. 1) I created the path /opt/ejabberd-17.07/.ejabberd-modules/sources_ and cloned there mod_filter:
git clone https://github.com/knobo/mod_filter.git
2) Checked if the module was available:
./bin/ejabberdctl modules_available
mod_filter Flexible filtering by server policy
3) Checked if the module was ready to install and got the warning:
./bin/ejabberdctl module_check mod_filter
/opt/ejabberd-17.07/.ejabberd-modules/sources/mod_filter/src/mod_filter.erl:13: Warning: undefined callback function depends/2 (behaviour 'gen_mod')
4) Tried to install the module and got the warning again:
./bin/ejabberdctl module_install mod_filter
/opt/ejabberd-17.07/.ejabberd-modules/sources/mod_filter/src/mod_filter.erl:13: Warning: undefined callback function depends/2 (behaviour 'gen_mod')
After installation got the directory:
tree .ejabberd-modules/mod_filter/
.ejabberd-modules/mod_filter/
|-- conf
| `-- mod_filter.yml
|-- ebin
| `-- mod_filter.beam
`-- mod_filter.spec
2 directories, 3 files
5) Added the activating string in ejabberd.cfg:
modules:
...
mod_filter: {}
6) Restarted ejabberd service, in ejabberd.log:
gen_mod:start_module:192 loading mod_filter at example.com
But after a client connection in ejabberd.log (the connection is successfull):
2017-07-26 01:00:57.982 [error] <0.460.0>@ejabberd_hooks:safe_apply:383 Hook filter_packet crashed when running mod_filter:filter_packet/1:
** Reason = {error,function_clause,[{mod_filter,filter_packet,[{file,"/opt/ejabberd-17.07/.ejabberd-modules/sources/mod_filter/src/mod_filter.erl"},{line,31}],[{iq,<<"purple39142b9a">>,result,<<"ru">>,{jid,<<"myuser">>,<<"example.com>>,<<>>,<<"myuser">>,<<"example.com">>,<<>>},{jid,<<"myuser">>,<<"example.com">>,<<" ">>,<<"myuser">>,<<"example.com">>,<<" ">>},[],#{ip => {0,0,0,0,0,65535,24484,18326}}}]},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{ejabberd_router,do_route,[{file,"src/ejabberd_router.erl"},{line,338}],1},{ejabberd_router,route,[{file,"src/ejabberd_router.erl"},{line,87}],1},{gen_iq_handler,process_iq,[{file,"src/gen_iq_handler.erl"},{line,146}],4},{ejabberd_sm,route,[{file,"src/ejabberd_sm.erl"},{line,138}],1},{ejabberd_local,route,[{
file,"src/ejabberd_local.erl"},{line,116}],1}]}** Arguments = [{iq,<<"purple39142b9a">>,result,<<"ru">>,{jid,<<"myuser">>,<<"example.com">>,<<>>,<<"myuser">>,<<"example.com">>,<<>>},{jid,<<"myuser">>,<<"example.com">>,<<" ">>,<<"myuser">>,<<"example.com">>,<<" ">>},[],#{ip => {0,0,0,0,0,65535,24484,18326}}}]
Also could you please explain how to use _modfilter.yml, because the format used in ejabberd.cfg is slightly different. It is said in the docs that the _modfilter.yml contents should be included into ejabberd.cfg, but into which sections? There is no more "access" section in ejabberd.cfg, there is "access_rules". I also wanted to ask you if there are any plans to update the docs for the new config format?
Here is the similar request: https://www.ejabberd.im/forum/28870/modfilter-crashes
Thanks in advance
@khamadiyarov The above error isn't due to config issues, it's due to changes that were made in eJabberd core. The mod_filter
code will need to be updated to work with newer versions of ejabberd. The error,function_clause
part of your error shows the problem - the hooks signature changed, and the current mod_filter
code no longer matches.
Hi, thanks for clarification @JohnBrodie , can I hope for a code update in the near future?
Possibly? @knobo are you working on this, or would you rather wait for a PR?
I'm not working on this now. And probably not for several months.
Hi @knobo , thanks for the comment
Hi, ejabberd-15.10 use yml format, how to you setup it? I create the file structure under "ejabberd/.ejabberd-modules/sources/ejabberd-contrib/mod_filter" and runned "ejabberdctl module_install mod_filter" and it generates the files on "ejabberd/.ejabberd-modules/mod_filter". Then I tryed to edit ejabberd.yml and right below "access:" I added:
and in the file "ejabberd/.ejabberd-modules/mod_filter/conf/mod_filter.yml"
But with this, users go online but can't see each other. I think I'm having the block "mod_filter, mod_filter_presence in wrong place".
Thanks.