aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_websocket.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-06-14 12:33:26 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-06-14 12:33:26 +0300
commita02cff0e780bb735531594c4ece81e8628f79782 (patch)
tree6fe7d8219d14f58183be1741fcea262c216db447 /src/ejabberd_websocket.erl
parentReturn jid_malformed error when sending presence without nick to conference (diff)
Use new configuration validator
Diffstat (limited to 'src/ejabberd_websocket.erl')
-rw-r--r--src/ejabberd_websocket.erl28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/ejabberd_websocket.erl b/src/ejabberd_websocket.erl
index 2dde8add2..1767a1603 100644
--- a/src/ejabberd_websocket.erl
+++ b/src/ejabberd_websocket.erl
@@ -37,12 +37,11 @@
%%%----------------------------------------------------------------------
-module(ejabberd_websocket).
--behaviour(ejabberd_config).
-protocol({rfc, 6455}).
-author('ecestari@process-one.net').
--export([socket_handoff/5, opt_type/1]).
+-export([socket_handoff/5]).
-include("logger.hrl").
@@ -429,27 +428,4 @@ websocket_close(Socket, WsHandleLoopPid, SocketMode, _CloseCode) ->
SocketMode:close(Socket).
get_origin() ->
- ejabberd_config:get_option(websocket_origin, []).
-
-opt_type(websocket_ping_interval) ->
- fun (I) when is_integer(I), I >= 0 -> I end;
-opt_type(websocket_timeout) ->
- fun (I) when is_integer(I), I > 0 -> I end;
-opt_type(websocket_origin) ->
- fun Verify(V) when is_binary(V) ->
- Verify([V]);
- Verify([]) ->
- [];
- Verify([<<"null">> | R]) ->
- [<<"null">> | Verify(R)];
- Verify([null | R]) ->
- [<<"null">> | Verify(R)];
- Verify([V | R]) when is_binary(V) ->
- URIs = [_|_] = lists:filtermap(
- fun(<<>>) -> false;
- (URI) -> {true, misc:try_url(URI)}
- end, re:split(V, "\\s+")),
- [str:join(URIs, <<" ">>) | Verify(R)]
- end;
-opt_type(_) ->
- [websocket_ping_interval, websocket_timeout, websocket_origin].
+ ejabberd_option:websocket_origin().