summaryrefslogtreecommitdiffstats
path: root/src/core/ephraim_account.erl
blob: ad254837773e9e0c447d8832f5db8e8773205d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-module(ephraim_account).
-behaviour(supervisor).
-export([start_link/1]).
-export([init/1]).

start_link(Account) ->
    {ok, Pid} = supervisor:start_link(?MODULE, []),

    {ok, EventManager} = supervisor:start_child(Pid, {event_man, {advanced_event, start_link, []}, permanent, 1000, worker, [advanced_event]}),
    ephraim_event_proxy:start(Account, EventManager),
    ephraim_account_event_proxy:start(Account, EventManager),

    {ok, Connection} = supervisor:start_child(Pid, {connection, {ephraim_conn, start_link, [EventManager]}, permanent, 10000, worker, [ephraim_conn]}),
    {ok, Roster} = supervisor:start_child(Pid, {roster, {ephraim_roster, start_link, [EventManager, Connection]}, permanent, 1000, worker, [ephraim_roster]}),
    {ok, _} = supervisor:start_child(Pid, {conv_man, {ephraim_conv_man, start_link, [EventManager, Connection, Roster]}, permanent, 1000, supervisor, [ephraim_conv_man]}),
    
    ephraim_conn:connect(Connection),
    
    {ok, Pid}.

init(_Args) ->
    {ok, {{one_for_all, 0, 1}, []}}.