Navigation Menu

Skip to content

Commit

Permalink
Introduce mod_avatar
Browse files Browse the repository at this point in the history
The purpose of the module is to cope with legacy and modern
XMPP clients posting avatars. It automatically converts vCard based
avatars (XEP-0153) to PEP based avatars (XEP-0084) and vice versa.
Also, the module supports convertation between avatar image formats on
the fly: this is controlled by `convert` option. For example, to
convert all avatars into PNG format, configure the module as:

mod_avatar:
  convert:
    default: png

In order to convert only `webp` format to `jpeg`, set the following:

mod_avatar:
  convert:
    webp: jpeg

Note: the module depends on mod_vcard, mod_vcard_xupdate and mod_pubsub.
Also, ejabberd should be built with --enable-graphics option.
  • Loading branch information
zinid committed Sep 17, 2017
1 parent 5414cbe commit e4d21c1
Show file tree
Hide file tree
Showing 8 changed files with 525 additions and 46 deletions.
9 changes: 9 additions & 0 deletions configure.ac
Expand Up @@ -236,6 +236,14 @@ AC_ARG_ENABLE(sip,
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sip) ;;
esac],[if test "x$sip" = "x"; then sip=false; fi])

AC_ARG_ENABLE(graphics,
[AC_HELP_STRING([--enable-graphics], [enable support for graphic images manipulation (default: yes)])],
[case "${enableval}" in
yes) graphics=true ;;
no) graphics=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-graphics) ;;
esac],[if test "x$graphics" = "x"; then graphics=true; fi])

AC_CONFIG_FILES([Makefile
vars.config
src/ejabberd.app.src])
Expand Down Expand Up @@ -280,6 +288,7 @@ AC_SUBST(iconv)
AC_SUBST(stun)
AC_SUBST(sip)
AC_SUBST(debug)
AC_SUBST(graphics)
AC_SUBST(tools)
AC_SUBST(latest_deps)
AC_SUBST(system_deps)
Expand Down
6 changes: 5 additions & 1 deletion rebar.config
Expand Up @@ -25,7 +25,7 @@
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.15"}}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.9"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.23"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.1.14"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "d98be4a3159"}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.10"}}},
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
{p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.2"}}},
Expand All @@ -44,6 +44,7 @@
{tag, "1.0.2"}}}},
{if_var_true, riak, {riakc, ".*", {git, "https://github.com/processone/riak-erlang-client.git",
{tag, "2.5.3"}}}},
{if_var_true, graphics, {eimp, ".*", {git, "https://github.com/processone/eimp.git"}}},
%% Elixir support, needed to run tests
{if_var_true, elixir, {elixir, ".*", {git, "https://github.com/elixir-lang/elixir",
{tag, {if_version_above, "17", "v1.4.4", "v1.1.1"}}}}},
Expand Down Expand Up @@ -74,6 +75,7 @@
p1_oauth2,
epam,
ezlib,
eimp,
iconv]}}.

{erl_first_files, ["src/ejabberd_config.erl", "src/gen_mod.erl", "src/mod_muc_room.erl", "src/mod_push.erl"]}.
Expand All @@ -87,6 +89,7 @@
{if_var_true, debug, debug_info},
{if_var_true, sip, {d, 'SIP'}},
{if_var_true, stun, {d, 'STUN'}},
{if_var_true, graphics, {d, 'GRAPHICS'}},
{if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}},
{if_var_match, db_type, mssql, {d, 'mssql'}},
{if_var_true, elixir, {d, 'ELIXIR_ENABLED'}},
Expand Down Expand Up @@ -154,6 +157,7 @@
{"fast_xml", [{if_var_true, full_xml, "--enable-full-xml"}]},
{if_var_true, pam, {"epam", []}},
{if_var_true, zlib, {"ezlib", []}},
{if_var_true, graphics, {"eimp", []}},
{if_var_true, iconv, {"iconv", []}}]}.

{port_env, [{"CFLAGS", "-g -O2 -Wall"}]}.
Expand Down
11 changes: 10 additions & 1 deletion src/ejabberd_app.erl
Expand Up @@ -146,7 +146,8 @@ start_apps() ->
ejabberd:start_app(fast_yaml),
ejabberd:start_app(fast_tls),
ejabberd:start_app(xmpp),
ejabberd:start_app(cache_tab).
ejabberd:start_app(cache_tab),
start_eimp().

setup_if_elixir_conf_used() ->
case ejabberd_config:is_using_elixir_config() of
Expand All @@ -170,3 +171,11 @@ start_elixir_application() ->
_ ->
ok
end.

-ifdef(GRAPHICS).
start_eimp() ->
ejabberd:start_app(eimp).
-else.
start_eimp() ->
ok.
-endif.

0 comments on commit e4d21c1

Please sign in to comment.