]> granicus.if.org Git - ejabberd/commitdiff
Replace TYPE/1 with is_TYPE/1 (EJAB-922)
authorBadlop <badlop@process-one.net>
Wed, 6 May 2009 16:54:43 +0000 (16:54 +0000)
committerBadlop <badlop@process-one.net>
Wed, 6 May 2009 16:54:43 +0000 (16:54 +0000)
SVN Revision: 2057

ChangeLog
src/ejabberd_c2s.erl
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

index d8405b18cca9410406802005431ef59b7f317806..39fa84889a92046223c31839509ba5de5bf89821 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 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:
        behaviour X undefined (EJAB-920)
 
index df6144203c225b8e1c8c89240d95cb5ab410041a..a6724b9df537a2f08c8cbd343cae96143e69cc17 100644 (file)
@@ -1894,7 +1894,7 @@ resend_offline_messages(#state{user = User,
                                 Server,
                                 [],
                                 [User, Server]) of
-       Rs when list(Rs) ->
+       Rs when is_list(Rs) ->
            lists:foreach(
              fun({route,
                   From, To, {xmlelement, Name, Attrs, Els} = Packet}) ->
index e356c649bc6ce2655b9e4d2aa515ac004b808609..ce18c5e12266ce66fd06db75de415ae323e03dc5 100644 (file)
@@ -117,7 +117,7 @@ reopen_log() ->
 write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) ->
     T = write_time(Time),
     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, []));
        _ ->
            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}}) ->
     T = write_time(Time),
     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 ++ "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}}}) ->
     T = write_time(Time, "INFO REPORT"),
     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, []));
        _ ->
            F = add_node("ERROR: ~p - ~p~n", Pid),
@@ -154,7 +154,7 @@ write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) ->
 write_event(_, _) ->
     ok.
 
-format_report(Rep) when list(Rep) ->
+format_report(Rep) when is_list(Rep) ->
     case string_p(Rep) of
        true ->
            io_lib:format("~s~n",[Rep]);
@@ -171,7 +171,7 @@ format_rep([Other|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(X, Pid) when node(Pid) /= node() ->
     lists:concat([X,"** at node ",node(Pid)," **~n"]);
@@ -183,7 +183,7 @@ string_p([]) ->
 string_p(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([$\n|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([$\f|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
        true -> string_p1(T);
        _    -> false
index e60f7253cf51e917cd716cde84c054986aed1a3b..ec4011bd429f0d704781a90feb8e78ce3cd3a895 100644 (file)
@@ -249,7 +249,7 @@ do_route(From, To, Packet) ->
     ?DEBUG("s2s manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
            [From, To, Packet, 8]),
     case find_connection(From, To) of
-       {atomic, Pid} when pid(Pid) ->
+       {atomic, Pid} when is_pid(Pid) ->
            ?DEBUG("sending to process ~p~n", [Pid]),
            {xmlelement, Name, Attrs, Els} = Packet,
            NewAttrs = jlib:replace_from_to_attrs(jlib:jid_to_string(From),
index 412a66862e0befd2f6dd3e43b15cd9371a68a3c2..5d7652fccdafcfb7174c3bda1f7edb0714e6397c 100644 (file)
@@ -143,14 +143,14 @@ close(Handle) ->
 %%%          {"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),
     gen_fsm:sync_send_event(Handle1, {add, Entry, add_attrs(Attributes)},
                            ?CALL_TIMEOUT).
 
 %%% Do sanity check !
 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... :-/
                {'AddRequest_attributes',Type, Vals} 
        end,
@@ -169,7 +169,7 @@ add_attrs(Attrs) ->
 %%%         "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),
     gen_fsm:sync_send_event(Handle1, {delete, Entry}, ?CALL_TIMEOUT).
 
@@ -184,7 +184,7 @@ delete(Handle, Entry) when list(Entry) ->
 %%%          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),
     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:
 %%%            replace("telephoneNumber", ["555 555 00"])
 %%%
-mod_add(Type, Values) when list(Type), list(Values)     -> m(add, Type, Values).
-mod_delete(Type, Values) when list(Type), list(Values)  -> m(delete, Type, Values).
-mod_replace(Type, Values) when list(Type), list(Values) -> m(replace, Type, Values).
+mod_add(Type, Values) when is_list(Type), is_list(Values)     -> m(add, Type, Values).
+mod_delete(Type, Values) when is_list(Type), is_list(Values)  -> m(delete, Type, Values).
+mod_replace(Type, Values) when is_list(Type), is_list(Values) -> m(replace, Type, Values).
 
 m(Operation, Type, Values) ->
     #'ModifyRequest_modification_SEQOF'{
@@ -217,7 +217,7 @@ m(Operation, Type, Values) ->
 %%%        )
 %%% --------------------------------------------------------------------
 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),
     gen_fsm:sync_send_event(
       Handle1,
@@ -234,7 +234,7 @@ modify_dn(Handle, Entry, NewRDN, DelOldRDN, NewSup)
 %%%    "secret")
 %%% --------------------------------------------------------------------
 bind(Handle, RootDN, Passwd) 
-  when list(RootDN),list(Passwd) ->
+  when is_list(RootDN), is_list(Passwd) ->
     Handle1 = get_handle(Handle),
     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);
-search(Handle, L) when list(L) ->
+search(Handle, L) when is_list(L) ->
     case catch parse_search_args(L) of
        {error, 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.
 
 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([{types_only, TypesOnly}|T],A) ->
     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([{limit, Limit}|T],A) when is_integer(Limit) ->
     parse_search_args(T,A#eldap_search{limit = Limit});
@@ -315,9 +315,9 @@ wholeSubtree() -> wholeSubtree.
 %%%
 %%% Boolean filter operations
 %%%
-'and'(ListOfFilters) when list(ListOfFilters) -> {'and',ListOfFilters}.
-'or'(ListOfFilters)  when list(ListOfFilters) -> {'or', ListOfFilters}.
-'not'(Filter)        when tuple(Filter)       -> {'not',Filter}.
+'and'(ListOfFilters) when is_list(ListOfFilters) -> {'and',ListOfFilters}.
+'or'(ListOfFilters)  when is_list(ListOfFilters) -> {'or', ListOfFilters}.
+'not'(Filter)        when is_tuple(Filter)       -> {'not',Filter}.
 
 %%%
 %%% 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
 %%%
-present(Attribute) when list(Attribute) -> 
+present(Attribute) when is_list(Attribute) -> 
     {present, Attribute}.
 
 
@@ -354,15 +354,15 @@ present(Attribute) when list(Attribute) ->
 %%% Example: substrings("sn",[{initial,"To"},{any,"kv"},{final,"st"}])
 %%% 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)},
     {substrings,#'SubstringFilter'{type = Type,
                                   substrings = Ss}}.
 
 
-get_handle(Pid) when pid(Pid)    -> Pid;
-get_handle(Atom) when atom(Atom) -> Atom;
-get_handle(Name) when list(Name) -> list_to_atom("eldap_" ++ Name).
+get_handle(Pid) when is_pid(Pid)    -> Pid;
+get_handle(Atom) when is_atom(Atom) -> Atom;
+get_handle(Name) when is_list(Name) -> list_to_atom("eldap_" ++ Name).
 %%%----------------------------------------------------------------------
 %%% Callback functions from gen_fsm
 %%%----------------------------------------------------------------------
@@ -835,7 +835,7 @@ cmd_timeout(Timer, Id, S) ->
 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,
     F = fun({_,A,V}) -> {A,V} end,
     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({approxMatch,AV})    -> {approxMatch,AV};
 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_modifications(Mods) ->
@@ -925,7 +925,7 @@ v_modifications(Mods) ->
        end,
     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)];
 v_substr([H|_]) ->
     throw({error,{substring_arg,H}});
@@ -940,11 +940,11 @@ v_bool(true)  -> true;
 v_bool(false) -> false;
 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_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])})
        end,
     lists:map(F,Attrs).
@@ -979,7 +979,7 @@ parse(Entries) ->
 
 get_integer(Key, List) ->
     case lists:keysearch(Key, 1, List) of
-       {value, {Key, Value}} when integer(Value) ->
+       {value, {Key, Value}} when is_integer(Value) ->
            Value;
        {value, {Key, _Value}} ->
            throw({error, "Bad Value in Config for " ++ atom_to_list(Key)});
@@ -989,7 +989,7 @@ get_integer(Key, List) ->
 
 get_list(Key, List) ->
     case lists:keysearch(Key, 1, List) of
-       {value, {Key, Value}} when list(Value) ->
+       {value, {Key, Value}} when is_list(Value) ->
            Value;
        {value, {Key, _Value}} ->
            throw({error, "Bad Value in Config for " ++ atom_to_list(Key)});
@@ -998,13 +998,13 @@ get_list(Key, List) ->
     end.
 
 get_hosts(Key, List) ->
-    lists:map(fun({Key1, {A,B,C,D}}) when integer(A),
-                                         integer(B),
-                                         integer(C),
-                                         integer(D),
+    lists:map(fun({Key1, {A,B,C,D}}) when is_integer(A),
+                                         is_integer(B),
+                                         is_integer(C),
+                                         is_integer(D),
                                          Key == Key1->
                      {A,B,C,D};
-                ({Key1, Value}) when list(Value),
+                ({Key1, Value}) when is_list(Value),
                                      Key == Key1->
                      Value;
                 ({_Else, _Value}) ->
index 0607ddb8b06055bc8dd19605a1fa46546776e7fc..e3898eb4fa4b5f5026c5f730095255699080cb75 100644 (file)
@@ -80,7 +80,7 @@ start(Host, Opts) ->
 init(infinity) ->
     loop(infinity);
 init(MaxOfflineMsgs) 
-  when integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
+  when is_integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
     loop(MaxOfflineMsgs).
 
 loop(MaxOfflineMsgs) ->
index e70cfbe6930ccbd97756cb25310f4de73237c048..3a61374dc1f75464abdbb3ebf1908e1cd61e8909 100644 (file)
@@ -74,7 +74,7 @@ start(Host, Opts) ->
 init(Host, infinity) ->
     loop(Host, infinity);
 init(Host, MaxOfflineMsgs) 
-  when integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
+  when is_integer(MaxOfflineMsgs), MaxOfflineMsgs > 0 ->
     loop(Host, MaxOfflineMsgs).
 
 loop(Host, MaxOfflineMsgs) ->
index 9cb23c2a4bc1614298bebbe15027a03e1ac173ba..1a32c7e0cbdd74d4679845229e6ac89699acfc44 100644 (file)
@@ -677,7 +677,7 @@ get_in_pending_subscriptions(Ls, User, Server) ->
     JID = jlib:make_jid(User, Server, ""),
     US = {JID#jid.luser, JID#jid.lserver},
     case mnesia:dirty_index_read(roster, US, #roster.us) of
-       Result when list(Result) ->
+       Result when is_list(Result) ->
            Ls ++ lists:map(
                    fun(R) ->
                            Message = R#roster.askmessage,
index b878184a8059d72b0c0b1b25768b6f14cf089e38..ef1f59218444d2bae8030635162f5725d65ae54f 100644 (file)
@@ -652,7 +652,7 @@ get_and_del_spool_msg_t(LServer, Username) ->
     [Result] = case ejabberd_odbc:sql_query(
                    LServer,
                    ["EXECUTE dbo.get_and_del_spool_msg '", Username, "'"]) of
-                  Rs when list(Rs) ->
+                  Rs when is_list(Rs) ->
                     lists:filter(fun({selected, _Header, _Row}) ->
                                          true;
                                     ({updated, _N}) ->
index 40ae33465307490fb1cba069b7671f1e5b693463..c4de9faa4eac2431b420deb4adf7334d2d8c1cf8 100644 (file)
@@ -663,7 +663,7 @@ limit_options([], Limits) ->
     Limits;
 %% Maximum number of messages allowed in the process message queue
 limit_options([{max_queue,N}|Options], Limits) 
-  when integer(N) ->
+  when is_integer(N) ->
     NewLimits = Limits#limits{max_queue=N},
     limit_options(Options, NewLimits);
 limit_options([_|Options], Limits) ->
index 846d93c9bb5f5b8f215db61531c5fd4dd56f61be..592ad5b99fdef40a19d6b0cff9e0f287875e7f59 100644 (file)
@@ -66,7 +66,7 @@ element_to_string_nocatch(El) ->
                    [$<, Name, attrs_to_list(Attrs), $/, $>]
               end;
        %% 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);
        %% We crypt list and possibly binaries if full XML usage is
        %% disabled unsupported (implies a conversion to list).