Fixed problems detected with Xref and a few more Dialyzer (#277)
This commit is contained in:
parent
b8c42a4766
commit
b7222c8828
|
@ -89,7 +89,7 @@ get_room_pid(Name, Host) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_room_config(Room_pid) ->
|
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.
|
C.
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ get_room_config(Room_pid) ->
|
||||||
|
|
||||||
show_dir_listing(DirName, LocalPath) ->
|
show_dir_listing(DirName, LocalPath) ->
|
||||||
Header = io_lib:format("Name Last modified Size Description~n", []),
|
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),
|
{ok, Listing} = file:list_dir(DirName),
|
||||||
Listing2 = lists:sort(Listing),
|
Listing2 = lists:sort(Listing),
|
||||||
|
|
|
@ -135,7 +135,7 @@ check_member_option(Host, Element, Option) ->
|
||||||
AllowedValues -> lists:member(Element, AllowedValues)
|
AllowedValues -> lists:member(Element, AllowedValues)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
ip_matches({Address, Port}, AllowedValues) ->
|
ip_matches({Address, _Port}, AllowedValues) ->
|
||||||
lists:any(fun({Net, Mask}) ->
|
lists:any(fun({Net, Mask}) ->
|
||||||
acl:match_acl(global, {ip,{Net,Mask}}, #{ip => Address})
|
acl:match_acl(global, {ip,{Net,Mask}}, #{ip => Address})
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -142,7 +142,7 @@ parse1_command(<<"executeshe">>, {_, _, Command}, Node) ->
|
||||||
|
|
||||||
execute(Type, Node, C) ->
|
execute(Type, Node, C) ->
|
||||||
GL = group_leader(),
|
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]),
|
{ok, File} = file:open(Filename, [write]),
|
||||||
group_leader(File, self()),
|
group_leader(File, self()),
|
||||||
Res = case Type of
|
Res = case Type of
|
||||||
|
|
|
@ -498,25 +498,12 @@ send_message_unregistered(To, Host, Lang) ->
|
||||||
send_headline(Host, To, Subject, Body).
|
send_headline(Host, To, Subject, Body).
|
||||||
|
|
||||||
send_headline(Host, To, Subject, Body) ->
|
send_headline(Host, To, Subject, Body) ->
|
||||||
ejabberd_router:route(
|
Packet = #message{type = headline,
|
||||||
jid:make(<<"">>, Host, <<"">>),
|
from = jid:make(Host),
|
||||||
To,
|
to = To,
|
||||||
#xmlel{
|
body = xmpp:mk_text(Body),
|
||||||
name = <<"message">>,
|
subject = xmpp:mk_text(Subject)},
|
||||||
attrs = [{<<"type">>, <<"headline">>}],
|
ejabberd_router:route(Packet).
|
||||||
children = [
|
|
||||||
#xmlel{
|
|
||||||
name = <<"subject">>,
|
|
||||||
attrs = [],
|
|
||||||
children = [{xmlcdata, Subject}]
|
|
||||||
},
|
|
||||||
#xmlel{
|
|
||||||
name = <<"body">>,
|
|
||||||
attrs = [],
|
|
||||||
children = [{xmlcdata, Body}]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}).
|
|
||||||
|
|
||||||
unregister_webpresence(From, Host, Lang) ->
|
unregister_webpresence(From, Host, Lang) ->
|
||||||
remove_user(From#jid.luser, From#jid.lserver),
|
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},
|
IQ = #iq{type = get, from = JID, to = JID},
|
||||||
IQr = Module:Function(IQ),
|
IQr = Module:Function(IQ),
|
||||||
[VCard] = IQr#iq.sub_els,
|
[VCard] = IQr#iq.sub_els,
|
||||||
Mime = fxml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"TYPE">>}, cdata]),
|
VCard2 = xmpp:decode(VCard),
|
||||||
BinVal = fxml:get_path_s(VCard, [{elem, <<"PHOTO">>}, {elem, <<"BINVAL">>}, cdata]),
|
Mime = (VCard2#vcard_temp.photo)#vcard_photo.type,
|
||||||
Photo = misc:decode_base64(BinVal),
|
Photo = (VCard2#vcard_temp.photo)#vcard_photo.binval,
|
||||||
{200, [{"Content-Type", Mime}], Photo};
|
{200, [{"Content-Type", Mime}], Photo};
|
||||||
|
|
||||||
show_presence({image_example, Theme, Show}) ->
|
show_presence({image_example, Theme, Show}) ->
|
||||||
|
|
Loading…
Reference in New Issue