From eea2a5d25718261d18099b5f62dc0e7791491b6f Mon Sep 17 00:00:00 2001 From: Mujtaba Roohani Date: Wed, 12 Oct 2022 14:27:52 +0500 Subject: [PATCH] Fixed error detected by Dialyzer --- mod_push_offline/src/mod_push_offline.erl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/mod_push_offline/src/mod_push_offline.erl b/mod_push_offline/src/mod_push_offline.erl index 735c34d..d379f56 100644 --- a/mod_push_offline/src/mod_push_offline.erl +++ b/mod_push_offline/src/mod_push_offline.erl @@ -104,7 +104,7 @@ offline_message(Acc) -> -spec notify(jid(), xmpp_element() | xmlel() | none) -> ok. notify(#jid{lserver = LServer} = To, Pkt) -> UnWrappedPkt = unwrap_message(Pkt), - DelayedPkt = add_delay_info(UnWrappedPkt, LServer, undefined), + DelayedPkt = add_delay_info(UnWrappedPkt, LServer), Id = p1_rand:get_string(), PushServer = mod_push_offline_opt:host(LServer), WrappedPacket = wrap(DelayedPkt, <<"urn:xmpp:push:nodes:messages">>, Id), @@ -137,13 +137,8 @@ wrap(Packet, Node, Id) -> id = Id, sub_els = [Packet]}]}}]}. --spec add_delay_info(message(), binary(), - undefined | erlang:timestamp()) -> message(). -add_delay_info(Packet, LServer, TS) -> - NewTS = case TS of - undefined -> erlang:timestamp(); - _ -> TS - end, +-spec add_delay_info(message(), binary()) -> message(). +add_delay_info(Packet, LServer) -> Packet1 = xmpp:put_meta(Packet, from_offline, true), - misc:add_delay_info(Packet1, jid:make(LServer), NewTS, + misc:add_delay_info(Packet1, jid:make(LServer), erlang:timestamp(), <<"Offline storage">>). \ No newline at end of file