Fixed problems detected with Xref and a few more Dialyzer (#277)

This commit is contained in:
Badlop 2019-08-28 16:09:37 +02:00
parent b8c42a4766
commit b7222c8828
4 changed files with 13 additions and 26 deletions

View File

@ -89,7 +89,7 @@ get_room_pid(Name, Host) ->
end.
get_room_config(Room_pid) ->
{ok, C} = gen_fsm:sync_send_all_state_event(Room_pid, get_config),
{ok, C} = p1_fsm:sync_send_all_state_event(Room_pid, get_config),
C.
@ -99,7 +99,7 @@ get_room_config(Room_pid) ->
show_dir_listing(DirName, LocalPath) ->
Header = io_lib:format("Name Last modified Size Description~n", []),
Address = io_lib:format("<address>ejabberd/~s Server</address>", [ejabberd_config:get_version()]),
Address = io_lib:format("<address>ejabberd/~s Server</address>", [ejabberd_config:version()]),
{ok, Listing} = file:list_dir(DirName),
Listing2 = lists:sort(Listing),

View File

@ -135,7 +135,7 @@ check_member_option(Host, Element, Option) ->
AllowedValues -> lists:member(Element, AllowedValues)
end.
ip_matches({Address, Port}, AllowedValues) ->
ip_matches({Address, _Port}, AllowedValues) ->
lists:any(fun({Net, Mask}) ->
acl:match_acl(global, {ip,{Net,Mask}}, #{ip => Address})
end,

View File

@ -142,7 +142,7 @@ parse1_command(<<"executeshe">>, {_, _, Command}, Node) ->
execute(Type, Node, C) ->
GL = group_leader(),
Filename = "temp" ++ io_lib:format("~p", [random:uniform()*10000]),
Filename = <<"temp", (p1_rand:get_string())/binary>>,
{ok, File} = file:open(Filename, [write]),
group_leader(File, self()),
Res = case Type of

View File

@ -498,25 +498,12 @@ send_message_unregistered(To, Host, Lang) ->
send_headline(Host, To, Subject, Body).
send_headline(Host, To, Subject, Body) ->
ejabberd_router:route(
jid:make(<<"">>, Host, <<"">>),
To,
#xmlel{
name = <<"message">>,
attrs = [{<<"type">>, <<"headline">>}],
children = [
#xmlel{
name = <<"subject">>,
attrs = [],
children = [{xmlcdata, Subject}]
},
#xmlel{
name = <<"body">>,
attrs = [],
children = [{xmlcdata, Body}]
}
]
}).
Packet = #message{type = headline,
from = jid:make(Host),
to = To,
body = xmpp:mk_text(Body),
subject = xmpp:mk_text(Subject)},
ejabberd_router:route(Packet).
unregister_webpresence(From, Host, Lang) ->
remove_user(From#jid.luser, From#jid.lserver),
@ -805,9 +792,9 @@ show_presence({avatar, WP, LUser, LServer}) ->
IQ = #iq{type = get, from = JID, to = JID},
IQr = Module:Function(IQ),
[VCard] = IQr#iq.sub_els,
Mime = fxml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"TYPE">>}, cdata]),
BinVal = fxml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"BINVAL">>}, cdata]),
Photo = misc:decode_base64(BinVal),
VCard2 = xmpp:decode(VCard),
Mime = (VCard2#vcard_temp.photo)#vcard_photo.type,
Photo = (VCard2#vcard_temp.photo)#vcard_photo.binval,
{200, [{"Content-Type", Mime}], Photo};
show_presence({image_example, Theme, Show}) ->