Update mod_webpresence to work with ejabberd 16.02
This commit is contained in:
parent
02759c6aae
commit
32fd4c4d9c
|
@ -184,7 +184,7 @@ do_route(Host, ServerHost, Access, From, To, Packet, BaseURL) ->
|
||||||
do_route1(Host, From, To, Packet, BaseURL);
|
do_route1(Host, From, To, Packet, BaseURL);
|
||||||
_ ->
|
_ ->
|
||||||
#xmlel{attrs = Attrs} = Packet,
|
#xmlel{attrs = Attrs} = Packet,
|
||||||
Lang = xml:get_attr_s(<<"xml:lang">>, Attrs),
|
Lang = fxml:get_attr_s(<<"xml:lang">>, Attrs),
|
||||||
ErrText = <<"Access denied by service policy">>,
|
ErrText = <<"Access denied by service policy">>,
|
||||||
Err = jlib:make_error_reply(Packet, ?ERRT_FORBIDDEN(Lang, ErrText)),
|
Err = jlib:make_error_reply(Packet, ?ERRT_FORBIDDEN(Lang, ErrText)),
|
||||||
ejabberd_router:route(To, From, Err)
|
ejabberd_router:route(To, From, Err)
|
||||||
|
@ -194,7 +194,7 @@ do_route1(Host, From, To, Packet, BaseURL) ->
|
||||||
#xmlel{name = Name, attrs = Attrs} = Packet,
|
#xmlel{name = Name, attrs = Attrs} = Packet,
|
||||||
case Name of
|
case Name of
|
||||||
<<"iq">> -> do_route1_iq(Host, From, To, Packet, BaseURL, jlib:iq_query_info(Packet));
|
<<"iq">> -> do_route1_iq(Host, From, To, Packet, BaseURL, jlib:iq_query_info(Packet));
|
||||||
_ -> case xml:get_attr_s(<<"type">>, Attrs) of
|
_ -> case fxml:get_attr_s(<<"type">>, Attrs) of
|
||||||
<<"error">> -> ok;
|
<<"error">> -> ok;
|
||||||
<<"result">> -> ok;
|
<<"result">> -> ok;
|
||||||
_ -> Err = jlib:make_error_reply(Packet, ?ERR_ITEM_NOT_FOUND),
|
_ -> Err = jlib:make_error_reply(Packet, ?ERR_ITEM_NOT_FOUND),
|
||||||
|
@ -544,7 +544,7 @@ get_attr(Attr, XData, Default) ->
|
||||||
|
|
||||||
process_iq_register_set(From, SubEl, Host, BaseURL, Lang) ->
|
process_iq_register_set(From, SubEl, Host, BaseURL, Lang) ->
|
||||||
#xmlel{name = _, attrs = _, children = Els} = SubEl,
|
#xmlel{name = _, attrs = _, children = Els} = SubEl,
|
||||||
case xml:get_subtag(SubEl, <<"remove">>) of
|
case fxml:get_subtag(SubEl, <<"remove">>) of
|
||||||
false -> case catch process_iq_register_set2(From, Els, Host, BaseURL, Lang) of
|
false -> case catch process_iq_register_set2(From, Els, Host, BaseURL, Lang) of
|
||||||
{'EXIT', _} -> {error, ?ERR_BAD_REQUEST};
|
{'EXIT', _} -> {error, ?ERR_BAD_REQUEST};
|
||||||
R -> R
|
R -> R
|
||||||
|
@ -559,8 +559,8 @@ process_iq_register_set2(From, Els, Host, BaseURL, Lang) ->
|
||||||
attrs = _Attrs1,
|
attrs = _Attrs1,
|
||||||
children = _Els1
|
children = _Els1
|
||||||
} = XEl
|
} = XEl
|
||||||
] = xml:remove_cdata(Els),
|
] = fxml:remove_cdata(Els),
|
||||||
case {xml:get_tag_attr_s(<<"xmlns">>, XEl), xml:get_tag_attr_s(<<"type">>, XEl)} of
|
case {fxml:get_tag_attr_s(<<"xmlns">>, XEl), fxml:get_tag_attr_s(<<"type">>, XEl)} of
|
||||||
{?NS_XDATA, <<"cancel">>} ->
|
{?NS_XDATA, <<"cancel">>} ->
|
||||||
{result, []};
|
{result, []};
|
||||||
{?NS_XDATA, <<"submit">>} ->
|
{?NS_XDATA, <<"submit">>} ->
|
||||||
|
@ -855,7 +855,7 @@ show_presence({image_res, WP, LUser, LServer, Theme, LResource}) ->
|
||||||
|
|
||||||
show_presence({xml, WP, LUser, LServer, Show_us}) ->
|
show_presence({xml, WP, LUser, LServer, Show_us}) ->
|
||||||
true = WP#webpresence.xml,
|
true = WP#webpresence.xml,
|
||||||
Presence_xml = xml:element_to_binary(get_presences({xml, LUser, LServer, Show_us})),
|
Presence_xml = fxml:element_to_binary(get_presences({xml, LUser, LServer, Show_us})),
|
||||||
{200, [{"Content-Type", "text/xml; charset=utf-8"}], ?BC([?XML_HEADER, Presence_xml])};
|
{200, [{"Content-Type", "text/xml; charset=utf-8"}], ?BC([?XML_HEADER, Presence_xml])};
|
||||||
|
|
||||||
show_presence({js, WP, LUser, LServer, Show_us, Lang, Q}) ->
|
show_presence({js, WP, LUser, LServer, Show_us, Lang, Q}) ->
|
||||||
|
@ -881,8 +881,8 @@ show_presence({avatar, WP, LUser, LServer}) ->
|
||||||
IQ = #iq{type = get, xmlns = ?NS_VCARD},
|
IQ = #iq{type = get, xmlns = ?NS_VCARD},
|
||||||
IQr = Module:Function(JID, JID, IQ),
|
IQr = Module:Function(JID, JID, IQ),
|
||||||
[VCard] = IQr#iq.sub_el,
|
[VCard] = IQr#iq.sub_el,
|
||||||
Mime = xml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"TYPE">>}, cdata]),
|
Mime = fxml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"TYPE">>}, cdata]),
|
||||||
BinVal = xml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"BINVAL">>}, cdata]),
|
BinVal = fxml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"BINVAL">>}, cdata]),
|
||||||
Photo = jlib:decode_base64(BinVal),
|
Photo = jlib:decode_base64(BinVal),
|
||||||
{200, [{"Content-Type", Mime}], Photo};
|
{200, [{"Content-Type", Mime}], Photo};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue