1 |
|
%%%---------------------------------------------------------------------- |
2 |
|
%%% File : ejabberd.erl |
3 |
|
%%% Author : Alexey Shchepin <alexey@process-one.net> |
4 |
|
%%% Purpose : ejabberd wrapper: start / stop |
5 |
|
%%% Created : 16 Nov 2002 by Alexey Shchepin <alexey@process-one.net> |
6 |
|
%%% |
7 |
|
%%% |
8 |
|
%%% ejabberd, Copyright (C) 2002-2011 ProcessOne |
9 |
|
%%% |
10 |
|
%%% This program is free software; you can redistribute it and/or |
11 |
|
%%% modify it under the terms of the GNU General Public License as |
12 |
|
%%% published by the Free Software Foundation; either version 2 of the |
13 |
|
%%% License, or (at your option) any later version. |
14 |
|
%%% |
15 |
|
%%% This program is distributed in the hope that it will be useful, |
16 |
|
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
|
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 |
|
%%% General Public License for more details. |
19 |
|
%%% |
20 |
|
%%% You should have received a copy of the GNU General Public License |
21 |
|
%%% along with this program; if not, write to the Free Software |
22 |
|
%%% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23 |
|
%%% |
24 |
|
%%%---------------------------------------------------------------------- |
25 |
|
|
26 |
|
-module(ejabberd). |
27 |
|
-author('alexey@process-one.net'). |
28 |
|
-export([get_pid_file/0, |
29 |
|
get_status_file/0, |
30 |
|
get_so_path/0]). |
31 |
|
|
32 |
|
-type lang() :: binary(). |
33 |
|
|
34 |
|
%% Incoming event from XML stream. Used everywhere in xmlstream fsm modules |
35 |
|
-type xml_stream_item() :: 'closed' |
36 |
|
| 'timeout' |
37 |
|
| {'xmlstreamelement', exml:element()} |
38 |
|
| {'xmlstreamend', _} |
39 |
|
| {'xmlstreamerror', _} |
40 |
|
| {'xmlstreamstart', Name :: any(), Attrs :: list()}. |
41 |
|
|
42 |
|
-export_type([lang/0, xml_stream_item/0]). |
43 |
|
|
44 |
|
-spec get_so_path() -> binary() | string(). |
45 |
|
get_so_path() -> |
46 |
4 |
case os:getenv("EJABBERD_SO_PATH") of |
47 |
|
false -> |
48 |
:-( |
case code:priv_dir(mongooseim) of |
49 |
|
{error, _} -> |
50 |
:-( |
"."; |
51 |
|
Path -> |
52 |
:-( |
filename:join([Path, "lib"]) |
53 |
|
end; |
54 |
|
Path -> |
55 |
4 |
Path |
56 |
|
end. |
57 |
|
|
58 |
|
-spec get_pid_file() -> 'false' | nonempty_string(). |
59 |
|
get_pid_file() -> |
60 |
202 |
case os:getenv("EJABBERD_PID_PATH") of |
61 |
|
false -> |
62 |
:-( |
false; |
63 |
|
"" -> |
64 |
:-( |
false; |
65 |
|
Path -> |
66 |
202 |
Path |
67 |
|
end. |
68 |
|
|
69 |
|
-spec get_status_file() -> 'false' | nonempty_string(). |
70 |
|
get_status_file() -> |
71 |
303 |
case os:getenv("EJABBERD_STATUS_PATH") of |
72 |
|
false -> |
73 |
:-( |
false; |
74 |
|
"" -> |
75 |
:-( |
false; |
76 |
|
Path -> |
77 |
303 |
Path |
78 |
|
end. |