]> granicus.if.org Git - ejabberd/commitdiff
Fix some dialyzer warnings
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 24 Jun 2013 10:04:56 +0000 (20:04 +1000)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 24 Jun 2013 10:04:56 +0000 (20:04 +1000)
src/ejabberd_c2s.erl
src/ejabberd_http.erl
src/ejabberd_receiver.erl
src/ejabberd_s2s.erl
src/mod_muc.erl
src/mod_offline.erl

index 903f321da4fd258cb4886cb0079b66c9b23d571a..c7038e6b2c4930957f59e7d09747121cea6b18f7 100644 (file)
@@ -283,10 +283,7 @@ get_subscribed(FsmRef) ->
 %%----------------------------------------------------------------------
 
 wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
-    DefaultLang = case ?MYLANG of
-       undefined -> <<"en">>;
-       DL -> DL
-    end,
+    DefaultLang = ?MYLANG,
     case xml:get_attr_s(<<"xmlns:stream">>, Attrs) of
        ?NS_STREAM ->
            Server = jlib:nameprep(xml:get_attr_s(<<"to">>, Attrs)),
index 240e0105b77ec40bb4aacae59338ff6dfaed4dd6..697aac1166bd16f197184a694b7674c81b2ccaf1 100644 (file)
@@ -198,7 +198,7 @@ parse_headers(#state{request_method = Method,
                   undefined -> http;
                   _ -> httph
               end,
-    case erlang:decode_packet(PktType, Data) of
+    case erlang:decode_packet(PktType, Data, []) of
         {ok, Pkt, Rest} ->
             NewState = process_header(State#state{trail = Rest}, {ok, Pkt}),
            case NewState#state.end_of_request of
index 88a7405fd5dca584d54a17f896cccf147dcd5cc8..f666ea8374bc197eac4f49a788de7d8d2e44e380 100644 (file)
@@ -102,7 +102,7 @@ change_shaper(Pid, Shaper) ->
 
 reset_stream(Pid) -> do_call(Pid, reset_stream).
 
--spec starttls(pid(), iodata()) -> {ok, p1_tls:tls_socket()} | {error, any()}.
+-spec starttls(pid(), p1_tls:tls_socket()) -> ok.
 
 starttls(Pid, TLSSocket) ->
     do_call(Pid, {starttls, TLSSocket}).
index 63fdc766052201d5c3dfbdd61e7138d99f77deed..591d31da294d8d6891b589c53a4692fb54e45d54 100644 (file)
@@ -62,8 +62,8 @@
 
 %% once a server is temporarly blocked, it stay blocked for 60 seconds
 
--record(s2s, {fromto = {<<"">>, <<"">>} :: {binary(), binary()},
-              pid = self()              :: pid() | '_',
+-record(s2s, {fromto = {<<"">>, <<"">>} :: {binary(), binary()} | '_',
+              pid = self()              :: pid() | '_' | '$1',
               key = <<"">>              :: binary() | '_'}).
 
 -record(state, {}).
index d3794d14124819c6a08e9851e6efb7b6f040fdc5..6b87f157920dc5d6a5161979ea098470aafba031 100644 (file)
@@ -60,8 +60,9 @@
                    opts = [] :: list() | '_'}).
 
 -record(muc_online_room,
-        {name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1',
-         pid = self() :: pid() | '$2' | '_'}).
+        {name_host = {<<"">>, <<"">>} :: {binary(), binary()} | '$1' |
+                                         {'_', binary()} | '_',
+         pid = self() :: pid() | '$2' | '_' | '$1'}).
 
 -record(muc_registered,
         {us_host = {{<<"">>, <<"">>}, <<"">>} :: {{binary(), binary()}, binary()} | '$1',
@@ -1104,7 +1105,7 @@ update_tables(Host) ->
     update_muc_room_table(Host),
     update_muc_registered_table(Host).
 
-update_muc_room_table(Host) ->
+update_muc_room_table(_Host) ->
     Fields = record_info(fields, muc_room),
     case mnesia:table_info(muc_room, attributes) of
       Fields ->
@@ -1122,7 +1123,7 @@ update_muc_room_table(Host) ->
          mnesia:transform_table(muc_room, ignore, Fields)
     end.
 
-update_muc_registered_table(Host) ->
+update_muc_registered_table(_Host) ->
     Fields = record_info(fields, muc_registered),
     case mnesia:table_info(muc_registered, attributes) of
       Fields ->
index bf7da6cd3bad3aaaba80e983e1b3982b8525a767..5033174856cff7ed4874e73d73282a3703e857aa 100644 (file)
@@ -43,6 +43,7 @@
         remove_old_messages/2,
         remove_user/2,
         get_queue_length/2,
+         get_offline_els/2,
         webadmin_page/3,
         webadmin_user/4,
         webadmin_user_parse_query/5]).
@@ -520,6 +521,40 @@ webadmin_page(_, Host,
     Res = user_queue(U, Host, Query, Lang), {stop, Res};
 webadmin_page(Acc, _, _) -> Acc.
 
+get_offline_els(LUser, LServer) ->
+    get_offline_els(LUser, LServer, gen_mod:db_type(LServer, ?MODULE)).
+
+get_offline_els(LUser, LServer, mnesia) ->
+    Msgs = read_all_msgs(LUser, LServer, mnesia),
+    lists:map(
+      fun(Msg) ->
+              {route, From, To, Packet} = offline_msg_to_route(LServer, Msg),
+              jlib:replace_from_to(From, To, Packet)
+      end, Msgs);
+get_offline_els(LUser, LServer, odbc) ->
+    Username = ejabberd_odbc:escape(LUser),
+    case catch ejabberd_odbc:sql_query(LServer,
+                                       [<<"select xml from spool where username='">>,
+                                        Username, <<"' order by seq;">>]) of
+        {selected, [<<"xml">>], Rs} ->
+            lists:flatmap(
+              fun([XML]) ->
+                      case xml_stream:parse_element(XML) of
+                          #xmlel{} = El ->
+                              case offline_msg_to_route(LServer, El) of
+                                  {route, _, _, NewEl} ->
+                                      [NewEl];
+                                  error ->
+                                      []
+                              end;
+                          _ ->
+                              []
+                      end
+              end, Rs);
+        _ ->
+            []
+    end.
+
 offline_msg_to_route(LServer, #offline_msg{} = R) ->
     El = #xmlel{children = Els} = R#offline_msg.packet,
     {route, R#offline_msg.from, R#offline_msg.to,