mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Convert to the new #iq record from Exmpp.
SVN Revision: 1524
This commit is contained in:
parent
5e78c53572
commit
d8c3aae412
@ -7,6 +7,11 @@
|
|||||||
Remove the compatibility layer and always call modules with the new
|
Remove the compatibility layer and always call modules with the new
|
||||||
#iq record from Exmpp.
|
#iq record from Exmpp.
|
||||||
|
|
||||||
|
* src/mod_roster.erl, src/mod_vcard.erl, src/adhoc.erl,
|
||||||
|
src/mod_adhoc.erl, src/mod_configure.erl, src/mod_configure2.erl,
|
||||||
|
src/mod_disco.erl, src/mod_last.erl: Convert to the new #iq record
|
||||||
|
from Exmpp.
|
||||||
|
|
||||||
2008-08-06 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-08-06 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/mod_offline.erl, src/mod_offline_odbc.erl, src/mod_echo.erl,
|
* src/mod_offline.erl, src/mod_offline_odbc.erl, src/mod_echo.erl,
|
||||||
|
@ -38,18 +38,16 @@
|
|||||||
|
|
||||||
%% Parse an ad-hoc request. Return either an adhoc_request record or
|
%% Parse an ad-hoc request. Return either an adhoc_request record or
|
||||||
%% an {error, ErrorType} tuple.
|
%% an {error, ErrorType} tuple.
|
||||||
parse_request(IQ) ->
|
parse_request(#iq{type = Type, ns = NS, payload = SubEl, lang = Lang}) ->
|
||||||
try
|
try
|
||||||
SubEl = exmpp_iq:get_request(IQ),
|
case {Type, NS} of
|
||||||
case {exmpp_iq:get_type(IQ), SubEl#xmlel.ns} of
|
|
||||||
{set, ?NS_ADHOC} ->
|
{set, ?NS_ADHOC} ->
|
||||||
?DEBUG("entering parse_request...", []),
|
?DEBUG("entering parse_request...", []),
|
||||||
Lang = exmpp_stanza:get_lang(IQ),
|
|
||||||
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
||||||
SessionID = exmpp_xml:get_attribute(SubEl, 'sessionid', ""),
|
SessionID = exmpp_xml:get_attribute(SubEl, 'sessionid', ""),
|
||||||
Action = exmpp_xml:get_attribute(SubEl, 'action', ""),
|
Action = exmpp_xml:get_attribute(SubEl, 'action', ""),
|
||||||
XData = find_xdata_el(SubEl),
|
XData = find_xdata_el(SubEl),
|
||||||
AllEls = SubEl#xmlel.ns,
|
AllEls = exmpp_xml:get_child_elements(SubEl),
|
||||||
if XData ->
|
if XData ->
|
||||||
Others = lists:delete(XData, AllEls);
|
Others = lists:delete(XData, AllEls);
|
||||||
true ->
|
true ->
|
||||||
|
@ -50,9 +50,9 @@
|
|||||||
start(Host, Opts) ->
|
start(Host, Opts) ->
|
||||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
||||||
|
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_ADHOC_s,
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_ADHOC,
|
||||||
?MODULE, process_local_iq, IQDisc),
|
?MODULE, process_local_iq, IQDisc),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ADHOC_s,
|
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ADHOC,
|
||||||
?MODULE, process_sm_iq, IQDisc),
|
?MODULE, process_sm_iq, IQDisc),
|
||||||
|
|
||||||
ejabberd_hooks:add(disco_local_identity, Host, ?MODULE, get_local_identity, 99),
|
ejabberd_hooks:add(disco_local_identity, Host, ?MODULE, get_local_identity, 99),
|
||||||
@ -74,8 +74,8 @@ stop(Host) ->
|
|||||||
ejabberd_hooks:delete(disco_local_features, Host, ?MODULE, get_local_features, 99),
|
ejabberd_hooks:delete(disco_local_features, Host, ?MODULE, get_local_features, 99),
|
||||||
ejabberd_hooks:delete(disco_local_identity, Host, ?MODULE, get_local_identity, 99),
|
ejabberd_hooks:delete(disco_local_identity, Host, ?MODULE, get_local_identity, 99),
|
||||||
|
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ADHOC_s),
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ADHOC),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ADHOC_s).
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ADHOC).
|
||||||
|
|
||||||
%-------------------------------------------------------------------------
|
%-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -208,19 +208,19 @@ get_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
|||||||
|
|
||||||
%-------------------------------------------------------------------------
|
%-------------------------------------------------------------------------
|
||||||
|
|
||||||
process_local_iq(From, To, IQ) ->
|
process_local_iq(From, To, IQ_Rec) ->
|
||||||
process_adhoc_request(From, To, IQ, adhoc_local_commands).
|
process_adhoc_request(From, To, IQ_Rec, adhoc_local_commands).
|
||||||
|
|
||||||
|
|
||||||
process_sm_iq(From, To, IQ) ->
|
process_sm_iq(From, To, IQ_Rec) ->
|
||||||
process_adhoc_request(From, To, IQ, adhoc_sm_commands).
|
process_adhoc_request(From, To, IQ_Rec, adhoc_sm_commands).
|
||||||
|
|
||||||
|
|
||||||
process_adhoc_request(From, To, IQ, Hook) ->
|
process_adhoc_request(From, To, IQ_Rec, Hook) ->
|
||||||
?DEBUG("About to parse ~p...", [IQ]),
|
?DEBUG("About to parse ~p...", [IQ_Rec]),
|
||||||
case adhoc:parse_request(IQ) of
|
case adhoc:parse_request(IQ_Rec) of
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
exmpp_iq:error(IQ, Error);
|
exmpp_iq:error(IQ_Rec, Error);
|
||||||
#adhoc_request{} = AdhocRequest ->
|
#adhoc_request{} = AdhocRequest ->
|
||||||
Host = To#jid.ldomain,
|
Host = To#jid.ldomain,
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
@ -231,11 +231,11 @@ process_adhoc_request(From, To, IQ, Hook) ->
|
|||||||
ignore ->
|
ignore ->
|
||||||
ignore;
|
ignore;
|
||||||
empty ->
|
empty ->
|
||||||
exmpp_iq:error(IQ, 'item-not-found');
|
exmpp_iq:error(IQ_Rec, 'item-not-found');
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
exmpp_iq:error(IQ, Error);
|
exmpp_iq:error(IQ_Rec, Error);
|
||||||
Command ->
|
Command ->
|
||||||
exmpp_iq:result(IQ, Command)
|
exmpp_iq:result(IQ_Rec, Command)
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ stop(Host) ->
|
|||||||
ejabberd_hooks:delete(disco_local_identity, Host, ?MODULE, get_local_identity, 50),
|
ejabberd_hooks:delete(disco_local_identity, Host, ?MODULE, get_local_identity, 50),
|
||||||
ejabberd_hooks:delete(disco_local_features, Host, ?MODULE, get_local_features, 50),
|
ejabberd_hooks:delete(disco_local_features, Host, ?MODULE, get_local_features, 50),
|
||||||
ejabberd_hooks:delete(disco_local_items, Host, ?MODULE, get_local_items, 50),
|
ejabberd_hooks:delete(disco_local_items, Host, ?MODULE, get_local_items, 50),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ADHOC_s),
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ADHOC),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ADHOC_s).
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_ADHOC).
|
||||||
|
|
||||||
%%%-----------------------------------------------------------------------
|
%%%-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -47,22 +47,22 @@
|
|||||||
|
|
||||||
start(Host, Opts) ->
|
start(Host, Opts) ->
|
||||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE_s,
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE,
|
||||||
?MODULE, process_local_iq, IQDisc),
|
?MODULE, process_local_iq, IQDisc),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE_s).
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_ECONFIGURE).
|
||||||
|
|
||||||
|
|
||||||
process_local_iq(From, To, IQ) ->
|
process_local_iq(From, To, #iq{type = Type, payload = Request} = IQ_Rec) ->
|
||||||
case acl:match_rule(To#jid.ldomain, configure, From) of
|
case acl:match_rule(To#jid.ldomain, configure, From) of
|
||||||
deny ->
|
deny ->
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
exmpp_iq:error(IQ_Rec, 'not-allowed');
|
||||||
allow ->
|
allow ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
case Type of
|
||||||
set ->
|
set ->
|
||||||
exmpp_iq:error(IQ, 'feature-not-implemented');
|
exmpp_iq:error(IQ_Rec, 'feature-not-implemented');
|
||||||
%%case xml:get_tag_attr_s("type", SubEl) of
|
%%case xml:get_tag_attr_s("type", SubEl) of
|
||||||
%% "cancel" ->
|
%% "cancel" ->
|
||||||
%% IQ#iq{type = result,
|
%% IQ#iq{type = result,
|
||||||
@ -96,11 +96,11 @@ process_local_iq(From, To, IQ) ->
|
|||||||
%% sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
|
%% sub_el = [SubEl, ?ERR_NOT_ALLOWED]}
|
||||||
%%end;
|
%%end;
|
||||||
get ->
|
get ->
|
||||||
case process_get(IQ#xmlel.children) of
|
case process_get(Request) of
|
||||||
{result, Res} ->
|
{result, Res} ->
|
||||||
exmpp_iq:result(IQ, Res);
|
exmpp_iq:result(IQ_Rec, Res);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
exmpp_iq:error(IQ, Error)
|
exmpp_iq:error(IQ_Rec, Error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
@ -63,13 +63,13 @@ start(Host, Opts) ->
|
|||||||
ejabberd_local:refresh_iq_handlers(),
|
ejabberd_local:refresh_iq_handlers(),
|
||||||
|
|
||||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host, atom_to_list(?NS_DISCO_ITEMS),
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_DISCO_ITEMS,
|
||||||
?MODULE, process_local_iq_items, IQDisc),
|
?MODULE, process_local_iq_items, IQDisc),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host, atom_to_list(?NS_DISCO_INFO),
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_DISCO_INFO,
|
||||||
?MODULE, process_local_iq_info, IQDisc),
|
?MODULE, process_local_iq_info, IQDisc),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, atom_to_list(?NS_DISCO_ITEMS),
|
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_DISCO_ITEMS,
|
||||||
?MODULE, process_sm_iq_items, IQDisc),
|
?MODULE, process_sm_iq_items, IQDisc),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, atom_to_list(?NS_DISCO_INFO),
|
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_DISCO_INFO,
|
||||||
?MODULE, process_sm_iq_info, IQDisc),
|
?MODULE, process_sm_iq_info, IQDisc),
|
||||||
|
|
||||||
catch ets:new(disco_features, [named_table, ordered_set, public]),
|
catch ets:new(disco_features, [named_table, ordered_set, public]),
|
||||||
@ -101,10 +101,10 @@ stop(Host) ->
|
|||||||
ejabberd_hooks:delete(disco_local_identity, Host, ?MODULE, get_local_identity, 100),
|
ejabberd_hooks:delete(disco_local_identity, Host, ?MODULE, get_local_identity, 100),
|
||||||
ejabberd_hooks:delete(disco_local_features, Host, ?MODULE, get_local_features, 100),
|
ejabberd_hooks:delete(disco_local_features, Host, ?MODULE, get_local_features, 100),
|
||||||
ejabberd_hooks:delete(disco_local_items, Host, ?MODULE, get_local_services, 100),
|
ejabberd_hooks:delete(disco_local_items, Host, ?MODULE, get_local_services, 100),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, atom_to_list(?NS_DISCO_ITEMS)),
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_DISCO_ITEMS),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, atom_to_list(?NS_DISCO_INFO)),
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_DISCO_INFO),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, atom_to_list(?NS_DISCO_ITEMS)),
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_DISCO_ITEMS),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, atom_to_list(?NS_DISCO_INFO)),
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_DISCO_INFO),
|
||||||
catch ets:match_delete(disco_features, {{'_', Host}}),
|
catch ets:match_delete(disco_features, {{'_', Host}}),
|
||||||
catch ets:match_delete(disco_extra_domains, {{'_', Host}}),
|
catch ets:match_delete(disco_extra_domains, {{'_', Host}}),
|
||||||
ok.
|
ok.
|
||||||
@ -126,15 +126,10 @@ unregister_extra_domain(Host, Domain) ->
|
|||||||
catch ets:new(disco_extra_domains, [named_table, ordered_set, public]),
|
catch ets:new(disco_extra_domains, [named_table, ordered_set, public]),
|
||||||
ets:delete(disco_extra_domains, {Domain, Host}).
|
ets:delete(disco_extra_domains, {Domain, Host}).
|
||||||
|
|
||||||
process_local_iq_items(From, To, IQ) ->
|
process_local_iq_items(From, To, #iq{type = get, payload = SubEl,
|
||||||
case exmpp_iq:get_type(IQ) of
|
lang = Lang} = IQ_Rec) ->
|
||||||
set ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
|
||||||
get ->
|
|
||||||
SubEl = exmpp_iq:get_request(IQ),
|
|
||||||
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
|
||||||
Host = To#jid.ldomain,
|
Host = To#jid.ldomain,
|
||||||
Lang = exmpp_stanza:get_lang(IQ),
|
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
||||||
|
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = jlib:to_old_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
@ -151,23 +146,19 @@ process_local_iq_items(From, To, IQ) ->
|
|||||||
end,
|
end,
|
||||||
Result = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'query',
|
Result = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'query',
|
||||||
attrs = ANode, children = Items},
|
attrs = ANode, children = Items},
|
||||||
exmpp_iq:result(IQ, Result);
|
exmpp_iq:result(IQ_Rec, Result);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
% XXX OLD FORMAT: Error.
|
% XXX OLD FORMAT: Error.
|
||||||
exmpp_iq:error(IQ, Error)
|
exmpp_iq:error(IQ_Rec, Error)
|
||||||
end
|
end;
|
||||||
end.
|
process_local_iq_items(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
|
|
||||||
|
|
||||||
process_local_iq_info(From, To, IQ) ->
|
process_local_iq_info(From, To, #iq{type = get, payload = SubEl,
|
||||||
case exmpp_iq:get_type(IQ) of
|
lang = Lang} = IQ_Rec) ->
|
||||||
set ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
|
||||||
get ->
|
|
||||||
Host = To#jid.ldomain,
|
Host = To#jid.ldomain,
|
||||||
SubEl = exmpp_iq:get_request(IQ),
|
|
||||||
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
||||||
Lang = exmpp_stanza:get_lang(IQ),
|
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = jlib:to_old_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = jlib:to_old_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
@ -190,11 +181,12 @@ process_local_iq_info(From, To, IQ) ->
|
|||||||
attrs = ANode,
|
attrs = ANode,
|
||||||
children = Identity ++ lists:map(fun feature_to_xml/1,
|
children = Identity ++ lists:map(fun feature_to_xml/1,
|
||||||
Features)},
|
Features)},
|
||||||
exmpp_iq:result(IQ, Result);
|
exmpp_iq:result(IQ_Rec, Result);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
exmpp_iq:error(IQ, Error)
|
exmpp_iq:error(IQ_Rec, Error)
|
||||||
end
|
end;
|
||||||
end.
|
process_local_iq_info(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
|
|
||||||
get_local_identity(Acc, _From, _To, [], _Lang) ->
|
get_local_identity(Acc, _From, _To, [], _Lang) ->
|
||||||
Acc ++ [#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = [
|
Acc ++ [#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = [
|
||||||
@ -232,6 +224,10 @@ feature_to_xml({{Feature, _Host}}) ->
|
|||||||
feature_to_xml(Feature) when is_list(Feature) ->
|
feature_to_xml(Feature) when is_list(Feature) ->
|
||||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [
|
||||||
#xmlattr{name = 'var', value = Feature}
|
#xmlattr{name = 'var', value = Feature}
|
||||||
|
]};
|
||||||
|
feature_to_xml(Feature) when is_atom(Feature) ->
|
||||||
|
#xmlel{ns = ?NS_DISCO_INFO, name = 'feature', attrs = [
|
||||||
|
#xmlattr{name = 'var', value = atom_to_list(Feature)}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
domain_to_xml({Domain}) ->
|
domain_to_xml({Domain}) ->
|
||||||
@ -283,32 +279,10 @@ get_vh_services(Host) ->
|
|||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
process_sm_iq_items(From, To, IQ) ->
|
process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
|
||||||
SubEl = exmpp_iq:get_request(IQ),
|
lang = Lang} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
|
||||||
set ->
|
|
||||||
#jid{lnode = LTo, ldomain = ToServer} = To,
|
|
||||||
#jid{lnode = LFrom, ldomain = LServer} = From,
|
|
||||||
Self = (LTo == LFrom) andalso (ToServer == LServer),
|
|
||||||
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
|
||||||
if
|
|
||||||
Self, Node /= [] ->
|
|
||||||
%% Here, we treat disco publish attempts to your own JID.
|
|
||||||
Items = SubEl#xmlel.children,
|
|
||||||
case process_disco_publish({LFrom, LServer}, Node, Items) of
|
|
||||||
ok ->
|
|
||||||
exmpp_iq:result(IQ);
|
|
||||||
{error, Err} ->
|
|
||||||
exmpp_iq:error(IQ, Err)
|
|
||||||
end;
|
|
||||||
|
|
||||||
true ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed')
|
|
||||||
end;
|
|
||||||
get ->
|
|
||||||
Host = To#jid.ldomain,
|
Host = To#jid.ldomain,
|
||||||
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
||||||
Lang = exmpp_stanza:get_lang(IQ),
|
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = jlib:to_old_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = jlib:to_old_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
@ -323,10 +297,28 @@ process_sm_iq_items(From, To, IQ) ->
|
|||||||
end,
|
end,
|
||||||
Result = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'query',
|
Result = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'query',
|
||||||
attrs = ANode, children = Items},
|
attrs = ANode, children = Items},
|
||||||
exmpp_iq:result(IQ, Result);
|
exmpp_iq:result(IQ_Rec, Result);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
exmpp_iq:error(IQ, Error)
|
exmpp_iq:error(IQ_Rec, Error)
|
||||||
end
|
end;
|
||||||
|
process_sm_iq_items(From, To, #iq{type = set, payload = SubEl} = IQ_Rec) ->
|
||||||
|
#jid{lnode = LTo, ldomain = ToServer} = To,
|
||||||
|
#jid{lnode = LFrom, ldomain = LServer} = From,
|
||||||
|
Self = (LTo == LFrom) andalso (ToServer == LServer),
|
||||||
|
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
||||||
|
if
|
||||||
|
Self, Node /= [] ->
|
||||||
|
%% Here, we treat disco publish attempts to your own JID.
|
||||||
|
Items = SubEl#xmlel.children,
|
||||||
|
case process_disco_publish({LFrom, LServer}, Node, Items) of
|
||||||
|
ok ->
|
||||||
|
exmpp_iq:result(IQ_Rec);
|
||||||
|
{error, Err} ->
|
||||||
|
exmpp_iq:error(IQ_Rec, Err)
|
||||||
|
end;
|
||||||
|
|
||||||
|
true ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed')
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_sm_items({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
|
get_sm_items({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
|
||||||
@ -359,15 +351,10 @@ get_sm_items(empty, From, To, _Node, _Lang) ->
|
|||||||
{error, 'not-allowed'}
|
{error, 'not-allowed'}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
process_sm_iq_info(From, To, IQ) ->
|
process_sm_iq_info(From, To, #iq{type = get, payload = SubEl,
|
||||||
case exmpp_iq:get_type(IQ) of
|
lang = Lang} = IQ_Rec) ->
|
||||||
set ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
|
||||||
get ->
|
|
||||||
Host = To#jid.ldomain,
|
Host = To#jid.ldomain,
|
||||||
SubEl = exmpp_iq:get_request(IQ),
|
|
||||||
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
Node = exmpp_xml:get_attribute(SubEl, 'node', ""),
|
||||||
Lang = exmpp_stanza:get_lang(IQ),
|
|
||||||
% XXX OLD FORMAT: From, To.
|
% XXX OLD FORMAT: From, To.
|
||||||
FromOld = jlib:to_old_jid(From),
|
FromOld = jlib:to_old_jid(From),
|
||||||
ToOld = jlib:to_old_jid(To),
|
ToOld = jlib:to_old_jid(To),
|
||||||
@ -389,11 +376,12 @@ process_sm_iq_info(From, To, IQ) ->
|
|||||||
attrs = ANode,
|
attrs = ANode,
|
||||||
children = Identity ++ lists:map(fun feature_to_xml/1,
|
children = Identity ++ lists:map(fun feature_to_xml/1,
|
||||||
Features)},
|
Features)},
|
||||||
exmpp_iq:result(IQ, Result);
|
exmpp_iq:result(IQ_Rec, Result);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
exmpp_iq:error(IQ, Error)
|
exmpp_iq:error(IQ_Rec, Error)
|
||||||
end
|
end;
|
||||||
end.
|
process_sm_iq_info(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
|
|
||||||
get_sm_identity(Acc, _From, _To, _Node, _Lang) ->
|
get_sm_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||||
Acc.
|
Acc.
|
||||||
|
@ -52,9 +52,9 @@ start(Host, Opts) ->
|
|||||||
[{disc_copies, [node()]},
|
[{disc_copies, [node()]},
|
||||||
{attributes, record_info(fields, last_activity)}]),
|
{attributes, record_info(fields, last_activity)}]),
|
||||||
update_table(),
|
update_table(),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY_s,
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY,
|
||||||
?MODULE, process_local_iq, IQDisc),
|
?MODULE, process_local_iq, IQDisc),
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY_s,
|
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY,
|
||||||
?MODULE, process_sm_iq, IQDisc),
|
?MODULE, process_sm_iq, IQDisc),
|
||||||
ejabberd_hooks:add(remove_user, Host,
|
ejabberd_hooks:add(remove_user, Host,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
@ -66,26 +66,19 @@ stop(Host) ->
|
|||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
ejabberd_hooks:delete(unset_presence_hook, Host,
|
ejabberd_hooks:delete(unset_presence_hook, Host,
|
||||||
?MODULE, on_presence_update, 50),
|
?MODULE, on_presence_update, 50),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY_s),
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_LAST_ACTIVITY),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY_s).
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_LAST_ACTIVITY).
|
||||||
|
|
||||||
process_local_iq(_From, _To, IQ) ->
|
process_local_iq(_From, _To, #iq{type = get} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
|
||||||
set ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
|
||||||
get ->
|
|
||||||
Sec = trunc(element(1, erlang:statistics(wall_clock))/1000),
|
Sec = trunc(element(1, erlang:statistics(wall_clock))/1000),
|
||||||
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query', attrs =
|
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query', attrs =
|
||||||
[#xmlattr{name = 'seconds', value = integer_to_list(Sec)}]},
|
[#xmlattr{name = 'seconds', value = integer_to_list(Sec)}]},
|
||||||
exmpp_iq:result(IQ, Response)
|
exmpp_iq:result(IQ_Rec, Response);
|
||||||
end.
|
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
|
|
||||||
|
|
||||||
process_sm_iq(From, To, IQ) ->
|
process_sm_iq(From, To, #iq{type = get} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
|
||||||
set ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
|
||||||
get ->
|
|
||||||
User = To#jid.lnode,
|
User = To#jid.lnode,
|
||||||
Server = To#jid.ldomain,
|
Server = To#jid.ldomain,
|
||||||
{Subscription, _Groups} =
|
{Subscription, _Groups} =
|
||||||
@ -106,22 +99,23 @@ process_sm_iq(From, To, IQ) ->
|
|||||||
exmpp_presence:available()},
|
exmpp_presence:available()},
|
||||||
out]) of
|
out]) of
|
||||||
allow ->
|
allow ->
|
||||||
get_last(IQ, User, Server);
|
get_last(IQ_Rec, User, Server);
|
||||||
deny ->
|
deny ->
|
||||||
exmpp_iq:error(IQ, 'not-allowed')
|
exmpp_iq:error(IQ_Rec, 'not-allowed')
|
||||||
end;
|
end;
|
||||||
true ->
|
true ->
|
||||||
exmpp_iq:error(IQ, 'not-allowed')
|
exmpp_iq:error(IQ_Rec, 'not-allowed')
|
||||||
end
|
end;
|
||||||
end.
|
process_sm_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
|
|
||||||
%% TODO: This function could use get_last_info/2
|
%% TODO: This function could use get_last_info/2
|
||||||
get_last(IQ, LUser, LServer) ->
|
get_last(IQ_Rec, LUser, LServer) ->
|
||||||
case catch mnesia:dirty_read(last_activity, {LUser, LServer}) of
|
case catch mnesia:dirty_read(last_activity, {LUser, LServer}) of
|
||||||
{'EXIT', _Reason} ->
|
{'EXIT', _Reason} ->
|
||||||
exmpp_iq:error(IQ, 'internal-server-error');
|
exmpp_iq:error(IQ_Rec, 'internal-server-error');
|
||||||
[] ->
|
[] ->
|
||||||
exmpp_iq:error(IQ, 'service-unavailable');
|
exmpp_iq:error(IQ_Rec, 'service-unavailable');
|
||||||
[#last_activity{timestamp = TimeStamp, status = Status}] ->
|
[#last_activity{timestamp = TimeStamp, status = Status}] ->
|
||||||
{MegaSecs, Secs, _MicroSecs} = now(),
|
{MegaSecs, Secs, _MicroSecs} = now(),
|
||||||
TimeStamp2 = MegaSecs * 1000000 + Secs,
|
TimeStamp2 = MegaSecs * 1000000 + Secs,
|
||||||
@ -129,7 +123,7 @@ get_last(IQ, LUser, LServer) ->
|
|||||||
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
Response = #xmlel{ns = ?NS_LAST_ACTIVITY, name = 'query',
|
||||||
attrs = [#xmlattr{name = 'seconds', value = integer_to_list(Sec)}],
|
attrs = [#xmlattr{name = 'seconds', value = integer_to_list(Sec)}],
|
||||||
children = [#xmlcdata{cdata = list_to_binary(Status)}]},
|
children = [#xmlcdata{cdata = list_to_binary(Status)}]},
|
||||||
exmpp_iq:result(IQ, Response)
|
exmpp_iq:result(IQ_Rec, Response)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,8 +78,7 @@ start(Host, Opts) ->
|
|||||||
?MODULE, webadmin_page, 50),
|
?MODULE, webadmin_page, 50),
|
||||||
ejabberd_hooks:add(webadmin_user, Host,
|
ejabberd_hooks:add(webadmin_user, Host,
|
||||||
?MODULE, webadmin_user, 50),
|
?MODULE, webadmin_user, 50),
|
||||||
% XXX OLD FORMAT: NS as string.
|
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_ROSTER,
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, atom_to_list(?NS_ROSTER),
|
|
||||||
?MODULE, process_iq, IQDisc).
|
?MODULE, process_iq, IQDisc).
|
||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
@ -103,41 +102,38 @@ stop(Host) ->
|
|||||||
?MODULE, webadmin_page, 50),
|
?MODULE, webadmin_page, 50),
|
||||||
ejabberd_hooks:delete(webadmin_user, Host,
|
ejabberd_hooks:delete(webadmin_user, Host,
|
||||||
?MODULE, webadmin_user, 50),
|
?MODULE, webadmin_user, 50),
|
||||||
% XXX OLD FORMAT: NS as string.
|
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host,
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host,
|
||||||
atom_to_list(?NS_ROSTER)).
|
?NS_ROSTER).
|
||||||
|
|
||||||
|
|
||||||
process_iq(From, To, IQ) ->
|
process_iq(From, To, IQ_Rec) ->
|
||||||
#jid{ldomain = LServer} = From,
|
#jid{ldomain = LServer} = From,
|
||||||
case lists:member(LServer, ?MYHOSTS) of
|
case lists:member(LServer, ?MYHOSTS) of
|
||||||
true ->
|
true ->
|
||||||
process_local_iq(From, To, IQ);
|
process_local_iq(From, To, IQ_Rec);
|
||||||
_ ->
|
_ ->
|
||||||
exmpp_iq:error(IQ, 'item-not-found')
|
exmpp_iq:error(IQ_Rec, 'item-not-found')
|
||||||
end.
|
end.
|
||||||
|
|
||||||
process_local_iq(From, To, IQ) ->
|
process_local_iq(From, To, #iq{type = get} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
process_iq_get(From, To, IQ_Rec);
|
||||||
set ->
|
process_local_iq(From, To, #iq{type = set} = IQ_Rec) ->
|
||||||
process_iq_set(From, To, IQ);
|
process_iq_set(From, To, IQ_Rec).
|
||||||
get ->
|
|
||||||
process_iq_get(From, To, IQ)
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
process_iq_get(From, To, IQ) ->
|
process_iq_get(From, To, IQ_Rec) ->
|
||||||
LUser = From#jid.lnode,
|
LUser = From#jid.lnode,
|
||||||
LServer = From#jid.ldomain,
|
LServer = From#jid.ldomain,
|
||||||
US = {LUser, LServer},
|
US = {LUser, LServer},
|
||||||
case catch ejabberd_hooks:run_fold(roster_get, To#jid.ldomain, [], [US]) of
|
case catch ejabberd_hooks:run_fold(roster_get, To#jid.ldomain, [], [US]) of
|
||||||
Items when is_list(Items) ->
|
Items when is_list(Items) ->
|
||||||
XItems = lists:map(fun item_to_xml/1, Items),
|
XItems = lists:map(fun item_to_xml/1, Items),
|
||||||
exmpp_iq:result(IQ, #xmlel{ns = ?NS_ROSTER, name = 'query',
|
Result = #xmlel{ns = ?NS_ROSTER, name = 'query',
|
||||||
children = XItems});
|
children = XItems},
|
||||||
|
exmpp_iq:result(IQ_Rec, Result);
|
||||||
_ ->
|
_ ->
|
||||||
exmpp_iq:error(IQ, 'internal-server-error')
|
exmpp_iq:error(IQ_Rec, 'internal-server-error')
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_user_roster(Acc, US) ->
|
get_user_roster(Acc, US) ->
|
||||||
@ -183,14 +179,14 @@ item_to_xml(Item) ->
|
|||||||
#xmlel{ns = ?NS_ROSTER, name = 'item', attrs = Attrs4, children = SubEls}.
|
#xmlel{ns = ?NS_ROSTER, name = 'item', attrs = Attrs4, children = SubEls}.
|
||||||
|
|
||||||
|
|
||||||
process_iq_set(From, To, IQ) ->
|
process_iq_set(From, To, #iq{payload = Request} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_request(IQ) of
|
case Request of
|
||||||
#xmlel{children = Els} ->
|
#xmlel{children = Els} ->
|
||||||
lists:foreach(fun(El) -> process_item_set(From, To, El) end, Els);
|
lists:foreach(fun(El) -> process_item_set(From, To, El) end, Els);
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
exmpp_iq:result(IQ).
|
exmpp_iq:result(IQ_Rec).
|
||||||
|
|
||||||
process_item_set(From, To, #xmlel{} = Item) ->
|
process_item_set(From, To, #xmlel{} = Item) ->
|
||||||
try
|
try
|
||||||
|
@ -84,11 +84,9 @@ start(Host, Opts) ->
|
|||||||
ejabberd_hooks:add(remove_user, Host,
|
ejabberd_hooks:add(remove_user, Host,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
||||||
% XXX OLD FORMAT: NS as string.
|
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_VCARD,
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_local, Host, atom_to_list(?NS_VCARD),
|
|
||||||
?MODULE, process_local_iq, IQDisc),
|
?MODULE, process_local_iq, IQDisc),
|
||||||
% XXX OLD FORMAT: NS as string.
|
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_VCARD,
|
||||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, atom_to_list(?NS_VCARD),
|
|
||||||
?MODULE, process_sm_iq, IQDisc),
|
?MODULE, process_sm_iq, IQDisc),
|
||||||
ejabberd_hooks:add(disco_sm_features, Host, ?MODULE, get_sm_features, 50),
|
ejabberd_hooks:add(disco_sm_features, Host, ?MODULE, get_sm_features, 50),
|
||||||
MyHost = gen_mod:get_opt_host(Host, Opts, "vjud.@HOST@"),
|
MyHost = gen_mod:get_opt_host(Host, Opts, "vjud.@HOST@"),
|
||||||
@ -126,12 +124,10 @@ loop(Host, ServerHost) ->
|
|||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
ejabberd_hooks:delete(remove_user, Host,
|
ejabberd_hooks:delete(remove_user, Host,
|
||||||
?MODULE, remove_user, 50),
|
?MODULE, remove_user, 50),
|
||||||
% XXX OLD FORMAT: NS as string.
|
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host,
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host,
|
||||||
atom_to_list(?NS_VCARD)),
|
?NS_VCARD),
|
||||||
% XXX OLD FORMAT: NS as string.
|
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host,
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host,
|
||||||
atom_to_list(?NS_VCARD)),
|
?NS_VCARD),
|
||||||
ejabberd_hooks:delete(disco_sm_features, Host, ?MODULE, get_sm_features, 50),
|
ejabberd_hooks:delete(disco_sm_features, Host, ?MODULE, get_sm_features, 50),
|
||||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||||
Proc ! stop,
|
Proc ! stop,
|
||||||
@ -155,15 +151,7 @@ get_sm_features(Acc, _From, _To, Node, _Lang) ->
|
|||||||
Acc
|
Acc
|
||||||
end.
|
end.
|
||||||
|
|
||||||
process_local_iq(_From, _To, IQ) ->
|
process_local_iq(_From, _To, #iq{type = get, lang = Lang} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
|
||||||
set ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed');
|
|
||||||
get ->
|
|
||||||
Lang = case exmpp_stanza:get_lang(IQ) of
|
|
||||||
undefined -> "";
|
|
||||||
L -> L
|
|
||||||
end,
|
|
||||||
Result = #xmlel{ns = ?NS_VCARD, name = 'vCard', children = [
|
Result = #xmlel{ns = ?NS_VCARD, name = 'vCard', children = [
|
||||||
exmpp_xml:set_cdata(#xmlel{ns = ?NS_VCARD, name = 'FN'},
|
exmpp_xml:set_cdata(#xmlel{ns = ?NS_VCARD, name = 'FN'},
|
||||||
"ejabberd"),
|
"ejabberd"),
|
||||||
@ -175,28 +163,18 @@ process_local_iq(_From, _To, IQ) ->
|
|||||||
exmpp_xml:set_cdata(#xmlel{ns = ?NS_VCARD, name = 'BDAY'},
|
exmpp_xml:set_cdata(#xmlel{ns = ?NS_VCARD, name = 'BDAY'},
|
||||||
"2002-11-16")
|
"2002-11-16")
|
||||||
]},
|
]},
|
||||||
exmpp_iq:result(IQ, Result)
|
exmpp_iq:result(IQ_Rec, Result);
|
||||||
end.
|
process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||||
|
|
||||||
|
|
||||||
process_sm_iq(From, To, IQ) ->
|
process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
||||||
case exmpp_iq:get_type(IQ) of
|
|
||||||
set ->
|
|
||||||
#jid{node = User, ldomain = LServer} = From,
|
|
||||||
case lists:member(LServer, ?MYHOSTS) of
|
|
||||||
true ->
|
|
||||||
set_vcard(User, LServer, exmpp_iq:get_request(IQ)),
|
|
||||||
exmpp_iq:result(IQ);
|
|
||||||
false ->
|
|
||||||
exmpp_iq:error(IQ, 'not-allowed')
|
|
||||||
end;
|
|
||||||
get ->
|
|
||||||
#jid{lnode = LUser, ldomain = LServer} = To,
|
#jid{lnode = LUser, ldomain = LServer} = To,
|
||||||
US = {LUser, LServer},
|
US = {LUser, LServer},
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
mnesia:read({vcard, US})
|
mnesia:read({vcard, US})
|
||||||
end,
|
end,
|
||||||
Els = case mnesia:transaction(F) of
|
[VCard | _] = case mnesia:transaction(F) of
|
||||||
{atomic, Rs} ->
|
{atomic, Rs} ->
|
||||||
lists:map(fun(R) ->
|
lists:map(fun(R) ->
|
||||||
case R#vcard.vcard of
|
case R#vcard.vcard of
|
||||||
@ -211,7 +189,15 @@ process_sm_iq(From, To, IQ) ->
|
|||||||
{aborted, _Reason} ->
|
{aborted, _Reason} ->
|
||||||
[]
|
[]
|
||||||
end,
|
end,
|
||||||
exmpp_iq:result(IQ, Els)
|
exmpp_iq:result(IQ_Rec, VCard);
|
||||||
|
process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) ->
|
||||||
|
#jid{node = User, ldomain = LServer} = From,
|
||||||
|
case lists:member(LServer, ?MYHOSTS) of
|
||||||
|
true ->
|
||||||
|
set_vcard(User, LServer, Request),
|
||||||
|
exmpp_iq:result(IQ_Rec);
|
||||||
|
false ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'not-allowed')
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_vcard(User, LServer, VCARD) ->
|
set_vcard(User, LServer, VCARD) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user