diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index f1cde0e0f..28c2901f6 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -292,7 +292,7 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) -> case lists:member(Server, ?MYHOSTS) of true -> Lang = case xml:get_attr_s(<<"xml:lang">>, Attrs) of - Lang1 when length(Lang1) =< 35 -> + Lang1 when size(Lang1) =< 35 -> %% As stated in BCP47, 4.4.1: %% Protocols or specifications that %% specify limited buffer sizes for diff --git a/src/ejabberd_router.erl b/src/ejabberd_router.erl index 8577d81ad..47a25fdd9 100644 --- a/src/ejabberd_router.erl +++ b/src/ejabberd_router.erl @@ -358,13 +358,13 @@ do_route(OrigFrom, OrigTo, OrigPacket) -> undefined -> case [R || R <- Rs, node(R#route.pid) == node()] of [] -> - R = lists:nth(erlang:phash(Value, str:len(Rs)), Rs), + R = lists:nth(erlang:phash(Value, length(Rs)), Rs), Pid = R#route.pid, if is_pid(Pid) -> Pid ! {route, From, To, Packet}; true -> drop end; LRs -> - R = lists:nth(erlang:phash(Value, str:len(LRs)), + R = lists:nth(erlang:phash(Value, length(LRs)), LRs), Pid = R#route.pid, case R#route.local_hint of @@ -375,7 +375,7 @@ do_route(OrigFrom, OrigTo, OrigPacket) -> end; _ -> SRs = lists:ukeysort(#route.local_hint, Rs), - R = lists:nth(erlang:phash(Value, str:len(SRs)), SRs), + R = lists:nth(erlang:phash(Value, length(SRs)), SRs), Pid = R#route.pid, if is_pid(Pid) -> Pid ! {route, From, To, Packet}; true -> drop diff --git a/src/ejabberd_socket.erl b/src/ejabberd_socket.erl index 189718a35..d06c48952 100644 --- a/src/ejabberd_socket.erl +++ b/src/ejabberd_socket.erl @@ -50,16 +50,14 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). --type sockmod() :: ejabberd_http_poll | ejabberd_bosh | - ejabberd_http_bind | ejabberd_http_bindjson | - ejabberd_http_ws | ejabberd_http_wsjson | +-type sockmod() :: ejabberd_http_poll | + ejabberd_http_bind | gen_tcp | tls | ejabberd_zlib. -type receiver() :: pid () | atom(). -type socket() :: pid() | inet:socket() | tls:tls_socket() | ejabberd_zlib:zlib_socket() | - ejabberd_bosh:bosh_socket() | - ejabberd_http_ws:ws_socket() | + ejabberd_http_bind:bind_socket() | ejabberd_http_poll:poll_socket(). -record(socket_state, {sockmod = gen_tcp :: sockmod(), diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl index 20efee7bc..78793bffb 100644 --- a/src/gen_iq_handler.erl +++ b/src/gen_iq_handler.erl @@ -101,7 +101,7 @@ handle(Host, Module, Function, Opts, From, To, IQ) -> process_iq(Host, Module, Function, From, To, IQ); {one_queue, Pid} -> Pid ! {process_iq, From, To, IQ}; {queues, Pids} -> - Pid = lists:nth(erlang:phash(now(), str:len(Pids)), + Pid = lists:nth(erlang:phash(now(), length(Pids)), Pids), Pid ! {process_iq, From, To, IQ}; parallel -> diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl index 43bb845fc..4f4dfbe84 100644 --- a/src/mod_carboncopy.erl +++ b/src/mod_carboncopy.erl @@ -35,8 +35,8 @@ stop/1]). %% Hooks: --export([user_send_packet/4, - user_receive_packet/5, +-export([user_send_packet/3, + user_receive_packet/4, iq_handler2/3, iq_handler1/3, remove_connection/4, @@ -127,15 +127,15 @@ iq_handler(From, _To, #iq{type=set, sub_el = #xmlel{name = Operation, children iq_handler(_From, _To, IQ, _CC)-> IQ#iq{type=error, sub_el = [?ERR_NOT_ALLOWED]}. -user_send_packet(_Debug, From, _To, Packet) -> +user_send_packet(From, _To, Packet) -> check_and_forward(From, Packet, sent). %% Only make carbon copies if the original destination was not a bare jid. %% If the original destination was a bare jid, the message is going to be delivered to all %% connected resources anyway. Avoid duplicate delivery. "XEP-0280 : 3.5 Receiving Messages" -user_receive_packet(_Debug, JID, _From, #jid{resource=Resource} = _To, Packet) when Resource /= <<>> -> +user_receive_packet(JID, _From, #jid{resource=Resource} = _To, Packet) when Resource /= <<>> -> check_and_forward(JID, Packet, received); -user_receive_packet(_Debug, _JID, _From, _To, _Packet) -> +user_receive_packet(_JID, _From, _To, _Packet) -> ok. % verifier si le trafic est local diff --git a/src/mod_offline.erl b/src/mod_offline.erl index a1bf3da04..4670b9b84 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -830,9 +830,10 @@ webadmin_user_parse_query(Acc, _Action, _User, _Server, count_offline_messages(LUser, LServer) -> Username = ejabberd_odbc:escape(LUser), case catch odbc_queries:count_records_where( - LServer, "spool", "where username='" ++ Username ++ "'") of + LServer, "spool", + <<"where username='", Username/binary, "'">>) of {selected, [_], [{Res}]} -> - list_to_integer(Res); + jlib:binary_to_integer(Res); _ -> 0 end. diff --git a/src/web/ejabberd_http.erl b/src/web/ejabberd_http.erl index be0af4157..25928c0af 100644 --- a/src/web/ejabberd_http.erl +++ b/src/web/ejabberd_http.erl @@ -822,25 +822,5 @@ old_integer_to_hex(I) when I >= 16 -> N = trunc(I / 16), old_integer_to_hex(N) ++ old_integer_to_hex(I rem 16). -% The following code is mostly taken from yaws_ssl.erl - -toupper(C) when C >= $a andalso C =< $z -> C - 32; -toupper(C) -> C. - -tolower(C) when C >= $A andalso C =< $Z -> C + 32; -tolower(C) -> C. - -normalize_header_name(Name) -> - normalize_header_name(Name, [], true). - -normalize_header_name(<<"">>, Acc, _) -> - iolist_to_binary(Acc); -normalize_header_name(<<"-", Rest/binary>>, Acc, _) -> - normalize_header_name(Rest, [Acc, "-"], true); -normalize_header_name(<>, Acc, true) -> - normalize_header_name(Rest, [Acc, toupper(C)], false); -normalize_header_name(<>, Acc, false) -> - normalize_header_name(Rest, [Acc, tolower(C)], false). - %% strip_spaces(String, left) -> %% drop_spaces(String);