]> granicus.if.org Git - ejabberd/commitdiff
Set translation callback on startup
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Fri, 17 Mar 2017 18:35:02 +0000 (21:35 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Fri, 17 Mar 2017 18:35:02 +0000 (21:35 +0300)
rebar.config
src/translate.erl

index f3859195580119a88c150e9f297b8c395e65e06d..a80fefe074792b6926d310fc1eb417af0e3ab686 100644 (file)
@@ -24,7 +24,7 @@
         {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", "afdd07811e0e6eff444c035ffeb2aa9efb4dbe6d"}},
         {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.7"}}},
         {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
-        {xmpp, ".*", {git, "https://github.com/processone/xmpp", "4aaed37a16fc21be505553aabf9f47a48b8af027"}},
+        {xmpp, ".*", {git, "https://github.com/processone/xmpp", "cfb5c11280fdd82f8370d9322bbcb3255b743c76"}},
         {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.9"}}},
         {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.10"}}},
         {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.8"}}},
index 4350fab27bca0335d5eedbff1d249d6109c9f8a4..cf59fef5b0cf1655469a811d10dd63d1c8b8b6a7 100644 (file)
@@ -43,6 +43,7 @@ start_link() ->
     gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
 
 init([]) ->
+    process_flag(trap_exit, true),
     ets:new(translations, [named_table, public]),
     Dir = case os:getenv("EJABBERD_MSGS_PATH") of
            false ->
@@ -53,6 +54,7 @@ init([]) ->
            Path -> Path
          end,
     load_dir(iolist_to_binary(Dir)),
+    xmpp:set_tr_callback({?MODULE, translate}),
     {ok, #state{}}.
 
 handle_call(_Request, _From, State) ->
@@ -66,7 +68,7 @@ handle_info(_Info, State) ->
     {noreply, State}.
 
 terminate(_Reason, _State) ->
-    ok.
+    xmpp:set_tr_callback(undefined).
 
 code_change(_OldVsn, State, _Extra) ->
     {ok, State}.