Skip to content

Commit

Permalink
Remove qdate dependency
Browse files Browse the repository at this point in the history
...to fix the build with OTP 20.1
  • Loading branch information
schlagert committed Nov 7, 2017
1 parent 58b7996 commit 49a396e
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 32 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ following options can/must be applied.

Default `Subject` value, used if not part of the POST. Default is _http2smtp_.

* `{timezone, string() | auto}`

Default timezone to use for the SMTP `Date` field. Default is _auto_. For more
information refer to the [qdate](https://github.com/choptastic/qdate) project.

* `{body_opts, [cowboy_req:body_opt()]}`

Options passed to [cowboy](https://github.com/ninenines/cowboy/)'s body read
Expand Down
1 change: 0 additions & 1 deletion apps/http2smtp/src/http2smtp.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
kernel,
stdlib,
sasl,
qdate,
gen_smtp,
cowlib,
cowboy
Expand Down
11 changes: 1 addition & 10 deletions apps/http2smtp/src/http2smtp_http.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
-define(FROM, list_to_binary("http2smtp@" ++ element(2, inet:gethostname()))).
-define(RATE_LIMIT, 2).
-define(SUBJECT, <<"http2smtp">>).
-define(TIMEZONE, auto).

%%%=============================================================================
%%% API
Expand Down Expand Up @@ -72,7 +71,6 @@ path_matches() ->
rate_limit :: pos_integer(),
smtp_opts :: proplists:proplist(),
subject :: binary(),
timezone :: string() | auto,
to :: binary()}).

%%------------------------------------------------------------------------------
Expand All @@ -94,7 +92,6 @@ init({tcp, _}, Req, Opts) ->
rate_limit = get_value(rate_limit, ContextOpts, Opts, ?RATE_LIMIT),
smtp_opts = [_ | _] = get_value(smtp_opts, Opts, undefined),
subject = to_bin(get_value(subject, Opts, ?SUBJECT)),
timezone = get_value(timezone, Opts, ?TIMEZONE),
to = get_to(ContextOpts, Opts)}}.

%%------------------------------------------------------------------------------
Expand Down Expand Up @@ -192,7 +189,7 @@ handle_mail(From, Subject, Body, Attachments, Req, State) ->
{<<"To">>, State#state.to},
{<<"Subject">>, Subject}, %% will be verified/encoded by gen_smtp
{<<"Message-ID">>, message_id()},
{<<"Date">>, datestr(State#state.timezone)},
{<<"Date">>, cowboy_clock:rfc1123()},
{<<"MIME-Version">>, <<"1.0">>},
{<<"X-Mailer">>, <<"http2smtp">>}
] ++ to_cc(State), %% will be verified/encoded by gen_smtp
Expand Down Expand Up @@ -337,12 +334,6 @@ is_mail(B) when is_binary(B) -> length([true || <<"@">> <= B]) =:= 1.
%%------------------------------------------------------------------------------
message_id() -> integer_to_binary(crypto:rand_uniform(100000000, 999999999)).

%%------------------------------------------------------------------------------
%% @private
%%------------------------------------------------------------------------------
datestr(Timezone) ->
qdate:to_string(<<"D, j M Y G:i:s O">>, Timezone, os:timestamp()).

%%------------------------------------------------------------------------------
%% @private
%%------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion config/http2smtp.service.template
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Environment=PROGNAME=http2smtp
Environment=ROOTDIR=/usr/lib64/http2smtp
ExecStart=/usr/lib64/http2smtp/erts-%ERTS%/bin/erlexec -boot ${ROOTDIR}/releases/%VSN%/http2smtp -mode embedded -config ${ROOTDIR}/releases/%VSN%/sys.config -name http2smtp -setcookie ${COOKIE} -noinput +K true
ExecStop=/bin/kill $MAINPID
ExecStopPost=/bin/sh -c 'while $(/bin/kill -0 $MAINPID 2>/dev/null); do sleep 1; done'
User=nobody
WorkingDirectory=/usr/lib64/http2smtp
Restart=on-failure
Expand Down
4 changes: 0 additions & 4 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
cf,
cowboy,
cowlib,
erlang_localtime,
erlware_commons,
gen_smtp,
qdate,
ranch,
recon,

Expand All @@ -56,7 +53,6 @@
{cowboy, "1.0.4"},
{gen_smtp, "0.11.0"},
{lager, "3.2.4"},
{qdate, "0.4.3"},
{recon, "2.3.2"},
{syslog, "3.1.0", {pkg, syslog_app}}
]}.
14 changes: 3 additions & 11 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
{"1.1.0",
[{<<"cf">>,{pkg,<<"cf">>,<<"0.2.1">>},2},
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"1.0.4">>},0},
[{<<"cowboy">>,{pkg,<<"cowboy">>,<<"1.0.4">>},0},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.0.2">>},1},
{<<"erlang_localtime">>,{pkg,<<"erlang_localtime">>,<<"1.0.0">>},1},
{<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"0.20.0">>},1},
{<<"gen_smtp">>,{pkg,<<"gen_smtp">>,<<"0.11.0">>},0},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"lager">>,{pkg,<<"lager">>,<<"3.2.4">>},0},
{<<"qdate">>,{pkg,<<"qdate">>,<<"0.4.3">>},0},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.2.1">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.4.0">>},1},
{<<"recon">>,{pkg,<<"recon">>,<<"2.3.2">>},0},
{<<"syslog">>,{pkg,<<"syslog_app">>,<<"3.1.0">>},0}]}.
[
{pkg_hash,[
{<<"cf">>, <<"69D0B1349FD4D7D4DC55B7F407D29D7A840BF9A1EF5AF529F1EBE0CE153FC2AB">>},
{<<"cowboy">>, <<"A324A8DF9F2316C833A470D918AAF73AE894278B8AA6226CE7A9BF699388F878">>},
{<<"cowlib">>, <<"9D769A1D062C9C3AC753096F868CA121E2730B9A377DE23DEC0F7E08B1DF84EE">>},
{<<"erlang_localtime">>, <<"497DFD4D13523D3E0EECDCB8D6D59857CF642A17A6BDC6133FF906FDAF2AEF21">>},
{<<"erlware_commons">>, <<"721F902031D0313E192FD4038C326F89415855CD1A5CF804AB04B314D0944146">>},
{<<"gen_smtp">>, <<"D90FF2F021FC86CB2A4259B1F2B177AB6E506676265E26454BF5755855ADC956">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"lager">>, <<"A6DEB74DAE7927F46BD13255268308EF03EB206EC784A94EAF7C1C0F3B811615">>},
{<<"qdate">>, <<"6037343CAA1EF8BA8AF13AFD5A2A89CE7695C1E8A12D87702D66624290E3BE76">>},
{<<"ranch">>, <<"A6FB992C10F2187B46FFD17CE398DDF8A54F691B81768F9EF5F461EA7E28C762">>},
{<<"ranch">>, <<"10272F95DA79340FA7E8774BA7930B901713D272905D0012B06CA6D994F8826B">>},
{<<"recon">>, <<"4444C879BE323B1B133EEC5241CB84BD3821EA194C740D75617E106BE4744318">>},
{<<"syslog">>, <<"EE5D21EDE60313EC10A810AE96E1880859418BEF0F11499A445186E1CC414FB2">>}]}
].

0 comments on commit 49a396e

Please sign in to comment.