2006-10-28 04:04:55 +02:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
%%% File : mod_proxy65_service.erl
|
|
|
|
%%% Author : Evgeniy Khramtsov <xram@jabber.ru>
|
|
|
|
%%% Purpose : SOCKS5 Bytestreams XMPP service.
|
|
|
|
%%% Created : 12 Oct 2006 by Evgeniy Khramtsov <xram@jabber.ru>
|
2007-12-24 14:57:53 +01:00
|
|
|
%%%
|
|
|
|
%%%
|
2019-01-08 22:53:27 +01:00
|
|
|
%%% ejabberd, Copyright (C) 2002-2019 ProcessOne
|
2007-12-24 14:57:53 +01:00
|
|
|
%%%
|
|
|
|
%%% This program is free software; you can redistribute it and/or
|
|
|
|
%%% modify it under the terms of the GNU General Public License as
|
|
|
|
%%% published by the Free Software Foundation; either version 2 of the
|
|
|
|
%%% License, or (at your option) any later version.
|
|
|
|
%%%
|
|
|
|
%%% This program is distributed in the hope that it will be useful,
|
|
|
|
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
%%% General Public License for more details.
|
2009-01-12 15:44:42 +01:00
|
|
|
%%%
|
2014-02-22 11:27:40 +01:00
|
|
|
%%% You should have received a copy of the GNU General Public License along
|
|
|
|
%%% with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-12-24 14:57:53 +01:00
|
|
|
%%%
|
2006-10-28 04:04:55 +02:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
|
|
|
|
-module(mod_proxy65_service).
|
2013-03-14 10:33:02 +01:00
|
|
|
|
2006-10-28 04:04:55 +02:00
|
|
|
-author('xram@jabber.ru').
|
|
|
|
|
|
|
|
-behaviour(gen_server).
|
|
|
|
|
|
|
|
%% gen_server callbacks.
|
2013-03-14 10:33:02 +01:00
|
|
|
-export([init/1, handle_info/2, handle_call/3,
|
|
|
|
handle_cast/2, terminate/2, code_change/3]).
|
2006-10-28 04:04:55 +02:00
|
|
|
|
2019-08-04 20:46:18 +02:00
|
|
|
-export([start_link/1, reload/3, add_listener/2, process_disco_info/1,
|
2016-07-29 12:21:00 +02:00
|
|
|
process_disco_items/1, process_vcard/1, process_bytestreams/1,
|
2019-07-06 11:30:57 +02:00
|
|
|
delete_listener/1, route/1]).
|
2006-10-28 04:04:55 +02:00
|
|
|
|
2013-04-08 11:12:54 +02:00
|
|
|
-include("logger.hrl").
|
2016-07-29 12:21:00 +02:00
|
|
|
-include("xmpp.hrl").
|
2018-01-08 09:29:17 +01:00
|
|
|
-include("translate.hrl").
|
2019-07-06 11:30:57 +02:00
|
|
|
-include("ejabberd_stacktrace.hrl").
|
2006-10-28 04:04:55 +02:00
|
|
|
|
|
|
|
-define(PROCNAME, ejabberd_mod_proxy65_service).
|
|
|
|
|
2017-08-08 16:46:26 +02:00
|
|
|
-record(state, {myhosts = [] :: [binary()]}).
|
2008-10-12 13:17:35 +02:00
|
|
|
|
|
|
|
%%%------------------------
|
|
|
|
%%% gen_server callbacks
|
|
|
|
%%%------------------------
|
2006-10-28 04:04:55 +02:00
|
|
|
|
2019-08-04 20:46:18 +02:00
|
|
|
start_link(Host) ->
|
2006-10-28 04:04:55 +02:00
|
|
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
2019-08-04 20:46:18 +02:00
|
|
|
gen_server:start_link({local, Proc}, ?MODULE, [Host], []).
|
2006-10-28 04:04:55 +02:00
|
|
|
|
2017-02-22 17:46:47 +01:00
|
|
|
reload(Host, NewOpts, OldOpts) ->
|
|
|
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
|
|
|
gen_server:cast(Proc, {reload, Host, NewOpts, OldOpts}).
|
|
|
|
|
2019-08-04 20:46:18 +02:00
|
|
|
init([Host]) ->
|
2017-02-14 08:25:08 +01:00
|
|
|
process_flag(trap_exit, true),
|
2019-08-04 20:46:18 +02:00
|
|
|
Opts = gen_mod:get_module_opts(Host, mod_proxy65),
|
2019-06-14 11:33:26 +02:00
|
|
|
MyHosts = gen_mod:get_opt_hosts(Opts),
|
2017-08-08 16:46:26 +02:00
|
|
|
lists:foreach(
|
|
|
|
fun(MyHost) ->
|
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, MyHost, ?NS_DISCO_INFO,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_disco_info),
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, MyHost, ?NS_DISCO_ITEMS,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_disco_items),
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, MyHost, ?NS_VCARD,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_vcard),
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, MyHost, ?NS_BYTESTREAMS,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_bytestreams),
|
2019-07-06 11:30:57 +02:00
|
|
|
ejabberd_router:register_route(
|
|
|
|
MyHost, Host, {apply, ?MODULE, route})
|
2017-08-08 16:46:26 +02:00
|
|
|
end, MyHosts),
|
|
|
|
{ok, #state{myhosts = MyHosts}}.
|
2006-10-28 04:04:55 +02:00
|
|
|
|
2017-08-08 16:46:26 +02:00
|
|
|
terminate(_Reason, #state{myhosts = MyHosts}) ->
|
|
|
|
lists:foreach(
|
|
|
|
fun(MyHost) ->
|
|
|
|
ejabberd_router:unregister_route(MyHost),
|
|
|
|
unregister_handlers(MyHost)
|
|
|
|
end, MyHosts).
|
2016-07-29 12:21:00 +02:00
|
|
|
|
2019-07-06 11:30:57 +02:00
|
|
|
handle_info({route, Packet}, State) ->
|
|
|
|
try route(Packet)
|
|
|
|
catch ?EX_RULE(Class, Reason, St) ->
|
|
|
|
StackTrace = ?EX_STACK(St),
|
2019-09-23 14:17:20 +02:00
|
|
|
?ERROR_MSG("Failed to route packet:~n~ts~n** ~ts",
|
2019-07-06 11:30:57 +02:00
|
|
|
[xmpp:pp(Packet),
|
|
|
|
misc:format_exception(2, Class, Reason, StackTrace)])
|
|
|
|
end,
|
2006-10-28 04:04:55 +02:00
|
|
|
{noreply, State};
|
2019-07-12 10:55:36 +02:00
|
|
|
handle_info(Info, State) ->
|
|
|
|
?WARNING_MSG("Unexpected info: ~p", [Info]),
|
|
|
|
{noreply, State}.
|
2006-10-28 04:04:55 +02:00
|
|
|
|
2019-07-12 10:55:36 +02:00
|
|
|
handle_call(Request, From, State) ->
|
|
|
|
?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
|
|
|
|
{noreply, State}.
|
2008-10-12 13:17:35 +02:00
|
|
|
|
2017-02-22 17:46:47 +01:00
|
|
|
handle_cast({reload, ServerHost, NewOpts, OldOpts}, State) ->
|
2019-06-14 11:33:26 +02:00
|
|
|
NewHosts = gen_mod:get_opt_hosts(NewOpts),
|
|
|
|
OldHosts = gen_mod:get_opt_hosts(OldOpts),
|
2017-08-08 16:46:26 +02:00
|
|
|
lists:foreach(
|
|
|
|
fun(NewHost) ->
|
|
|
|
ejabberd_router:register_route(NewHost, ServerHost),
|
2018-02-11 10:54:15 +01:00
|
|
|
register_handlers(NewHost)
|
2017-08-08 16:46:26 +02:00
|
|
|
end, NewHosts -- OldHosts),
|
|
|
|
lists:foreach(
|
|
|
|
fun(OldHost) ->
|
|
|
|
ejabberd_router:unregister_route(OldHost),
|
|
|
|
unregister_handlers(OldHost)
|
|
|
|
end, OldHosts -- NewHosts),
|
|
|
|
{noreply, State#state{myhosts = NewHosts}};
|
2017-02-22 17:46:47 +01:00
|
|
|
handle_cast(Msg, State) ->
|
2019-06-24 19:32:34 +02:00
|
|
|
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
|
2017-02-22 17:46:47 +01:00
|
|
|
{noreply, State}.
|
2008-10-12 13:17:35 +02:00
|
|
|
|
2013-03-14 10:33:02 +01:00
|
|
|
code_change(_OldVsn, State, _Extra) -> {ok, State}.
|
2008-10-12 13:17:35 +02:00
|
|
|
|
2019-07-06 11:30:57 +02:00
|
|
|
-spec route(stanza()) -> ok.
|
|
|
|
route(#iq{} = IQ) ->
|
|
|
|
ejabberd_router:process_iq(IQ);
|
|
|
|
route(_) ->
|
|
|
|
ok.
|
|
|
|
|
2008-10-12 13:17:35 +02:00
|
|
|
%%%------------------------
|
|
|
|
%%% Listener management
|
|
|
|
%%%------------------------
|
|
|
|
|
|
|
|
add_listener(Host, Opts) ->
|
2018-09-18 13:51:42 +02:00
|
|
|
{_, IP, _} = EndPoint = get_endpoint(Host),
|
2019-06-14 11:33:26 +02:00
|
|
|
Opts1 = gen_mod:set_opt(server_host, Host, Opts),
|
|
|
|
Opts2 = gen_mod:set_opt(ip, IP, Opts1),
|
2018-09-18 13:51:42 +02:00
|
|
|
ejabberd_listener:add_listener(EndPoint, mod_proxy65_stream, Opts2).
|
2008-10-12 13:17:35 +02:00
|
|
|
|
|
|
|
delete_listener(Host) ->
|
2018-09-18 11:53:36 +02:00
|
|
|
ejabberd_listener:delete_listener(get_endpoint(Host), mod_proxy65_stream).
|
2008-10-12 13:17:35 +02:00
|
|
|
|
2006-10-28 04:04:55 +02:00
|
|
|
%%%------------------------
|
|
|
|
%%% IQ Processing
|
|
|
|
%%%------------------------
|
2016-07-29 12:21:00 +02:00
|
|
|
-spec process_disco_info(iq()) -> iq().
|
|
|
|
process_disco_info(#iq{type = set, lang = Lang} = IQ) ->
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Value 'set' of 'type' attribute is not allowed"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
|
|
|
process_disco_info(#iq{type = get, to = To, lang = Lang} = IQ) ->
|
|
|
|
Host = ejabberd_router:host_of_route(To#jid.lserver),
|
2019-06-14 11:33:26 +02:00
|
|
|
Name = mod_proxy65_opt:name(Host),
|
2016-07-29 12:21:00 +02:00
|
|
|
Info = ejabberd_hooks:run_fold(disco_info, Host,
|
|
|
|
[], [Host, ?MODULE, <<"">>, <<"">>]),
|
|
|
|
xmpp:make_iq_result(
|
|
|
|
IQ, #disco_info{xdata = Info,
|
|
|
|
identities = [#identity{category = <<"proxy">>,
|
|
|
|
type = <<"bytestreams">>,
|
|
|
|
name = translate:translate(Lang, Name)}],
|
|
|
|
features = [?NS_DISCO_INFO, ?NS_DISCO_ITEMS,
|
|
|
|
?NS_VCARD, ?NS_BYTESTREAMS]}).
|
|
|
|
|
|
|
|
-spec process_disco_items(iq()) -> iq().
|
|
|
|
process_disco_items(#iq{type = set, lang = Lang} = IQ) ->
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Value 'set' of 'type' attribute is not allowed"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
|
|
|
process_disco_items(#iq{type = get} = IQ) ->
|
|
|
|
xmpp:make_iq_result(IQ, #disco_items{}).
|
|
|
|
|
|
|
|
-spec process_vcard(iq()) -> iq().
|
|
|
|
process_vcard(#iq{type = set, lang = Lang} = IQ) ->
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Value 'set' of 'type' attribute is not allowed"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
2019-08-02 12:55:48 +02:00
|
|
|
process_vcard(#iq{type = get, to = To, lang = Lang} = IQ) ->
|
|
|
|
ServerHost = ejabberd_router:host_of_route(To#jid.lserver),
|
|
|
|
VCard = case mod_proxy65_opt:vcard(ServerHost) of
|
|
|
|
undefined ->
|
|
|
|
#vcard_temp{fn = <<"ejabberd/mod_proxy65">>,
|
|
|
|
url = ejabberd_config:get_uri(),
|
|
|
|
desc = misc:get_descr(
|
|
|
|
Lang, ?T("ejabberd SOCKS5 Bytestreams module"))};
|
|
|
|
V ->
|
|
|
|
V
|
|
|
|
end,
|
|
|
|
xmpp:make_iq_result(IQ, VCard).
|
2016-07-29 12:21:00 +02:00
|
|
|
|
|
|
|
-spec process_bytestreams(iq()) -> iq().
|
|
|
|
process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->
|
|
|
|
Host = To#jid.lserver,
|
|
|
|
ServerHost = ejabberd_router:host_of_route(Host),
|
2019-06-14 11:33:26 +02:00
|
|
|
ACL = mod_proxy65_opt:access(ServerHost),
|
2006-10-28 04:04:55 +02:00
|
|
|
case acl:match_rule(ServerHost, ACL, JID) of
|
2016-07-29 12:21:00 +02:00
|
|
|
allow ->
|
|
|
|
StreamHost = get_streamhost(Host, ServerHost),
|
|
|
|
xmpp:make_iq_result(IQ, #bytestreams{hosts = [StreamHost]});
|
|
|
|
deny ->
|
2019-06-22 16:08:45 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_forbidden(?T("Access denied by service policy"), Lang))
|
2006-10-28 04:04:55 +02:00
|
|
|
end;
|
2016-07-29 12:21:00 +02:00
|
|
|
process_bytestreams(#iq{type = set, lang = Lang,
|
|
|
|
sub_els = [#bytestreams{sid = SID}]} = IQ)
|
2017-02-18 07:36:27 +01:00
|
|
|
when SID == <<"">> orelse size(SID) > 128 ->
|
2016-07-29 12:21:00 +02:00
|
|
|
Why = {bad_attr_value, <<"sid">>, <<"query">>, ?NS_BYTESTREAMS},
|
2017-11-14 07:02:43 +01:00
|
|
|
Txt = xmpp:io_format_error(Why),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang));
|
2019-06-14 11:33:26 +02:00
|
|
|
process_bytestreams(#iq{type = set, lang = Lang,
|
2016-07-29 12:21:00 +02:00
|
|
|
sub_els = [#bytestreams{activate = undefined}]} = IQ) ->
|
|
|
|
Why = {missing_cdata, <<"">>, <<"activate">>, ?NS_BYTESTREAMS},
|
2017-11-14 07:02:43 +01:00
|
|
|
Txt = xmpp:io_format_error(Why),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_jid_malformed(Txt, Lang));
|
|
|
|
process_bytestreams(#iq{type = set, lang = Lang, from = InitiatorJID, to = To,
|
|
|
|
sub_els = [#bytestreams{activate = TargetJID,
|
|
|
|
sid = SID}]} = IQ) ->
|
|
|
|
ServerHost = ejabberd_router:host_of_route(To#jid.lserver),
|
2019-06-14 11:33:26 +02:00
|
|
|
ACL = mod_proxy65_opt:access(ServerHost),
|
2006-10-28 04:04:55 +02:00
|
|
|
case acl:match_rule(ServerHost, ACL, InitiatorJID) of
|
2016-07-29 12:21:00 +02:00
|
|
|
allow ->
|
2017-01-16 13:28:11 +01:00
|
|
|
Node = ejabberd_cluster:get_node_by_id(To#jid.lresource),
|
2017-02-26 08:07:12 +01:00
|
|
|
Target = jid:encode(jid:tolower(TargetJID)),
|
|
|
|
Initiator = jid:encode(jid:tolower(InitiatorJID)),
|
2017-03-14 00:31:51 +01:00
|
|
|
SHA1 = str:sha(<<SID/binary, Initiator/binary, Target/binary>>),
|
2017-01-16 13:28:11 +01:00
|
|
|
Mod = gen_mod:ram_db_mod(global, mod_proxy65),
|
|
|
|
MaxConnections = max_connections(ServerHost),
|
|
|
|
case Mod:activate_stream(SHA1, Initiator, MaxConnections, Node) of
|
|
|
|
{ok, InitiatorPid, TargetPid} ->
|
|
|
|
mod_proxy65_stream:activate(
|
|
|
|
{InitiatorPid, InitiatorJID}, {TargetPid, TargetJID}),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_iq_result(IQ);
|
2017-01-16 13:28:11 +01:00
|
|
|
{error, notfound} ->
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Failed to activate bytestream"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_item_not_found(Txt, Lang));
|
2017-01-16 13:28:11 +01:00
|
|
|
{error, {limit, InitiatorPid, TargetPid}} ->
|
|
|
|
mod_proxy65_stream:stop(InitiatorPid),
|
|
|
|
mod_proxy65_stream:stop(TargetPid),
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Too many active bytestreams"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_resource_constraint(Txt, Lang));
|
2017-01-16 13:28:11 +01:00
|
|
|
{error, conflict} ->
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Bytestream already activated"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_conflict(Txt, Lang));
|
2017-01-16 13:28:11 +01:00
|
|
|
{error, Err} ->
|
2019-09-23 14:17:20 +02:00
|
|
|
?ERROR_MSG("Failed to activate bytestream from ~ts to ~ts: ~p",
|
2016-07-29 12:21:00 +02:00
|
|
|
[Initiator, Target, Err]),
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Database failure"),
|
2017-01-16 13:28:11 +01:00
|
|
|
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
|
2016-07-29 12:21:00 +02:00
|
|
|
end;
|
|
|
|
deny ->
|
2019-06-22 16:08:45 +02:00
|
|
|
Txt = ?T("Access denied by service policy"),
|
2016-07-29 12:21:00 +02:00
|
|
|
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
|
|
|
end.
|
2017-01-16 13:28:11 +01:00
|
|
|
|
2006-10-28 04:04:55 +02:00
|
|
|
%%%-------------------------
|
|
|
|
%%% Auxiliary functions.
|
|
|
|
%%%-------------------------
|
2016-07-29 12:21:00 +02:00
|
|
|
-spec get_streamhost(binary(), binary()) -> streamhost().
|
|
|
|
get_streamhost(Host, ServerHost) ->
|
2018-09-18 11:53:36 +02:00
|
|
|
{Port, IP, _} = get_endpoint(ServerHost),
|
2019-06-14 11:33:26 +02:00
|
|
|
HostName = case mod_proxy65_opt:hostname(ServerHost) of
|
|
|
|
undefined -> misc:ip_to_list(IP);
|
|
|
|
Val -> Val
|
|
|
|
end,
|
2017-01-16 13:28:11 +01:00
|
|
|
Resource = ejabberd_cluster:node_id(),
|
|
|
|
#streamhost{jid = jid:make(<<"">>, Host, Resource),
|
2016-07-29 12:21:00 +02:00
|
|
|
host = HostName,
|
|
|
|
port = Port}.
|
|
|
|
|
2018-09-18 11:53:36 +02:00
|
|
|
-spec get_endpoint(binary()) -> {inet:port_number(), inet:ip_address(), tcp}.
|
|
|
|
get_endpoint(Host) ->
|
2019-06-14 11:33:26 +02:00
|
|
|
Port = mod_proxy65_opt:port(Host),
|
|
|
|
IP = case mod_proxy65_opt:ip(Host) of
|
2018-01-23 08:54:52 +01:00
|
|
|
undefined -> get_my_ip();
|
|
|
|
Addr -> Addr
|
|
|
|
end,
|
2018-09-18 11:53:36 +02:00
|
|
|
{Port, IP, tcp}.
|
2016-07-29 12:21:00 +02:00
|
|
|
|
|
|
|
-spec get_my_ip() -> inet:ip_address().
|
2009-02-27 04:22:40 +01:00
|
|
|
get_my_ip() ->
|
|
|
|
{ok, MyHostName} = inet:gethostname(),
|
|
|
|
case inet:getaddr(MyHostName, inet) of
|
2013-03-14 10:33:02 +01:00
|
|
|
{ok, Addr} -> Addr;
|
|
|
|
{error, _} -> {127, 0, 0, 1}
|
2007-08-25 19:24:00 +02:00
|
|
|
end.
|
2017-01-16 13:28:11 +01:00
|
|
|
|
|
|
|
max_connections(ServerHost) ->
|
2019-06-14 11:33:26 +02:00
|
|
|
mod_proxy65_opt:max_connections(ServerHost).
|
2017-08-08 16:46:26 +02:00
|
|
|
|
2018-02-11 10:54:15 +01:00
|
|
|
register_handlers(Host) ->
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_DISCO_INFO,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_disco_info),
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_DISCO_ITEMS,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_disco_items),
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_VCARD,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_vcard),
|
2017-08-08 16:46:26 +02:00
|
|
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_BYTESTREAMS,
|
2018-02-11 10:54:15 +01:00
|
|
|
?MODULE, process_bytestreams).
|
2017-08-08 16:46:26 +02:00
|
|
|
|
|
|
|
unregister_handlers(Host) ->
|
|
|
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_DISCO_INFO),
|
|
|
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_DISCO_ITEMS),
|
|
|
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_VCARD),
|
|
|
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_BYTESTREAMS).
|