diff --git a/.gitignore b/.gitignore index 06a50614f0b12ea9d0a0c4ba100b297f93d7a72b..4096281b6b9d331d10100eec82e21285768ea479 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,10 @@ workspace.xml .idea/ .DS_Store _build +*.crashdump + +# Generated code +priv/ # Excessive for iOS models apps/roster/priv/macbert/Model/PublishService.swift diff --git a/Makefile b/Makefile index dd4a9409d9f4017b9c71f5525a81e6935bd932d9..54489d236f9c229a23e28d776a50bfaba98cdc8a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,49 @@ +REBAR ?= ./rebar3 + RELEASE := mq COOKIE := node_runner VER := 1.0.0 -default: deps compile +all: compile + +compile: + @$(REBAR) compile + +clean: + @rm -rf priv + @$(REBAR) clean + +console: local-build + @./_build/local/rel/server/bin/server console + +start: local-build + @./_build/local/rel/server/bin/server start + +attach: + @./_build/local/rel/server/bin/server attach + +local-build: + @$(REBAR) as local release + + +prod-build: + @$(REBAR) as prod release + +prod-console: prod-build + @./_build/prod/rel/server/bin/server console + +prod-start: prod-build + @./_build/prod/rel/server/bin/server start + +prod-attach: + @./_build/prod/rel/server/bin/server attach + +tar: + @$(REBAR) as prod tar + -include otp.mk +.PHONY: \ + all compile clean console local-build \ + start attach \ + prod-build prod-console prod-start prod-attach \ + tar diff --git a/README.md b/README.md index 18a1a741506bbfed6cb608cf522a8ab76623bdfc..67ffd9a74ea7959f9f35874b17161d59152abcd3 100644 --- a/README.md +++ b/README.md @@ -26,79 +26,26 @@ Developers Setup ---------------- ``` -$ curl -fsSL https://raw.github.com/synrc/mad/master/mad > mad \ - && chmod +x mad \ - && sudo cp /usr/local/bin -$ mad dep com rep -Configuration: [{n2o, - [{port,8000}, - {app,review}, - {pickler,n2o_secret}, - {formatter,bert}, - {log_modules,config}, - {log_level,config}]}, - {emq_dashboard, - [{listeners_dash, - [{http,18083,[{acceptors,4},{max_clients,512}]}]}]}, - {emq_modules, - [{modules, - [{emq_mod_presence,[{qos,1}]}, - {emq_mod_subscription,[{<<"%u/%c/#">>,2}]}, - {emq_mod_rewrite, - [{rewrite,"x/#","^x/y/(.+)$","z/y/$1"}, - {rewrite,"y/+/z/#","^y/(.+)/z/(.+)$", - "y/z/$2"}]}]}]}, - {emqttd, - [{listeners, - [{http,8083,[{acceptors,4},{max_clients,512}]}, - {tcp,1883,[{acceptors,4},{max_clients,512}]}]}, - {sysmon, - [{long_gc,false}, - {long_schedule,240}, - {large_heap,8000000}, - {busy_port,false}, - {busy_dist_port,true}]}, - {session, - [{upgrade_qos,off}, - {max_inflight,32}, - {retry_interval,20}, - {max_awaiting_rel,100}, - {await_rel_timeout,20}, - {enable_stats,off}]}, - {queue,[]}, - {allow_anonymous,true}, - {protocol, - [{max_clientid_len,1024},{max_packet_size,64000}]}, - {acl_file,"etc/acl.conf"}, - {plugins_etc_dir,"etc/plugins/"}, - {plugins_loaded_file,"etc/loaded_plugins"}, - {pubsub, - [{pool_size,8},{by_clientid,true},{async,true}]}]}, - {kvs, - [{dba,store_mnesia}, - {schema,[kvs_user,kvs_acl,kvs_feed,kvs_subscription]}]}] -Applications: [kernel,stdlib,gproc,lager_syslog,pbkdf2,asn1,fs,ranch,mnesia, - compiler,inets,crypto,syntax_tools,xmerl,gen_logger,esockd, - cowlib,goldrush,public_key,lager,ssl,cowboy,mochiweb,emqttd, - erlydtl,kvs,mad,emqttc,nitro,rest,sh,syslog,review] -Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] - [async-threads:10] [hipe] [kernel-poll:false] [dtrace] - -Eshell V8.3 (abort with ^G) -starting emqttd on node 'nonode@nohost' -Nonexistent: [] -Plugins: [{mqtt_plugin,emq_auth_username,"2.1.1", - "Authentication with Username/Password",false}, - {mqtt_plugin,emq_dashboard,"2.1.1","EMQ Web Dashboard",false}, - {mqtt_plugin,emq_modules,"2.1.1","EMQ Modules",false}, - {mqtt_plugin,n2o,"4.5-mqtt","N2O Server",false}] -Names: [emq_dashboard,n2o] -dashboard:http listen on 0.0.0.0:18083 with 4 acceptors. -Async Start Attempt {handler,"timer",n2o,system,n2o,[],[]} -Proc Init: init -mqtt:ws listen on 0.0.0.0:8083 with 4 acceptors. -mqtt:tcp listen on 0.0.0.0:1883 with 4 acceptors. -emqttd 2.1.1 is running now +$ make +===> Verifying dependencies... +... +===> Compiling roster +===> Compiling service +$ make console +===> Verifying dependencies... +===> Compiling roster +===> Compiling service +===> Starting relx build process ... +===> Resolving OTP Applications from directories: +... +===> release successfully created! +Exec: /.../erlang/20.3/erts-9.3/bin/erlexec -boot /.../nynja/server/_build/local/rel/server/releases/1.0.0/server -mode embedded -boot_var ERTS_LIB_DIR /.../erlang/20.3/lib -config /.../nynja/server/_build/local/rel/server/releases/1.0.0/sys.config -args_file /.../nynja/server/_build/local/rel/server/releases/1.0.0/vm.args -- console +Root: /.../nynja/server/_build/local/rel/server +/.../nynja/server/_build/local/rel/server +Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:32] [hipe] [kernel-poll:true] +... +Eshell V9.3 (abort with ^G) +(mq@127.0.0.1)1> > ``` @@ -132,8 +79,7 @@ Creating Single File Bundle --------------------------- ``` -$ mad release emqttd -$ ./emqttd rep +$ make tar ``` User/Device Registration @@ -160,32 +106,9 @@ ok > emqttd_ctl:run(["help"]). ``` -MQTT Erlang Client ------------------- - -``` -$ mad com -==> "/Users/maxim/depot/voxoz/emqttc/examples/gen_server" -Compiling /src/gen_server_example.erl -Writing /ebin/gen_server_example.app -OK -bash-3.2$ ./run -Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] - [async-threads:10] [hipe] [kernel-poll:false] [dtrace] - -Eshell V8.2 (abort with ^G) -1> [info] [Client <0.58.0>]: connecting to 127.0.0.1:1883 -[info] [Client <0.58.0>] connected with 127.0.0.1:1883 -[info] [Client <0.58.0>] RECV: CONNACK_ACCEPT -Client <0.58.0> is connected -[warning] [simpleClient@127.0.0.1:64618] resubscribe [{<<"TopicA">>,1}] -Message from TopicA: <<"hello...1">> -Message from TopicB: <<"hello...1">> -``` Credits ------- * Maxim Sokhatsky - -OM A HUM +* Ulf Wiger diff --git a/apps/rebar.config b/apps/rebar.config deleted file mode 100644 index c337a9c61111b599156aff4ca5e7b7e0d4ea6787..0000000000000000000000000000000000000000 --- a/apps/rebar.config +++ /dev/null @@ -1,2 +0,0 @@ -{sub_dirs, [ "roster", "service" ]}. -{deps_dir, ["../deps"]}. diff --git a/apps/roster/rebar.config b/apps/roster/rebar.config deleted file mode 100644 index a3a320496122b26a277284d0f2e3cd5d95a77267..0000000000000000000000000000000000000000 --- a/apps/roster/rebar.config +++ /dev/null @@ -1,4 +0,0 @@ -{deps_dir, ["../../deps"]}. -{lib_dirs, ["../../apps"]}. -{deps, []}. -{erl_opts, [debug_info]}. \ No newline at end of file diff --git a/apps/roster/src/protocol/micro_auth.erl b/apps/roster/src/protocol/micro_auth.erl index 00a0ef818f8816c38b1ce6f11c03e0bae69a22d2..5139c2c2276398503f58bcaaf10586495ddcbb5e 100644 --- a/apps/roster/src/protocol/micro_auth.erl +++ b/apps/roster/src/protocol/micro_auth.erl @@ -19,20 +19,20 @@ description() -> "Micro Authentication Module". check(#mqtt_client{client_id = <<"sys_micro_", _/binary>> = ClientId, client_pid = ClientPid}, _Pwd, _State) -> roster:info(?MODULE, "~p:Auth:auth(micro)/check", [ClientId]), - emqttd_client:subscribe(ClientPid, [{roster:action_topic(ClientId), 2}]), + emqttd_client:subscribe(ClientPid, [{roster:action_topic(ClientId), 2}]), ignore; -check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, +check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, username = <<"micro">>, ws_initial_headers = [_|_] = Headers} = MC, Pwd, State) when not is_tuple(Pwd) -> roster:info(?MODULE, "~p:Auth:auth(micro)/check/ws headers: ~p", [ClientId, Headers]), Jwt = get_token(normalize(Headers)), check(MC, {token, Jwt}, State); -check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, +check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, username = <<"micro">>} = MC, ?SYS_TOKEN=Pwd, State) -> -check(MC, {token, Pwd}, State); -check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, + check(MC, {token, Pwd}, State); +check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, username = <<"micro">>, - client_pid = ClientPid, + client_pid = ClientPid, will_topic = WT}, {token, Token}, _State) -> roster:info(?MODULE, "~p:Auth:auth(micro)/check", [ClientId]), case WT of @@ -49,9 +49,11 @@ check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, Auth1 = Auth0#'Auth'{last_online = roster:now_msec(), type = verified}, kvs:put(Auth1), roster:info(?MODULE, "~p:Auth:auth(micro)/check:session created, post logout ", [ClientId]), + roster:sub_client(subscribe, ClientId, PhoneId), AuthPid ! roster_auth:control_ver(Auth1, Ver), ok; {ok, #'Auth'{user_id = PhoneId} = Auth} -> + roster:sub_client(subscribe, ClientId, PhoneId), AuthPid ! roster_auth:control_ver(Auth#'Auth'{type = []}, Ver), ok; {ok, #'Auth'{user_id = _PhoneId2} = Auth} -> @@ -65,6 +67,7 @@ check(#mqtt_client{client_id = <<"emqttd_", _/binary>> = ClientId, kvs:put(Auth = #'Auth'{client_id = ClientId, user_id = PhoneId, phone = roster:phone(PhoneId), created = roster:now_msec(), last_online = roster:now_msec(), type = verified}), roster:info(?MODULE, "~p:Auth:auth(micro)/check:session created", [ClientId]), + roster:sub_client(subscribe, ClientId, PhoneId), AuthPid ! roster_auth:control_ver( Auth#'Auth'{client_id = ClientId, user_id = PhoneId, type = verified}, Ver), ok @@ -163,7 +166,7 @@ get_token(Headers) -> ?EMPTY_TOKEN -> case proplists:get_value("x-envoy-original-path", Headers, ?EMPTY_TOKEN) of %% If empty, try getting tokens from params headers ?EMPTY_TOKEN -> ?EMPTY_TOKEN; - Params -> + Params -> <<"/mqtts?access_token=", Jwt/binary>> = list_to_binary(Params), %% Parse the token from the params Jwt end; @@ -219,4 +222,4 @@ get_token(Headers) -> %% case kvs:get('LinkRoster', AccId) of %% {ok, #'LinkRoster'{phone_id = PhoneId}} -> roster:roster_id(PhoneId); %% _ -> [] -%% end. \ No newline at end of file +%% end. diff --git a/apps/roster/src/protocol/roster_auth.erl b/apps/roster/src/protocol/roster_auth.erl index dadb3d88e4d548cf2a276527f1fd6d1899ba463f..214e9e4394e8b3ea2dfb281647b94cda79636377 100644 --- a/apps/roster/src/protocol/roster_auth.erl +++ b/apps/roster/src/protocol/roster_auth.erl @@ -20,7 +20,7 @@ start() -> stop() -> n2o_async:stop(system, roster_auth). -init([Listeners]) -> +init([Listeners]) -> roster:info(?MODULE, "init/2: Listeners: ~p", [Listeners]), {ok, Listeners}. @@ -72,7 +72,7 @@ check(#mqtt_client{ token = Token, settings = Settings, last_online = LO - } = Auth) when Type == verified; + } = Auth) when Type == verified; Type == []; Type == expired -> roster:info(?MODULE, "[WS Headers]: ~p", [Headers]), @@ -94,9 +94,9 @@ check(#mqtt_client{ ), AuthPid = roster:n2o_pid(?MODULE), Now = roster:now_msec(), - LastOnline = case Type of + LastOnline = case Type of verified -> Now; - _ -> LO + _ -> LO end, Auth2 = Auth#'Auth'{ type = update, @@ -108,7 +108,7 @@ check(#mqtt_client{ {bad_token,_} -> Auth3 = Auth2#'Auth'{ type = expired, - token = element(2,roster:gen_token([],[])) + token = element(2,roster:gen_token([],[])) }, roster:info(?MODULE, "Auth:auth/roamToken:~p", [Auth3]), kvs:put(Auth3), @@ -126,7 +126,7 @@ check(#mqtt_client{ {_, _} -> OldIpBin = case FindIp = lists:keyfind(?IP_KEY, #'Feature'.key, Settings) of false -> IpBin; - #'Feature'{value = V} -> V + #'Feature'{value = V} -> V end, IsCheckIp = application:get_env(roster, auth_check_ip, true), Ver = binary_to_list(BVer), @@ -170,7 +170,7 @@ check(#mqtt_client{ ) ) of true -> []; - _ -> verified + _ -> verified end, kvs:put(Auth#'Auth'{token = Token, type = Type}), check(MqttClient, Token, Auth#'Auth'{token = Token, type = Type}); @@ -197,9 +197,9 @@ check(#mqtt_client{ {error, not_found} = Error404 -> roster:error(?MODULE, "~p:Auth/check:~p", [ClientId, Error404]), Error404; - Err -> + Err -> roster:error(?MODULE, "~p:Auth:auth/check:~p", [ClientId, Err]), - Err + Err end; check(#mqtt_client{ client_id = <<"emqttd_", _/binary>> = ClientId, @@ -267,7 +267,7 @@ info(#'Auth'{ {error, _} -> skip; {ok, #'Auth'{} = A} -> - roster_presence:on_disconnect(A#'Auth'{type = logout}, C) + roster_presence:on_disconnect(A#'Auth'{type = logout}, C) end; {ok, #'Auth'{client_id = ClId}} -> kvs:delete('Auth', ClId) @@ -290,7 +290,7 @@ info(#'Auth'{ {ok, _} -> Fun = case Services of [] -> generate_sms; - [jwt] -> generate_jwt + [jwt] -> generate_jwt end, {ok, Codes} = telesign_api:Fun(Phone), kvs:put(Auth#'Auth'{ @@ -435,7 +435,7 @@ info(#'Auth'{ UserId = roster:phone_id(Phone, RosterId), ClientId = client(RegClientId), [ - kvs:delete('Auth', ClId) + kvs:delete('Auth', ClId) || #'Auth'{client_id = ClId} <- kvs:index('Auth', dev_key, DevKey) ], {'Token', Token} = roster:gen_token([], []), @@ -514,7 +514,7 @@ info(#'Auth'{type = clear}, IO = #io{ code = case kvs:get('Auth', ClientId) of {ok, #'Auth'{user_id = PhoneId}} -> - [roster:force_logout(A) + [roster:force_logout(A) || #'Auth'{client_id = ClId} = A <- kvs:index('Auth', user_id, PhoneId), ClId /= ClientId ], #ok{code = cleared}; @@ -560,7 +560,7 @@ info(#'Auth'{type = get}, IO = case kvs:get('Auth', ClientId) of {ok, #'Auth'{user_id = PhoneId}} -> [ - Auth#'Auth'{token = []} + Auth#'Auth'{token = []} || #'Auth'{type = Type} = Auth <- kvs:index('Auth', user_id, PhoneId), Type == verified orelse Type == []]; {error, _} = Err -> @@ -578,10 +578,10 @@ info(#'Auth'{type = logout}, {ok, Auth} -> kvs:put(Auth#'Auth'{type = logout}); _ -> - skip + skip end, {bert, #io{code = #ok{code = logout}}}; - _ -> + _ -> <<>> end, {reply, D, Req, State}; @@ -621,7 +621,7 @@ proc(#'Auth'{ RegClientId = <<"reg_", Post/binary>>, n2o_vnode:unsubscribe(RegClientId, roster:action_topic(RegClientId)), kvs:delete(mqtt_session, RegClientId), - catch roster_presence:on_verify(ClientId, UserId), + catch roster:sub_client(subscribe, ClientId, UserId), Reply; %%proc(#'Auth'{type = [], token = Token, phone = Phone, client_id = <<"emqttd_", _/binary>> = ClientId}=Auth,H)-> %% proc(Auth#'Auth'{type = {ver,?VERSION}}, H); @@ -665,7 +665,7 @@ proc({vox, #'Profile'{phone = Phone, services = Services} = Profile, Cli}, ok -> {VoxResponse1} = VoxResponse, [Id, U, P] = [ - proplists:get_value(Key, VoxResponse1) + proplists:get_value(Key, VoxResponse1) || Key <- [user_id, user_name, user_password] ], roster:info(?MODULE, "~p:~p:vox:~p:~p:~p", [Phone, Cli, Id, U, P]), @@ -677,7 +677,7 @@ proc({vox, #'Profile'{phone = Phone, services = Services} = Profile, Cli}, status = added }; _ER -> - [] + [] end, kvs:put(Profile2 = #'Profile'{rosters = Rosters} = Profile#'Profile'{services = lists:flatten([Service | Services])}), case emqttd_cm:lookup(Cli) of @@ -714,15 +714,15 @@ proc({voice, Phone, SmsCode, Lang}, #handler{} = H) -> {reply, [], H}; proc({mqttc, C, connected}, - State = #handler{state = C, seq = S}) -> + State = #handler{state = C, seq = S}) -> {ok, State#handler{seq = S + 1}}; -proc({mqttc, _C, disconnected}, State) -> +proc({mqttc, _C, disconnected}, State) -> {ok, State}; proc(Unknown, #handler{} = H) -> roster:info(?MODULE, "invalid auth data :~p", [Unknown]), {reply, [], H}. -client(<<"reg_", Post/binary>>) -> +client(<<"reg_", Post/binary>>) -> <<"emqttd_", Post/binary>>; client(ClientId) -> ClientId. @@ -760,12 +760,12 @@ get_geolocal(IP) -> V when is_binary(V) -> {K, V}; _ -> - [] - end + [] + end || {K, Keys} <- L ]); {error, _} -> - [] + [] end. geoval([], Acc) -> Acc; @@ -785,7 +785,7 @@ delete_duplicated_tokens(ClientId, PushToken) -> _ -> roster:info(?MODULE, "DeleteOldAuthSession:~p:~p", [PushToken, SessionId]), kvs:delete('Auth', SessionId) - end + end || #'Auth'{client_id = SessionId} <- kvs:index('Auth', push, PushToken) ]. @@ -807,6 +807,6 @@ control_ver(A, Ver) -> A#'Auth'{type = {ver, Ver}}; verified -> A#'Auth'{type = {reg, Ver}}; - _ -> + _ -> A end. diff --git a/apps/roster/src/protocol/roster_presence.erl b/apps/roster/src/protocol/roster_presence.erl index 9ecf2434cf49ffdc5770a463f37347de5830ee16..c743c46820ea2b34a20c052c416a5b6b8f82c75f 100644 --- a/apps/roster/src/protocol/roster_presence.erl +++ b/apps/roster/src/protocol/roster_presence.erl @@ -55,7 +55,7 @@ on_disconnect(#'Auth'{phone = Phone, client_id = ClientId, type=Type}, C) -> roster:info(?MODULE, "~p:~p:DISCONNECT:~p", [Phone, ClientId, Type]), send_presence(offline, Phone, C, ClientId). -on_verify(ClientId, PhoneId) -> roster:sub_client(subscribe, ClientId, PhoneId). +on_verify(_ClientId, _PhoneId) -> ok. %% Warning: Do not always delete Auth record, it holds push notification tokens should_preserve_auth_record(ClientId) -> @@ -107,4 +107,4 @@ amazon_settings(#'Profile'{phone = ProfileId, settings = Settings}) -> StaticFeatures = lists:foldl(fun({Key, Value}, Acc) -> Acc ++ [#'Feature'{id = iolist_to_binary([ProfileId, Key]), key = Key, value = Value, group = <<"SPECIAL_ANDROID_KEYS">>}] end, [], [{<<"ACCESS_KEY">>, ?AWS_ACCESS_KEY_ID}, {<<"SECRET_KEY">>, ?AWS_SECRET_ACCESS_KEY}]), - Settings ++ StaticFeatures. \ No newline at end of file + Settings ++ StaticFeatures. diff --git a/apps/roster/src/roster.app.src b/apps/roster/src/roster.app.src index e5ed158381e133b9a1950c109e602c6724111cfc..ec6fdf48612cb45316aba1b69ba22a9bf7e0b4e9 100644 --- a/apps/roster/src/roster.app.src +++ b/apps/roster/src/roster.app.src @@ -2,6 +2,11 @@ [{description, "Roster Protocol"}, {vsn, "1"}, {registered, []}, - {applications, [kernel,stdlib,mnesia,kvs,emqttd,n2o,bpe,locus,prometheus,libphonenumber_erlang]}, + {applications, [kernel,stdlib, mnesia, crypto, inets, ssl, + ibrowse, cowlib, mochiweb, gen_smtp, + kvs, nitro, n2o, emqttc, emqttd, nitro, bpe, + jose, json_rec, jsx, uuid, erlydtl, jwt, + mad, migresia, mini_s3, qdate, rest, enenra, + locus, prometheus, libphonenumber_erlang]}, {mod, { roster, []}}, {env, []} ]}. diff --git a/apps/roster/src/roster.erl b/apps/roster/src/roster.erl index 3de088001dc4b0ca88d4e47d9af71445dd4f426e..42de5ea37d7f82553e284fcaabb29cd5233dee17 100644 --- a/apps/roster/src/roster.erl +++ b/apps/roster/src/roster.erl @@ -32,10 +32,10 @@ log_modules() -> [ %% rest api rest_handler, rest_session, rest_whitelist, rest_whitelist_admin, rest_push, rest_deeplink, rest_helpers, rest_publish, rest_fake_numbers, rest_metric, rest_cri, rest_users, rest_gw, rest_message, -%% test staff +%% test stuff main_test, auth_test, room_test, -%% other staff - signup, n2o, dashboard, stream, n2o_auth, n2o_vnode, macbert_javascript +%% other stuff + signup, n2o, dashboard, stream, n2o_auth, n2o_vnode ]. register_acl_mod() -> @@ -48,42 +48,46 @@ register_acl_mod() -> atoms() -> [android, ios, contact, signup, signin, welcome]. init([]) -> {ok, {{one_for_one, 5, 10}, []}}. -start(_, _) -> atoms(), catch load([]), - application:stop(n2o), - application:start(n2o), - X = try begin - A = supervisor:start_link({local, roster}, roster, []), - emqttd_access_control:register_mod(auth, n2o_auth, [[]], 9997), - emqttd_access_control:register_mod(auth, roster_auth, [[]], 9998), - emqttd_access_control:register_mod(auth, micro_auth, [[]], 9996), - register_acl_mod(), - % roster_db:restore("mnesia.backup"), - roster_message:start(), - roster_friend:start(), - roster_roster:start(), - roster_profile:start(), - % roster_search:start(), - roster_auth:start(), - micro_auth:start(), - [M:start() || M <- application:get_env(?MODULE, start_modules, [])], - roster_bpe:start(), - rest_handler:init(), - roster_room:start(), - roster_history:start(), - roster_push:start(), - stickers_api:init_default_pack(), - init_default_fake_numbers(), - prometheus_api:init(), - sync_indexes(), - A end - catch E:Z -> - io:format("FATAL ROSTER START: ~p~n",[{E, Z, erlang:get_stacktrace()}]), - [] - end, +start(_, _) -> + atoms(), + try load([]) + catch + Error:Reason -> + warning("Error loading ~p: ~p~n",[Error, Reason]) + end, + A = supervisor:start_link({local, roster}, roster, []), + try + emqttd_access_control:register_mod(auth, n2o_auth, [[]], 9997), + emqttd_access_control:register_mod(auth, roster_auth, [[]], 9998), + emqttd_access_control:register_mod(auth, micro_auth, [[]], 9996), + register_acl_mod(), + % roster_db:restore("mnesia.backup"), + roster_message:start(), + roster_friend:start(), + roster_roster:start(), + roster_profile:start(), + % roster_search:start(), + roster_auth:start(), + micro_auth:start(), + [ M:start() || M <- application:get_env(?MODULE, start_modules, [])], + roster_bpe:start(), + rest_handler:init(), + roster_room:start(), + roster_history:start(), + roster_push:start(), + stickers_api:init_default_pack(), + init_default_fake_numbers(), + prometheus_api:init(), + sync_indexes() + catch E:Z -> + io:format("FATAL ROSTER START: ~p~n",[{E, Z, erlang:get_stacktrace()}]), + erlang:error("FATAL ROSTER START: ~p~n", [{E, Z}]), + {E, Z} + end, google_api:start(), - X. + A. -execution_time(StartTime) -> +execution_time(StartTime) -> TimeInMicroSec = (os:system_time() - StartTime)/1000, list_to_integer(float_to_list(TimeInMicroSec,[{decimals,0}])). @@ -134,9 +138,9 @@ error(String) -> roster_io:log(?MODULE, String, [], error). % PROFILE MANAGEMENT delete_sessions(Index, P) -> - [begin + [begin n2o_vnode:unsubscribe(ClientId, roster:action_topic(ClientId)), - kvs:delete('Auth', ClientId) + kvs:delete('Auth', ClientId) end || #'Auth'{client_id = ClientId} <- kvs:index('Auth', Index, P)]. delete_sessions({client_id, ClientId}) -> @@ -176,8 +180,8 @@ add_length_settings_maybe(Settings, Size, #'Roster'{userlist = Contacts, [] -> Settings; _ -> RealStars = [RealStar || RealStar = #'Star'{} <- Stars], - info(?MODULE, - "split_roster:TotalLength: ~p Contacts | ~p Rooms | ~p Stars", + info(?MODULE, + "split_roster:TotalLength: ~p Contacts | ~p Rooms | ~p Stars", [length(Contacts), length(Rooms), length(RealStars)]), Settings ++ [create_length_feature(contacts, length(Contacts))] @@ -188,7 +192,7 @@ add_length_settings_maybe(Settings, Size, #'Roster'{userlist = Contacts, create_length_feature(Key, Size) -> Type = atom_to_binary(Key, utf8), - #'Feature'{id = [], + #'Feature'{id = [], key = <>, value = list_to_binary(integer_to_list(Size)), group = <<"PAGINATION">>}. @@ -210,7 +214,7 @@ send_profile(#'Profile'{ ClientPid) -> roster:info(?MODULE, "SEND PROFILE [~p]", [length(Rosters)]), case kvs:get('Roster', RosterId) of - {error, _} -> + {error, _} -> roster:info(?MODULE, "roster ~p not found in profile ~p", [RosterId, Phone]); {ok, #'Roster'{} = Roster} -> ProfileWithNewSettings = Profile#'Profile'{settings = add_length_settings_maybe(Settings, N, Roster)}, @@ -245,7 +249,7 @@ send_profile(#'Profile'{ ClientPid) -> roster:info(?MODULE, "SEND PROFILE [~p]", [length(Rosters)]), case kvs:get('Roster', RosterId) of - {error, _} -> + {error, _} -> roster:info(?MODULE, "roster ~p not found in profile ~p", [RosterId, Phone]); {ok, #'Roster'{} = Roster} -> ProfileWithNewSettings = Profile#'Profile'{settings = add_length_settings_maybe(Settings, N, Roster)}, @@ -880,12 +884,12 @@ parse_token(Token) -> {error, invalid_token}; {Expiration, D} when Expiration =< Now -> {error, token_expired}; - {_, D} -> D + {_, D} -> D end. parse_token2(Token) -> case depicle(Token) of <<>> -> {error, invalid_token}; - {_, D} -> D + {_, D} -> D end. get_vnode(Term) -> [H|_] = binary_to_list(erlang:md5(term_to_binary(Term))), @@ -1210,11 +1214,11 @@ last_objs([Obj|TObjs], PhoneId, LastSync, N, {Acc, MaxUpd}) -> {0, Feed} end, LastUpd = erlang:max(Created, last_upd(Obj)), - Acc2 = case LastUpd > LastSync of + Acc2 = case LastUpd > LastSync of true -> Acc++[{Obj, W}]; _ -> - Acc + Acc end, %% TODO sort objects if update? last_objs(TObjs, PhoneId, LastSync, N, {Acc2, erlang:max(MaxUpd, LastUpd)}). @@ -1234,7 +1238,7 @@ split_objlist(Index, #'Roster'{} = Roster, LastSync, N, Acc) split_objlist([], _Roster, _LastSync, _N, Acc) -> Acc; split_objlist([_|_] = List, #'Roster'{}=Roster, LastSync, N, Acc) -> - %[ Objs | TObjs ] = + %[ Objs | TObjs ] = objlist(List, Roster, LastSync, N); %split_objlist(TObjs, Roster, LastSync, N, Acc ++ [Objs]); split_objlist(Index, Id, LastSync, N, Acc) @@ -1246,7 +1250,7 @@ split_objlist(Index, Id, LastSync, N, Acc) split_objlist(Index, R, LastSync, N, Acc); _ -> info(?MODULE, "roster ~p not found", [Id]), - {error, roster_not_found} + {error, roster_not_found} end. objlist(Index, Roster) -> @@ -1284,7 +1288,7 @@ objlist([Object | _] = Objects, [H | _ ] when length(H) =< N -> Fun(H), Objs; - _ -> + _ -> Objs end; objlist([_Obj | TObjs], #'Roster'{id = _Id} = Roster, LastSync, N, Fun) -> @@ -1320,7 +1324,7 @@ build_object(Object, Acc, maybe_build_and_add_object(Object, Acc, Roster, Feed, LastUpd, LastSync) end. -maybe_build_and_add_object(_Object, Acc, _Roster, _Writer, LastUpd, LastSync) +maybe_build_and_add_object(_Object, Acc, _Roster, _Writer, LastUpd, LastSync) when LastUpd =< LastSync -> Acc; maybe_build_and_add_object(#'Contact'{} = Object, [HAcc | TAcc], Roster, Writer, _LastUpd, LastSync) -> @@ -1505,12 +1509,12 @@ roster(#'Roster'{} = Roster, N, LastSync) -> favorite = objlist(#'Roster'.favorite, Roster, LastSync, N) }; -roster(Id, N, LastSync) -> +roster(Id, N, LastSync) -> case kvs:get('Roster', Id) of {ok, Roster} -> roster(Roster, N, LastSync); _ -> - [] + [] end. sub_room(subscribe, #'Member'{status = removed}) -> []; @@ -1834,7 +1838,7 @@ presence(#'Contact'{phone_id = PhoneId} = C) -> info(?MODULE, "invalid contact: ~p", [PhoneId]), C end. get_data_val(Key, Data) -> - case get_data(Key, Data) of + case get_data(Key, Data) of [] -> []; #'Feature'{value = Val} -> Val @@ -1844,7 +1848,7 @@ get_data(Key, #'Desc'{data = Data}) when not is_record(Data, 'Desc') -> get_data(Key, Data) -> case lists:keyfind(Key, #'Feature'.key, Data) of false -> []; - F -> F + F -> F end. set_data(Key, Val, Data) -> case get_data(Key, Data) of diff --git a/apps/roster/src/roster_validator.erl b/apps/roster/src/roster_validator.erl index ea5d1c818f74323a1d884f78e1ed29693fb2d005..a9888e27652f8c4a019dd8cc96499c3c6777af28 100644 --- a/apps/roster/src/roster_validator.erl +++ b/apps/roster/src/roster_validator.erl @@ -1,982 +1,1215 @@ -module(roster_validator). --include_lib("bpe/include/bpe.hrl"). --include_lib("emqttd/include/emqttd.hrl"). --include_lib("kvs/include/feed.hrl"). --include_lib("kvs/include/group.hrl"). --include_lib("kvs/include/kvs.hrl"). + +-include("roster.hrl"). +-include("static_auth.hrl"). +-include_lib("n2o/include/n2o.hrl"). -include_lib("kvs/include/metainfo.hrl"). -include_lib("kvs/include/user.hrl"). --include_lib("n2o/include/n2o.hrl"). --include_lib("roster/include/roster.hrl"). --include_lib("roster/include/static_auth.hrl"). --compile(export_all). +-include_lib("kvs/include/group.hrl"). +-include_lib("emqttd/include/emqttd.hrl"). +-include_lib("mnesia/src/mnesia.hrl"). -custom_validate(_Obj) -> []. -validate(Obj) -> validate(Obj, [], application:get_env(bert, custom_validate, {?MODULE, custom_validate})). -validate(Obj, Acc, _) when is_atom(Obj) -> Acc; -validate(Obj, Acc, _) when is_integer(Obj) -> Acc; -validate(Obj, Acc, _) when is_binary(Obj) -> Acc; +-compile(export_all). +-define(COND_FUN(Cond), fun(Rec) when Cond -> true; (_) -> false end). +validate(Obj) -> validate(Obj, []). +validate(_, [{[_|_] , _R}|_] = Acc) -> {error, Acc}; +validate([], _) -> ok; +validate(Objs, [{[] , R}|T]) -> validate(Objs, [R|T]); +validate([{CondFun, _, []}|T], Acc) when is_function(CondFun) -> validate(T, Acc); +validate([{CondFun, Field, [Obj|TObjs]}|T], Acc) when is_function(CondFun) -> + case CondFun(Obj) of + true -> validate([{CondFun, Field, TObjs}|T], Acc); + false -> {error, [Field, Obj|Acc]} end; +validate([{CondFun, Field, Obj}|T], Acc) when is_function(CondFun) -> + case CondFun(Obj) of true -> validate(T, Acc); false -> {error, [Field, Obj|Acc]} end; +validate([{_Field, []}|T], Acc) -> validate(T, Acc); +validate([{Field, [Obj|TObjs]}|T], Acc) -> + case validate(Obj, [Field|Acc]) of + ok -> validate([{Field, TObjs}|T], Acc); + Err -> Err + end; -validate(D = #'writer'{id = Id, count = Count, cache = Cache, args = Args, first = First}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} -> Acc2; - {count,_} when is_integer(Count) -> Acc2; - {cache,_} when Cache==[] orelse is_tuple(Cache) -> Acc2; - {args,_} -> Acc2; - {first,_} when First==[] orelse is_tuple(First) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'writer'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'reader'{id = Id, pos = Pos, cache = Cache, args = Args, feed = Feed, dir = Dir}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} -> Acc2; - {pos,_} when Pos==[] orelse is_integer(Pos) -> Acc2; - {cache,_} when Cache==[] orelse is_integer(Cache) -> Acc2; - {args,_} -> Acc2; - {feed,_} -> Acc2; - {dir,_} when Dir==0 orelse Dir==1 -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'reader'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'cur'{id = Id, top = Top, bot = Bot, dir = Dir, reader = Reader, writer = Writer, args = Args}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} -> Acc2; - {top,_} when Top==[] orelse is_integer(Top) -> Acc2; - {bot,_} when Bot==[] orelse is_integer(Bot) -> Acc2; - {dir,_} when Dir==0 orelse Dir==1 -> Acc2; - {reader,_} when Reader==[] orelse is_tuple(Reader) -> Acc2; - {writer,_} when Writer==[] orelse is_tuple(Writer) -> Acc2; - {args,_} when is_list(Args) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) orelse is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{args, D}|Acc3] end, Acc2, Args); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'cur'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'iter'{id = Id, container = Container, feed = Feed, next = Next, prev = Prev}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed,_} -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'iter'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'container'{id = Id, top = Top, rear = Rear, count = Count}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {top,_} when Top==[] orelse is_integer(Top) -> Acc2; - {rear,_} when Rear==[] orelse is_integer(Rear) -> Acc2; - {count,_} when is_integer(Count) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'container'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'iterator'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed_id,_} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'iterator'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'log'{id = Id, top = Top, rear = Rear, count = Count}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {top,_} when Top==[] orelse is_integer(Top) -> Acc2; - {rear,_} when Rear==[] orelse is_integer(Rear) -> Acc2; - {count,_} when is_integer(Count) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'log'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'operation'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed_id,_} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'operation'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'feed'{id = Id, top = Top, rear = Rear, count = Count}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {top,_} when Top==[] orelse is_integer(Top) -> Acc2; - {rear,_} when Rear==[] orelse is_integer(Rear) -> Acc2; - {count,_} when is_integer(Count) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'feed'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'task'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {roles,_} when is_binary(Roles) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'task'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'userTask'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {roles,_} when is_binary(Roles) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'userTask'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'serviceTask'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {roles,_} when is_binary(Roles) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'serviceTask'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'receiveTask'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {roles,_} when is_binary(Roles) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'receiveTask'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'messageEvent'{name = Name, module = Module, prompt = Prompt, payload = Payload, timeout = Timeout}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {payload,_} when is_binary(Payload) -> Acc2; - {timeout,_} when is_tuple(Timeout) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'messageEvent'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'boundaryEvent'{name = Name, module = Module, prompt = Prompt, payload = Payload, timeout = Timeout, timeDate = TimeDate, timeDuration = TimeDuration, timeCycle = TimeCycle}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {payload,_} when is_binary(Payload) -> Acc2; - {timeout,_} when is_tuple(Timeout) -> Acc2; - {timeDate,_} when is_binary(TimeDate) -> Acc2; - {timeDuration,_} when is_binary(TimeDuration) -> Acc2; - {timeCycle,_} when is_binary(TimeCycle) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'boundaryEvent'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'timeoutEvent'{name = Name, module = Module, prompt = Prompt, payload = Payload, timeout = Timeout, timeDate = TimeDate, timeDuration = TimeDuration, timeCycle = TimeCycle}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - {payload,_} when Payload==[] orelse is_binary(Payload) -> Acc2; - {timeout,_} when Timeout==[] orelse is_tuple(Timeout) -> Acc2; - {timeDate,_} when TimeDate==[] orelse is_binary(TimeDate) -> Acc2; - {timeDuration,_} when TimeDuration==[] orelse is_binary(TimeDuration) -> Acc2; - {timeCycle,_} when TimeCycle==[] orelse is_binary(TimeCycle) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'timeoutEvent'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'beginEvent'{name = Name, module = Module, prompt = Prompt}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'beginEvent'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'endEvent'{name = Name, module = Module, prompt = Prompt}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_atom(Name) -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {prompt,_} when is_list(Prompt) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{prompt, D}|Acc3] end, Acc2, Prompt); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'endEvent'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'sequenceFlow'{source = Source, target = Target}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {source,_} when Source==[] orelse is_atom(Source) -> Acc2; - {target,_} when Target==[] orelse is_atom(Target) orelse is_list(Target) -> - lists:foldl(fun(Tmp, Acc3) when is_atom(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{target, D}|Acc3] end, Acc2, Target); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'sequenceFlow'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'hist'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, name = Name, task = Task, docs = Docs, time = Time}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed_id,_} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - {name,_} when Name==[] orelse is_binary(Name) -> Acc2; - {task,_} when is_atom(Task) -> Acc2; - {docs,_} when is_list(Docs) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{docs, D}|Acc3] end, Acc2, Docs); - {time,_} -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'hist'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'process'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, name = Name, roles = Roles, tasks = Tasks, events = Events, hist = Hist, flows = Flows, rules = Rules, docs = Docs, options = Options, task = Task, timer = Timer, notifications = Notifications, result = Result, started = Started, beginEvent = BeginEvent, endEvent = EndEvent}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed_id,_} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - {name,_} when Name==[] orelse is_binary(Name) -> Acc2; - {roles,_} when is_list(Roles) -> []; - {tasks,_} when is_list(Tasks) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'task') orelse is_record(Tmp,'serviceTask') orelse is_record(Tmp,'userTask') orelse is_record(Tmp,'receiveTask') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{tasks, D}|Acc3] end, Acc2, Tasks); - {events,_} when is_list(Events) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'messageEvent') orelse is_record(Tmp,'boundaryEvent') orelse is_record(Tmp,'timeoutEvent') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{events, D}|Acc3] end, Acc2, Events); - - {flows,_} when is_list(Flows) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'sequenceFlow') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{flows, D}|Acc3] end, Acc2, Flows); - - {docs,_} when is_list(Docs) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{docs, D}|Acc3] end, Acc2, Docs); - {options,_} -> Acc2; - {task,_} when Task==[] orelse is_atom(Task) -> Acc2; - {timer,_} when Timer==[] orelse is_binary(Timer) -> Acc2; - {notifications,_} when Notifications==[] orelse true -> Acc2; - {result,_} when Result==[] orelse is_binary(Result) -> Acc2; - {started,_} when Started==[] orelse is_tuple(Started) -> Acc2; - {beginEvent,_} when BeginEvent==[] orelse is_atom(BeginEvent) -> Acc2; - {endEvent,_} when EndEvent==[] orelse is_atom(EndEvent) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'process'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'complete'{id = Id}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'complete'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'proc'{id = Id}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'proc'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'load'{id = Id}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'load'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'histo'{id = Id}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'histo'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'create'{proc = Proc, docs = Docs}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {proc,_} when Proc==[] orelse is_record(Proc,'process') orelse is_binary(Proc) -> Acc2; - {docs,_} when Docs==[] orelse is_list(Docs) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{docs, D}|Acc3] end, Acc2, Docs); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'create'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'amend'{id = Id, docs = Docs}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {docs,_} when Docs==[] orelse is_list(Docs) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{docs, D}|Acc3] end, Acc2, Docs); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'amend'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'chain'{id = Id, top = Top, rear = Rear, count = Count}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {top,_} when Top==[] orelse is_integer(Top) -> Acc2; - {rear,_} when Rear==[] orelse is_integer(Rear) -> Acc2; - {count,_} when is_integer(Count) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'chain'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'push'{model = Model, type = Type, title = Title, alert = Alert, badge = Badge, sound = Sound}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {model,_} when Model==[] orelse true -> Acc2; - {type,_} when Type==[] orelse is_binary(Type) -> Acc2; - {title,_} when Title==[] orelse is_binary(Title) -> Acc2; - {alert,_} when Alert==[] orelse is_binary(Alert) -> Acc2; - {badge,_} when Badge==[] orelse is_integer(Badge) -> Acc2; - {sound,_} when Sound==[] orelse is_binary(Sound) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'push'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Search'{id = Id, ref = Ref, field = Field, type = Type, value = Value, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when is_integer(Id) orelse is_binary(Id) -> Acc2; - {ref,_} when is_binary(Ref) -> Acc2; - {field,_} when is_binary(Field) -> Acc2; - {type,_} when Type=='==' orelse Type=='!=' orelse Type=='like' -> Acc2; - {value,_} when is_list(Value) -> - lists:foldl(fun(Tmp, Acc3) when true orelse is_binary(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{value, D}|Acc3] end, Acc2, Value); - {status,_} when Status=='profile' orelse Status=='roster' orelse Status=='contact' orelse Status=='member' orelse Status=='room' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Search'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'p2p'{from = From, to = To}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {from,_} when is_binary(From) -> Acc2; - {to,_} when is_binary(To) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'p2p'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'muc'{name = Name}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when is_binary(Name) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'muc'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqi'{feed_id = Feed_id, query = Query, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {feed_id, #'muc'{}} -> Acc2; - {query,_} when Query==[] orelse is_binary(Query) -> Acc2; - {status,_} when Status==[] orelse Status=='admin' orelse Status=='member' orelse Status=='removed' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqi'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Feature'{id = Id, key = Key, value = Value, group = Group}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - {key,_} when is_binary(Key) -> Acc2; - {value,_} when is_binary(Value) -> Acc2; - {group,_} when is_binary(Group) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Feature'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Service'{id = Id, type = Type, data = Data, login = Login, password = Password, expiration = Expiration, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - {type,_} when Type=='email' orelse Type=='vox' orelse Type=='aws' orelse Type=='wallet' -> Acc2; - {data,_} -> Acc2; - {login,_} when Login==[] orelse is_binary(Login) -> Acc2; - {password,_} when Password==[] orelse is_binary(Password) -> Acc2; - {expiration,_} when Expiration==[] orelse is_integer(Expiration) -> Acc2; - {status,_} when Status==[] orelse Status=='verified' orelse Status=='added' orelse Status=='add' orelse Status=='remove' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Service'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Member'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, phone_id = Phone_id, avatar = Avatar, names = Names, surnames = Surnames, alias = Alias, reader = Reader, update = Update, settings = Settings, services = Services, presence = Presence, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when Container=='chain' orelse Container=='cur' orelse Container==[] -> Acc2; - {feed_id,_} when is_record(Feed_id,'muc') orelse is_record(Feed_id,'p2p') orelse Feed_id==[] -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - {phone_id,_} when Phone_id==[] orelse is_binary(Phone_id) -> Acc2; - {avatar,_} when Avatar==[] orelse is_binary(Avatar) -> Acc2; - {names,_} when Names==[] orelse is_binary(Names) -> Acc2; - {surnames,_} when Surnames==[] orelse is_binary(Surnames) -> Acc2; - {alias,_} when Alias==[] orelse is_binary(Alias) -> Acc2; - {reader,_} when Reader==[] orelse is_integer(Reader) -> Acc2; - {update,_} when Update==[] orelse is_integer(Update) -> Acc2; - {settings,_} when Settings==[] orelse is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {services,_} when Services==[] orelse is_list(Services) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Service') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{services, D}|Acc3] end, Acc2, Services); - {presence,_} when Presence==[] orelse Presence=='online' orelse Presence=='offline' -> Acc2; - {status,_} when Status==[] orelse Status=='admin' orelse Status=='member' orelse Status=='removed' orelse Status=='patch' orelse Status=='owner' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Member'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Desc'{id = Id, mime = Mime, payload = Payload, parentid = Parentid, data = Data}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - {mime,_} when Mime==[] orelse is_binary(Mime) -> Acc2; - {payload,_} when Payload==[] orelse is_binary(Payload) -> Acc2; - {parentid,_} when Parentid==[] orelse is_binary(Parentid) -> Acc2; - {data,_} when is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Desc'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'StickerPack'{id = Id, name = Name, keywords = Keywords, description = Description, author = Author, stickers = Stickers, created = Created, updated = Updated, downloaded = Downloaded}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {name,_} when Name==[] orelse is_binary(Name) -> Acc2; - {keywords,_} when is_list(Keywords) -> - lists:foldl(fun(Tmp, Acc3) when is_binary(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{keywords, D}|Acc3] end, Acc2, Keywords); - {description,_} when Description==[] orelse is_binary(Description) -> Acc2; - {author,_} when Author==[] orelse is_binary(Author) -> Acc2; - {stickers,_} when is_list(Stickers) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Desc') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{stickers, D}|Acc3] end, Acc2, Stickers); - {created,_} when is_integer(Created) -> Acc2; - {updated,_} when is_integer(Updated) -> Acc2; - {downloaded,_} when is_integer(Downloaded) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'StickerPack'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Message'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, msg_id = Msg_id, from = From, to = To, created = Created, files = Files, type = Type, link = Link, seenby = Seenby, repliedby = Repliedby, mentioned = Mentioned, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when Container=='chain' orelse Container=='cur' orelse Container==[] -> Acc2; - {feed_id,_} when is_record(Feed_id,'muc') orelse is_record(Feed_id,'p2p') -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {msg_id,_} when Msg_id==[] orelse is_binary(Msg_id) -> Acc2; - {from,_} when From==[] orelse is_binary(From) -> Acc2; - {to,_} when To==[] orelse is_binary(To) -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - {files,_} when is_list(Files) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Desc') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{files, D}|Acc3] end, Acc2, Files); - {type,_} when is_list(Type) -> - lists:foldl(fun(Tmp, Acc3) when Tmp=='sys' orelse Tmp=='reply' orelse Tmp=='forward' orelse Tmp=='read' orelse Tmp=='edited' orelse Tmp=='cursor' orelse Tmp=='draft' -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{type, D}|Acc3] end, Acc2, Type); - {link,_} when Link==[] orelse is_integer(Link) orelse is_record(Link,'Message') -> Acc2; - {seenby,_} when Seenby==[] orelse is_list(Seenby) -> - lists:foldl(fun(Tmp, Acc3) when is_binary(Tmp) orelse is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{seenby, D}|Acc3] end, Acc2, Seenby); - {repliedby,_} when Repliedby==[] orelse is_list(Repliedby) -> - lists:foldl(fun(Tmp, Acc3) when is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{repliedby, D}|Acc3] end, Acc2, Repliedby); - {mentioned,_} when Mentioned==[] orelse is_list(Mentioned) -> - lists:foldl(fun(Tmp, Acc3) when is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{mentioned, D}|Acc3] end, Acc2, Mentioned); - {status,_} when Status==[] orelse Status=='async' orelse Status=='delete' orelse Status=='clear' orelse Status=='update' orelse Status=='edit' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Message'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Link'{id = Id, name = Name, room_id = Room_id, created = Created, type = Type, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - {name,_} when Name==[] orelse is_binary(Name) -> Acc2; - {room_id,_} when Room_id==[] orelse is_binary(Room_id) -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - {type,_} when Type==[] orelse Type=='group' orelse Type=='channel' -> Acc2; - {status,_} when Status==[] orelse Status=='gen' orelse Status=='check' orelse Status=='add' orelse Status=='get' orelse Status=='join' orelse Status=='update' orelse Status=='delete' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Link'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Room'{id = Id, name = Name, links = Links, description = Description, settings = Settings, members = Members, admins = Admins, data = Data, type = Type, tos = Tos, tos_update = Tos_update, unread = Unread, mentions = Mentions, readers = Readers, last_msg = Last_msg, update = Update, created = Created, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - {name,_} when Name==[] orelse is_binary(Name) -> Acc2; - {links,_} when Links==[] orelse is_list(Links) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Link') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{links, D}|Acc3] end, Acc2, Links); - {description,_} when Description==[] orelse is_binary(Description) -> Acc2; - {settings,_} when is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {members,_} when is_list(Members) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Member') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{members, D}|Acc3] end, Acc2, Members); - {admins,_} when is_list(Admins) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Member') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{admins, D}|Acc3] end, Acc2, Admins); - {data,_} when is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Desc') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - {type,_} when Type==[] orelse Type=='group' orelse Type=='channel' orelse Type=='call' -> Acc2; - {tos,_} when Tos==[] orelse is_binary(Tos) -> Acc2; - {tos_update,_} when Tos_update==[] orelse is_integer(Tos_update) -> Acc2; - {unread,_} when Unread==[] orelse is_integer(Unread) -> Acc2; - {mentions,_} when is_list(Mentions) -> - lists:foldl(fun(Tmp, Acc3) when is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{mentions, D}|Acc3] end, Acc2, Mentions); - {readers,_} when is_list(Readers) -> - lists:foldl(fun(Tmp, Acc3) when is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{readers, D}|Acc3] end, Acc2, Readers); - {last_msg,_} when Last_msg==[] orelse is_integer(Last_msg) orelse is_record(Last_msg,'Message') -> Acc2; - {update,_} when Update==[] orelse is_integer(Update) -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - {status,_} when Status==[] orelse Status=='create' orelse Status=='leave' orelse Status=='add' orelse Status=='remove' orelse Status=='removed' orelse Status=='join' orelse Status=='joined' orelse Status=='info' orelse Status=='patch' orelse Status=='get' orelse Status=='delete' orelse Status=='last_msg' orelse Status=='mute' orelse Status=='unmute' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Room'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Tag'{roster_id = Roster_id, name = Name, color = Color, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {roster_id,_} when Roster_id==[] orelse is_binary(Roster_id) -> Acc2; - {name,_} when is_binary(Name) -> Acc2; - {color,_} when is_binary(Color) -> Acc2; - {status,_} when Status==[] orelse Status=='create' orelse Status=='remove' orelse Status=='edit' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Tag'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Star'{id = Id, client_id = Client_id, roster_id = Roster_id, message = Message, tags = Tags, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {client_id,_} when Client_id==[] orelse is_binary(Client_id) -> Acc2; - {roster_id,_} when Roster_id==[] orelse is_integer(Roster_id) -> Acc2; - {message,_} when Message==[] orelse is_record(Message,'Message') -> Acc2; - {tags,_} when is_list(Tags) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Tag') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{tags, D}|Acc3] end, Acc2, Tags); - {status,_} when Status==[] orelse Status=='add' orelse Status=='remove' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Star'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Typing'{phone_id = Phone_id, comments = Comments}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {phone_id,_} when is_binary(Phone_id) -> Acc2; - {comments,_} -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Typing'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Contact'{phone_id = Phone_id, avatar = Avatar, names = Names, surnames = Surnames, nick = Nick, reader = Reader, unread = Unread, last_msg = Last_msg, update = Update, created = Created, settings = Settings, services = Services, presence = Presence, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {phone_id,_} when Phone_id==[] orelse is_binary(Phone_id) -> Acc2; - {avatar,_} when Avatar==[] orelse is_binary(Avatar) -> Acc2; - {names,_} when Names==[] orelse is_binary(Names) -> Acc2; - {surnames,_} when Surnames==[] orelse is_binary(Surnames) -> Acc2; - {nick,_} when Nick==[] orelse is_binary(Nick) -> Acc2; - {reader,_} when Reader==[] orelse is_integer(Reader) orelse is_list(Reader) -> - lists:foldl(fun(Tmp, Acc3) when is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{reader, D}|Acc3] end, Acc2, Reader); - {unread,_} when Unread==[] orelse is_integer(Unread) -> Acc2; - {last_msg,_} when Last_msg==[] orelse is_record(Last_msg,'Message') -> Acc2; - {update,_} when Update==[] orelse is_integer(Update) -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - {settings,_} when is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {services,_} when is_list(Services) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Service') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{services, D}|Acc3] end, Acc2, Services); - {presence,_} when Presence==[] orelse Presence=='online' orelse Presence=='offline' orelse is_binary(Presence) -> Acc2; - {status,_} when Status==[] orelse Status=='request' orelse Status=='authorization' orelse Status=='ignore' orelse Status=='internal' orelse Status=='friend' orelse Status=='last_msg' orelse Status=='ban' orelse Status=='banned' orelse Status=='deleted' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Contact'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'ExtendedStar'{star = Star, from = From}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {star,_} when is_record(Star,'Star') orelse Star==[] -> Acc2; - {from,_} when is_record(From,'Contact') orelse is_record(From,'Room') orelse From==[] -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'ExtendedStar'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Auth'{client_id = Client_id, dev_key = Dev_key, user_id = User_id, phone = Phone, token = Token, type = Type, sms_code = Sms_code, attempts = Attempts, services = Services, settings = Settings, push = Push, os = Os, created = Created, last_online = Last_online}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {client_id,_} when Client_id==[] orelse is_binary(Client_id) -> Acc2; - {dev_key,_} when Dev_key==[] orelse is_binary(Dev_key) -> Acc2; - {user_id,_} when User_id==[] orelse is_binary(User_id) -> Acc2; - {phone,_} when Phone==[] orelse is_binary(Phone) orelse is_tuple(Phone) -> Acc2; - {token,_} when Token==[] orelse is_binary(Token) -> Acc2; - {type,_} when Type==[] orelse is_atom(Type) -> Acc2; - {sms_code,_} when Sms_code==[] orelse is_binary(Sms_code) -> Acc2; - {attempts,_} when Attempts==[] orelse is_integer(Attempts) -> Acc2; - {services,_} when is_list(Services) -> - lists:foldl(fun(Tmp, Acc3) when true -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{services, D}|Acc3] end, Acc2, Services); - {settings,_} when Settings==[] orelse is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {push,_} when Push==[] orelse is_binary(Push) -> Acc2; - {os,_} when Os==[] orelse Os=='ios' orelse Os=='android' orelse Os=='web' -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - {last_online,_} when Last_online==[] orelse is_integer(Last_online) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Auth'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Roster'{id = Id, names = Names, surnames = Surnames, email = Email, nick = Nick, userlist = Userlist, roomlist = Roomlist, favorite = Favorite, tags = Tags, phone = Phone, avatar = Avatar, update = Update, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_binary(Id) orelse is_integer(Id) -> Acc2; - {names,_} when Names==[] orelse is_binary(Names) -> Acc2; - {surnames,_} when Surnames==[] orelse is_binary(Surnames) -> Acc2; - {email,_} when Email==[] orelse is_binary(Email) -> Acc2; - {nick,_} when Nick==[] orelse is_binary(Nick) -> Acc2; - {userlist,_} when is_list(Userlist) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Contact') orelse is_integer(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{userlist, D}|Acc3] end, Acc2, Userlist); - {roomlist,_} when is_list(Roomlist) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Room') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{roomlist, D}|Acc3] end, Acc2, Roomlist); - {favorite,_} when is_list(Favorite) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Star') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{favorite, D}|Acc3] end, Acc2, Favorite); - {tags,_} when is_list(Tags) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Tag') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{tags, D}|Acc3] end, Acc2, Tags); - {phone,_} when Phone==[] orelse is_binary(Phone) -> Acc2; - {avatar,_} when Avatar==[] orelse is_binary(Avatar) -> Acc2; - {update,_} when Update==[] orelse is_integer(Update) -> Acc2; - {status,_} when Status==[] orelse Status=='get' orelse Status=='create' orelse Status=='del' orelse Status=='remove' orelse Status=='nick' orelse Status=='add' orelse Status=='update' orelse Status=='list' orelse Status=='patch' orelse Status=='last_msg' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Roster'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Profile'{phone = Phone, services = Services, rosters = Rosters, settings = Settings, update = Update, balance = Balance, presence = Presence, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {phone,_} when Phone==[] orelse is_binary(Phone) -> Acc2; - {services,_} when Services==[] orelse is_list(Services) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Service') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{services, D}|Acc3] end, Acc2, Services); - {rosters,_} when Rosters==[] orelse is_list(Rosters) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Roster') orelse is_binary(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{rosters, D}|Acc3] end, Acc2, Rosters); - {settings,_} when Settings==[] orelse is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {update,_} when is_integer(Update) -> Acc2; - {balance,_} when is_integer(Balance) -> Acc2; - {presence,_} when Presence==[] orelse Presence=='offline' orelse Presence=='online' orelse is_binary(Presence) -> Acc2; - {status,_} when Status==[] orelse Status=='remove' orelse Status=='get' orelse Status=='patch' orelse Status=='update' orelse Status=='delete' orelse Status=='create' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Profile'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Presence'{uid = Uid, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {uid,_} when is_binary(Uid) -> Acc2; - {status,_} when Status==[] orelse Status=='offline' orelse Status=='online' orelse is_binary(Status) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Presence'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Friend'{phone_id = Phone_id, friend_id = Friend_id, settings = Settings, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {phone_id,_} when is_binary(Phone_id) -> Acc2; - {friend_id,_} when is_binary(Friend_id) -> Acc2; - {settings,_} when Settings==[] orelse is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {status,_} when Status=='ban' orelse Status=='unban' orelse Status=='request' orelse Status=='confirm' orelse Status=='update' orelse Status=='ignore' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Friend'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'act'{name = Name, data = Data}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when Name==[] orelse is_binary(Name) -> Acc2; - {data,_} when is_binary(Data) orelse is_integer(Data) orelse is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when true -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'act'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Job'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, context = Context, proc = Proc, time = Time, data = Data, events = Events, settings = Settings, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when Container=='chain' orelse Container==[] -> Acc2; - {feed_id, #'act'{}} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {context,_} when Context==[] orelse is_integer(Context) orelse is_binary(Context) -> Acc2; - {proc,_} when Proc==[] orelse is_integer(Proc) orelse is_record(Proc,'process') -> Acc2; - {time,_} when Time==[] orelse is_integer(Time) -> Acc2; - {data,_} when Data==[] orelse is_binary(Data) orelse is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when true orelse is_record(Tmp,'Message') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - {events,_} when Events==[] orelse is_list(Events) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'messageEvent') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{events, D}|Acc3] end, Acc2, Events); - {settings,_} when Settings==[] orelse is_list(Settings) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Feature') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{settings, D}|Acc3] end, Acc2, Settings); - {status,_} when Status==[] orelse Status=='init' orelse Status=='update' orelse Status=='delete' orelse Status=='pending' orelse Status=='stop' orelse Status=='complete' orelse Status=='restart' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Job'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'History'{roster_id = Roster_id, feed = Feed, size = Size, entity_id = Entity_id, data = Data, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {roster_id,_} when is_binary(Roster_id) -> Acc2; - {feed,_} when is_record(Feed,'p2p') orelse is_record(Feed,'muc') orelse is_record(Feed,'act') orelse is_record(Feed,'StickerPack') orelse Feed==[] -> Acc2; - {size,_} when Size==[] orelse is_integer(Size) -> Acc2; - {entity_id,_} when Entity_id==[] orelse is_integer(Entity_id) -> Acc2; - {data,_} when Data==[] orelse is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'Message') orelse is_record(Tmp,'Job') orelse is_record(Tmp,'StickerPack') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - {status,_} when Status=='updated' orelse Status=='get' orelse Status=='update' orelse Status=='last_loaded' orelse Status=='last_msg' orelse Status=='get_reply' orelse Status=='double_get' orelse Status=='delete' orelse Status=='image' orelse Status=='video' orelse Status=='file' orelse Status=='link' orelse Status=='audio' orelse Status=='contact' orelse Status=='location' orelse Status=='text' orelse Status=='draft' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'History'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Schedule'{id = Id, proc = Proc, data = Data, state = State}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) orelse is_tuple(Id) -> Acc2; - {proc,_} when Proc==[] orelse is_integer(Proc) orelse is_binary(Proc) -> Acc2; - {data,_} when is_binary(Data) orelse is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when true -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - {state,_} when State==[] orelse true -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Schedule'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Index'{id = Id, roster = Roster}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse true -> Acc2; - {roster,_} when is_list(Roster) -> - lists:foldl(fun(Tmp, Acc3) when true -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{roster, D}|Acc3] end, Acc2, Roster); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Index'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Whitelist'{phone = Phone, created = Created}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {phone,_} when Phone==[] orelse is_binary(Phone) -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Whitelist'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'error'{code = Code}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {code,_} when Code==[] orelse is_atom(Code) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'error'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'ok'{code = Code}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {code,_} when Code==[] orelse is_binary(Code) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'ok'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'error2'{code = Code, src = Src}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {code,_} when Code==[] orelse is_atom(Code) -> Acc2; - {src,_} when Src==[] orelse is_binary(Src) orelse is_integer(Src) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'error2'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'ok2'{code = Code, src = Src}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {code,_} when Code==[] orelse is_atom(Code) -> Acc2; - {src,_} when Src==[] orelse is_tuple(Src) orelse is_binary(Src) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'ok2'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'io'{code = Code, data = Data}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {code,_} when Code==[] orelse is_record(Code,'ok') orelse is_record(Code,'error') orelse is_record(Code,'ok2') orelse is_record(Code,'error2') orelse Code=='transcribe' -> Acc2; - {data,_} when Data==[] orelse is_binary(Data) orelse is_record(Data,'Roster') orelse is_tuple(Data) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'io'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Ack'{table = Table, id = Id}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {table,_} when is_atom(Table) -> Acc2; - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Ack'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'errors'{code = Code, data = Data}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {code,_} when Code==[] orelse is_list(Code) -> - lists:foldl(fun(Tmp, Acc3) when is_binary(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{code, D}|Acc3] end, Acc2, Code); - {data,_} when Data==[] orelse true -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'errors'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'PushService'{recipients = Recipients, id = Id, ttl = Ttl, module = Module, priority = Priority, payload = Payload}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {recipients,_} when is_list(Recipients) -> - lists:foldl(fun(Tmp, Acc3) when is_binary(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{recipients, D}|Acc3] end, Acc2, Recipients); - {id,_} when Id==[] orelse is_binary(Id) -> Acc2; - {ttl,_} when Ttl==[] orelse is_integer(Ttl) -> Acc2; - {module,_} when Module==[] orelse is_binary(Module) -> Acc2; - {priority,_} when Priority==[] orelse is_binary(Priority) -> Acc2; - {payload,_} when Payload==[] orelse is_binary(Payload) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'PushService'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'PublishService'{message = Message, topic = Topic, qos = Qos}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {message,_} when Message==[] orelse is_binary(Message) -> Acc2; - {topic,_} when Topic==[] orelse is_binary(Topic) -> Acc2; - {qos,_} when Qos==[] orelse is_integer(Qos) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'PublishService'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'FakeNumbers'{phone = Phone, created = Created}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {phone,_} when Phone==[] orelse is_binary(Phone) -> Acc2; - {created,_} when Created==[] orelse is_integer(Created) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'FakeNumbers'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'Draft'{data = Data, status = Status}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {data,_} when is_list(Data) -> - lists:foldl(fun(Tmp, Acc3) when true -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{data, D}|Acc3] end, Acc2, Data); - {status,_} when Status=='update' orelse Status=='get' orelse Status=='delete' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'Draft'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'handler'{name = Name, module = Module, class = Class, group = Group, config = Config, state = State, seq = Seq}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when is_atom(Name) -> Acc2; - {module,_} when is_atom(Module) -> Acc2; - {class,_} -> Acc2; - {group,_} when is_atom(Group) -> Acc2; - {config,_} -> Acc2; - {state,_} -> Acc2; - {seq,_} -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'handler'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'pi'{name = Name, sup = Sup, module = Module, state = State}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {name,_} when is_atom(Name) -> Acc2; - {sup,_} when is_atom(Sup) -> Acc2; - {module,_} when is_atom(Module) -> Acc2; - {state,_} -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'pi'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'cx'{handlers = Handlers, actions = Actions, req = Req, module = Module, lang = Lang, path = Path, session = Session, formatter = Formatter, params = Params, node = Node, client_pid = Client_pid, state = State, from = From, vsn = Vsn}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {handlers,_} when is_list(Handlers) -> - lists:foldl(fun(Tmp, Acc3) when is_record(Tmp,'handler') -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{handlers, D}|Acc3] end, Acc2, Handlers); - {actions,_} when is_list(Actions) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{actions, D}|Acc3] end, Acc2, Actions); - {req,_} when Req==[] orelse true -> Acc2; - {module,_} when Module==[] orelse is_atom(Module) -> Acc2; - {lang,_} when Lang==[] orelse is_atom(Lang) -> Acc2; - {path,_} when Path==[] orelse is_binary(Path) -> Acc2; - {session,_} when Session==[] orelse is_binary(Session) -> Acc2; - {formatter,_} when Formatter=='bert' orelse Formatter=='json' -> Acc2; - {params,_} when Params==[] orelse is_list(Params) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{params, D}|Acc3] end, Acc2, Params); - {node,_} when Node==[] orelse is_atom(Node) -> Acc2; - {client_pid,_} when Client_pid==[] orelse true -> Acc2; - {state,_} when State==[] orelse true -> Acc2; - {from,_} when From==[] orelse is_binary(From) -> Acc2; - {vsn,_} when Vsn==[] orelse is_binary(Vsn) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'cx'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'user'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, email = Email}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed_id,_} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - {email,_} when Email==[] orelse is_binary(Email) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'user'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'group'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when Id==[] orelse is_integer(Id) -> Acc2; - {container,_} when is_atom(Container) -> Acc2; - {feed_id,_} -> Acc2; - {prev,_} when Prev==[] orelse is_integer(Prev) -> Acc2; - {next,_} when Next==[] orelse is_integer(Next) -> Acc2; - {feeds,_} when is_list(Feeds) -> []; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'group'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_topic'{topic = Topic, flags = Flags}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {topic,_} when is_binary(Topic) -> Acc2; - {flags,_} when is_list(Flags) -> - lists:foldl(fun(Tmp, Acc3) when Tmp=='retained' orelse Tmp=='static' -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{flags, D}|Acc3] end, Acc2, Flags); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_topic'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_client'{client_id = Client_id, client_pid = Client_pid, username = Username, peername = Peername, clean_sess = Clean_sess, proto_ver = Proto_ver, will_topic = Will_topic, ws_initial_headers = Ws_initial_headers}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {client_id,_} when is_binary(Client_id) orelse Client_id=='undefined' -> Acc2; - - {username,_} when is_binary(Username) orelse Username=='undefined' -> Acc2; - {peername,_} when is_tuple(Peername) -> Acc2; - - {proto_ver,_} when Proto_ver==3 orelse Proto_ver==4 -> Acc2; - {will_topic,_} when Will_topic=='undefined' orelse is_binary(Will_topic) -> Acc2; - {ws_initial_headers,_} when is_list(Ws_initial_headers) -> - lists:foldl(fun(Tmp, Acc3) when is_tuple(Tmp) -> validate(Tmp, Acc3, CM); (Tmp, Acc3) -> [{ws_initial_headers, D}|Acc3] end, Acc2, Ws_initial_headers); - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_client'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_session'{client_id = Client_id, sess_pid = Sess_pid, clean_sess = Clean_sess}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {client_id,_} when is_binary(Client_id) -> Acc2; - - - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_session'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_message'{id = Id}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when is_binary(Id) orelse Id=='undefined' -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_message'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_delivery'{sender = Sender, message = Message}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - - {message, #'mqtt_message'{}} -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_delivery'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_route'{topic = Topic, node = Node}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {topic,_} when is_binary(Topic) -> Acc2; - - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_route'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end; -validate(D = #'mqtt_alarm'{id = Id, severity = Severity, title = Title, summary = Summary}, Acc, {CustomValidateModule, ValidateFun} = CM) -> - ErrFields = lists:foldl(fun ({RecField, F}, Acc2) -> - case {RecField, F} of - {id,_} when is_binary(Id) -> Acc2; - {severity,_} when Severity=='warning' orelse Severity=='error' orelse Severity=='critical' -> Acc2; - {title,_} when is_list(Title) orelse is_binary(Title) -> Acc2; - {summary,_} when is_list(Summary) orelse is_binary(Summary) -> Acc2; - _ -> [{RecField, D}|Acc2] - end end, Acc, lists:zip(record_info(fields, 'mqtt_alarm'), tl(tuple_to_list(D)))), - ErrFields++case ErrFields of [] -> CustomValidateModule:ValidateFun(D); _ -> [] end. \ No newline at end of file +validate(D = #'writer'{id = Id, count = Count, cache = Cache, args = Args, first = First}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} -> []; + {count,_} when is_integer(Count) -> []; + {cache,_} when (is_tuple(Cache) orelse Cache==[]) -> []; + {args,_} -> []; + {first,_} when (is_tuple(First) orelse First==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'writer'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'reader'{id = Id, pos = Pos, cache = Cache, args = Args, feed = Feed, dir = Dir}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} -> []; + {pos,_} when (is_integer(Pos) orelse Pos==[]) -> []; + {cache,_} when (is_integer(Cache) orelse Cache==[]) -> []; + {args,_} -> []; + {feed,_} -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'reader'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'iter'{id = Id, container = Container, feed = Feed, next = Next, prev = Prev}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when is_atom(Container) -> []; + {feed,_} -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'iter'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'container'{id = Id, top = Top, rear = Rear, count = Count}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {top,_} when (is_integer(Top) orelse Top==[]) -> []; + {rear,_} when (is_integer(Rear) orelse Rear==[]) -> []; + {count,_} when is_integer(Count) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'container'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'iterator'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when is_atom(Container) -> []; + {feed_id,_} -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {feeds,_} when is_list(Feeds) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'iterator'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'task'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {roles,_} when is_binary(Roles) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'task'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'userTask'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {roles,_} when is_binary(Roles) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'userTask'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'serviceTask'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {roles,_} when is_binary(Roles) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'serviceTask'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'receiveTask'{name = Name, module = Module, prompt = Prompt, roles = Roles}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {roles,_} when is_binary(Roles) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'receiveTask'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'messageEvent'{name = Name, module = Module, prompt = Prompt, payload = Payload, timeout = Timeout}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {payload,_} when is_binary(Payload) -> []; + {timeout,_} when is_tuple(Timeout) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'messageEvent'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'boundaryEvent'{name = Name, module = Module, prompt = Prompt, payload = Payload, timeout = Timeout, timeDate = TimeDate, timeDuration = TimeDuration, timeCycle = TimeCycle}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {payload,_} when is_binary(Payload) -> []; + {timeout,_} when is_tuple(Timeout) -> []; + {timeDate,_} when is_binary(TimeDate) -> []; + {timeDuration,_} when is_binary(TimeDuration) -> []; + {timeCycle,_} when is_binary(TimeCycle) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'boundaryEvent'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'timeoutEvent'{name = Name, module = Module, prompt = Prompt, payload = Payload, timeout = Timeout, timeDate = TimeDate, timeDuration = TimeDuration, timeCycle = TimeCycle}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + {payload,_} when (is_binary(Payload) orelse Payload==[]) -> []; + {timeout,_} when (is_tuple(Timeout) orelse Timeout==[]) -> []; + {timeDate,_} when (is_binary(TimeDate) orelse TimeDate==[]) -> []; + {timeDuration,_} when (is_binary(TimeDuration) orelse TimeDuration==[]) -> []; + {timeCycle,_} when (is_binary(TimeCycle) orelse TimeCycle==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'timeoutEvent'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'beginEvent'{name = Name, module = Module, prompt = Prompt}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'beginEvent'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'endEvent'{name = Name, module = Module, prompt = Prompt}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_atom(Name) orelse Name==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {prompt,_} when is_list(Prompt) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'endEvent'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'sequenceFlow'{source = Source, target = Target}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {source,_} when (is_atom(Source) orelse Source==[]) -> []; + {target,_} when (is_list(Target) orelse is_atom(Target) orelse Target==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'sequenceFlow'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'hist'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, name = Name, task = Task, docs = Docs, time = Time}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when is_atom(Container) -> []; + {feed_id,_} -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {feeds,_} when is_list(Feeds) -> []; + {name,_} when (is_binary(Name) orelse Name==[]) -> []; + {task,_} when is_atom(Task) -> []; + {docs,_} when is_list(Docs) -> []; + {time,_} -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'hist'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'process'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, name = Name, roles = Roles, tasks = Tasks, events = Events, hist = Hist, flows = Flows, rules = Rules, docs = Docs, options = Options, task = Task, timer = Timer, notifications = Notifications, result = Result, started = Started, beginEvent = BeginEvent, endEvent = EndEvent}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when is_atom(Container) -> []; + {feed_id,_} -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {feeds,_} when is_list(Feeds) -> []; + {name,_} when (is_binary(Name) orelse Name==[]) -> []; + {roles,_} when is_list(Roles) -> []; + {tasks,_} when is_list(Tasks) -> []; + {events,_} when is_list(Events) -> []; + {flows,_} when is_list(Flows) -> []; + {docs,_} when is_list(Docs) -> []; + {options,_} -> []; + {task,_} when (is_atom(Task) orelse Task==[]) -> []; + {timer,_} when (is_binary(Timer) orelse Timer==[]) -> []; + {notifications,_} when (Notifications==[]) -> []; + {result,_} when (is_binary(Result) orelse Result==[]) -> []; + {started,_} when (is_tuple(Started) orelse Started==[]) -> []; + {beginEvent,_} when (is_atom(BeginEvent) orelse BeginEvent==[]) -> []; + {endEvent,_} when (is_atom(EndEvent) orelse EndEvent==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'process'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'sequenceFlow'))], + Fields = [Flows], + FieldNames = [flows], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'complete'{id = Id}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'complete'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'proc'{id = Id}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'proc'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'load'{id = Id}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'load'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'histo'{id = Id}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'histo'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'create'{proc = Proc, docs = Docs}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {proc,_} when (is_binary(Proc) orelse is_record(Proc,'process') orelse Proc==[]) -> []; + {docs,_} when (is_list(Docs) orelse Docs==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'create'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'amend'{id = Id, docs = Docs}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {docs,_} when (is_list(Docs) orelse Docs==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'amend'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'push'{model = Model, type = Type, title = Title, alert = Alert, badge = Badge, sound = Sound}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {model,_} when (Model==[]) -> []; + {type,_} when (is_binary(Type) orelse Type==[]) -> []; + {title,_} when (is_binary(Title) orelse Title==[]) -> []; + {alert,_} when (is_binary(Alert) orelse Alert==[]) -> []; + {badge,_} when (is_integer(Badge) orelse Badge==[]) -> []; + {sound,_} when (is_binary(Sound) orelse Sound==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'push'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Search'{id = Id, ref = Ref, field = Field, type = Type, value = Value, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_binary(Id) orelse is_integer(Id)) -> []; + {ref,_} when is_binary(Ref) -> []; + {field,_} when is_binary(Field) -> []; + {type,_} when (Type=='like' orelse Type=='!=' orelse Type=='==') -> []; + {value,_} when is_list(Value) -> []; + {status,_} when (Status=='room' orelse Status=='member' orelse Status=='contact' orelse Status=='roster' orelse Status=='profile') -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Search'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'p2p'{from = From, to = To}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {from,_} when is_binary(From) -> []; + {to,_} when is_binary(To) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'p2p'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'muc'{name = Name}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when is_binary(Name) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'muc'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'mqi'{feed_id = Feed_id, query = Query, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {feed_id,_} when is_record(Feed_id,'mqi') -> []; + {query,_} when (is_binary(Query) orelse Query==[]) -> []; + {status,_} when (Status=='removed' orelse Status=='member' orelse Status=='admin' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'mqi'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Feature'{id = Id, key = Key, value = Value, group = Group}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + {key,_} when is_binary(Key) -> []; + {value,_} when is_binary(Value) -> []; + {group,_} when is_binary(Group) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Feature'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Service'{id = Id, type = Type, data = Data, login = Login, password = Password, expiration = Expiration, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + {type,_} when (Type=='wallet' orelse Type=='aws' orelse Type=='vox' orelse Type=='email') -> []; + {data,_} -> []; + {login,_} when (is_binary(Login) orelse Login==[]) -> []; + {password,_} when (is_binary(Password) orelse Password==[]) -> []; + {expiration,_} when (is_integer(Expiration) orelse Expiration==[]) -> []; + {status,_} when (Status=='remove' orelse Status=='add' orelse Status=='added' orelse Status=='verified' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Service'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Member'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, feeds = Feeds, phone_id = Phone_id, avatar = Avatar, names = Names, surnames = Surnames, alias = Alias, reader = Reader, update = Update, settings = Settings, services = Services, presence = Presence, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when (Container==[] orelse Container=='cur' orelse Container=='chain') -> []; + {feed_id,_} when (Feed_id==[] orelse is_record(Feed_id,'p2p') orelse is_record(Feed_id,'muc')) -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {feeds,_} when is_list(Feeds) -> []; + {phone_id,_} when (is_binary(Phone_id) orelse Phone_id==[]) -> []; + {avatar,_} when (is_binary(Avatar) orelse Avatar==[]) -> []; + {names,_} when (is_binary(Names) orelse Names==[]) -> []; + {surnames,_} when (is_binary(Surnames) orelse Surnames==[]) -> []; + {alias,_} when (is_binary(Alias) orelse Alias==[]) -> []; + {reader,_} when (is_integer(Reader) orelse Reader==[]) -> []; + {update,_} when (is_integer(Update) orelse Update==[]) -> []; + {settings,_} when (is_list(Settings) orelse Settings==[]) -> []; + {services,_} when (is_list(Services) orelse Services==[]) -> []; + {presence,_} when (Presence=='offline' orelse Presence=='online' orelse Presence==[]) -> []; + {status,_} when (Status=='owner' orelse Status=='patch' orelse Status=='removed' orelse Status=='member' orelse Status=='admin' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Member'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Desc'{id = Id, mime = Mime, payload = Payload, parentid = Parentid, data = Data}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + {mime,_} when (is_binary(Mime) orelse Mime==[]) -> []; + {payload,_} when (is_binary(Payload) orelse Payload==[]) -> []; + {parentid,_} when (is_binary(Parentid) orelse Parentid==[]) -> []; + {data,_} when is_list(Data) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Desc'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Feature'))], + Fields = [Data], + FieldNames = [data], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'StickerPack'{id = Id, name = Name, keywords = Keywords, description = Description, author = Author, stickers = Stickers, created = Created, updated = Updated, downloaded = Downloaded}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {name,_} when (is_binary(Name) orelse Name==[]) -> []; + {keywords,_} when is_list(Keywords) -> []; + {description,_} when (is_binary(Description) orelse Description==[]) -> []; + {author,_} when (is_binary(Author) orelse Author==[]) -> []; + {stickers,_} when is_list(Stickers) -> []; + {created,_} when is_integer(Created) -> []; + {updated,_} when is_integer(Updated) -> []; + {downloaded,_} when is_integer(Downloaded) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'StickerPack'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Desc'))], + Fields = [Stickers], + FieldNames = [stickers], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Message'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, msg_id = Msg_id, from = From, to = To, created = Created, files = Files, type = Type, link = Link, seenby = Seenby, repliedby = Repliedby, mentioned = Mentioned, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when (Container==[] orelse Container=='cur' orelse Container=='chain') -> []; + {feed_id,_} when (is_record(Feed_id,'p2p') orelse is_record(Feed_id,'muc')) -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {msg_id,_} when (is_binary(Msg_id) orelse Msg_id==[]) -> []; + {from,_} when (is_binary(From) orelse From==[]) -> []; + {to,_} when (is_binary(To) orelse To==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + {files,_} when is_list(Files) -> []; + {type,_} when is_list(Type) -> []; + {link,_} when (is_record(Link,'Message') orelse is_integer(Link) orelse Link==[]) -> []; + {seenby,_} when (is_list(Seenby) orelse Seenby==[]) -> []; + {repliedby,_} when (is_list(Repliedby) orelse Repliedby==[]) -> []; + {mentioned,_} when (is_list(Mentioned) orelse Mentioned==[]) -> []; + {status,_} when (Status=='edit' orelse Status=='update' orelse Status=='clear' orelse Status=='delete' orelse Status=='async' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Message'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Desc'))], + Fields = [Files], + FieldNames = [files], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Link'{id = Id, name = Name, room_id = Room_id, created = Created, type = Type, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + {name,_} when (is_binary(Name) orelse Name==[]) -> []; + {room_id,_} when (is_binary(Room_id) orelse Room_id==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + {type,_} when (Type=='channel' orelse Type=='group' orelse Type==[]) -> []; + {status,_} when (Status=='delete' orelse Status=='update' orelse Status=='join' orelse Status=='get' orelse Status=='add' orelse Status=='check' orelse Status=='gen' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Link'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Room'{id = Id, name = Name, links = Links, description = Description, settings = Settings, members = Members, admins = Admins, data = Data, type = Type, tos = Tos, tos_update = Tos_update, unread = Unread, mentions = Mentions, readers = Readers, last_msg = Last_msg, update = Update, created = Created, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + {name,_} when (is_binary(Name) orelse Name==[]) -> []; + {links,_} when (is_list(Links) orelse Links==[]) -> []; + {description,_} when (is_binary(Description) orelse Description==[]) -> []; + {settings,_} when is_list(Settings) -> []; + {members,_} when is_list(Members) -> []; + {admins,_} when is_list(Admins) -> []; + {data,_} when is_list(Data) -> []; + {type,_} when (Type=='call' orelse Type=='channel' orelse Type=='group' orelse Type==[]) -> []; + {tos,_} when (is_binary(Tos) orelse Tos==[]) -> []; + {tos_update,_} when (is_integer(Tos_update) orelse Tos_update==[]) -> []; + {unread,_} when (is_integer(Unread) orelse Unread==[]) -> []; + {mentions,_} when is_list(Mentions) -> []; + {readers,_} when is_list(Readers) -> []; + {last_msg,_} when (is_record(Last_msg,'Message') orelse is_integer(Last_msg) orelse Last_msg==[]) -> []; + {update,_} when (is_integer(Update) orelse Update==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + {status,_} when (Status=='unmute' orelse Status=='mute' orelse Status=='last_msg' orelse Status=='delete' orelse Status=='get' orelse Status=='patch' orelse Status=='info' orelse Status=='joined' orelse Status=='join' orelse Status=='removed' orelse Status=='remove' orelse Status=='add' orelse Status=='leave' orelse Status=='create' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Room'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Feature')),?COND_FUN(is_record(Rec, 'Member')),?COND_FUN(is_record(Rec, 'Member')),?COND_FUN(is_record(Rec, 'Desc'))], + Fields = [Settings,Members,Admins,Data], + FieldNames = [settings,members,admins,data], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Tag'{roster_id = Roster_id, name = Name, color = Color, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {roster_id,_} when (is_binary(Roster_id) orelse Roster_id==[]) -> []; + {name,_} when is_binary(Name) -> []; + {color,_} when is_binary(Color) -> []; + {status,_} when (Status=='edit' orelse Status=='remove' orelse Status=='create' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Tag'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Star'{id = Id, client_id = Client_id, roster_id = Roster_id, message = Message, tags = Tags, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {client_id,_} when (is_binary(Client_id) orelse Client_id==[]) -> []; + {roster_id,_} when (is_integer(Roster_id) orelse Roster_id==[]) -> []; + {message,_} when (is_record(Message,'Message') orelse Message==[]) -> []; + {tags,_} when is_list(Tags) -> []; + {status,_} when (Status=='remove' orelse Status=='add' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Star'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Tag'))], + Fields = [Tags], + FieldNames = [tags], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Typing'{phone_id = Phone_id, comments = Comments}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {phone_id,_} when is_binary(Phone_id) -> []; + {comments,_} -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Typing'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Contact'{phone_id = Phone_id, avatar = Avatar, names = Names, surnames = Surnames, nick = Nick, reader = Reader, unread = Unread, last_msg = Last_msg, update = Update, created = Created, settings = Settings, services = Services, presence = Presence, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {phone_id,_} when (is_binary(Phone_id) orelse Phone_id==[]) -> []; + {avatar,_} when (is_binary(Avatar) orelse Avatar==[]) -> []; + {names,_} when (is_binary(Names) orelse Names==[]) -> []; + {surnames,_} when (is_binary(Surnames) orelse Surnames==[]) -> []; + {nick,_} when (is_binary(Nick) orelse Nick==[]) -> []; + {reader,_} when (is_list(Reader) orelse is_integer(Reader) orelse Reader==[]) -> []; + {unread,_} when (is_integer(Unread) orelse Unread==[]) -> []; + {last_msg,_} when (is_record(Last_msg,'Message') orelse Last_msg==[]) -> []; + {update,_} when (is_integer(Update) orelse Update==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + {settings,_} when is_list(Settings) -> []; + {services,_} when is_list(Services) -> []; + {presence,_} when (is_binary(Presence) orelse Presence=='offline' orelse Presence=='online' orelse Presence==[]) -> []; + {status,_} when (Status=='deleted' orelse Status=='banned' orelse Status=='ban' orelse Status=='last_msg' orelse Status=='friend' orelse Status=='internal' orelse Status=='ignore' orelse Status=='authorization' orelse Status=='request' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Contact'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Feature')),?COND_FUN(is_record(Rec, 'Service'))], + Fields = [Settings,Services], + FieldNames = [settings,services], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'ExtendedStar'{star = Star, from = From}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {star,_} when (Star==[] orelse is_record(Star,'Star')) -> []; + {from,_} when (From==[] orelse is_record(From,'Room') orelse is_record(From,'Contact')) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'ExtendedStar'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Auth'{client_id = Client_id, dev_key = Dev_key, user_id = User_id, phone = Phone, token = Token, type = Type, sms_code = Sms_code, attempts = Attempts, services = Services, settings = Settings, push = Push, os = Os, created = Created, last_online = Last_online}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {client_id,_} when (is_binary(Client_id) orelse Client_id==[]) -> []; + {dev_key,_} when (is_binary(Dev_key) orelse Dev_key==[]) -> []; + {user_id,_} when (is_binary(User_id) orelse User_id==[]) -> []; + {phone,_} when (is_tuple(Phone) orelse is_binary(Phone) orelse Phone==[]) -> []; + {token,_} when (is_binary(Token) orelse Token==[]) -> []; + {type,_} when (is_atom(Type) orelse Type==[]) -> []; + {sms_code,_} when (is_binary(Sms_code) orelse Sms_code==[]) -> []; + {attempts,_} when (is_integer(Attempts) orelse Attempts==[]) -> []; + {services,_} when is_list(Services) -> []; + {settings,_} when (is_list(Settings) orelse Settings==[]) -> []; + {push,_} when (is_binary(Push) orelse Push==[]) -> []; + {os,_} when (Os=='web' orelse Os=='android' orelse Os=='ios' orelse Os==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + {last_online,_} when (is_integer(Last_online) orelse Last_online==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Auth'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Roster'{id = Id, names = Names, surnames = Surnames, email = Email, nick = Nick, userlist = Userlist, roomlist = Roomlist, favorite = Favorite, tags = Tags, phone = Phone, avatar = Avatar, update = Update, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse is_binary(Id) orelse Id==[]) -> []; + {names,_} when (is_binary(Names) orelse Names==[]) -> []; + {surnames,_} when (is_binary(Surnames) orelse Surnames==[]) -> []; + {email,_} when (is_binary(Email) orelse Email==[]) -> []; + {nick,_} when (is_binary(Nick) orelse Nick==[]) -> []; + {userlist,_} when is_list(Userlist) -> []; + {roomlist,_} when is_list(Roomlist) -> []; + {favorite,_} when is_list(Favorite) -> []; + {tags,_} when is_list(Tags) -> []; + {phone,_} when (is_binary(Phone) orelse Phone==[]) -> []; + {avatar,_} when (is_binary(Avatar) orelse Avatar==[]) -> []; + {update,_} when (is_integer(Update) orelse Update==[]) -> []; + {status,_} when (Status=='last_msg' orelse Status=='patch' orelse Status=='list' orelse Status=='update' orelse Status=='add' orelse Status=='nick' orelse Status=='remove' orelse Status=='del' orelse Status=='create' orelse Status=='get' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Roster'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'Room')),?COND_FUN(is_record(Rec, 'Star')),?COND_FUN(is_record(Rec, 'Tag'))], + Fields = [Roomlist,Favorite,Tags], + FieldNames = [roomlist,favorite,tags], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Profile'{phone = Phone, services = Services, rosters = Rosters, settings = Settings, update = Update, balance = Balance, presence = Presence, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {phone,_} when (is_binary(Phone) orelse Phone==[]) -> []; + {services,_} when (is_list(Services) orelse Services==[]) -> []; + {rosters,_} when (is_list(Rosters) orelse Rosters==[]) -> []; + {settings,_} when (is_list(Settings) orelse Settings==[]) -> []; + {update,_} when is_integer(Update) -> []; + {balance,_} when is_integer(Balance) -> []; + {presence,_} when (is_binary(Presence) orelse Presence=='online' orelse Presence=='offline' orelse Presence==[]) -> []; + {status,_} when (Status=='create' orelse Status=='delete' orelse Status=='update' orelse Status=='patch' orelse Status=='get' orelse Status=='remove' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Profile'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Presence'{uid = Uid, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {uid,_} when is_binary(Uid) -> []; + {status,_} when (is_binary(Status) orelse Status=='online' orelse Status=='offline' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Presence'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Friend'{phone_id = Phone_id, friend_id = Friend_id, settings = Settings, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {phone_id,_} when is_binary(Phone_id) -> []; + {friend_id,_} when is_binary(Friend_id) -> []; + {settings,_} when (is_list(Settings) orelse Settings==[]) -> []; + {status,_} when (Status=='ignore' orelse Status=='update' orelse Status=='confirm' orelse Status=='request' orelse Status=='unban' orelse Status=='ban') -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Friend'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'act'{name = Name, data = Data}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when (is_binary(Name) orelse Name==[]) -> []; + {data,_} when (is_list(Data) orelse is_integer(Data) orelse is_binary(Data)) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'act'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Job'{id = Id, container = Container, feed_id = Feed_id, prev = Prev, next = Next, context = Context, proc = Proc, time = Time, data = Data, events = Events, settings = Settings, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {container,_} when (Container==[] orelse Container=='chain') -> []; + {feed_id,_} when is_record(Feed_id,'Job') -> []; + {prev,_} when (is_integer(Prev) orelse Prev==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {context,_} when (is_binary(Context) orelse is_integer(Context) orelse Context==[]) -> []; + {proc,_} when (is_record(Proc,'process') orelse is_integer(Proc) orelse Proc==[]) -> []; + {time,_} when (is_integer(Time) orelse Time==[]) -> []; + {data,_} when (is_list(Data) orelse is_binary(Data) orelse Data==[]) -> []; + {events,_} when (is_list(Events) orelse Events==[]) -> []; + {settings,_} when (is_list(Settings) orelse Settings==[]) -> []; + {status,_} when (Status=='restart' orelse Status=='complete' orelse Status=='stop' orelse Status=='pending' orelse Status=='delete' orelse Status=='update' orelse Status=='init' orelse Status==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Job'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'History'{roster_id = Roster_id, feed = Feed, size = Size, entity_id = Entity_id, data = Data, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {roster_id,_} when is_binary(Roster_id) -> []; + {feed,_} when (Feed==[] orelse is_record(Feed,'StickerPack') orelse is_record(Feed,'act') orelse is_record(Feed,'muc') orelse is_record(Feed,'p2p')) -> []; + {size,_} when (is_integer(Size) orelse Size==[]) -> []; + {entity_id,_} when (is_integer(Entity_id) orelse Entity_id==[]) -> []; + {data,_} when (is_list(Data) orelse Data==[]) -> []; + {status,_} when (Status=='draft' orelse Status=='text' orelse Status=='location' orelse Status=='contact' orelse Status=='audio' orelse Status=='link' orelse Status=='file' orelse Status=='video' orelse Status=='image' orelse Status=='delete' orelse Status=='double_get' orelse Status=='get_reply' orelse Status=='last_msg' orelse Status=='last_loaded' orelse Status=='update' orelse Status=='get' orelse Status=='updated') -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'History'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Schedule'{id = Id, proc = Proc, data = Data, state = State}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_tuple(Id) orelse is_integer(Id) orelse Id==[]) -> []; + {proc,_} when (is_binary(Proc) orelse is_integer(Proc) orelse Proc==[]) -> []; + {data,_} when (is_list(Data) orelse is_binary(Data)) -> []; + {state,_} when (State==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Schedule'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Index'{id = Id, roster = Roster}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (Id==[]) -> []; + {roster,_} when is_list(Roster) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Index'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Whitelist'{phone = Phone, created = Created}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {phone,_} when (is_binary(Phone) orelse Phone==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Whitelist'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'error'{code = Code}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {code,_} when (is_atom(Code) orelse Code==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'error'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'ok'{code = Code}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {code,_} when (is_binary(Code) orelse Code==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'ok'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'error2'{code = Code, src = Src}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {code,_} when (is_atom(Code) orelse Code==[]) -> []; + {src,_} when (is_integer(Src) orelse is_binary(Src) orelse Src==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'error2'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'ok2'{code = Code, src = Src}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {code,_} when (is_atom(Code) orelse Code==[]) -> []; + {src,_} when (is_binary(Src) orelse is_tuple(Src) orelse Src==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'ok2'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'MessageErr'{feed_id = Feed_id, msg_id = Msg_id, error = Error}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {feed_id,_} when (is_record(Feed_id,'p2p') orelse is_record(Feed_id,'muc')) -> []; + {msg_id,_} when (is_binary(Msg_id) orelse Msg_id==[]) -> []; + {error,_} when (is_record(Error,'error') orelse Error==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'MessageErr'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'io'{code = Code, data = Data}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {code,_} when (is_record(Code,'MessageErr') orelse Code=='transcribe' orelse is_record(Code,'error2') orelse is_record(Code,'ok2') orelse is_record(Code,'error') orelse is_record(Code,'ok') orelse Code==[]) -> []; + {data,_} when (is_tuple(Data) orelse is_record(Data,'Roster') orelse is_binary(Data) orelse Data==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'io'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Ack'{table = Table, id = Id}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {table,_} when is_atom(Table) -> []; + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Ack'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'MessageAck'{id = Id, next = Next, feed_id = Feed_id, created = Created, msg_id = Msg_id}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {id,_} when (is_integer(Id) orelse Id==[]) -> []; + {next,_} when (is_integer(Next) orelse Next==[]) -> []; + {feed_id,_} when (is_record(Feed_id,'p2p') orelse is_record(Feed_id,'muc')) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + {msg_id,_} when (is_binary(Msg_id) orelse Msg_id==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'MessageAck'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'errors'{code = Code, data = Data}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {code,_} when (is_list(Code) orelse Code==[]) -> []; + {data,_} when (Data==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'errors'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'PushService'{recipients = Recipients, id = Id, ttl = Ttl, module = Module, priority = Priority, payload = Payload}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {recipients,_} when is_list(Recipients) -> []; + {id,_} when (is_binary(Id) orelse Id==[]) -> []; + {ttl,_} when (is_integer(Ttl) orelse Ttl==[]) -> []; + {module,_} when (is_binary(Module) orelse Module==[]) -> []; + {priority,_} when (is_binary(Priority) orelse Priority==[]) -> []; + {payload,_} when (is_binary(Payload) orelse Payload==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'PushService'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'PublishService'{message = Message, topic = Topic, qos = Qos}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {message,_} when (is_binary(Message) orelse Message==[]) -> []; + {topic,_} when (is_binary(Topic) orelse Topic==[]) -> []; + {qos,_} when (is_integer(Qos) orelse Qos==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'PublishService'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'FakeNumbers'{phone = Phone, created = Created}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {phone,_} when (is_binary(Phone) orelse Phone==[]) -> []; + {created,_} when (is_integer(Created) orelse Created==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'FakeNumbers'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'Draft'{data = Data, status = Status}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {data,_} when is_list(Data) -> []; + {status,_} when (Status=='delete' orelse Status=='get' orelse Status=='update') -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'Draft'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'handler'{name = Name, module = Module, class = Class, group = Group, config = Config, state = State, seq = Seq}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {name,_} when is_atom(Name) -> []; + {module,_} when is_atom(Module) -> []; + {class,_} -> []; + {group,_} when is_atom(Group) -> []; + {config,_} -> []; + {state,_} -> []; + {seq,_} -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'handler'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'cx'{handlers = Handlers, actions = Actions, req = Req, module = Module, lang = Lang, path = Path, session = Session, formatter = Formatter, params = Params, node = Node, client_pid = Client_pid, state = State, from = From, vsn = Vsn}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {handlers,_} when is_list(Handlers) -> []; + {actions,_} when is_list(Actions) -> []; + {req,_} when (Req==[]) -> []; + {module,_} when (is_atom(Module) orelse Module==[]) -> []; + {lang,_} when (is_atom(Lang) orelse Lang==[]) -> []; + {path,_} when (is_binary(Path) orelse Path==[]) -> []; + {session,_} when (is_binary(Session) orelse Session==[]) -> []; + {formatter,_} when (Formatter=='json' orelse Formatter=='bert') -> []; + {params,_} when (is_list(Params) orelse Params==[]) -> []; + {node,_} when (is_atom(Node) orelse Node==[]) -> []; + {client_pid,_} when (Client_pid==[]) -> []; + {state,_} when (State==[]) -> []; + {from,_} when (is_binary(From) orelse From==[]) -> []; + {vsn,_} when (is_binary(Vsn) orelse Vsn==[]) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'cx'), tl(tuple_to_list(D)))]), + CondFuns = [?COND_FUN(is_record(Rec, 'handler'))], + Fields = [Handlers], + FieldNames = [handlers], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'mqtt_topic'{topic = Topic, flags = Flags}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {topic,_} when is_binary(Topic) -> []; + {flags,_} when is_list(Flags) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'mqtt_topic'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'mqtt_session'{client_id = Client_id, sess_pid = Sess_pid, clean_sess = Clean_sess}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {client_id,_} when is_binary(Client_id) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'mqtt_session'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end; +validate(D = #'mqtt_route'{topic = Topic, node = Node}, Acc) -> + ErrFields = lists:flatten( + [case {Field, F} of + {topic,_} when is_binary(Topic) -> []; + _ -> Field + end || {Field, F} <- lists:zip(record_info(fields, 'mqtt_route'), tl(tuple_to_list(D)))]), + CondFuns = [], + Fields = [], + FieldNames = [], + case validate(lists:zip3(CondFuns, FieldNames, Fields), [{ErrFields, D}|Acc]) of + ok -> validate(lists:zip(FieldNames,Fields), [{ErrFields, D}|Acc]); + Err -> Err + end. diff --git a/apps/roster/src/test/auth_test.erl b/apps/roster/test/auth_test.erl similarity index 100% rename from apps/roster/src/test/auth_test.erl rename to apps/roster/test/auth_test.erl diff --git a/apps/roster/src/test/call_room_test.erl b/apps/roster/test/call_room_test.erl similarity index 100% rename from apps/roster/src/test/call_room_test.erl rename to apps/roster/test/call_room_test.erl diff --git a/apps/roster/src/test/channel_test.erl b/apps/roster/test/channel_test.erl similarity index 100% rename from apps/roster/src/test/channel_test.erl rename to apps/roster/test/channel_test.erl diff --git a/apps/roster/src/test/friend_test.erl b/apps/roster/test/friend_test.erl similarity index 100% rename from apps/roster/src/test/friend_test.erl rename to apps/roster/test/friend_test.erl diff --git a/apps/roster/src/test/job_tests.erl b/apps/roster/test/job_tests.erl similarity index 100% rename from apps/roster/src/test/job_tests.erl rename to apps/roster/test/job_tests.erl diff --git a/apps/roster/src/test/main_test.erl b/apps/roster/test/main_test.erl similarity index 100% rename from apps/roster/src/test/main_test.erl rename to apps/roster/test/main_test.erl diff --git a/apps/roster/src/test/micro_test.erl b/apps/roster/test/micro_test.erl similarity index 100% rename from apps/roster/src/test/micro_test.erl rename to apps/roster/test/micro_test.erl diff --git a/apps/roster/src/test/rest_test.erl b/apps/roster/test/rest_test.erl similarity index 100% rename from apps/roster/src/test/rest_test.erl rename to apps/roster/test/rest_test.erl diff --git a/apps/roster/src/test/room_test.erl b/apps/roster/test/room_test.erl similarity index 100% rename from apps/roster/src/test/room_test.erl rename to apps/roster/test/room_test.erl diff --git a/apps/roster/src/test/roster_test.erl b/apps/roster/test/roster_test.erl similarity index 100% rename from apps/roster/src/test/roster_test.erl rename to apps/roster/test/roster_test.erl diff --git a/apps/service/rebar.config b/apps/service/rebar.config deleted file mode 100644 index 3af62d09d982540eee7491d120627685fa701a14..0000000000000000000000000000000000000000 --- a/apps/service/rebar.config +++ /dev/null @@ -1 +0,0 @@ -{deps,[{bert, ".*", {git, "git://github.com/synrc/bert",[]}}]}. \ No newline at end of file diff --git a/otp.mk b/otp.mk deleted file mode 100644 index 2b74dc0b770eea8de329f9747b101df8c5178ff4..0000000000000000000000000000000000000000 --- a/otp.mk +++ /dev/null @@ -1,33 +0,0 @@ -VM := vm.args -SYS := sys.config -ERL_ARGS := -args_file $(VM) -config $(SYS) -RUN_DIR ?= . -LOG_DIR ?= ./log -empty := -ROOTS := deps apps -space := $(empty) $(empty) -comma := $(empty),$(empty) -VSN := $(shell git rev-parse HEAD | head -c 6) -DATE := $(shell date "+%Y%m%d-%H%M%S") -ERL_LIBS := $(subst $(space),:,$(ROOTS)) - -clean: - rm -f .applist - mad $@ -compile: - mad $@ -.applist: - mad plan -$(RUN_DIR) $(LOG_DIR): - mkdir -p $(RUN_DIR) & mkdir -p $(LOG_DIR) -attach: - to_erl $(RUN_DIR)/ -console: .applist - ERL_LIBS=$(ERL_LIBS) erl +pc unicode $(ERL_ARGS) -eval '[application:ensure_started(A) || A <- $(shell cat .applist)]' -start: $(RUN_DIR) $(LOG_DIR) .applist - RUN_ERL_LOG_GENERATIONS=1000 RUN_ERL_LOG_MAXSIZE=20000000 \ - ERL_LIBS=$(ERL_LIBS) run_erl -daemon $(RUN_DIR)/ $(LOG_DIR)/ "exec $(MAKE) console" -stop: - @kill -9 $(shell ps ax -o pid= -o command=|grep $(RELEASE)|grep $(COOKIE)|awk '{print $$1}') - -.PHONY: compile clean console start diff --git a/priv/protobuf/service_auth/1compile.sh b/priv/protobuf/service_auth/1compile.sh deleted file mode 100755 index 6ad626dee21b25f4fa0b9b918f9631377fd75f88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/1compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc *.proto --java_out=java diff --git a/priv/protobuf/service_auth/Auth.proto b/priv/protobuf/service_auth/Auth.proto deleted file mode 100644 index f5c0b18ecc1ce9a535bbccc356df41f8165da1e0..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/Auth.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Auth.grpc"; -option java_outer_classname = "AuthCls"; -import public "authOs.proto"; -import public "Feature.proto"; -import public "authType.proto"; -import public "Service.proto"; - -message Auth { - string client_id = 1; - string dev_key = 2; - string user_id = 3; - string token = 4; - string data = 5; - authType type = 6; - int64 attempts = 7; - repeated Feature settings = 8; - repeated Service services = 9; - string push = 10; - authOs os = 11; - int64 created = 12; - int64 last_online = 13; -} diff --git a/priv/protobuf/service_auth/AuthError.proto b/priv/protobuf/service_auth/AuthError.proto deleted file mode 100644 index c75a62ed642c9674ff611ca1eb5e0887e805a646..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/AuthError.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "AuthError.grpc"; -option java_outer_classname = "AuthErrorCls"; -import public "Auth.proto"; -import public "authStatus.proto"; - -message AuthError { - repeated authStatus codes = 1; - Auth data = 2; -} diff --git a/priv/protobuf/service_auth/AuthService.proto b/priv/protobuf/service_auth/AuthService.proto deleted file mode 100644 index e5022911c823c2ef613d6a5c57f5266cf7467334..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/AuthService.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package service_auth; - -import "Auth.proto"; -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "AuthService.grpc"; -option java_outer_classname = "AuthServiceCls"; - -service AuthService { - rpc login (Auth) returns (Auth); - rpc resendSMS (Auth) returns (Auth); - rpc call (Auth) returns (Auth); - rpc confirm (Auth) returns (Auth); - rpc updatePushToken (Auth) returns (Auth); - rpc getSessions (Auth) returns (Auth); - rpc deleteSession (Auth) returns (Auth); - rpc deleteAllSessions (Auth) returns (Auth); -} diff --git a/priv/protobuf/service_auth/Desc.proto b/priv/protobuf/service_auth/Desc.proto deleted file mode 100644 index a1bdff122639882de16d2365361829b1f23827dc..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/Desc.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Desc.grpc"; -option java_outer_classname = "DescCls"; -import public "Feature.proto"; - -message Desc { - string id = 1; - string mime = 2; - string payload = 3; - string parentid = 4; - repeated Feature data = 5; -} diff --git a/priv/protobuf/service_auth/Feature.proto b/priv/protobuf/service_auth/Feature.proto deleted file mode 100644 index 44e5d5a25170e7dd0f9c778227de975185b59a61..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/Feature.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Feature.grpc"; -option java_outer_classname = "FeatureCls"; - -message Feature { - string id = 1; - string key = 2; - string value = 3; - string group = 4; -} diff --git a/priv/protobuf/service_auth/Service.proto b/priv/protobuf/service_auth/Service.proto deleted file mode 100644 index 5255c11383fad0751fad42cd288351aea27fd6ba..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/Service.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Service.grpc"; -option java_outer_classname = "ServiceCls"; -import public "Feature.proto"; -import public "serverType.proto"; -import public "serverStatus.proto"; - -message Service { - string id = 1; - string data = 2; - serverType type = 3; - repeated Feature setting = 4; - int64 expiration = 5; - serverStatus service_status = 6; -} diff --git a/priv/protobuf/service_auth/Tag.proto b/priv/protobuf/service_auth/Tag.proto deleted file mode 100644 index fb29d81cb4aea95a05444d71d1cd7e9419de1629..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/Tag.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Tag.grpc"; -option java_outer_classname = "TagCls"; -import public "tagType.proto"; - -message Tag { - int64 roster_id = 1; - string name = 2; - string color = 3; - tagType tag_status = 4; -} diff --git a/priv/protobuf/service_auth/authOs.proto b/priv/protobuf/service_auth/authOs.proto deleted file mode 100644 index 4308091b1208cd3bf560d0cf6e99d940110c4fad..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/authOs.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "authOs.grpc"; -option java_outer_classname = "authOsCls"; - -enum authOs { - ios = 0; - android = 1; - web = 2; -} - diff --git a/priv/protobuf/service_auth/authStatus.proto b/priv/protobuf/service_auth/authStatus.proto deleted file mode 100644 index 241324b6bfe8c83a39916370f4ae5aa6e6ec79b5..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/authStatus.proto +++ /dev/null @@ -1,23 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "authStatus.grpc"; -option java_outer_classname = "authStatusCls"; - -enum authStatus { - invalid_version = 0; - mismatch_user_data = 1; - number_not_allowed = 2; - session_not_found = 3; - attempts_expired = 4; - invalid_sms_code = 5; - invalid_jwt_code = 6; - permission_denied = 7; - invalid_data = 8; -} - diff --git a/priv/protobuf/service_auth/authType.proto b/priv/protobuf/service_auth/authType.proto deleted file mode 100644 index 0dbed28f069f7bd7c5bf9fbee8e348af63cca828..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/authType.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "authType.grpc"; -option java_outer_classname = "authTypeCls"; - -enum authType { - google_auth = 0; - facebook_auth = 1; - mobile_auth = 2; - email_auth = 3; - voice = 4; - resend = 5; - verify = 6; - push = 7; - logout = 8; - get = 9; - delete = 10; - clear = 11; -} - diff --git a/priv/protobuf/service_auth/presence.proto b/priv/protobuf/service_auth/presence.proto deleted file mode 100644 index 00f79c3f14b24783674e06115917a035e3410fe9..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/presence.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "presence.grpc"; -option java_outer_classname = "presenceCls"; - -enum presence { - online = 0; - offline = 1; -} - diff --git a/priv/protobuf/service_auth/serverStatus.proto b/priv/protobuf/service_auth/serverStatus.proto deleted file mode 100644 index 97d7dd002854abc3904040d78c3a5bc9e9c58a00..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/serverStatus.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverStatus.grpc"; -option java_outer_classname = "serverStatusCls"; - -enum serverStatus { - servie_verified = 0; - service_not_verified = 1; -} - diff --git a/priv/protobuf/service_auth/serverType.proto b/priv/protobuf/service_auth/serverType.proto deleted file mode 100644 index 56279a32238e9ae7b34a68269defae2d99553080..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/serverType.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverType.grpc"; -option java_outer_classname = "serverTypeCls"; - -enum serverType { - email = 0; - wallet = 1; - google_type = 2; - fb = 3; - phone = 4; -} - diff --git a/priv/protobuf/service_auth/tagType.proto b/priv/protobuf/service_auth/tagType.proto deleted file mode 100644 index 18503cdcac81525aa4dd9345f0f0bec4ee577e8e..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_auth/tagType.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_auth; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "tagType.grpc"; -option java_outer_classname = "tagTypeCls"; - -enum tagType { - tag_create = 0; - tag_remove = 1; - tag_edit = 2; -} - diff --git a/priv/protobuf/service_friend/1compile.sh b/priv/protobuf/service_friend/1compile.sh deleted file mode 100755 index 6ad626dee21b25f4fa0b9b918f9631377fd75f88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/1compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc *.proto --java_out=java diff --git a/priv/protobuf/service_friend/Desc.proto b/priv/protobuf/service_friend/Desc.proto deleted file mode 100644 index cfc8b92b45579fc7ec7572b847c4cc8eb984ef3e..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/Desc.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Desc.grpc"; -option java_outer_classname = "DescCls"; -import public "Feature.proto"; - -message Desc { - string id = 1; - string mime = 2; - string payload = 3; - string parentid = 4; - repeated Feature data = 5; -} diff --git a/priv/protobuf/service_friend/Feature.proto b/priv/protobuf/service_friend/Feature.proto deleted file mode 100644 index 21240771b56a93cd866c61e8229d5eaf0c5febc4..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/Feature.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Feature.grpc"; -option java_outer_classname = "FeatureCls"; - -message Feature { - string id = 1; - string key = 2; - string value = 3; - string group = 4; -} diff --git a/priv/protobuf/service_friend/FriendService.proto b/priv/protobuf/service_friend/FriendService.proto deleted file mode 100644 index 8af2e80293cd9d2075003dc07d08493a3e71aa88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/FriendService.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "FriendService.grpc"; -option java_outer_classname = "FriendServiceCls"; -import public "Friend.proto"; -import public "Contact.proto"; - -service FriendService { - rpc banUser(Friend) returns (Contact); - rpc unbanContact(Friend) returns (Contact); - rpc friendRequest(Friend) returns (Contact); - rpc confirmFrienship(Friend) returns (Contact); - rpc muteContact(Friend) returns (Contact); - rpc unmuteContact(Friend) returns (Contact); - rpc ignoreRequest(Friend) returns (Contact); -} \ No newline at end of file diff --git a/priv/protobuf/service_friend/Service.proto b/priv/protobuf/service_friend/Service.proto deleted file mode 100644 index fa6c1583279207312a127499c6a9ab9a14896fc7..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/Service.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Service.grpc"; -option java_outer_classname = "ServiceCls"; -import public "Feature.proto"; -import public "serverType.proto"; -import public "serverStatus.proto"; - -message Service { - string id = 1; - string data = 2; - serverType type = 3; - repeated Feature setting = 4; - int64 expiration = 5; - serverStatus service_status = 6; -} diff --git a/priv/protobuf/service_friend/Tag.proto b/priv/protobuf/service_friend/Tag.proto deleted file mode 100644 index 0bf0dea199c090e36023ba8dd3eaeae432bff754..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/Tag.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Tag.grpc"; -option java_outer_classname = "TagCls"; -import public "tagType.proto"; - -message Tag { - int64 roster_id = 1; - string name = 2; - string color = 3; - tagType tag_status = 4; -} diff --git a/priv/protobuf/service_friend/presence.proto b/priv/protobuf/service_friend/presence.proto deleted file mode 100644 index a340e10d6a903ab1b8212b4b99d777c61c697029..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/presence.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "presence.grpc"; -option java_outer_classname = "presenceCls"; - -enum presence { - online = 0; - offline = 1; -} - diff --git a/priv/protobuf/service_friend/serverStatus.proto b/priv/protobuf/service_friend/serverStatus.proto deleted file mode 100644 index 837e7ce36722e7f4d149d9151de6cc2e7c0b5219..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/serverStatus.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverStatus.grpc"; -option java_outer_classname = "serverStatusCls"; - -enum serverStatus { - servie_verified = 0; - service_not_verified = 1; -} - diff --git a/priv/protobuf/service_friend/serverType.proto b/priv/protobuf/service_friend/serverType.proto deleted file mode 100644 index eccfaae8a537cd46934708252dc7152a7b6349f9..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/serverType.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverType.grpc"; -option java_outer_classname = "serverTypeCls"; - -enum serverType { - email = 0; - wallet = 1; - google_type = 2; - fb = 3; - phone = 4; -} - diff --git a/priv/protobuf/service_friend/tagType.proto b/priv/protobuf/service_friend/tagType.proto deleted file mode 100644 index 05a0f94a92505082f9284fb0dfc54891fd2205b6..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_friend/tagType.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_friend; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "tagType.grpc"; -option java_outer_classname = "tagTypeCls"; - -enum tagType { - tag_create = 0; - tag_remove = 1; - tag_edit = 2; -} - diff --git a/priv/protobuf/service_message/1compile.sh b/priv/protobuf/service_message/1compile.sh deleted file mode 100755 index 6ad626dee21b25f4fa0b9b918f9631377fd75f88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/1compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc *.proto --java_out=java diff --git a/priv/protobuf/service_message/Desc.proto b/priv/protobuf/service_message/Desc.proto deleted file mode 100644 index 08869717e1da6dc410f2c897ef46978c0a6cf8e6..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/Desc.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Desc.grpc"; -option java_outer_classname = "DescCls"; -import public "Feature.proto"; - -message Desc { - string id = 1; - string mime = 2; - string payload = 3; - string parentid = 4; - repeated Feature data = 5; -} diff --git a/priv/protobuf/service_message/Feature.proto b/priv/protobuf/service_message/Feature.proto deleted file mode 100644 index c525cc9148869e2e972e7383845d2f915f531222..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/Feature.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Feature.grpc"; -option java_outer_classname = "FeatureCls"; - -message Feature { - string id = 1; - string key = 2; - string value = 3; - string group = 4; -} diff --git a/priv/protobuf/service_message/History.proto b/priv/protobuf/service_message/History.proto deleted file mode 100644 index 9ec7743622212e77f87beff198fedfc2e48e2387..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/History.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "History.grpc"; -option java_outer_classname = "HistoryCls"; -import public "muc.proto"; -import public "p2p.proto"; -import public "historyType.proto"; - -message History { - string roster_id = 1; - oneof feed { - p2p feed20 = 20; - muc feed21 = 21; - } - int64 size = 3; - int64 entity_id = 4; - int64 data = 5; - historyType status = 6; -} diff --git a/priv/protobuf/service_message/Job.proto b/priv/protobuf/service_message/Job.proto deleted file mode 100644 index 0b9faf28ad69b5eac4a34ec4b869d51efbd234c0..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/Job.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Job.grpc"; -option java_outer_classname = "JobCls"; -import public "act.proto"; -import public "jobType.proto"; -import public "Feature.proto"; -import public "Message.proto"; -import public "messageEvent.proto"; -import public "container.proto"; - -message Job { - int64 id = 1; - container container = 2; - act feed_id = 3; - int64 prev = 4; - int64 next = 5; - oneof context { - int64 context60 = 60; - string context61 = 61; - } - int64 proc = 7; - int64 time = 8; - repeated Message data = 9; - repeated messageEvent events = 10; - repeated Feature settings = 11; - jobType status = 12; -} diff --git a/priv/protobuf/service_message/Message.proto b/priv/protobuf/service_message/Message.proto deleted file mode 100644 index 838663d199308c44a6966bd3daf582877143e87f..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/Message.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -import "google/protobuf/Any.proto"; -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Message.grpc"; -option java_outer_classname = "MessageCls"; -import public "messageType.proto"; -import public "messageStatus.proto"; -import public "muc.proto"; -import public "p2p.proto"; -import public "Desc.proto"; -import public "container.proto"; - -message Message { - int64 id = 1; - container container = 2; - oneof feed_id { - muc feed_id30 = 30; - p2p feed_id31 = 31; - } - int64 prev = 4; - int64 next = 5; - string msg_id = 6; - string from = 7; - string to = 8; - int64 created = 9; - repeated Desc files = 10; - messageType type = 11; - oneof link { - int64 link120 = 120; - Message link121 = 121; - } - repeated google.protobuf.Any seenby = 13; - repeated int64 repliedby = 14; - repeated int64 mentioned = 15; - messageStatus mstatus = 16; -} diff --git a/priv/protobuf/service_message/MessageService.proto b/priv/protobuf/service_message/MessageService.proto deleted file mode 100644 index 2663f92a57d3394a2348e01160c70a8d103e1369..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/MessageService.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "MessageService.grpc"; -option java_outer_classname = "MessageServiceCls"; -import public "Message.proto"; -import public "History.proto"; -import public "Job.proto"; - -service MessageService { - //Message - rpc sendMessage(Message) returns (Message); - rpc delete(Message) returns (Message); - rpc deleteForAll(Message) returns (Message); - rpc replyMessage(Message) returns (Message); - rpc editMessage(Message) returns (Message); - rpc updateMessage(Message) returns (Message); - rpc translateMessage(Message) returns (Message); - rpc trancribeMessage(Message) returns (Message); - - //Job - rpc forwardMessage(Job) returns (Job); - rpc createScheduledMessage(Job) returns (Job); - rpc deleteScheduledMessage(Job) returns (Job); - rpc editScheduledMessage(Job) returns (Job); - - //History - rpc getMessage(History) returns (History); - rpc getMessagesToEndFromMessageId(History) returns (History); - rpc getAllMessages(History) returns (History); - rpc readMessage(History) returns (History); - rpc clearMessageHistory(History) returns (History); - rpc getMessageByType(History) returns (History); - rpc getMessageByTypeWithPagination(History) returns (History); - rpc getRepliedMessages(History) returns (History); - rpc getMessagesBetweenIds(History) returns (History); -} \ No newline at end of file diff --git a/priv/protobuf/service_message/Service.proto b/priv/protobuf/service_message/Service.proto deleted file mode 100644 index fd98188cc7be5d125995a0b2e392b519a4d3b882..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/Service.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Service.grpc"; -option java_outer_classname = "ServiceCls"; -import public "Feature.proto"; -import public "serverType.proto"; -import public "serverStatus.proto"; - -message Service { - string id = 1; - string data = 2; - serverType type = 3; - repeated Feature setting = 4; - int64 expiration = 5; - serverStatus service_status = 6; -} diff --git a/priv/protobuf/service_message/Tag.proto b/priv/protobuf/service_message/Tag.proto deleted file mode 100644 index 9a1632c0de26e45ecd7114e468b20d90054a0aea..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/Tag.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Tag.grpc"; -option java_outer_classname = "TagCls"; -import public "tagType.proto"; - -message Tag { - int64 roster_id = 1; - string name = 2; - string color = 3; - tagType tag_status = 4; -} diff --git a/priv/protobuf/service_message/act.proto b/priv/protobuf/service_message/act.proto deleted file mode 100644 index bbeec857a6062d34b966211d79f9bf6cc7f45ce5..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/act.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "act.grpc"; -option java_outer_classname = "actCls"; - -message act { - string name = 1; - oneof data { - string data20 = 20; - int64 data21 = 21; - } -} diff --git a/priv/protobuf/service_message/container.proto b/priv/protobuf/service_message/container.proto deleted file mode 100644 index 3012039d1edb6c9ce5098fc83143936696900912..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/container.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "container.grpc"; -option java_outer_classname = "containerCls"; - -enum container { - chain = 0; - cur = 1; -} - diff --git a/priv/protobuf/service_message/historyType.proto b/priv/protobuf/service_message/historyType.proto deleted file mode 100644 index e9a7eebdbf952e7a17d7d1aac53aa29bbfaac378..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/historyType.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "historyType.grpc"; -option java_outer_classname = "historyTypeCls"; - -enum historyType { - hupdated = 0; - hget = 1; - hupdate = 2; - hlast_loaded = 3; - hlast_msg = 4; - hget_reply = 5; -} - diff --git a/priv/protobuf/service_message/jobType.proto b/priv/protobuf/service_message/jobType.proto deleted file mode 100644 index c64277dc63f1f63d2ad892fc9a3e1378595a1170..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/jobType.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "jobType.grpc"; -option java_outer_classname = "jobTypeCls"; - -enum jobType { - jinit = 0; - jupdate = 1; - jdelete = 2; - jpending = 3; - jstop = 4; - jcomplete = 5; -} - diff --git a/priv/protobuf/service_message/messageEvent.proto b/priv/protobuf/service_message/messageEvent.proto deleted file mode 100644 index 72715dd79e30d0e2ca85dd30115592c0c77bf63b..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/messageEvent.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "messageEvent.grpc"; -option java_outer_classname = "messageEventCls"; - -message messageEvent { - string name = 1; - string payload = 2; - int64 timeout = 3; - string module = 4; -} diff --git a/priv/protobuf/service_message/messageStatus.proto b/priv/protobuf/service_message/messageStatus.proto deleted file mode 100644 index b514a8a72708b351b1aa00604f15bdee1ca8c475..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/messageStatus.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "messageStatus.grpc"; -option java_outer_classname = "messageStatusCls"; - -enum messageStatus { - masync = 0; - mdelete = 1; - mclear = 2; - mupdate = 3; - medit = 4; -} - diff --git a/priv/protobuf/service_message/messageType.proto b/priv/protobuf/service_message/messageType.proto deleted file mode 100644 index 5f38169131c0ff79eb9d795399262ad1c61291d9..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/messageType.proto +++ /dev/null @@ -1,20 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "messageType.grpc"; -option java_outer_classname = "messageTypeCls"; - -enum messageType { - sys = 0; - reply = 1; - forward = 2; - read = 3; - edited = 4; - cursor = 5; -} - diff --git a/priv/protobuf/service_message/muc.proto b/priv/protobuf/service_message/muc.proto deleted file mode 100644 index 8eb84eb4f0b68c7a58c269f215f2368d7c954896..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/muc.proto +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "muc.grpc"; -option java_outer_classname = "mucCls"; - -message muc { - string name = 1; -} diff --git a/priv/protobuf/service_message/p2p.proto b/priv/protobuf/service_message/p2p.proto deleted file mode 100644 index 3290d952615c1f2286bb6053b11172fa81b5943f..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/p2p.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "p2p.grpc"; -option java_outer_classname = "p2pCls"; - -message p2p { - string from = 1; - string to = 2; -} diff --git a/priv/protobuf/service_message/presence.proto b/priv/protobuf/service_message/presence.proto deleted file mode 100644 index 0b33ae3cc4fa1ae3b83aac2d041653e2f4d83306..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/presence.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "presence.grpc"; -option java_outer_classname = "presenceCls"; - -enum presence { - online = 0; - offline = 1; -} - diff --git a/priv/protobuf/service_message/serverStatus.proto b/priv/protobuf/service_message/serverStatus.proto deleted file mode 100644 index 41e3eeac5f149c3de2e8d3adfb543d0b2b75894e..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/serverStatus.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverStatus.grpc"; -option java_outer_classname = "serverStatusCls"; - -enum serverStatus { - servie_verified = 0; - service_not_verified = 1; -} - diff --git a/priv/protobuf/service_message/serverType.proto b/priv/protobuf/service_message/serverType.proto deleted file mode 100644 index afa4a3716aaf865eaf24b1241f35a945d7eadaca..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/serverType.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverType.grpc"; -option java_outer_classname = "serverTypeCls"; - -enum serverType { - email = 0; - wallet = 1; - google_type = 2; - fb = 3; - phone = 4; -} - diff --git a/priv/protobuf/service_message/tagType.proto b/priv/protobuf/service_message/tagType.proto deleted file mode 100644 index f21e09717a572d79caee5933d6731fcfbc5f43e8..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_message/tagType.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_message; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "tagType.grpc"; -option java_outer_classname = "tagTypeCls"; - -enum tagType { - tag_create = 0; - tag_remove = 1; - tag_edit = 2; -} - diff --git a/priv/protobuf/service_profile/1compile.sh b/priv/protobuf/service_profile/1compile.sh deleted file mode 100755 index 6ad626dee21b25f4fa0b9b918f9631377fd75f88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/1compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc *.proto --java_out=java diff --git a/priv/protobuf/service_profile/Desc.proto b/priv/protobuf/service_profile/Desc.proto deleted file mode 100644 index 9a5a2dd166166bd8cc75b78d3b673fc6b454fd92..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/Desc.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Desc.grpc"; -option java_outer_classname = "DescCls"; -import public "Feature.proto"; - -message Desc { - string id = 1; - string mime = 2; - string payload = 3; - string parentid = 4; - repeated Feature data = 5; -} diff --git a/priv/protobuf/service_profile/Feature.proto b/priv/protobuf/service_profile/Feature.proto deleted file mode 100644 index 64e1725871b5a1ad01018c1343521fbc56f1d608..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/Feature.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Feature.grpc"; -option java_outer_classname = "FeatureCls"; - -message Feature { - string id = 1; - string key = 2; - string value = 3; - string group = 4; -} diff --git a/priv/protobuf/service_profile/Profile.proto b/priv/protobuf/service_profile/Profile.proto deleted file mode 100644 index db8e1b3d233548f4adb1942ad1131edce8d6793b..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/Profile.proto +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Profile.grpc"; -option java_outer_classname = "ProfileCls"; -import public "Feature.proto"; -import public "profileStatus.proto"; -import public "presence.proto"; -import public "Service.proto"; - -message Profile { - string phone = 1; - repeated Service services = 2; - repeated int64 rosters = 3; - repeated Feature settings = 4; - int64 update = 5; - int64 balance = 6; - presence presence = 7; - profileStatus profileStatus = 8; -} diff --git a/priv/protobuf/service_profile/ProfileService.proto b/priv/protobuf/service_profile/ProfileService.proto deleted file mode 100644 index 64dab5f5bb7bed7414ace485b13f6d79abdb026b..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/ProfileService.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "ProfileService.grpc"; -option java_outer_classname = "ProfileServiceCls"; -import public "Profile.proto"; - -service FriendService { - rpc getProfile(Profile) returns (Profile); - rpc deleteProfile(Profile) returns (Profile); -} \ No newline at end of file diff --git a/priv/protobuf/service_profile/Service.proto b/priv/protobuf/service_profile/Service.proto deleted file mode 100644 index d3af3a6ee25ff6fb7e1487a132371178c04525fc..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/Service.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Service.grpc"; -option java_outer_classname = "ServiceCls"; -import public "Feature.proto"; -import public "serverType.proto"; -import public "serverStatus.proto"; - -message Service { - string id = 1; - string data = 2; - serverType type = 3; - repeated Feature setting = 4; - int64 expiration = 5; - serverStatus service_status = 6; -} diff --git a/priv/protobuf/service_profile/Tag.proto b/priv/protobuf/service_profile/Tag.proto deleted file mode 100644 index db4d5d5b4198c748ca798bac521a4aeb5afe9918..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/Tag.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Tag.grpc"; -option java_outer_classname = "TagCls"; -import public "tagType.proto"; - -message Tag { - int64 roster_id = 1; - string name = 2; - string color = 3; - tagType tag_status = 4; -} diff --git a/priv/protobuf/service_profile/presence.proto b/priv/protobuf/service_profile/presence.proto deleted file mode 100644 index f37d175ce43b465495fedd5f147c8d6594e1eed0..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/presence.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "presence.grpc"; -option java_outer_classname = "presenceCls"; - -enum presence { - online = 0; - offline = 1; -} - diff --git a/priv/protobuf/service_profile/profileStatus.proto b/priv/protobuf/service_profile/profileStatus.proto deleted file mode 100644 index 44277b57cb56553088551c39fc443c206352e7cd..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/profileStatus.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "profileStatus.grpc"; -option java_outer_classname = "profileStatusCls"; - -enum profileStatus { - remove_profile = 0; - get_profile = 1; - patch_profile = 2; -} - diff --git a/priv/protobuf/service_profile/serverStatus.proto b/priv/protobuf/service_profile/serverStatus.proto deleted file mode 100644 index 1883e26bcadb3ff4d6af50a51fada0f85131b11b..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/serverStatus.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverStatus.grpc"; -option java_outer_classname = "serverStatusCls"; - -enum serverStatus { - servie_verified = 0; - service_not_verified = 1; -} - diff --git a/priv/protobuf/service_profile/serverType.proto b/priv/protobuf/service_profile/serverType.proto deleted file mode 100644 index af48113f40d7fe3996486c58dab53fb2270e36ed..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/serverType.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverType.grpc"; -option java_outer_classname = "serverTypeCls"; - -enum serverType { - email = 0; - wallet = 1; - google_type = 2; - fb = 3; - phone = 4; -} - diff --git a/priv/protobuf/service_profile/tagType.proto b/priv/protobuf/service_profile/tagType.proto deleted file mode 100644 index e7673153547d894925b862651330c2e887d9e37f..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_profile/tagType.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_profile; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "tagType.grpc"; -option java_outer_classname = "tagTypeCls"; - -enum tagType { - tag_create = 0; - tag_remove = 1; - tag_edit = 2; -} - diff --git a/priv/protobuf/service_room/1compile.sh b/priv/protobuf/service_room/1compile.sh deleted file mode 100755 index 6ad626dee21b25f4fa0b9b918f9631377fd75f88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/1compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc *.proto --java_out=java diff --git a/priv/protobuf/service_room/Desc.proto b/priv/protobuf/service_room/Desc.proto deleted file mode 100644 index e9a4db9b74f83347aab34670ddca9f9eaed8017b..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Desc.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Desc.grpc"; -option java_outer_classname = "DescCls"; -import public "Feature.proto"; - -message Desc { - string id = 1; - string mime = 2; - string payload = 3; - string parentid = 4; - repeated Feature data = 5; -} diff --git a/priv/protobuf/service_room/Feature.proto b/priv/protobuf/service_room/Feature.proto deleted file mode 100644 index 2de076cb5d05aa33adb8684bcffda5b71e7ef28a..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Feature.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Feature.grpc"; -option java_outer_classname = "FeatureCls"; - -message Feature { - string id = 1; - string key = 2; - string value = 3; - string group = 4; -} diff --git a/priv/protobuf/service_room/Link.proto b/priv/protobuf/service_room/Link.proto deleted file mode 100644 index a3cf002d4507f96e4b4bc9bec4f9773b354fabf1..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Link.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Link.grpc"; -option java_outer_classname = "LinkCls"; - -message Link { - string id = 1; - string name = 2; - string room_id = 3; - int64 created = 4; - oneof type { - } - oneof status { - } -} diff --git a/priv/protobuf/service_room/Member.proto b/priv/protobuf/service_room/Member.proto deleted file mode 100644 index fa750d3ba8e902f87262133e69f543c46618ab61..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Member.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -import "google/protobuf/Any.proto"; -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Member.grpc"; -option java_outer_classname = "MemberCls"; -import public "Feature.proto"; -import public "presence.proto"; -import public "muc.proto"; -import public "p2p.proto"; -import public "memberStatus.proto"; -import public "Service.proto"; -import public "container.proto"; - -message Member { - int64 id = 1; - container container = 2; - oneof feed_id { - muc feed_id30 = 30; - p2p feed_id31 = 31; - } - int64 prev = 4; - int64 next = 5; - repeated google.protobuf.Any feeds = 6; - string phone_id = 7; - string avatar = 8; - string names = 9; - string surnames = 10; - string alias = 11; - int64 reader = 12; - int64 update = 13; - repeated Feature settings = 14; - repeated Service services = 15; - presence presence = 16; - memberStatus member_status = 17; -} diff --git a/priv/protobuf/service_room/Room.proto b/priv/protobuf/service_room/Room.proto deleted file mode 100644 index 13d1f556a2853b23fdd041862cb6917accca0740..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Room.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Room.grpc"; -option java_outer_classname = "RoomCls"; -import public "Member.proto"; -import public "Feature.proto"; -import public "Message.proto"; -import public "Desc.proto"; - -message Room { - string id = 1; - string name = 2; - string links = 3; - string description = 4; - repeated Feature settings = 5; - repeated Member members = 6; - repeated Member admins = 7; - repeated Desc data = 8; - oneof type { - } - string tos = 10; - int64 tos_update = 11; - int64 unread = 12; - repeated int64 mentions = 13; - repeated int64 readers = 14; - oneof last_msg { - int64 last_msg150 = 150; - Message last_msg151 = 151; - } - int64 update = 16; - int64 created = 17; - oneof status { - } -} diff --git a/priv/protobuf/service_room/RoomService.proto b/priv/protobuf/service_room/RoomService.proto deleted file mode 100644 index 034e92c38f7b1de6c52e5b39ceedad72167f1b04..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/RoomService.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "RoomService.grpc"; -option java_outer_classname = "RoomServiceCls"; -import public "Room.proto"; -import public "Member.proto"; - -service RoomService { - rpc createRoom(Room) returns (Room); - rpc leaveRoom(Room) returns (Room); - rpc kickFromRoom(Room) returns (Room); - rpc updatemRoom(Room) returns (Room); - rpc addUserToRoom(Room) returns (Room); - rpc changeUserRoleInRoom(Room) returns (Room); - rpc getRoomMembers(Room) returns (Room); - rpc clearRoomHistory(Room) returns (Room); - rpc muteRoom(Member) returns (Member); - rpc unmuteRoom(Member) returns (Member); - rpc updateMemberDetails(Member) returns (Member); -} \ No newline at end of file diff --git a/priv/protobuf/service_room/Service.proto b/priv/protobuf/service_room/Service.proto deleted file mode 100644 index 596afa5735d66b3a6f8aa3009ed201821af995c5..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Service.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Service.grpc"; -option java_outer_classname = "ServiceCls"; -import public "Feature.proto"; -import public "serverType.proto"; -import public "serverStatus.proto"; - -message Service { - string id = 1; - string data = 2; - serverType type = 3; - repeated Feature setting = 4; - int64 expiration = 5; - serverStatus service_status = 6; -} diff --git a/priv/protobuf/service_room/Tag.proto b/priv/protobuf/service_room/Tag.proto deleted file mode 100644 index e2d1b28d2f59fa50b598c111781af2bd5c855afa..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/Tag.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Tag.grpc"; -option java_outer_classname = "TagCls"; -import public "tagType.proto"; - -message Tag { - int64 roster_id = 1; - string name = 2; - string color = 3; - tagType tag_status = 4; -} diff --git a/priv/protobuf/service_room/container.proto b/priv/protobuf/service_room/container.proto deleted file mode 100644 index 917329a001dc795736917f2a83318a846c92b0a0..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/container.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "container.grpc"; -option java_outer_classname = "containerCls"; - -enum container { - chain = 0; - cur = 1; -} - diff --git a/priv/protobuf/service_room/linkStatus.proto b/priv/protobuf/service_room/linkStatus.proto deleted file mode 100644 index 1ff436f8b7cc12476bbee9b61013d146eb310a6e..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/linkStatus.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "linkStatus.grpc"; -option java_outer_classname = "linkStatusCls"; - -enum linkStatus { - lgen = 0; - lcheck = 1; - ladd = 2; - ldelete = 3; - lupdate = 4; -} - diff --git a/priv/protobuf/service_room/memberStatus.proto b/priv/protobuf/service_room/memberStatus.proto deleted file mode 100644 index 34bee9bab1e829d093d204aa6d228ad6b7030e16..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/memberStatus.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "memberStatus.grpc"; -option java_outer_classname = "memberStatusCls"; - -enum memberStatus { - admin = 0; - member = 1; - removed = 2; - patch = 3; - owner = 4; -} - diff --git a/priv/protobuf/service_room/muc.proto b/priv/protobuf/service_room/muc.proto deleted file mode 100644 index 57ddef8afd34c4bac4fbe95eb665189b4acecd64..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/muc.proto +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "muc.grpc"; -option java_outer_classname = "mucCls"; - -message muc { - string name = 1; -} diff --git a/priv/protobuf/service_room/p2p.proto b/priv/protobuf/service_room/p2p.proto deleted file mode 100644 index e0d183961c5592bde7c90b761c88bc723657d7b8..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/p2p.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "p2p.grpc"; -option java_outer_classname = "p2pCls"; - -message p2p { - string from = 1; - string to = 2; -} diff --git a/priv/protobuf/service_room/presence.proto b/priv/protobuf/service_room/presence.proto deleted file mode 100644 index bb9958e1c220bc8359b1bc504a478ae785d2330a..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/presence.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "presence.grpc"; -option java_outer_classname = "presenceCls"; - -enum presence { - online = 0; - offline = 1; -} - diff --git a/priv/protobuf/service_room/roomStatus.proto b/priv/protobuf/service_room/roomStatus.proto deleted file mode 100644 index d6c14cfdefc7abea14e4b0934d48b5b4c3df184e..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/roomStatus.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "roomStatus.grpc"; -option java_outer_classname = "roomStatusCls"; - -enum roomStatus { - room_create = 0; - room_leave = 1; - room_add = 2; - room_remove = 3; - room_patch = 4; - room_get = 5; - room_delete = 6; - room_last_msg = 7; -} - diff --git a/priv/protobuf/service_room/roomType.proto b/priv/protobuf/service_room/roomType.proto deleted file mode 100644 index 1ce70af7b7bc0aaa2f9e1d0e679bff39eda61df1..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/roomType.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "roomType.grpc"; -option java_outer_classname = "roomTypeCls"; - -enum roomType { - group = 0; - channel = 1; -} - diff --git a/priv/protobuf/service_room/serverStatus.proto b/priv/protobuf/service_room/serverStatus.proto deleted file mode 100644 index 045d8ed0e6398ae96a789eb4be7fe94a18eea87b..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/serverStatus.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverStatus.grpc"; -option java_outer_classname = "serverStatusCls"; - -enum serverStatus { - servie_verified = 0; - service_not_verified = 1; -} - diff --git a/priv/protobuf/service_room/serverType.proto b/priv/protobuf/service_room/serverType.proto deleted file mode 100644 index eeefc6b5cf0c7636f541b841362890e13bdc18a4..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/serverType.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverType.grpc"; -option java_outer_classname = "serverTypeCls"; - -enum serverType { - email = 0; - wallet = 1; - google_type = 2; - fb = 3; - phone = 4; -} - diff --git a/priv/protobuf/service_room/tagType.proto b/priv/protobuf/service_room/tagType.proto deleted file mode 100644 index c0f05076e5560cb938673108fc12ea211649a296..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_room/tagType.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_room; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "tagType.grpc"; -option java_outer_classname = "tagTypeCls"; - -enum tagType { - tag_create = 0; - tag_remove = 1; - tag_edit = 2; -} - diff --git a/priv/protobuf/service_roster/1compile.sh b/priv/protobuf/service_roster/1compile.sh deleted file mode 100755 index 6ad626dee21b25f4fa0b9b918f9631377fd75f88..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/1compile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -protoc *.proto --java_out=java diff --git a/priv/protobuf/service_roster/Contact.proto b/priv/protobuf/service_roster/Contact.proto deleted file mode 100644 index 8fcb3eec68396638ffd6bec97b6d78ec62432370..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/Contact.proto +++ /dev/null @@ -1,32 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -import "google/protobuf/Any.proto"; -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Contact.grpc"; -option java_outer_classname = "ContactCls"; -import public "Feature.proto"; -import public "contactStatus.proto"; -import public "presence.proto"; -import public "Service.proto"; - -message Contact { - string user_id = 1; - repeated int64 avatar = 2; - string names = 3; - string surnames = 4; - string nick = 5; - repeated google.protobuf.Any reader = 6; - int64 unread = 7; - int64 last_msg = 8; - int64 update = 9; - int64 created = 10; - repeated Feature settings = 11; - repeated Service services = 12; - presence presence = 13; - contactStatus status = 14; -} diff --git a/priv/protobuf/service_roster/Desc.proto b/priv/protobuf/service_roster/Desc.proto deleted file mode 100644 index 99c421db4a2cc404394a5ca6f59c76a9ff1968d8..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/Desc.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Desc.grpc"; -option java_outer_classname = "DescCls"; -import public "Feature.proto"; - -message Desc { - string id = 1; - string mime = 2; - string payload = 3; - string parentid = 4; - repeated Feature data = 5; -} diff --git a/priv/protobuf/service_roster/Feature.proto b/priv/protobuf/service_roster/Feature.proto deleted file mode 100644 index 3859dcf675244820ed48253043efa88c789b12ca..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/Feature.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Feature.grpc"; -option java_outer_classname = "FeatureCls"; - -message Feature { - string id = 1; - string key = 2; - string value = 3; - string group = 4; -} diff --git a/priv/protobuf/service_roster/Roster.proto b/priv/protobuf/service_roster/Roster.proto deleted file mode 100644 index 956afea8e247d9b5f5918227e60199e76cc2b77e..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/Roster.proto +++ /dev/null @@ -1,28 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Roster.grpc"; -option java_outer_classname = "RosterCls"; -import public "Contact.proto"; -import public "rosterStatus.proto"; - -message Roster { - int64 id = 1; - string names = 2; - string surnames = 3; - string email = 4; - string nick = 5; - repeated Contact userlist = 6; - repeated int64 roomlist = 7; - repeated int64 favorite = 8; - repeated int64 tags = 9; - string phone = 10; - string avatar = 11; - int64 update = 12; - rosterStatus rosterStatus = 13; -} diff --git a/priv/protobuf/service_roster/RosterService.proto b/priv/protobuf/service_roster/RosterService.proto deleted file mode 100644 index abf822cc920a3757c7a074fcfd3c87f96a439345..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/RosterService.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "RosterService.grpc"; -option java_outer_classname = "RosterServiceCls"; -import public "Roster.proto"; -import public "Contact.proto"; - -service RosterService { - rpc update(Roster) returns (Roster); - rpc updateNick(Roster) returns (Roster); -} \ No newline at end of file diff --git a/priv/protobuf/service_roster/Service.proto b/priv/protobuf/service_roster/Service.proto deleted file mode 100644 index 180788cd3120cf232a2ae3d76bfd8b31d2512d8c..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/Service.proto +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Service.grpc"; -option java_outer_classname = "ServiceCls"; -import public "Feature.proto"; -import public "serverType.proto"; -import public "serverStatus.proto"; - -message Service { - string id = 1; - string data = 2; - serverType type = 3; - repeated Feature setting = 4; - int64 expiration = 5; - serverStatus service_status = 6; -} diff --git a/priv/protobuf/service_roster/Tag.proto b/priv/protobuf/service_roster/Tag.proto deleted file mode 100644 index 8fc287a05eaaad8fd0c198be1a9957ddd4e3e28f..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/Tag.proto +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "Tag.grpc"; -option java_outer_classname = "TagCls"; -import public "tagType.proto"; - -message Tag { - int64 roster_id = 1; - string name = 2; - string color = 3; - tagType tag_status = 4; -} diff --git a/priv/protobuf/service_roster/contactStatus.proto b/priv/protobuf/service_roster/contactStatus.proto deleted file mode 100644 index be8237beaf778b4d4c5886301b1b5b8a5105f1ef..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/contactStatus.proto +++ /dev/null @@ -1,23 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "contactStatus.grpc"; -option java_outer_classname = "contactStatusCls"; - -enum contactStatus { - conact_request = 0; - authorization = 1; - contact_ignore = 2; - conatct_internal = 3; - friend = 4; - contact_last_msg = 5; - contact_ban = 6; - conact_banned = 7; - contact_deleted = 8; -} - diff --git a/priv/protobuf/service_roster/muc.proto b/priv/protobuf/service_roster/muc.proto deleted file mode 100644 index 039c4d5224bc7eb1da2776ef8655526ef97bc6de..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/muc.proto +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "muc.grpc"; -option java_outer_classname = "mucCls"; - -message muc { - string name = 1; -} diff --git a/priv/protobuf/service_roster/p2p.proto b/priv/protobuf/service_roster/p2p.proto deleted file mode 100644 index 46a95b911cc13c55a16713e889979ea363ab62c1..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/p2p.proto +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "p2p.grpc"; -option java_outer_classname = "p2pCls"; - -message p2p { - string from = 1; - string to = 2; -} diff --git a/priv/protobuf/service_roster/presence.proto b/priv/protobuf/service_roster/presence.proto deleted file mode 100644 index 3c2a5c119cf0afea9d4a01b3029a5cd329a15002..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/presence.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "presence.grpc"; -option java_outer_classname = "presenceCls"; - -enum presence { - online = 0; - offline = 1; -} - diff --git a/priv/protobuf/service_roster/rosterStatus.proto b/priv/protobuf/service_roster/rosterStatus.proto deleted file mode 100644 index 65c391024ba14d93be03838e546653f8e0955635..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/rosterStatus.proto +++ /dev/null @@ -1,24 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "rosterStatus.grpc"; -option java_outer_classname = "rosterStatusCls"; - -enum rosterStatus { - get_roster = 0; - create_roster = 1; - del_roster = 2; - remove_roster = 3; - nick = 4; - add_roster = 5; - update_roster = 6; - list_loster = 7; - patch_roster = 8; - roster_last_msg = 9; -} - diff --git a/priv/protobuf/service_roster/serverStatus.proto b/priv/protobuf/service_roster/serverStatus.proto deleted file mode 100644 index 57d0314df734039ae7f2f61934c06d9bde997567..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/serverStatus.proto +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverStatus.grpc"; -option java_outer_classname = "serverStatusCls"; - -enum serverStatus { - servie_verified = 0; - service_not_verified = 1; -} - diff --git a/priv/protobuf/service_roster/serverType.proto b/priv/protobuf/service_roster/serverType.proto deleted file mode 100644 index 7ca622a890869f2b71d6dafec6d7f9cdac7bfc7d..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/serverType.proto +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "serverType.grpc"; -option java_outer_classname = "serverTypeCls"; - -enum serverType { - email = 0; - wallet = 1; - google_type = 2; - fb = 3; - phone = 4; -} - diff --git a/priv/protobuf/service_roster/tagType.proto b/priv/protobuf/service_roster/tagType.proto deleted file mode 100644 index 73981ba16a735570949d6021bd25098ad4fcc555..0000000000000000000000000000000000000000 --- a/priv/protobuf/service_roster/tagType.proto +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by https://github.com/synrc/bert -// DO NOT EDIT - -syntax = "proto3"; -package service_roster; - -option java_generic_services = true; -option java_multiple_files = true; -option java_package = "tagType.grpc"; -option java_outer_classname = "tagTypeCls"; - -enum tagType { - tag_create = 0; - tag_remove = 1; - tag_edit = 2; -} - diff --git a/rebar.config b/rebar.config index dfc1848f47a406f57b8f584a14f7a04811477925..6a0608bf67d593cb4e0882d72592812ff8235357 100644 --- a/rebar.config +++ b/rebar.config @@ -1,51 +1,91 @@ -{sub_dirs,["apps"]}. -{lib_dirs,["apps","deps"]}. -{deps_dir,"deps"}. +%% -*- mode:erlang; erlang-indent-level: 4; indent-tabs-mode: nil -*- +{erl_opts, [{parse_transform,lager_transform}, {parse_transform, oc_span_transform}, debug_info]}. + {deps, [ - {bert, ".*", {git, "git://github.com/synrc/bert",{tag,"2.4"}}}, - {active, ".*", {git, "git://github.com/synrc/active",{tag,"master"}}}, - {esockd, ".*", {git, "https://github.com/voxoz/esockd",{ref, "a80634b961c315ffe5f020d73236473b53ae5dc9"}}}, - {bpe, ".*", {git, "git://github.com/synrc/bpe", {tag,"4.4"}}}, - {emqttd, ".*", {git, "git://github.com/NYNJA-MC/emqttd",{tag,"master"}}}, - {n2o, ".*", {git, "git://github.com/synrc/n2o", {tag,"6.4"}}}, - {emqttc, ".*", {git, "git://github.com/NYNJA-MC/emqttc",{tag,"master"}}}, - {rest, ".*", {git, "git://github.com/synrc/rest",{tag,"5.10"}}}, - {gen_smtp, ".*", {git, "git://github.com/voxoz/gen_smtp",{tag,"master"}}}, - {emq_dashboard, ".*", {git, "https://github.com/synrc/emq_dashboard",{tag,"master"}}}, - {'opencensus-erlang', ".*", {git, "https://github.com/voxoz/opencensus-erlang",{tag, "v0.4.0"}}}, - {libphonenumber_erlang, ".*", {git, "https://github.com/marinakr/libphonenumber_erlang.git",{tag,"master"}}}, - {gproc, ".*", {git, "https://github.com/uwiger/gproc","0.6.1"}}, - {erlydtl, ".*", {git, "git://github.com/voxoz/erlydtl",{tag,"master"}}}, - {mini_s3, ".*", {git, "https://github.com/chef/mini_s3.git",{tag,"master"}}}, - {jwt, ".*", {git, "https://github.com/artemeff/jwt.git",{tag, "0.1.8"}}}, - {jsx, ".*", {git, "https://github.com/talentdeficit/jsx.git","v2.9.0"}}, - {base64url, ".*", {git, "https://github.com/dvv/base64url.git","v1.0"}}, - {migresia, ".*", {git, "https://github.com/yoonka/migresia.git",{tag,"master"}}}, - {counters, ".*", {git, "https://github.com/deadtrickster/counters.erl.git", {tag, "v0.2.0"}}}, - {ctx, ".*", {git, "https://github.com/tsloughter/ctx.git", []}}, - {wts, ".*", {git, "https://github.com/tsloughter/wts.git", []}}, - {rfc3339, ".*", {git, "https://github.com/talentdeficit/rfc3339",{tag,"0.2.2"}}}, - {locus, ".*", {git, "https://github.com/g-andrade/locus.git",{ref,"0ea9079ce5686573e0e70e2b1311343dd25feef8"}}}, - {prometheus, ".*", {git, "https://github.com/deadtrickster/prometheus.erl",{tag,"master"}}}, - {cowboy, ".*", {git, "git://github.com/voxoz/cowboy", {tag,"master"}}}, - {'jose-erlang', ".*", {git, "https://github.com/manifest/jose-erlang.git", {tag,"master"}}}, - {json_rec, ".*", {git, "https://github.com/justinkirby/json_rec.git", {tag,"master"}}}, - {'erlang-uuid', ".*", {git, "https://github.com/avtobiff/erlang-uuid.git",{tag,"master"}}}, - {enenra, ".*", {git, "https://github.com/nlfiedler/enenra", {tag, "0.3.0"}}}, - {'qdate', ".*", {git, "https://github.com/enterprizing/qdate.git",{ref,"fba988fc54214bb37a3ce11d5c5a3cc68752c3ce"}}} + {active, {git, "git://github.com/synrc/active", {branch,"master"}}}, + {bert, {git, "git://github.com/NYNJA-MC/bert.git", {branch, master}}}, + {esockd, {git, "https://github.com/voxoz/esockd", {branch, "master"}}}, + {bpe, {git, "git://github.com/synrc/bpe", {tag,"4.4"}}}, + {emqttd, {git, "git://github.com/NYNJA-MC/emqttd", {branch,"master"}}}, + {n2o, {git, "git://github.com/synrc/n2o", {tag,"6.4"}}}, + {emqttc, {git, "git://github.com/NYNJA-MC/emqttc", {branch,"master"}}}, + {rest, {git, "git://github.com/synrc/rest", {tag,"5.10"}}}, + {gen_smtp, {git, "git://github.com/voxoz/gen_smtp", {branch,"master"}}}, + {emq_dashboard, {git, "https://github.com/synrc/emq_dashboard", {branch,"master"}}}, + {opencensus, {git, "https://github.com/census-instrumentation/opencensus-erlang", {ref, "7fb276f"}}}, + {libphonenumber_erlang, {git, "https://github.com/marinakr/libphonenumber_erlang.git", {branch,"master"}}}, + {gproc, {git, "https://github.com/uwiger/gproc", {tag, "0.6.1"}}}, + {erlydtl, {git, "git://github.com/voxoz/erlydtl", {branch,"master"}}}, + {mini_s3, {git, "https://github.com/chef/mini_s3.git", {branch,"master"}}}, + {jwt, {git, "https://github.com/artemeff/jwt.git", {tag, "0.1.8"}}}, + {jsx, {git, "https://github.com/talentdeficit/jsx.git",{tag, "v2.9.0"}}}, + {base64url, {git, "https://github.com/dvv/base64url.git", {tag, "v1.0"}}}, + {migresia, {git, "https://github.com/yoonka/migresia.git", {branch,"master"}}}, + {counters, {git, "https://github.com/deadtrickster/counters.erl.git", {tag, "v0.2.2"}}}, + {ctx, {git, "https://github.com/tsloughter/ctx.git"}}, + {wts, {git, "https://github.com/tsloughter/wts.git"}}, + {rfc3339, {git, "https://github.com/talentdeficit/rfc3339",{tag,"0.2.2"}}}, + {locus, {git, "https://github.com/g-andrade/locus.git", {ref,"0ea9079ce5686573e0e70e2b1311343dd25feef8"}}}, + {prometheus, {git, "https://github.com/deadtrickster/prometheus.erl", {branch,"master"}}}, + {cowboy, {git, "git://github.com/ninenines/cowboy", {tag,"2.7.0"}}}, + {jose, {git, "https://github.com/NYNJA-MC/jose-erlang.git", {ref, "7094018"}}}, + {json_rec, {git, "https://github.com/justinkirby/json_rec.git", {branch,"master"}}}, + {uuid, {git, "https://github.com/avtobiff/erlang-uuid.git",{branch,"master"}}}, + {enenra, {git, "https://github.com/nlfiedler/enenra", {tag, "0.3.0"}}}, + {'qdate', {git, "https://github.com/enterprizing/qdate.git", {ref,"fba988fc54214bb37a3ce11d5c5a3cc68752c3ce"}}} ]}. -{erl_opts, [{parse_transform,lager_transform},{parse_transform, oc_transform},debug_info]}. + + +{profiles, [{local, [{relx, [{dev_mode, true}, + {include_erts, false}, + {include_src, true}]} + ]}, + {prod, [{relx, [{dev_mode, false}, + {include_erts, true}, + {include_src, true}, + {overlay, []} + ]} + ]} + ]}. + +%% Generate json, javascript and swift in following way +{overrides, [{add, service, [{erl_opts, [{bert_proto_dir, "priv"}, + {bert_disallowed, ['feed', 'Whitelist', 'FakeNumbers','Schedule','Index','process']} + ]}]}, + {add, roster, [{erl_opts, [{bert_erl, "priv/src"}, + {bert_js, "priv/macbert"}, + {bert_swift, "priv/macbert"}, + {bert_allowed_hrl, ["roster"]}, + {bert_disallowed, ['feed', 'Whitelist', 'FakeNumbers','Schedule','Index','process']} + ]}]} + ]}. + +{artifacts, ["lib/roster/src/roster_validator.erl", "lib/roster/ebin/roster_validator.beam"]}. + {relx, [{release, {server, "1.0.0"}, - [roster, service]}, - {sys_config, "./sys.config"}, - {vm_args, "./vm.args"}, - {dev_mode, true}, - {include_erts, false}, - {extended_start_script, true} - ] - }. - {profiles, [ - {prod, [{relx, [{dev_mode, false}, - {include_erts, true}]} - ]} - ]}. + %% Copied from .applist in older version. Should be cleaned up. + [kernel, stdlib, sasl, crypto, inets, os_mon, + fs, gproc, gen_logger, compiler, + mnesia, kvs, + esockd, + prometheus,bert,n2o, + metrics,mimerl,unicode_util_compat,base64url,jsx,tools, + certifi,ibrowse,asn1,xmerl,counters,ctx, + wts,syntax_tools,qdate_localtime, + libphonenumber_erlang,syn,cowlib,jiffy,idna,parse_trans, + goldrush, public_key,bpe,lager,ssl,ranch,mochiweb, + ssl_verify_fun,locus,emqttd,hackney,roster,service,active, + cowboy,emq_dashboard,emqttc,enenra,envy,uuid,erlydtl,forms, + gen_smtp,json_rec,jwt,mad,migresia,mini_s3,nitro,opencensus, + qdate,rest,rfc3339,sh,stacktrace_compat]}, + {sys_config, "./sys.config"}, + {vm_args, "./vm.args"}, + {dev_mode, true}, + {include_erts, false}, + {extended_start_script, true}, + {overlay, [{link, "admin", "./admin"}, + {link, "etc", "./etc"}, + {link, "priv", "./priv"}, + {link, "asserts", "./asserts"} + ]} + ]}. diff --git a/rebar.lock b/rebar.lock index f641a2fbb6bca33e10d4417842103b9f24c3d93d..3d6b74732aa433607dfa0b2384ea9d244f05b1e9 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,68 +1,78 @@ {"1.1.0", -[{<<"base64url">>, +[{<<"active">>, + {git,"git://github.com/synrc/active", + {ref,"cdd8f2b0f62b9785673bdbea7be90e1ae1ca1c02"}}, + 0}, + {<<"base64url">>, {git,"https://github.com/dvv/base64url.git", {ref,"f2c64ed8b9bebc536fad37ad97243452b674b837"}}, 0}, {<<"bert">>, - {git,"git://github.com/synrc/bert", - {ref,"6cde41b32448e85ecd48225221d6f978943a1bad"}}, + {git,"git://github.com/NYNJA-MC/bert.git", + {ref,"9a0cd97b6db86852811947888424236b25b451c9"}}, 0}, {<<"bpe">>, {git,"git://github.com/synrc/bpe", {ref,"356c9e621c38e927a8611ecac592bcdc8d689026"}}, 0}, {<<"certifi">>,{pkg,<<"certifi">>,<<"2.4.2">>},1}, + {<<"cf">>,{pkg,<<"cf">>,<<"0.3.1">>},2}, {<<"counters">>, {git,"https://github.com/deadtrickster/counters.erl.git", - {ref,"c3f4aa3acdf71c3db0a4b3fc1343aa45de2c5df0"}}, + {ref,"70e709ef43ba0f6ee28e31efe5894eaa475211e1"}}, 0}, {<<"cowboy">>, - {git,"git://github.com/voxoz/cowboy", - {ref,"c1cfbfa5dc6b5f6ecd9591ad5bf642b6a107a7f5"}}, + {git,"git://github.com/ninenines/cowboy", + {ref,"63b17e4edf666d995ec86cdcda17a62ba5ebc423"}}, 0}, {<<"cowlib">>, - {git,"git://github.com/voxoz/cowlib", - {ref,"5cc0038d0a3ae6a829646ddfff998d8c491969ca"}}, + {git,"https://github.com/ninenines/cowlib", + {ref,"c6553f8308a2ca5dcd69d845f0a7d098c40c3363"}}, 1}, {<<"ctx">>, {git,"https://github.com/tsloughter/ctx.git", - {ref,"a5a6b0948708e02bc7b9cb6248807c9ff8327940"}}, + {ref,"91c892b51d3340fc004099e15e4e029a5ec0e098"}}, 0}, {<<"emq_dashboard">>, {git,"https://github.com/synrc/emq_dashboard", - {ref,"f711e8d2b0a992f5540123f3504eebabc324a684"}}, + {ref,"3317c7dd47b07d28d7dbea4de971b48fc042fefd"}}, 0}, {<<"emqttc">>, - {git,"git://github.com/voxoz/emqttc", - {ref,"141fd2e925be854321d22005313762adb1195f48"}}, + {git,"git://github.com/NYNJA-MC/emqttc", + {ref,"1ffeaf64791b76faa18dad9e9f40686814d5dd10"}}, 0}, {<<"emqttd">>, - {git,"git://github.com/synrc/emqttd", - {ref,"c3d0b7b092fffe7bebe27af27dbbfe1714757d1c"}}, + {git,"git://github.com/NYNJA-MC/emqttd", + {ref,"5e2342bf7ae597804a6f9234a54cad2f6b5761d1"}}, + 0}, + {<<"enenra">>, + {git,"https://github.com/nlfiedler/enenra", + {ref,"ccc2553b8df5a188cdc77aeec7b856a1e5250e67"}}, 0}, {<<"envy">>, {git,"https://github.com/markan/envy.git", {ref,"0148fb4b7ed0e188511578e98b42d6e7dde0ebd1"}}, 1}, - {<<"erlang-uuid">>, - {git,"https://github.com/avtobiff/erlang-uuid.git", - {ref,"cb02a2039a9b29dd2eef0446039c9c6e164df9ef"}}, - 0}, + {<<"erlware_commons">>,{pkg,<<"erlware_commons">>,<<"1.3.1">>},1}, {<<"erlydtl">>, {git,"git://github.com/voxoz/erlydtl", {ref,"bdebe6f87d8f989018facbbf8dc6320936ffe98f"}}, 0}, {<<"esockd">>, {git,"https://github.com/voxoz/esockd", - {ref,"a80634b961c315ffe5f020d73236473b53ae5dc9"}}, + {ref,"817a4f059698a349aac9037fc0600b3928036e3d"}}, 0}, {<<"forms">>, {git,"git://github.com/synrc/forms", {ref,"845feb45a46dfc2e0e9a156da9c01c218d8fd6cc"}}, 1}, + {<<"fs">>, + {git,"git://github.com/synrc/fs", + {ref,"45ca2003b208f461ef4acd56c5fdecd2e98e1f33"}}, + 1}, {<<"gen_logger">>, - {git,"git://github.com/voxoz/gen_logger", - {ref,"5b14530363feb0b049c4f5c7c606f815aec781d2"}}, + {git,"git://github.com/NYNJA-MC/gen_logger", + {ref,"edc9b0aa1202cd4129725d3962a8b992fcf0e29c"}}, 1}, {<<"gen_smtp">>, {git,"git://github.com/voxoz/gen_smtp", @@ -76,10 +86,27 @@ {git,"https://github.com/uwiger/gproc", {ref,"1d16f5e6d7cf616eec4395f2385e3a680a4ffc9f"}}, 0}, + {<<"hackney">>, + {git,"https://github.com/benoitc/hackney", + {ref,"f2ac65700ef7918eb4e827892f1a7bb01e826026"}}, + 1}, {<<"ibrowse">>, {git,"git://github.com/cmullaparthi/ibrowse.git", {ref,"c97136cfb61fcc6f39d4e7da47372a64f7fca04e"}}, 1}, + {<<"idna">>,{pkg,<<"idna">>,<<"6.0.0">>},2}, + {<<"jiffy">>, + {git,"https://github.com/davisp/jiffy", + {ref,"c942525130ff0271bd318715406f234c0dc9bc5a"}}, + 1}, + {<<"jose">>, + {git,"https://github.com/NYNJA-MC/jose-erlang.git", + {ref,"709401825367c029986a3bc688de3ed016b914cd"}}, + 0}, + {<<"json_rec">>, + {git,"https://github.com/justinkirby/json_rec.git", + {ref,"8c72324e0f6fca8534ca733f8af03d4808f7e3be"}}, + 0}, {<<"jsx">>, {git,"https://github.com/talentdeficit/jsx.git", {ref,"fc2a001073f2300ba38427c23e83d5673c020542"}}, @@ -94,23 +121,29 @@ 1}, {<<"lager">>, {git,"git://github.com/voxoz/lager", - {ref,"1ecf4c17e9e39dd7a1943140477f632d17518f0c"}}, + {ref,"9d657ab5acc9e82354f945ef819dab3760fe63cb"}}, 1}, {<<"libphonenumber_erlang">>, {git,"https://github.com/marinakr/libphonenumber_erlang.git", - {ref,"3a6be75ef4f6fdd40fa8afee2a7fc5cf2ddb8601"}}, + {ref,"a78037e6f06f0aeeed9eaf4b8abaf378d24a0d01"}}, 0}, {<<"locus">>, {git,"https://github.com/g-andrade/locus.git", {ref,"0ea9079ce5686573e0e70e2b1311343dd25feef8"}}, 0}, + {<<"mad">>, + {git,"git://github.com/synrc/mad", + {ref,"0cd4d9e709d0ca70ec6d01b9d434692eff51222d"}}, + 1}, + {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"migresia">>, {git,"https://github.com/yoonka/migresia.git", {ref,"40e11825e01502d045e87bf8b5d7dc5a9d6e3f73"}}, 0}, + {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2}, {<<"mini_s3">>, {git,"https://github.com/chef/mini_s3.git", - {ref,"df0c68ea901343b8e0c647142d88d7f3aae27e7b"}}, + {ref,"73c1be787dfe590113419091c531564e58592478"}}, 0}, {<<"mochiweb">>, {git,"git://github.com/voxoz/mochiweb", @@ -124,18 +157,26 @@ {git,"git://github.com/synrc/nitro", {ref,"1aeb421c332f94b135563f8e855b139c1b067f59"}}, 1}, - {<<"opencensus-erlang">>, - {git,"https://github.com/voxoz/opencensus-erlang", - {ref,"8dc9ae86f5c1ef69593fe37b49e649afed6bd201"}}, + {<<"opencensus">>, + {git,"https://github.com/census-instrumentation/opencensus-erlang", + {ref,"7fb276ff73d677c00458922c9180df634f45e018"}}, 0}, - {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},2}, + {<<"parse_trans">>, + {git,"https://github.com/uwiger/parse_trans.git", + {ref,"e61ab8e09eee791222ba49a5706162c4985f24b0"}}, + 1}, {<<"prometheus">>, {git,"https://github.com/deadtrickster/prometheus.erl", - {ref,"46ea4b487baf4f6cc44495eae07582808e0369d4"}}, + {ref,"39c6595728041fa075561c03f3d45881065cc7e7"}}, + 0}, + {<<"qdate">>, + {git,"https://github.com/enterprizing/qdate.git", + {ref,"fba988fc54214bb37a3ce11d5c5a3cc68752c3ce"}}, 0}, + {<<"qdate_localtime">>,{pkg,<<"qdate_localtime">>,<<"1.1.0">>},1}, {<<"ranch">>, - {git,"git://github.com/voxoz/ranch", - {ref,"1a75038c82ede22efec46a7dca192b8ce26309e0"}}, + {git,"https://github.com/ninenines/ranch", + {ref,"3190aef88aea04d6dce8545fe9b4574288903f44"}}, 1}, {<<"rest">>, {git,"git://github.com/synrc/rest", @@ -145,20 +186,35 @@ {git,"https://github.com/talentdeficit/rfc3339", {ref,"90effc078c5e673d025b2c1269a153ad4748d3df"}}, 0}, + {<<"sh">>, + {git,"git://github.com/synrc/sh", + {ref,"a4e646aba9a4c18a34d19089e8b9391076b2bff8"}}, + 2}, {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.4">>},1}, {<<"stacktrace_compat">>,{pkg,<<"stacktrace_compat">>,<<"1.0.2">>},1}, {<<"syn">>, {git,"git://github.com/ostinelli/syn", {ref,"9964eb8969b6e1e712249d3aed4f3dfafd3aaac3"}}, 1}, + {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.4.1">>},3}, + {<<"uuid">>, + {git,"https://github.com/avtobiff/erlang-uuid.git", + {ref,"cb02a2039a9b29dd2eef0446039c9c6e164df9ef"}}, + 0}, {<<"wts">>, {git,"https://github.com/tsloughter/wts.git", - {ref,"5613b6c4354867fd2b02fde5ef15bf80190b8586"}}, + {ref,"09c039e4d9f7ab9b984c9ffb45dd0db0add58f96"}}, 0}]}. [ {pkg_hash,[ {<<"certifi">>, <<"75424FF0F3BAACCFD34B1214184B6EF616D89E420B258BB0A5EA7D7BC628F7F0">>}, - {<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>}, + {<<"cf">>, <<"5CB902239476E141EA70A740340233782D363A31EEA8AD37049561542E6CD641">>}, + {<<"erlware_commons">>, <<"0CE192AD69BC6FD0880246D852D0ECE17631E234878011D1586E053641ED4C04">>}, + {<<"idna">>, <<"689C46CBCDF3524C44D5F3DDE8001F364CD7608A99556D8FBD8239A5798D4C10">>}, + {<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>}, + {<<"mimerl">>, <<"993F9B0E084083405ED8252B99460C4F0563E41729AB42D9074FD5E52439BE88">>}, + {<<"qdate_localtime">>, <<"5F6C3ACF10ECC5A7E2EFA3DCD2C863102B962188DBD9E086EC01D29FE029DA29">>}, {<<"ssl_verify_fun">>, <<"F0EAFFF810D2041E93F915EF59899C923F4568F4585904D010387ED74988E77B">>}, - {<<"stacktrace_compat">>, <<"8AD31C32C9A0EADB1EB298F04DC8B0C8D79BCC6233A638B02791FFCA4F331275">>}]} + {<<"stacktrace_compat">>, <<"8AD31C32C9A0EADB1EB298F04DC8B0C8D79BCC6233A638B02791FFCA4F331275">>}, + {<<"unicode_util_compat">>, <<"D869E4C68901DD9531385BB0C8C40444EBF624E60B6962D95952775CAC5E90CD">>}]} ]. diff --git a/rebar3 b/rebar3 new file mode 100755 index 0000000000000000000000000000000000000000..865ec59000c95fec9d6adf6c0e24f42c88f5014c Binary files /dev/null and b/rebar3 differ diff --git a/sys.config b/sys.config index 74771f3c109a7ee9da41beab6a443ded50ff2c9e..037819064ea5a5a828071ee6e3e7981850c5a751 100644 --- a/sys.config +++ b/sys.config @@ -1,43 +1,51 @@ +%% -*- mode:erlang; erlang-indent-level: 2; indent-tabs-mode: nil -*- [ - {review,[{host,"ns.synrc.com"}]}, - {bert,[{js,"apps/roster/priv/macbert/"}, - {erl,"apps/roster/src"}, - {google,"apps/service/priv/"}, - {disallowed,['feed', 'Whitelist', 'FakeNumbers','Schedule','Index','process']}, - {allowed_hrl, ["roster"]}, - {custom_validate, {roster, validate}}, - {swift,"apps/roster/priv/macbert/"}]}, - {roster,[ - {freeze_time, 1000}, - {upload,"./storage"}, - {email_api,[ - {from,<<"Nynja App">>}, - {host,<<"smtp.gmail.com">>}, - {login,<<"sandbox.nynja.app@gmail.com">>}, - {password,<<"tecSynt_nynja110917">>}]}, - {vox_api,[ - {account_id,<<"1152724">>}, - {api_key,<<"94b9f0f0-7d93-4e63-9061-aef62c30182b">>}, - {application_name,<<"videoconf.nynja.voximplant.com">>}, - {conference_rule_id,<<"294893">>}]}, - {telesign_api,[ - {customer_id,<<"CF6E2918-89A9-417F-8074-382908FEDCD9">>}, - {api_key,<<"JE1zC3gjYg1fITkPK4xYtAGk0uVpbsWSqi7e54wg+sLbMGAbKoJSw0/BRJaAezZpVZzEQfHYyL3PKutGfZ38Gg==">>}]}, - {amazon_api,[ - {access_key_id,<<"AKIAITNYSJXI2NUDRRXA">>}, - {secret_access_key,<<"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">>}, - {sts, [ - {host, <<"sts.amazonaws.com">>}, - {region, <<"us-east-1">>}, - {service, <<"sts">>}, - {action, <<"GetSessionToken">>}, - {duration_seconds, <<"43200">>}, - {version, <<"2011-06-15">>}, - {http_method, <<"GET">>}, - {endpoint, <<"https://sts.amazonaws.com">>} - ]}, - {s3, [ - {default_bucket_name,<<"nynja-defaults">>} + {kernel, + [{logger, + [{handler, default, logger_std_h, + #{level => error, + config => #{file => "log/erlang.log"}}}, + {handler, info, logger_std_h, + #{level => debug, + config => #{file => "log/debug.log"}}} + ]}]}, + {review,[{host,"ns.synrc.com"}]}, + {roster, + [ + {freeze_time, 1000}, + {upload,"./storage"}, + {email_api, + [ + {from,<<"Nynja App">>}, + {host,<<"smtp.gmail.com">>}, + {login,<<"sandbox.nynja.app@gmail.com">>}, + {password,<<"tecSynt_nynja110917">>}]}, + {vox_api, + [ + {account_id,<<"1152724">>}, + {api_key,<<"94b9f0f0-7d93-4e63-9061-aef62c30182b">>}, + {application_name,<<"videoconf.nynja.voximplant.com">>}, + {conference_rule_id,<<"294893">>}]}, + {telesign_api, + [ + {customer_id,<<"CF6E2918-89A9-417F-8074-382908FEDCD9">>}, + {api_key,<<"JE1zC3gjYg1fITkPK4xYtAGk0uVpbsWSqi7e54wg+sLbMGAbKoJSw0/BRJaAezZpVZzEQfHYyL3PKutGfZ38Gg==">>}]}, + {amazon_api, + [ + {access_key_id,<<"AKIAITNYSJXI2NUDRRXA">>}, + {secret_access_key,<<"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">>}, + {sts, [ + {host, <<"sts.amazonaws.com">>}, + {region, <<"us-east-1">>}, + {service, <<"sts">>}, + {action, <<"GetSessionToken">>}, + {duration_seconds, <<"43200">>}, + {version, <<"2011-06-15">>}, + {http_method, <<"GET">>}, + {endpoint, <<"https://sts.amazonaws.com">>} + ]}, + {s3, [ + {default_bucket_name,<<"nynja-defaults">>} ]} ]}, {google_api, [ @@ -57,118 +65,124 @@ {fake_numbers_check, true}, {validate_token, micro_auth} ]}, - {rest, [{port,8888}, - {basic_auth,[ - {username,<<"nynja">>}, - {password,<<"nynjaTS">>}]}, -%% api which can be opened without basic auth - {open_api_list, [<<"/test">>, <<"/metrics">>]} - ]}, - {n2o, [{port,8000}, - {upload,"./storage"}, - {app,review}, - {tables,[ cookies, file, caching, ring, async, nick, names, surnames, system]}, - {pickler,nitro_pickle}, - {formatter,n2o_bert}, - {auth_ttl, 86400}, %% 24 h - {protocols,[n2o_nitro,n2o_ftp,roster_proto]}, - {log_modules,[roster, n2o_vnode]}, - {log_level,roster}, - {vnode, {roster, get_vnode}}, - {validate, {roster, validate}} + {rest, [{port,8888}, + {basic_auth,[ + {username,<<"nynja">>}, + {password,<<"nynjaTS">>}]}, + %% api which can be opened without basic auth + {open_api_list, [<<"/test">>, <<"/metrics">>]} ]}, - {emq_dashboard, [ - {listeners_dash,[ - {http,18083,[ - {acceptors,4},{max_clients,512}] - }, - {https,18084,[ - {acceptors,4},{max_clients,512},{handshake_timeout, 15}, -% {certfile, "etc/certs/cert.pem"}, - {keyfile, "etc/certs/privkey.pem"}, - {cacertfile ,"etc/certs/fullchain.pem"}, - {verify,verify_peer}, - {fail_if_no_peer_cert, false}]} + {n2o, [{port,8000}, + {upload,"./storage"}, + {app,review}, + {tables,[ cookies, file, caching, ring, async, nick, names, surnames, system]}, + {pickler,nitro_pickle}, + {formatter,n2o_bert}, + {auth_ttl, 86400}, %% 24 h + {protocols,[n2o_nitro,n2o_ftp,roster_proto]}, + {log_modules,[roster, n2o_vnode]}, + {log_level,roster}, + {vnode, {roster, get_vnode}}, + {validate, {roster, validate}} ]}, - {default_admin, [ - {name, <<"nynja">>}, - {password, <<"nynjaAdmin">>} - ]}]}, - {emq_modules, [{modules,[{emq_mod_presence,[{qos,1}]}, - {emq_mod_subscription,[{<<"%u/%c/#">>,2}]}, - {emq_mod_rewrite,[{rewrite,"x/#","^x/y/(.+)$","z/y/$1"}, - {rewrite,"y/+/z/#","^y/(.+)/z/(.+)$","y/z/$2"}]}]}]}, -{emqttd, - [{plugins_loaded_file,"etc/loaded_plugins"}, - {plugins_etc_dir,"etc/plugins/"}, - {broker_sys_interval,60}, - {conn_force_gc_count,100}, - {cache_acl,true}, - {acl_file,"etc/acl.conf"}, - {allow_anonymous,true}, - {protocol,[{max_clientid_len,1024},{max_packet_size,25165824}]}, - {client,[{client_idle_timeout,30000},{client_enable_stats,false}]}, - {session, - [{upgrade_qos,false}, - {max_inflight,32}, - {retry_interval,20000}, - {max_awaiting_rel,100000}, - {await_rel_timeout,60000}, - {enable_stats,false}, - {expiry_interval,7200000}]}, - {queue, - [{priority,[]}, - {type,simple}, - {max_length,infinity}, - {low_watermark,0.2}, - {high_watermark,0.6}, - {queue_qos0,true}]}, - {pubsub,[{pool_size,8},{by_clientid,true},{async,true}]}, - {bridge,[{max_queue_len,10000},{ping_down_interval,1}]}, - {listeners, - [{tcp,1883, - [{connopts,[]}, - {sockopts,[{backlog,1024},{nodelay,true}]}, - {acceptors,8}, - {max_clients,1048576}, - {tune_buffer,false}]}, - {ssl,8883, - [{sslopts, - [{versions,['tlsv1.2','tlsv1.1',tlsv1]}, - {cacertfile,"etc/certs/cert.pem"}, - {keyfile,"etc/certs/privkey.pem"}, - {certfile,"etc/certs/fullchain.pem"}]}, - {connopts,[]}, - {sockopts,[{nodelay,true}]}, - {acceptors,8}, - {max_clients,1048576}]}, - {http,8083, - [{connopts,[]}, - {sockopts,[{nodelay,true}]}, - {acceptors,8}, - {max_clients,1048576}]}, - {https,8084, - [{sslopts, - [{cacertfile,"etc/certs/cert.pem"}, - {keyfile,"etc/certs/privkey.pem"}, - {certfile,"etc/certs/fullchain.pem"}]}, - {connopts,[]}, - {sockopts,[{nodelay,true}]}, - {acceptors,8}, - {max_clients,1048576}]}]}, - {sysmon, - [{long_gc,false}, - {long_schedule,2400}, - {large_heap,67108864}, - {busy_port,false}, - {busy_dist_port,true}]}]}, - {kvs, [{dba,store_mnesia}, + {emq_dashboard, + [ + {listeners_dash, + [ + {http,18083, + [ + {acceptors,4},{max_clients,512}] + }, + {https,18084, + [ + {acceptors,4},{max_clients,512},{handshake_timeout, 15}, + %% {certfile, "etc/certs/cert.pem"}, + {keyfile, "etc/certs/privkey.pem"}, + {cacertfile ,"etc/certs/fullchain.pem"}, + {verify,verify_peer}, + {fail_if_no_peer_cert, false}]} + ]}, + {default_admin, [ + {name, <<"nynja">>}, + {password, <<"nynjaAdmin">>} + ]}]}, + {emq_modules, + [{modules,[{emq_mod_presence,[{qos,1}]}, + {emq_mod_subscription,[{<<"%u/%c/#">>,2}]}, + {emq_mod_rewrite, + [{rewrite,"x/#","^x/y/(.+)$","z/y/$1"}, + {rewrite,"y/+/z/#","^y/(.+)/z/(.+)$","y/z/$2"}]}]}]}, + {emqttd, + [{plugins_loaded_file,"etc/loaded_plugins"}, + {plugins_etc_dir,"etc/plugins/"}, + {broker_sys_interval,60}, + {conn_force_gc_count,100}, + {cache_acl,true}, + {acl_file,"etc/acl.conf"}, + {allow_anonymous,true}, + {protocol,[{max_clientid_len,1024},{max_packet_size,25165824}]}, + {client,[{client_idle_timeout,30000},{client_enable_stats,false}]}, + {session, + [{upgrade_qos,false}, + {max_inflight,32}, + {retry_interval,20000}, + {max_awaiting_rel,100000}, + {await_rel_timeout,60000}, + {enable_stats,false}, + {expiry_interval,7200000}]}, + {queue, + [{priority,[]}, + {type,simple}, + {max_length,infinity}, + {low_watermark,0.2}, + {high_watermark,0.6}, + {queue_qos0,true}]}, + {pubsub,[{pool_size,8},{by_clientid,true},{async,true}]}, + {bridge,[{max_queue_len,10000},{ping_down_interval,1}]}, + {listeners, + [{tcp,1883, + [{connopts,[]}, + {sockopts,[{backlog,1024},{nodelay,true}]}, + {acceptors,8}, + {max_clients,1048576}, + {tune_buffer,false}]}, + {ssl,8883, + [{sslopts, + [{versions,['tlsv1.2','tlsv1.1',tlsv1]}, + {cacertfile,"etc/certs/cert.pem"}, + {keyfile,"etc/certs/privkey.pem"}, + {certfile,"etc/certs/fullchain.pem"}]}, + {connopts,[]}, + {sockopts,[{nodelay,true}]}, + {acceptors,8}, + {max_clients,1048576}]}, + {http,8083, + [{connopts,[]}, + {sockopts,[{nodelay,true}]}, + {acceptors,8}, + {max_clients,1048576}]}, + {https,8084, + [{sslopts, + [{cacertfile,"etc/certs/cert.pem"}, + {keyfile,"etc/certs/privkey.pem"}, + {certfile,"etc/certs/fullchain.pem"}]}, + {connopts,[]}, + {sockopts,[{nodelay,true}]}, + {acceptors,8}, + {max_clients,1048576}]}]}, + {sysmon, + [{long_gc,false}, + {long_schedule,2400}, + {large_heap,67108864}, + {busy_port,false}, + {busy_dist_port,true}]}]}, + {kvs, [{dba,store_mnesia}, {schema, [kvs_user, kvs_acl, kvs_feed, kvs_subscription, roster, micro, emqttd_kvs, bpe_metainfo]} -%% ,{generation, {roster_test, limit}} -%% ,{forbidding, {roster_test, forbid}} - ]}, - {bpe,[{process_worker,{job,worker}} - ,{ttl, 8640000} - ]}, - {locus, [{url, "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"}]} + %% ,{generation, {roster_test, limit}} + %% ,{forbidding, {roster_test, forbid}} + ]}, + {bpe,[{process_worker,{job,worker}} + ,{ttl, 8640000} + ]}, + {locus, [{url, "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"}]} ].