{p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.2"}}},
{jose, ".*", {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.8.4"}}},
{fs, ".*", {git, "https://github.com/synrc/fs", "bed9467"}},
- {eimp, ".*", {git, "https://github.com/processone/eimp", "c7201d18"}},
+ {eimp, ".*", {git, "https://github.com/processone/eimp", "6858909d"}},
{if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.20"}}}},
{if_var_true, sip, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.21"}}}},
{if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql",
true ->
?DEBUG("Converting avatar of ~s@~s: ~s -> ~s",
[LUser, LServer, Type, NewType]),
- case eimp:convert(Data, NewType) of
+ RateLimit = gen_mod:get_module_opt(LServer, ?MODULE, rate_limit),
+ Opts = [{limit_by, {LUser, LServer}},
+ {rate_limit, RateLimit}],
+ case eimp:convert(Data, NewType, Opts) of
{ok, NewData} ->
{ok, encode_mime_type(NewType), NewData};
{error, Reason} = Err ->
true -> To
end
end
- end.
+ end;
+mod_opt_type(rate_limit) ->
+ fun(I) when is_integer(I), I > 0 -> I end.
mod_options(_) ->
- [{convert,
+ [{rate_limit, 10},
+ {convert,
[{T, undefined} || T <- [default|eimp:supported_formats()]]}].