Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 79 lines (71 sloc) 2.69 kb
e6db538 @baphled Refactored so they no longer take the web port as a param, will add this...
authored
1
d731afe @baphled Added basic OTP structure, using sinan.
authored
2 %%%----------------------------------------------------------------
ae39528 @baphled General cleanup.
authored
3 %%% @author Yomi Colledge <yomi@boodah.net>
d731afe @baphled Added basic OTP structure, using sinan.
authored
4 %%% @doc
d9d9991 @baphled After a while of tinker it seems we have now got clean stops from the cl...
authored
5 %%% Initialises chatterl, a multiprocessed chat system, allowing one
6 %%% to create a number of chat groups to which clients can connect
7 %%% and send each other private messages.
d731afe @baphled Added basic OTP structure, using sinan.
authored
8 %%%
9 %%% @end
ae39528 @baphled General cleanup.
authored
10 %%% @copyright 2008 Yomi Colledge
d731afe @baphled Added basic OTP structure, using sinan.
authored
11 %%%----------------------------------------------------------------,
b2e2183 @baphled Forgot to rename module.
authored
12 -module(chatterl).
d731afe @baphled Added basic OTP structure, using sinan.
authored
13
14 -behaviour(application).
15
16 %% Application callbacks
44d0dfb @baphled General cleanup, forgot that chatterl's param was a simple int & not a l...
authored
17 -export([start/0,start/2, stop/1,stop/0]).
d731afe @baphled Added basic OTP structure, using sinan.
authored
18
19 %%%===================================================================
20 %%% Application callbacks
21 %%%===================================================================
43895ef @baphled Moved to make a bit more sense.
authored
22 %%--------------------------------------------------------------------
23 %% @doc
24 %% This function is used to call initialise all essential applications
25 %% linked to Chatterl and starts Chatterl itself.
26 %%
27 %% @spec start() -> {ok, Pid} | {ok, Pid, State} | {error, Reason}
28 %% @end
29 %%--------------------------------------------------------------------
30 start() ->
87712bc @baphled Added inets to the start and stop methods.
authored
31 inets:start(),
32 mochiweb:start(),
33 application:start(?MODULE).
44d0dfb @baphled General cleanup, forgot that chatterl's param was a simple int & not a l...
authored
34
35 stop() ->
87712bc @baphled Added inets to the start and stop methods.
authored
36 inets:stop(),
37 application:stop(?MODULE),
38 mochiweb:stop().
d731afe @baphled Added basic OTP structure, using sinan.
authored
39 %%--------------------------------------------------------------------
40 %% @private
41 %% @doc
42 %% This function is called whenever an application is started using
43 %% application:start/[1,2], and should start the processes of the
44 %% application. If the application is structured according to the OTP
45 %% design principles as a supervision tree, this means starting the
46 %% top supervisor of the tree.
47 %%
48 %% @spec start(StartType, StartArgs) -> {ok, Pid} |
49 %% {ok, Pid, State} |
50 %% {error, Reason}
51 %% StartType = normal | {takeover, Node} | {failover, Node}
52 %% StartArgs = term()
53 %% @end
54 %%--------------------------------------------------------------------
630a194 @baphled Refactored to take our port variable tuple, will add mnesia options shor...
authored
55 start(_StartType, StartArgs) ->
56 case chatterl_sup:start_link(StartArgs) of
d731afe @baphled Added basic OTP structure, using sinan.
authored
57 {ok, Pid} ->
58 {ok, Pid};
59 Error ->
60 Error
61 end.
62
63 %%--------------------------------------------------------------------
64 %% @private
65 %% @doc
66 %% This function is called whenever an application has stopped. It
67 %% is intended to be the opposite of Module:start/2 and should do
68 %% any necessary cleaning up. The return value is ignored.
69 %%
70 %% @spec stop(State) -> void()
71 %% @end
72 %%--------------------------------------------------------------------
73 stop(_State) ->
74 ok.
75
76 %%%===================================================================
77 %%% Internal functions
78 %%%===================================================================
Something went wrong with that request. Please try again.