Drop exmpp usage from mod_admin_extra

This commit is contained in:
Paweł Chmielowski 2015-04-01 15:44:49 +02:00
parent 305b281c15
commit cf3b4dbc7b
1 changed files with 1 additions and 14 deletions

View File

@ -333,7 +333,7 @@ commands() ->
args = [{user, binary}, {host, binary}, {name, binary}, {subname, binary}],
result = {content, string}},
#ejabberd_commands{name = get_vcard2_multi, tags = [vcard],
desc = "Get multiple contents from a vCard field (requires exmpp installed)",
desc = "Get multiple contents from a vCard field",
longdesc = Vcard2FieldsString ++ "\n\n" ++ Vcard1FieldsString ++ "\n" ++ VcardXEP,
module = ?MODULE, function = get_vcard_multi,
args = [{user, binary}, {host, binary}, {name, binary}, {subname, binary}],
@ -997,21 +997,8 @@ get_vcard([Data], A1) ->
get_subtag(A1, Data).
get_subtag(Xmlelement, Name) ->
case code:ensure_loaded(exmpp_xml) of
{error, _} ->
[get_subtag_xml(Xmlelement, Name)];
{module, exmpp_xml} ->
get_subtag_exmpp(Xmlelement, Name)
end.
get_subtag_xml(Xmlelement, Name) ->
xml:get_subtag(Xmlelement, Name).
get_subtag_exmpp(Xmlelement, Name) ->
Xmlel = exmpp_xml:xmlelement_to_xmlel(Xmlelement),
XmlelList = exmpp_xml:get_elements(Xmlel, Name),
[exmpp_xml:xmlel_to_xmlelement(Xmlel2) || Xmlel2 <- XmlelList].
set_vcard_content(User, Server, Data, SomeContent) ->
ContentList = case SomeContent of
[Bin | _] when is_binary(Bin) -> SomeContent;