mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Replace TYPE/1 with is_TYPE/1 (EJAB-922)
SVN Revision: 2057
This commit is contained in:
parent
69349925a3
commit
1d3947c0da
11
ChangeLog
11
ChangeLog
@ -1,5 +1,16 @@
|
|||||||
2009-05-06 Badlop <badlop@process-one.net>
|
2009-05-06 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/ejabberd_c2s.erl: Replace TYPE/1 with is_TYPE/1 (EJAB-922)
|
||||||
|
* src/ejabberd_logger_h.erl:
|
||||||
|
* src/ejabberd_s2s.erl:
|
||||||
|
* src/eldap/eldap.erl:
|
||||||
|
* src/mod_offline.erl:
|
||||||
|
* src/mod_offline_odbc.erl:
|
||||||
|
* src/mod_roster.erl:
|
||||||
|
* src/odbc/odbc_queries.erl:
|
||||||
|
* src/p1_fsm.erl:
|
||||||
|
* src/xml.erl:
|
||||||
|
|
||||||
* src/Makefile.in: Prevent Erlang R13B compilation warning:
|
* src/Makefile.in: Prevent Erlang R13B compilation warning:
|
||||||
behaviour X undefined (EJAB-920)
|
behaviour X undefined (EJAB-920)
|
||||||
|
|
||||||
|
@ -1809,7 +1809,7 @@ resend_offline_messages(#state{user = UserB,
|
|||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
[],
|
[],
|
||||||
[UserB, ServerB]) of
|
[UserB, ServerB]) of
|
||||||
Rs when list(Rs) ->
|
Rs when is_list(Rs) ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun({route,
|
fun({route,
|
||||||
From, To, Packet}) ->
|
From, To, Packet}) ->
|
||||||
|
@ -117,7 +117,7 @@ reopen_log() ->
|
|||||||
write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) ->
|
write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) ->
|
||||||
T = write_time(Time),
|
T = write_time(Time),
|
||||||
case catch io_lib:format(add_node(Format,Pid), Args) of
|
case catch io_lib:format(add_node(Format,Pid), Args) of
|
||||||
S when list(S) ->
|
S when is_list(S) ->
|
||||||
file:write(Fd, io_lib:format(T ++ S, []));
|
file:write(Fd, io_lib:format(T ++ S, []));
|
||||||
_ ->
|
_ ->
|
||||||
F = add_node("ERROR: ~p - ~p~n", Pid),
|
F = add_node("ERROR: ~p - ~p~n", Pid),
|
||||||
@ -126,7 +126,7 @@ write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) ->
|
|||||||
write_event(Fd, {Time, {emulator, _GL, Chars}}) ->
|
write_event(Fd, {Time, {emulator, _GL, Chars}}) ->
|
||||||
T = write_time(Time),
|
T = write_time(Time),
|
||||||
case catch io_lib:format(Chars, []) of
|
case catch io_lib:format(Chars, []) of
|
||||||
S when list(S) ->
|
S when is_list(S) ->
|
||||||
file:write(Fd, io_lib:format(T ++ S, []));
|
file:write(Fd, io_lib:format(T ++ S, []));
|
||||||
_ ->
|
_ ->
|
||||||
file:write(Fd, io_lib:format(T ++ "ERROR: ~p ~n", [Chars]))
|
file:write(Fd, io_lib:format(T ++ "ERROR: ~p ~n", [Chars]))
|
||||||
@ -145,7 +145,7 @@ write_event(Fd, {Time, {info_report, _GL, {Pid, std_info, Rep}}}) ->
|
|||||||
write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) ->
|
write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) ->
|
||||||
T = write_time(Time, "INFO REPORT"),
|
T = write_time(Time, "INFO REPORT"),
|
||||||
case catch io_lib:format(add_node(Format,Pid), Args) of
|
case catch io_lib:format(add_node(Format,Pid), Args) of
|
||||||
S when list(S) ->
|
S when is_list(S) ->
|
||||||
file:write(Fd, io_lib:format(T ++ S, []));
|
file:write(Fd, io_lib:format(T ++ S, []));
|
||||||
_ ->
|
_ ->
|
||||||
F = add_node("ERROR: ~p - ~p~n", Pid),
|
F = add_node("ERROR: ~p - ~p~n", Pid),
|
||||||
@ -154,7 +154,7 @@ write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) ->
|
|||||||
write_event(_, _) ->
|
write_event(_, _) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
format_report(Rep) when list(Rep) ->
|
format_report(Rep) when is_list(Rep) ->
|
||||||
case string_p(Rep) of
|
case string_p(Rep) of
|
||||||
true ->
|
true ->
|
||||||
io_lib:format("~s~n",[Rep]);
|
io_lib:format("~s~n",[Rep]);
|
||||||
@ -171,7 +171,7 @@ format_rep([Other|Rep]) ->
|
|||||||
format_rep(_) ->
|
format_rep(_) ->
|
||||||
[].
|
[].
|
||||||
|
|
||||||
add_node(X, Pid) when atom(X) ->
|
add_node(X, Pid) when is_atom(X) ->
|
||||||
add_node(atom_to_list(X), Pid);
|
add_node(atom_to_list(X), Pid);
|
||||||
add_node(X, Pid) when node(Pid) /= node() ->
|
add_node(X, Pid) when node(Pid) /= node() ->
|
||||||
lists:concat([X,"** at node ",node(Pid)," **~n"]);
|
lists:concat([X,"** at node ",node(Pid)," **~n"]);
|
||||||
@ -183,7 +183,7 @@ string_p([]) ->
|
|||||||
string_p(Term) ->
|
string_p(Term) ->
|
||||||
string_p1(Term).
|
string_p1(Term).
|
||||||
|
|
||||||
string_p1([H|T]) when integer(H), H >= $\s, H < 255 ->
|
string_p1([H|T]) when is_integer(H), H >= $\s, H < 255 ->
|
||||||
string_p1(T);
|
string_p1(T);
|
||||||
string_p1([$\n|T]) -> string_p1(T);
|
string_p1([$\n|T]) -> string_p1(T);
|
||||||
string_p1([$\r|T]) -> string_p1(T);
|
string_p1([$\r|T]) -> string_p1(T);
|
||||||
@ -192,7 +192,7 @@ string_p1([$\v|T]) -> string_p1(T);
|
|||||||
string_p1([$\b|T]) -> string_p1(T);
|
string_p1([$\b|T]) -> string_p1(T);
|
||||||
string_p1([$\f|T]) -> string_p1(T);
|
string_p1([$\f|T]) -> string_p1(T);
|
||||||
string_p1([$\e|T]) -> string_p1(T);
|
string_p1([$\e|T]) -> string_p1(T);
|
||||||
string_p1([H|T]) when list(H) ->
|
string_p1([H|T]) when is_list(H) ->
|
||||||
case string_p1(H) of
|
case string_p1(H) of
|
||||||
true -> string_p1(T);
|
true -> string_p1(T);
|
||||||
_ -> false
|
_ -> false
|
||||||
|
@ -277,7 +277,7 @@ do_route(From, To, Packet) ->
|
|||||||
?DEBUG("s2s manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
|
?DEBUG("s2s manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
|
||||||
[From, To, Packet, 8]),
|
[From, To, Packet, 8]),
|
||||||
case find_connection(From, To) of
|
case find_connection(From, To) of
|
||||||
{atomic, Pid} when pid(Pid) ->
|
{atomic, Pid} when is_pid(Pid) ->
|
||||||
?DEBUG("sending to process ~p~n", [Pid]),
|
?DEBUG("sending to process ~p~n", [Pid]),
|
||||||
NewPacket1 = exmpp_stanza:set_sender(Packet, From),
|
NewPacket1 = exmpp_stanza:set_sender(Packet, From),
|
||||||
NewPacket = exmpp_stanza:set_recipient(NewPacket1, To),
|
NewPacket = exmpp_stanza:set_recipient(NewPacket1, To),
|
||||||
|
@ -143,14 +143,14 @@ close(Handle) ->
|
|||||||
%%% {"telephoneNumber", ["545 555 00"]}]
|
%%% {"telephoneNumber", ["545 555 00"]}]
|
||||||
%%% )
|
%%% )
|
||||||
%%% --------------------------------------------------------------------
|
%%% --------------------------------------------------------------------
|
||||||
add(Handle, Entry, Attributes) when list(Entry),list(Attributes) ->
|
add(Handle, Entry, Attributes) when is_list(Entry), is_list(Attributes) ->
|
||||||
Handle1 = get_handle(Handle),
|
Handle1 = get_handle(Handle),
|
||||||
gen_fsm:sync_send_event(Handle1, {add, Entry, add_attrs(Attributes)},
|
gen_fsm:sync_send_event(Handle1, {add, Entry, add_attrs(Attributes)},
|
||||||
?CALL_TIMEOUT).
|
?CALL_TIMEOUT).
|
||||||
|
|
||||||
%%% Do sanity check !
|
%%% Do sanity check !
|
||||||
add_attrs(Attrs) ->
|
add_attrs(Attrs) ->
|
||||||
F = fun({Type,Vals}) when list(Type),list(Vals) ->
|
F = fun({Type,Vals}) when is_list(Type), is_list(Vals) ->
|
||||||
%% Confused ? Me too... :-/
|
%% Confused ? Me too... :-/
|
||||||
{'AddRequest_attributes',Type, Vals}
|
{'AddRequest_attributes',Type, Vals}
|
||||||
end,
|
end,
|
||||||
@ -169,7 +169,7 @@ add_attrs(Attrs) ->
|
|||||||
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com"
|
%%% "cn=Bill Valentine, ou=people, o=Bluetail AB, dc=bluetail, dc=com"
|
||||||
%%% )
|
%%% )
|
||||||
%%% --------------------------------------------------------------------
|
%%% --------------------------------------------------------------------
|
||||||
delete(Handle, Entry) when list(Entry) ->
|
delete(Handle, Entry) when is_list(Entry) ->
|
||||||
Handle1 = get_handle(Handle),
|
Handle1 = get_handle(Handle),
|
||||||
gen_fsm:sync_send_event(Handle1, {delete, Entry}, ?CALL_TIMEOUT).
|
gen_fsm:sync_send_event(Handle1, {delete, Entry}, ?CALL_TIMEOUT).
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ delete(Handle, Entry) when list(Entry) ->
|
|||||||
%%% add("description", ["LDAP hacker"])]
|
%%% add("description", ["LDAP hacker"])]
|
||||||
%%% )
|
%%% )
|
||||||
%%% --------------------------------------------------------------------
|
%%% --------------------------------------------------------------------
|
||||||
modify(Handle, Object, Mods) when list(Object), list(Mods) ->
|
modify(Handle, Object, Mods) when is_list(Object), is_list(Mods) ->
|
||||||
Handle1 = get_handle(Handle),
|
Handle1 = get_handle(Handle),
|
||||||
gen_fsm:sync_send_event(Handle1, {modify, Object, Mods}, ?CALL_TIMEOUT).
|
gen_fsm:sync_send_event(Handle1, {modify, Object, Mods}, ?CALL_TIMEOUT).
|
||||||
|
|
||||||
@ -193,9 +193,9 @@ modify(Handle, Object, Mods) when list(Object), list(Mods) ->
|
|||||||
%%% Example:
|
%%% Example:
|
||||||
%%% replace("telephoneNumber", ["555 555 00"])
|
%%% replace("telephoneNumber", ["555 555 00"])
|
||||||
%%%
|
%%%
|
||||||
mod_add(Type, Values) when list(Type), list(Values) -> m(add, Type, Values).
|
mod_add(Type, Values) when is_list(Type), is_list(Values) -> m(add, Type, Values).
|
||||||
mod_delete(Type, Values) when list(Type), list(Values) -> m(delete, Type, Values).
|
mod_delete(Type, Values) when is_list(Type), is_list(Values) -> m(delete, Type, Values).
|
||||||
mod_replace(Type, Values) when list(Type), list(Values) -> m(replace, Type, Values).
|
mod_replace(Type, Values) when is_list(Type), is_list(Values) -> m(replace, Type, Values).
|
||||||
|
|
||||||
m(Operation, Type, Values) ->
|
m(Operation, Type, Values) ->
|
||||||
#'ModifyRequest_modification_SEQOF'{
|
#'ModifyRequest_modification_SEQOF'{
|
||||||
@ -217,7 +217,7 @@ m(Operation, Type, Values) ->
|
|||||||
%%% )
|
%%% )
|
||||||
%%% --------------------------------------------------------------------
|
%%% --------------------------------------------------------------------
|
||||||
modify_dn(Handle, Entry, NewRDN, DelOldRDN, NewSup)
|
modify_dn(Handle, Entry, NewRDN, DelOldRDN, NewSup)
|
||||||
when list(Entry),list(NewRDN),atom(DelOldRDN),list(NewSup) ->
|
when is_list(Entry), is_list(NewRDN), is_atom(DelOldRDN), is_list(NewSup) ->
|
||||||
Handle1 = get_handle(Handle),
|
Handle1 = get_handle(Handle),
|
||||||
gen_fsm:sync_send_event(
|
gen_fsm:sync_send_event(
|
||||||
Handle1,
|
Handle1,
|
||||||
@ -234,7 +234,7 @@ modify_dn(Handle, Entry, NewRDN, DelOldRDN, NewSup)
|
|||||||
%%% "secret")
|
%%% "secret")
|
||||||
%%% --------------------------------------------------------------------
|
%%% --------------------------------------------------------------------
|
||||||
bind(Handle, RootDN, Passwd)
|
bind(Handle, RootDN, Passwd)
|
||||||
when list(RootDN),list(Passwd) ->
|
when is_list(RootDN), is_list(Passwd) ->
|
||||||
Handle1 = get_handle(Handle),
|
Handle1 = get_handle(Handle),
|
||||||
gen_fsm:sync_send_event(Handle1, {bind, RootDN, Passwd}, ?CALL_TIMEOUT).
|
gen_fsm:sync_send_event(Handle1, {bind, RootDN, Passwd}, ?CALL_TIMEOUT).
|
||||||
|
|
||||||
@ -270,13 +270,13 @@ optional(Value) -> Value.
|
|||||||
%%% []}}
|
%%% []}}
|
||||||
%%%
|
%%%
|
||||||
%%% --------------------------------------------------------------------
|
%%% --------------------------------------------------------------------
|
||||||
search(Handle, A) when record(A, eldap_search) ->
|
search(Handle, A) when is_record(A, eldap_search) ->
|
||||||
call_search(Handle, A);
|
call_search(Handle, A);
|
||||||
search(Handle, L) when list(L) ->
|
search(Handle, L) when is_list(L) ->
|
||||||
case catch parse_search_args(L) of
|
case catch parse_search_args(L) of
|
||||||
{error, Emsg} -> {error, Emsg};
|
{error, Emsg} -> {error, Emsg};
|
||||||
{'EXIT', Emsg} -> {error, Emsg};
|
{'EXIT', Emsg} -> {error, Emsg};
|
||||||
A when record(A, eldap_search) -> call_search(Handle, A)
|
A when is_record(A, eldap_search) -> call_search(Handle, A)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
call_search(Handle, A) ->
|
call_search(Handle, A) ->
|
||||||
@ -296,7 +296,7 @@ parse_search_args([{attributes, Attrs}|T],A) ->
|
|||||||
parse_search_args(T,A#eldap_search{attributes = Attrs});
|
parse_search_args(T,A#eldap_search{attributes = Attrs});
|
||||||
parse_search_args([{types_only, TypesOnly}|T],A) ->
|
parse_search_args([{types_only, TypesOnly}|T],A) ->
|
||||||
parse_search_args(T,A#eldap_search{types_only = TypesOnly});
|
parse_search_args(T,A#eldap_search{types_only = TypesOnly});
|
||||||
parse_search_args([{timeout, Timeout}|T],A) when integer(Timeout) ->
|
parse_search_args([{timeout, Timeout}|T],A) when is_integer(Timeout) ->
|
||||||
parse_search_args(T,A#eldap_search{timeout = Timeout});
|
parse_search_args(T,A#eldap_search{timeout = Timeout});
|
||||||
parse_search_args([{limit, Limit}|T],A) when is_integer(Limit) ->
|
parse_search_args([{limit, Limit}|T],A) when is_integer(Limit) ->
|
||||||
parse_search_args(T,A#eldap_search{limit = Limit});
|
parse_search_args(T,A#eldap_search{limit = Limit});
|
||||||
@ -315,9 +315,9 @@ wholeSubtree() -> wholeSubtree.
|
|||||||
%%%
|
%%%
|
||||||
%%% Boolean filter operations
|
%%% Boolean filter operations
|
||||||
%%%
|
%%%
|
||||||
'and'(ListOfFilters) when list(ListOfFilters) -> {'and',ListOfFilters}.
|
'and'(ListOfFilters) when is_list(ListOfFilters) -> {'and',ListOfFilters}.
|
||||||
'or'(ListOfFilters) when list(ListOfFilters) -> {'or', ListOfFilters}.
|
'or'(ListOfFilters) when is_list(ListOfFilters) -> {'or', ListOfFilters}.
|
||||||
'not'(Filter) when tuple(Filter) -> {'not',Filter}.
|
'not'(Filter) when is_tuple(Filter) -> {'not',Filter}.
|
||||||
|
|
||||||
%%%
|
%%%
|
||||||
%%% The following Filter parameters consist of an attribute
|
%%% The following Filter parameters consist of an attribute
|
||||||
@ -335,7 +335,7 @@ av_assert(Desc, Value) ->
|
|||||||
%%%
|
%%%
|
||||||
%%% Filter to check for the presence of an attribute
|
%%% Filter to check for the presence of an attribute
|
||||||
%%%
|
%%%
|
||||||
present(Attribute) when list(Attribute) ->
|
present(Attribute) when is_list(Attribute) ->
|
||||||
{present, Attribute}.
|
{present, Attribute}.
|
||||||
|
|
||||||
|
|
||||||
@ -354,15 +354,15 @@ present(Attribute) when list(Attribute) ->
|
|||||||
%%% Example: substrings("sn",[{initial,"To"},{any,"kv"},{final,"st"}])
|
%%% Example: substrings("sn",[{initial,"To"},{any,"kv"},{final,"st"}])
|
||||||
%%% will match entries containing: 'sn: Tornkvist'
|
%%% will match entries containing: 'sn: Tornkvist'
|
||||||
%%%
|
%%%
|
||||||
substrings(Type, SubStr) when list(Type), list(SubStr) ->
|
substrings(Type, SubStr) when is_list(Type), is_list(SubStr) ->
|
||||||
Ss = {'SubstringFilter_substrings',v_substr(SubStr)},
|
Ss = {'SubstringFilter_substrings',v_substr(SubStr)},
|
||||||
{substrings,#'SubstringFilter'{type = Type,
|
{substrings,#'SubstringFilter'{type = Type,
|
||||||
substrings = Ss}}.
|
substrings = Ss}}.
|
||||||
|
|
||||||
|
|
||||||
get_handle(Pid) when pid(Pid) -> Pid;
|
get_handle(Pid) when is_pid(Pid) -> Pid;
|
||||||
get_handle(Atom) when atom(Atom) -> Atom;
|
get_handle(Atom) when is_atom(Atom) -> Atom;
|
||||||
get_handle(Name) when list(Name) -> list_to_atom("eldap_" ++ Name).
|
get_handle(Name) when is_list(Name) -> list_to_atom("eldap_" ++ Name).
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%% Callback functions from gen_fsm
|
%%% Callback functions from gen_fsm
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
@ -835,7 +835,7 @@ cmd_timeout(Timer, Id, S) ->
|
|||||||
polish(Entries) ->
|
polish(Entries) ->
|
||||||
polish(Entries, [], []).
|
polish(Entries, [], []).
|
||||||
|
|
||||||
polish([H|T], Res, Ref) when record(H, 'SearchResultEntry') ->
|
polish([H|T], Res, Ref) when is_record(H, 'SearchResultEntry') ->
|
||||||
ObjectName = H#'SearchResultEntry'.objectName,
|
ObjectName = H#'SearchResultEntry'.objectName,
|
||||||
F = fun({_,A,V}) -> {A,V} end,
|
F = fun({_,A,V}) -> {A,V} end,
|
||||||
Attrs = lists:map(F, H#'SearchResultEntry'.attributes),
|
Attrs = lists:map(F, H#'SearchResultEntry'.attributes),
|
||||||
@ -913,7 +913,7 @@ v_filter({greaterOrEqual,AV}) -> {greaterOrEqual,AV};
|
|||||||
v_filter({lessOrEqual,AV}) -> {lessOrEqual,AV};
|
v_filter({lessOrEqual,AV}) -> {lessOrEqual,AV};
|
||||||
v_filter({approxMatch,AV}) -> {approxMatch,AV};
|
v_filter({approxMatch,AV}) -> {approxMatch,AV};
|
||||||
v_filter({present,A}) -> {present,A};
|
v_filter({present,A}) -> {present,A};
|
||||||
v_filter({substrings,S}) when record(S,'SubstringFilter') -> {substrings,S};
|
v_filter({substrings,S}) when is_record(S,'SubstringFilter') -> {substrings,S};
|
||||||
v_filter(_Filter) -> throw({error,concat(["unknown filter: ",_Filter])}).
|
v_filter(_Filter) -> throw({error,concat(["unknown filter: ",_Filter])}).
|
||||||
|
|
||||||
v_modifications(Mods) ->
|
v_modifications(Mods) ->
|
||||||
@ -925,7 +925,7 @@ v_modifications(Mods) ->
|
|||||||
end,
|
end,
|
||||||
lists:foreach(F, Mods).
|
lists:foreach(F, Mods).
|
||||||
|
|
||||||
v_substr([{Key,Str}|T]) when list(Str),Key==initial;Key==any;Key==final ->
|
v_substr([{Key,Str}|T]) when is_list(Str),Key==initial;Key==any;Key==final ->
|
||||||
[{Key,Str}|v_substr(T)];
|
[{Key,Str}|v_substr(T)];
|
||||||
v_substr([H|_]) ->
|
v_substr([H|_]) ->
|
||||||
throw({error,{substring_arg,H}});
|
throw({error,{substring_arg,H}});
|
||||||
@ -940,11 +940,11 @@ v_bool(true) -> true;
|
|||||||
v_bool(false) -> false;
|
v_bool(false) -> false;
|
||||||
v_bool(_Bool) -> throw({error,concat(["not Boolean: ",_Bool])}).
|
v_bool(_Bool) -> throw({error,concat(["not Boolean: ",_Bool])}).
|
||||||
|
|
||||||
v_timeout(I) when integer(I), I>=0 -> I;
|
v_timeout(I) when is_integer(I), I>=0 -> I;
|
||||||
v_timeout(_I) -> throw({error,concat(["timeout not positive integer: ",_I])}).
|
v_timeout(_I) -> throw({error,concat(["timeout not positive integer: ",_I])}).
|
||||||
|
|
||||||
v_attributes(Attrs) ->
|
v_attributes(Attrs) ->
|
||||||
F = fun(A) when list(A) -> A;
|
F = fun(A) when is_list(A) -> A;
|
||||||
(A) -> throw({error,concat(["attribute not String: ",A])})
|
(A) -> throw({error,concat(["attribute not String: ",A])})
|
||||||
end,
|
end,
|
||||||
lists:map(F,Attrs).
|
lists:map(F,Attrs).
|
||||||
@ -979,7 +979,7 @@ parse(Entries) ->
|
|||||||
|
|
||||||
get_integer(Key, List) ->
|
get_integer(Key, List) ->
|
||||||
case lists:keysearch(Key, 1, List) of
|
case lists:keysearch(Key, 1, List) of
|
||||||
{value, {Key, Value}} when integer(Value) ->
|
{value, {Key, Value}} when is_integer(Value) ->
|
||||||
Value;
|
Value;
|
||||||
{value, {Key, _Value}} ->
|
{value, {Key, _Value}} ->
|
||||||
throw({error, "Bad Value in Config for " ++ atom_to_list(Key)});
|
throw({error, "Bad Value in Config for " ++ atom_to_list(Key)});
|
||||||
@ -989,7 +989,7 @@ get_integer(Key, List) ->
|
|||||||
|
|
||||||
get_list(Key, List) ->
|
get_list(Key, List) ->
|
||||||
case lists:keysearch(Key, 1, List) of
|
case lists:keysearch(Key, 1, List) of
|
||||||
{value, {Key, Value}} when list(Value) ->
|
{value, {Key, Value}} when is_list(Value) ->
|
||||||
Value;
|
Value;
|
||||||
{value, {Key, _Value}} ->
|
{value, {Key, _Value}} ->
|
||||||
throw({error, "Bad Value in Config for " ++ atom_to_list(Key)});
|
throw({error, "Bad Value in Config for " ++ atom_to_list(Key)});
|
||||||
@ -998,13 +998,13 @@ get_list(Key, List) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
get_hosts(Key, List) ->
|
get_hosts(Key, List) ->
|
||||||
lists:map(fun({Key1, {A,B,C,D}}) when integer(A),
|
lists:map(fun({Key1, {A,B,C,D}}) when is_integer(A),
|
||||||
integer(B),
|
is_integer(B),
|
||||||
integer(C),
|
is_integer(C),
|
||||||
integer(D),
|
is_integer(D),
|
||||||
Key == Key1->
|
Key == Key1->
|
||||||
{A,B,C,D};
|
{A,B,C,D};
|
||||||
({Key1, Value}) when list(Value),
|
({Key1, Value}) when is_list(Value),
|
||||||
Key == Key1->
|
Key == Key1->
|
||||||
Value;
|
Value;
|
||||||
({_Else, _Value}) ->
|
({_Else, _Value}) ->
|
||||||
|
@ -87,7 +87,7 @@ start(Host, Opts) ->
|
|||||||
init(infinity) ->
|
init(infinity) ->
|
||||||
loop(infinity);
|
loop(infinity);
|
||||||
init(MaxOfflineMsgs)
|
init(MaxOfflineMsgs)
|
||||||
when integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
|
when is_integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
|
||||||
loop(MaxOfflineMsgs).
|
loop(MaxOfflineMsgs).
|
||||||
|
|
||||||
loop(MaxOfflineMsgs) ->
|
loop(MaxOfflineMsgs) ->
|
||||||
|
@ -81,7 +81,7 @@ start(Host, Opts) ->
|
|||||||
init(Host, infinity) ->
|
init(Host, infinity) ->
|
||||||
loop(Host, infinity);
|
loop(Host, infinity);
|
||||||
init(Host, MaxOfflineMsgs)
|
init(Host, MaxOfflineMsgs)
|
||||||
when integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
|
when is_integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
|
||||||
loop(Host, MaxOfflineMsgs).
|
loop(Host, MaxOfflineMsgs).
|
||||||
|
|
||||||
loop(Host, MaxOfflineMsgs) ->
|
loop(Host, MaxOfflineMsgs) ->
|
||||||
|
@ -846,7 +846,7 @@ get_in_pending_subscriptions(Ls, User, Server)
|
|||||||
JID = exmpp_jid:make_jid(User, Server),
|
JID = exmpp_jid:make_jid(User, Server),
|
||||||
US = {exmpp_jid:lnode(JID), exmpp_jid:ldomain(JID)},
|
US = {exmpp_jid:lnode(JID), exmpp_jid:ldomain(JID)},
|
||||||
case mnesia:dirty_index_read(roster, US, #roster.us) of
|
case mnesia:dirty_index_read(roster, US, #roster.us) of
|
||||||
Result when list(Result) ->
|
Result when is_list(Result) ->
|
||||||
Ls ++ lists:map(
|
Ls ++ lists:map(
|
||||||
fun(R) ->
|
fun(R) ->
|
||||||
Message = R#roster.askmessage,
|
Message = R#roster.askmessage,
|
||||||
|
@ -652,7 +652,7 @@ get_and_del_spool_msg_t(LServer, Username) ->
|
|||||||
[Result] = case ejabberd_odbc:sql_query(
|
[Result] = case ejabberd_odbc:sql_query(
|
||||||
LServer,
|
LServer,
|
||||||
["EXECUTE dbo.get_and_del_spool_msg '", Username, "'"]) of
|
["EXECUTE dbo.get_and_del_spool_msg '", Username, "'"]) of
|
||||||
Rs when list(Rs) ->
|
Rs when is_list(Rs) ->
|
||||||
lists:filter(fun({selected, _Header, _Row}) ->
|
lists:filter(fun({selected, _Header, _Row}) ->
|
||||||
true;
|
true;
|
||||||
({updated, _N}) ->
|
({updated, _N}) ->
|
||||||
|
@ -663,7 +663,7 @@ limit_options([], Limits) ->
|
|||||||
Limits;
|
Limits;
|
||||||
%% Maximum number of messages allowed in the process message queue
|
%% Maximum number of messages allowed in the process message queue
|
||||||
limit_options([{max_queue,N}|Options], Limits)
|
limit_options([{max_queue,N}|Options], Limits)
|
||||||
when integer(N) ->
|
when is_integer(N) ->
|
||||||
NewLimits = Limits#limits{max_queue=N},
|
NewLimits = Limits#limits{max_queue=N},
|
||||||
limit_options(Options, NewLimits);
|
limit_options(Options, NewLimits);
|
||||||
limit_options([_|Options], Limits) ->
|
limit_options([_|Options], Limits) ->
|
||||||
|
@ -58,7 +58,7 @@ element_to_string(El) ->
|
|||||||
[$<, Name, attrs_to_list(Attrs), $/, $>]
|
[$<, Name, attrs_to_list(Attrs), $/, $>]
|
||||||
end;
|
end;
|
||||||
%% We do not crypt CDATA binary, but we enclose it in XML CDATA
|
%% We do not crypt CDATA binary, but we enclose it in XML CDATA
|
||||||
{xmlcdata, CData} when binary(CData) ->
|
{xmlcdata, CData} when is_binary(CData) ->
|
||||||
?ESCAPE_BINARY(CData);
|
?ESCAPE_BINARY(CData);
|
||||||
%% We crypt list and possibly binaries if full XML usage is
|
%% We crypt list and possibly binaries if full XML usage is
|
||||||
%% disabled unsupported (implies a conversion to list).
|
%% disabled unsupported (implies a conversion to list).
|
||||||
|
Loading…
Reference in New Issue
Block a user