ejabberd - Comments for "How to implement my own access control to the MUC rooms ?" https://www.ejabberd.im/node/2767 en Hi again. I've just https://www.ejabberd.im/node/2767#comment-51578 <p>Hi again. </p> <p>I've just discovered the mod_filter and modified it a bit. Not sure about the speed, but seems cool =)</p> <p>Am I right in the way I handle "room joins" ?</p> <pre> -module(mod_muc_access_filter). -behaviour(gen_mod). -export([start/2, stop/1, filter_packet/1]). -include("ejabberd.hrl"). -include("jlib.hrl"). start(_Host, _Opts) -&gt; ejabberd_hooks:add(filter_packet, global, ?MODULE, filter_packet, 100). stop(_Host) -&gt; ejabberd_hooks:delete(filter_packet, global, ?MODULE, filter_packet, 100). filter_packet(drop) -&gt; drop; filter_packet({From, To, Packet} = Input) -&gt; MucHostname = "conference." ++ ?MYNAME, % TODO: if To#jid.server == MucHostname -&gt; {_, PT, _, _} = Packet, if PT == "presence" -&gt; case can_join(To#jid.user, From#jid.luser) of allow -&gt; Input; _ -&gt; drop end end, % io:format("From: ~p~nTo: ~p~nPacket: ~p~n", [From, To, Packet]), Input; true -&gt; Input end. can_join(Room, Who) -&gt; io:format("Room: ~p~nWho: ~p~n", [Room, Who]), % TODO: Call web-service or execute the SQL query allow. </pre> Mon, 07 Jan 2008 16:30:23 +0000 Anonymous comment 51578 at https://www.ejabberd.im