Hello,
I want to control the access to the MUC rooms. I need to call my web-service for that or make a mysql query, I can imagine how to implement this in erlang. But it is not clear to me how to integrate this into the ejabberd.
As I understood from mod_muc.erl:do_route, I can't have acl per room. Please correct me if I am wrong.
I can call my web-service from mod_muc:do_route, but I do not want to do this because I do not want to modify ejabberd, if it is possible.
Is there any other more clean way of doing this ?
Thank you in advance.
Hi again. I've just
Hi again.
I've just discovered the mod_filter and modified it a bit. Not sure about the speed, but seems cool =)
Am I right in the way I handle "room joins" ?
-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) -> ejabberd_hooks:add(filter_packet, global, ?MODULE, filter_packet, 100). stop(_Host) -> ejabberd_hooks:delete(filter_packet, global, ?MODULE, filter_packet, 100). filter_packet(drop) -> drop; filter_packet({From, To, Packet} = Input) -> MucHostname = "conference." ++ ?MYNAME, % TODO: if To#jid.server == MucHostname -> {_, PT, _, _} = Packet, if PT == "presence" -> case can_join(To#jid.user, From#jid.luser) of allow -> Input; _ -> drop end end, % io:format("From: ~p~nTo: ~p~nPacket: ~p~n", [From, To, Packet]), Input; true -> Input end. can_join(Room, Who) -> io:format("Room: ~p~nWho: ~p~n", [Room, Who]), % TODO: Call web-service or execute the SQL query allow.