25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-06 16:42:56 +01:00

* src/mod_muc/mod_muc.erl: Added access rules for using serveice

and creating rooms (thanks to Sergei Golovan)

* src/win32/ejabberd.nsi: Updated (thanks to Sergei Golovan)
* src/win32/CheckUserH.ini: Likewise

* src/translate.erl: Search translations in priv_dir instead of
lib_dir (thanks to Sergei Golovan)

* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)

* src/ejabberd.cfg.example: Updated (thanks to Sergei Golovan)

* src/**/Makefile.in: Updated (thanks to Sergei Golovan)
* src/**/Makefile.win32: Likewise

2004-05-16  Alexey Shchepin  <alexey@sevcom.net>

* src/web/ejabberd_web_admin.erl: Updated

SVN Revision: 235
This commit is contained in:
Alexey Shchepin 2004-05-17 20:36:41 +00:00
parent d46abc7ad4
commit 78a673f526
17 changed files with 322 additions and 146 deletions

View File

@ -1,3 +1,21 @@
2004-05-17 Alexey Shchepin <alexey@sevcom.net>
* src/mod_muc/mod_muc.erl: Added access rules for using serveice
and creating rooms (thanks to Sergei Golovan)
* src/win32/ejabberd.nsi: Updated (thanks to Sergei Golovan)
* src/win32/CheckUserH.ini: Likewise
* src/translate.erl: Search translations in priv_dir instead of
lib_dir (thanks to Sergei Golovan)
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)
* src/ejabberd.cfg.example: Updated (thanks to Sergei Golovan)
* src/**/Makefile.in: Updated (thanks to Sergei Golovan)
* src/**/Makefile.win32: Likewise
2004-05-16 Alexey Shchepin <alexey@sevcom.net>
* src/web/ejabberd_web_admin.erl: Updated

View File

@ -19,12 +19,12 @@ ERLSHLIBS = expat_erl.so
DESTDIR =
EJABBERDDIR = $(DESTDIR)/var/lib/ejabberd
BEAMDIR = $(EJABBERDDIR)/beam
BEAMDIR = $(EJABBERDDIR)/ebin
PRIVDIR = $(EJABBERDDIR)/priv
SODIR = $(PRIVDIR)
SODIR = $(PRIVDIR)/lib
MSGSDIR = $(PRIVDIR)/msgs
all: all-recursive $(ERLSHLIBS) compile-beam
all: $(ERLSHLIBS) compile-beam all-recursive
compile-beam:
@erl -s make all report -noinput -s erlang halt
@ -49,16 +49,25 @@ $(ERLSHLIBS): %.so: %.c
-o $@ -fpic -shared \
install: all
mkdir -p $(BEAMDIR)
cp *.beam $(BEAMDIR)
mkdir -p $(SODIR)
cp *.so $(SODIR)
mkdir -p $(MSGSDIR)
cp msgs/*.msg $(MSGSDIR)
install -d $(BEAMDIR)
install -m 644 *.beam $(BEAMDIR)
rm -f $(BEAMDIR)/configure.beam
install -m 644 *.app $(BEAMDIR)
install -d $(SODIR)
install -m 644 *.so $(SODIR)
install -d $(MSGSDIR)
install -m 644 msgs/*.msg $(MSGSDIR)
clean: clean-recursive
clean: clean-recursive clean-local
clean-local:
rm -f *.beam $(ERLSHLIBS)
distclean: distclean-recursive clean-local
rm -f config.status
rm -f config.log
rm -f Makefile
TAGS:
etags *.erl

View File

@ -6,10 +6,10 @@ ALL : build
REL=..\release
EREL=$(REL)\ejabberd-$(EJABBERD_VERSION)
EBIN_DIR=$(EREL)\ebin
MSGS_DIR=$(EREL)\msgs
SRC_DIR=$(EREL)\src
PRIV_DIR=$(EREL)\priv
SO_DIR=$(PRIV_DIR)\lib
MSGS_DIR=$(PRIV_DIR)\msgs
WIN32_DIR=$(EREL)\win32
DOC_DIR=$(EREL)\doc
@ -41,6 +41,8 @@ release : build release_clean
copy msgs\*.msg $(MSGS_DIR)
mkdir $(WIN32_DIR)
copy win32\ejabberd.cfg $(EREL)
copy $(SYSTEMROOT)\system32\libeay32.dll $(EREL)
copy $(SYSTEMROOT)\system32\ssleay32.dll $(EREL)
copy win32\ejabberd.ico $(WIN32_DIR)
mkdir $(WIN32_DIR)\5.3
copy win32\5.3\*.beam $(WIN32_DIR)\5.3
@ -125,6 +127,7 @@ clean-recursive :
cd ..\..
distclean : release_clean clean
-@erase $(NSIS_HEADER)
-@erase Makefile.inc
CC=cl.exe

View File

@ -64,6 +64,9 @@
% Admins of this server are also admins of MUC service:
{access, muc_admin, [{allow, admin}]}.
% All users are allowed to use MUC service:
{access, muc, [{allow, all}]}.
% This rule allows access only for local users:
{access, local, [{allow, local}]}.
@ -84,41 +87,47 @@
% Listened ports:
{listen, [{5222, ejabberd_c2s, [{access, c2s},
{shaper, c2s_shaper}]},
{5223, ejabberd_c2s, [{access, c2s},
ssl, {certfile, "./ssl.pem"}]},
{5269, ejabberd_s2s_in, [{shaper, s2s_shaper}]},
{8888, ejabberd_service, [%{access, local},
{hosts,
["conference.e.localhost",
"muc.e.localhost"],
[{password, "secret"}]}]}
]}.
{listen,
[{5222, ejabberd_c2s, [{access, c2s}, {shaper, c2s_shaper}]},
{5223, ejabberd_c2s, [{access, c2s}, ssl, {certfile, "./ssl.pem"}]},
{5269, ejabberd_s2s_in, [{shaper, s2s_shaper}]},
{8888, ejabberd_service, [{access, all},
{hosts, ["conference.e.localhost", "muc.e.localhost"],
[{password, "secret"}]}]}
]}.
% If SRV lookup fails, then port 5269 is used to communicate with remote server
{outgoing_s2s_port, 5269}.
% Used modules:
{modules, [
{mod_register, []},
{mod_roster, []},
{mod_privacy, []},
{mod_configure, []},
{mod_disco, []},
{mod_stats, []},
{mod_vcard, []},
{mod_offline, []},
{mod_echo, [{host, "echo.localhost"}]},
{mod_private, []},
{mod_irc, []},
{mod_muc, []},
{mod_pubsub, []},
{mod_time, []},
{mod_last, []},
{mod_version, []}
]}.
{modules,
[
{mod_register, []},
{mod_roster, []},
{mod_privacy, []},
{mod_configure, []},
{mod_configure2, []},
{mod_disco, []},
{mod_stats, []},
{mod_vcard, []},
{mod_offline, []},
{mod_echo, [{host, "echo.localhost"}]},
{mod_private, []},
{mod_irc, []},
% Default options for mod_muc:
% host: "conference." ++ ?MYNAME
% access: all
% access_create: all
% access_admin: none (only room creator has owner privileges)
{mod_muc, [{access, muc},
{access_create, muc},
{access_admin, muc_admin}]},
{mod_pubsub, []},
{mod_time, []},
{mod_last, []},
{mod_version, []}
]}.

View File

@ -29,8 +29,15 @@ $(OUTDIR)/%.beam: %.erl ELDAPv3.erl
clean:
rm -f ELDAPv3.asn1db
rm -f ELDAPv3.erl
rm -f ELDAPv3.hrl
rm -f ELDAPv3.beam
rm -f $(OBJS)
distclean: clean
rm -f Makefile
TAGS:
etags *.erl

View File

@ -43,6 +43,9 @@ $(ERLSHLIBS): ../%.so: %.c
clean:
rm -f $(OBJS) $(ERLSHLIBS)
distclean: clean
rm -f Makefile
TAGS:
etags *.erl

View File

@ -28,6 +28,9 @@ $(OUTDIR)/%.beam: %.erl
clean:
rm -f $(OBJS)
distclean: clean
rm -f Makefile
TAGS:
etags *.erl

View File

@ -13,7 +13,7 @@
-behaviour(gen_mod).
-export([start/1,
init/1,
init/2,
stop/0,
room_destroyed/1,
store_room/2,
@ -40,43 +40,63 @@ start(Opts) ->
{attributes, record_info(fields, muc_registered)}]),
mnesia:add_table_index(muc_registered, nick),
Host = gen_mod:get_opt(host, Opts, "conference." ++ ?MYNAME),
register(ejabberd_mod_muc, spawn(?MODULE, init, [Host])).
Access = gen_mod:get_opt(access, Opts, all),
AccessCreate = gen_mod:get_opt(access_create, Opts, all),
AccessAdmin = gen_mod:get_opt(access_admin, Opts, none),
register(ejabberd_mod_muc,
spawn(?MODULE, init, [Host, {Access, AccessCreate, AccessAdmin}])).
init(Host) ->
init(Host, Access) ->
catch ets:new(muc_online_room, [named_table,
public,
{keypos, #muc_online_room.name}]),
ejabberd_router:register_route(Host),
load_permanent_rooms(Host),
loop(Host).
load_permanent_rooms(Host, Access),
loop(Host, Access).
loop(Host) ->
loop(Host, Access) ->
receive
{route, From, To, Packet} ->
case catch do_route(Host, From, To, Packet) of
case catch do_route(Host, Access, From, To, Packet) of
{'EXIT', Reason} ->
?ERROR_MSG("~p", [Reason]);
_ ->
ok
end,
loop(Host);
loop(Host, Access);
{room_destroyed, Room} ->
ets:delete(muc_online_room, Room),
loop(Host);
loop(Host, Access);
stop ->
% TODO
ejabberd_router:unregister_global_route(Host),
ok;
_ ->
loop(Host)
loop(Host, Access)
end.
do_route(Host, From, To, Packet) ->
do_route(Host, Access, From, To, Packet) ->
{AccessRoute, _AccessCreate, _AccessAdmin} = Access,
case acl:match_rule(AccessRoute, From) of
allow ->
do_route1(Host, Access, From, To, Packet);
_ ->
{xmlelement, _Name, Attrs, _Els} = Packet,
Lang = xml:get_attr_s("xml:lang", Attrs),
ErrText = "Access denied by service policy",
Err = jlib:make_error_reply(Packet,
?ERRT_FORBIDDEN(Lang, ErrText)),
ejabberd_router:route(To, From, Err)
end.
do_route1(Host, Access, From, To, Packet) ->
{_AccessRoute, AccessCreate, AccessAdmin} = Access,
{Room, _, Nick} = jlib:jid_tolower(To),
{xmlelement, Name, Attrs, Els} = Packet,
{xmlelement, Name, Attrs, _Els} = Packet,
case Room of
"" ->
case Nick of
@ -155,7 +175,7 @@ do_route(Host, From, To, Packet) ->
"error" ->
ok;
_ ->
case acl:match_rule(muc_admin, From) of
case acl:match_rule(AccessAdmin, From) of
allow ->
Msg = xml:get_path_s(
Packet,
@ -193,14 +213,23 @@ do_route(Host, From, To, Packet) ->
Type = xml:get_attr_s("type", Attrs),
case {Name, Type} of
{"presence", ""} ->
?DEBUG("MUC: open new room '~s'~n", [Room]),
{ok, Pid} = mod_muc_room:start(
Host, Room, From, Nick),
ets:insert(
muc_online_room,
#muc_online_room{name = Room, pid = Pid}),
mod_muc_room:route(Pid, From, Nick, Packet),
ok;
case acl:match_rule(AccessCreate, From) of
allow ->
?DEBUG("MUC: open new room '~s'~n", [Room]),
{ok, Pid} = mod_muc_room:start(
Host, Access, Room, From, Nick),
ets:insert(
muc_online_room,
#muc_online_room{name = Room, pid = Pid}),
mod_muc_room:route(Pid, From, Nick, Packet),
ok;
_ ->
Lang = xml:get_attr_s("xml:lang", Attrs),
ErrText = "Room creation is denied by service policy",
Err = jlib:make_error_reply(
Packet, ?ERRT_FORBIDDEN(Lang, ErrText)),
ejabberd_router:route(To, From, Err)
end;
_ ->
Lang = xml:get_attr_s("xml:lang", Attrs),
ErrText = "Conference room does not exist",
@ -251,7 +280,7 @@ forget_room(Name) ->
mnesia:transaction(F).
load_permanent_rooms(Host) ->
load_permanent_rooms(Host, Access) ->
case catch mnesia:dirty_select(muc_room, [{'_', [], ['$_']}]) of
{'EXIT', Reason} ->
?ERROR_MSG("~p", [Reason]),
@ -261,6 +290,7 @@ load_permanent_rooms(Host) ->
Room = R#muc_room.name,
{ok, Pid} = mod_muc_room:start(
Host,
Access,
Room,
R#muc_room.opts),
ets:insert(
@ -314,7 +344,7 @@ iq_get_register_info(From, Host, Lang) ->
{LUser, LServer, _} = jlib:jid_tolower(From),
LUS = {LUser, LServer},
{Nick, Registered} = case catch mnesia:dirty_read(muc_registered, LUS) of
{'EXIT', Reason} ->
{'EXIT', _Reason} ->
{"", []};
[] ->
{"", []};
@ -384,9 +414,9 @@ iq_set_register_info(From, XData, Lang) ->
end.
process_iq_register_set(From, SubEl, Lang) ->
{xmlelement, Name, Attrs, Els} = SubEl,
{xmlelement, _Name, _Attrs, Els} = SubEl,
case xml:remove_cdata(Els) of
[{xmlelement, "x", Attrs1, Els1} = XEl] ->
[{xmlelement, "x", _Attrs1, _Els1} = XEl] ->
case {xml:get_tag_attr_s("xmlns", XEl),
xml:get_tag_attr_s("type", XEl)} of
{?NS_XDATA, "cancel"} ->
@ -419,14 +449,14 @@ iq_get_vcard(Lang) ->
broadcast_service_message(Msg) ->
lists:foreach(
fun(#muc_online_room{name = Name, pid = Pid}) ->
fun(#muc_online_room{pid = Pid}) ->
gen_fsm:send_all_state_event(
Pid, {service_message, Msg})
end, ets:tab2list(muc_online_room)).
can_use_nick(JID, "") ->
can_use_nick(_JID, "") ->
false;
can_use_nick(JID, Nick) ->
{LUser, LServer, _} = jlib:jid_tolower(JID),
@ -434,7 +464,7 @@ can_use_nick(JID, Nick) ->
case catch mnesia:dirty_index_read(muc_registered,
Nick,
#muc_registered.nick) of
{'EXIT', Reason} ->
{'EXIT', _Reason} ->
true;
[] ->
true;

View File

@ -14,8 +14,8 @@
%% External exports
-export([start/4,
start/3,
-export([start/5,
start/4,
route/4]).
%% gen_fsm callbacks
@ -59,6 +59,7 @@
-record(state, {room,
host,
access,
jid,
config = #config{},
users = ?DICT:new(),
@ -81,11 +82,11 @@
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start(Host, Room, Creator, Nick) ->
gen_fsm:start(?MODULE, [Host, Room, Creator, Nick], ?FSMOPTS).
start(Host, Access, Room, Creator, Nick) ->
gen_fsm:start(?MODULE, [Host, Access, Room, Creator, Nick], ?FSMOPTS).
start(Host, Room, Opts) ->
gen_fsm:start(?MODULE, [Host, Room, Opts], ?FSMOPTS).
start(Host, Access, Room, Opts) ->
gen_fsm:start(?MODULE, [Host, Access, Room, Opts], ?FSMOPTS).
%%%----------------------------------------------------------------------
%%% Callback functions from gen_fsm
@ -98,16 +99,17 @@ start(Host, Room, Opts) ->
%% ignore |
%% {stop, StopReason}
%%----------------------------------------------------------------------
init([Host, Room, Creator, Nick]) ->
LCreator = jlib:jid_tolower(Creator),
init([Host, Access, Room, Creator, Nick]) ->
State = set_affiliation(Creator, owner,
#state{host = Host,
access = Access,
room = Room,
jid = jlib:make_jid(Room, Host, ""),
just_created = true}),
{ok, normal_state, State};
init([Host, Room, Opts]) ->
init([Host, Access, Room, Opts]) ->
State = set_opts(Opts, #state{host = Host,
access = Access,
room = Room,
jid = jlib:make_jid(Room, Host, "")}),
{ok, normal_state, State}.
@ -160,7 +162,7 @@ normal_state({route, From, "",
case IsAllowed of
true ->
lists:foreach(
fun({LJID, Info}) ->
fun({_LJID, Info}) ->
ejabberd_router:route(
jlib:jid_replace_resource(
StateData#state.jid,
@ -275,7 +277,7 @@ normal_state({route, From, "",
end;
normal_state({route, From, "",
{xmlelement, "iq", Attrs, Els} = Packet},
{xmlelement, "iq", _Attrs, _Els} = Packet},
StateData) ->
case jlib:iq_query_info(Packet) of
#iq{type = Type, xmlns = XMLNS, lang = Lang, sub_el = SubEl} = IQ when
@ -326,7 +328,7 @@ normal_state({route, From, "",
end;
normal_state({route, From, Nick,
{xmlelement, "presence", Attrs, Els} = Packet},
{xmlelement, "presence", Attrs, _Els} = Packet},
StateData) ->
Type = xml:get_attr_s("type", Attrs),
Lang = xml:get_attr_s("xml:lang", Attrs),
@ -413,7 +415,7 @@ normal_state({route, From, Nick,
end;
normal_state({route, From, ToNick,
{xmlelement, "message", Attrs, Els} = Packet},
{xmlelement, "message", Attrs, _Els} = Packet},
StateData) ->
Type = xml:get_attr_s("type", Attrs),
Lang = xml:get_attr_s("xml:lang", Attrs),
@ -484,7 +486,7 @@ normal_state({route, From, ToNick,
end;
normal_state({route, From, ToNick,
{xmlelement, "iq", Attrs, Els} = Packet},
{xmlelement, "iq", Attrs, _Els} = Packet},
StateData) ->
Lang = xml:get_attr_s("xml:lang", Attrs),
case {(StateData#state.config)#config.allow_query_users,
@ -556,12 +558,12 @@ normal_state(Event, StateData) ->
%% {next_state, NextStateName, NextStateData, Timeout} |
%% {stop, Reason, NewStateData}
%%----------------------------------------------------------------------
handle_event({service_message, Msg}, StateName, StateData) ->
handle_event({service_message, Msg}, _StateName, StateData) ->
MessagePkt = {xmlelement, "message",
[{"type", "groupchat"}],
[{xmlelement, "body", [], [{xmlcdata, Msg}]}]},
lists:foreach(
fun({LJID, Info}) ->
fun({_LJID, Info}) ->
ejabberd_router:route(
StateData#state.jid,
Info#user.jid,
@ -573,7 +575,7 @@ handle_event({service_message, Msg}, StateName, StateData) ->
StateData),
{next_state, normal_state, NSD};
handle_event(Event, StateName, StateData) ->
handle_event(_Event, StateName, StateData) ->
{next_state, StateName, StateData}.
%%----------------------------------------------------------------------
@ -585,7 +587,7 @@ handle_event(Event, StateName, StateData) ->
%% {stop, Reason, NewStateData} |
%% {stop, Reason, Reply, NewStateData}
%%----------------------------------------------------------------------
handle_sync_event({get_disco_item, JID, Lang}, From, StateName, StateData) ->
handle_sync_event({get_disco_item, JID, Lang}, _From, StateName, StateData) ->
FAffiliation = get_affiliation(JID, StateData),
FRole = get_role(JID, StateData),
Tail =
@ -615,11 +617,11 @@ handle_sync_event({get_disco_item, JID, Lang}, From, StateName, StateData) ->
false
end,
{reply, Reply, StateName, StateData};
handle_sync_event(Event, From, StateName, StateData) ->
handle_sync_event(_Event, _From, StateName, StateData) ->
Reply = ok,
{reply, Reply, StateName, StateData}.
code_change(OldVsn, StateName, StateData, Extra) ->
code_change(_OldVsn, StateName, StateData, _Extra) ->
{ok, StateName, StateData}.
%%----------------------------------------------------------------------
@ -628,7 +630,7 @@ code_change(OldVsn, StateName, StateData, Extra) ->
%% {next_state, NextStateName, NextStateData, Timeout} |
%% {stop, Reason, NewStateData}
%%----------------------------------------------------------------------
handle_info(Info, StateName, StateData) ->
handle_info(_Info, StateName, StateData) ->
{next_state, StateName, StateData}.
%%----------------------------------------------------------------------
@ -636,7 +638,7 @@ handle_info(Info, StateName, StateData) ->
%% Purpose: Shutdown the fsm
%% Returns: any
%%----------------------------------------------------------------------
terminate(Reason, StateName, StateData) ->
terminate(_Reason, _StateName, StateData) ->
mod_muc:room_destroyed(StateData#state.room),
ok.
@ -702,7 +704,8 @@ set_affiliation(JID, Affiliation, StateData) ->
StateData#state{affiliations = Affiliations}.
get_affiliation(JID, StateData) ->
case acl:match_rule(muc_admin, JID) of
{_AccessRoute, _AccessCreate, AccessAdmin} = StateData#state.access,
case acl:match_rule(AccessAdmin, JID) of
allow ->
owner;
_ ->
@ -803,7 +806,7 @@ filter_presence({xmlelement, "presence", Attrs, Els}) ->
case El of
{xmlcdata, _} ->
false;
{xmlelement, Name1, Attrs1, Els1} ->
{xmlelement, Name1, _Attrs1, _Els1} ->
XMLNS = xml:get_attr_s("xmlns", Attrs),
case {Name1, XMLNS} of
{"show", ""} ->
@ -1067,9 +1070,9 @@ calc_shift(MaxSize, Size, Shift, [S | TSizes]) ->
calc_shift(MaxSize, Size - S, Shift + 1, TSizes)
end.
extract_history([], Type) ->
extract_history([], _Type) ->
false;
extract_history([{xmlelement, Name, Attrs, SubEls} = El | Els], Type) ->
extract_history([{xmlelement, _Name, Attrs, _SubEls} = El | Els], Type) ->
case xml:get_attr_s("xmlns", Attrs) of
?NS_MUC ->
AttrVal = xml:get_path_s(El,
@ -1077,7 +1080,7 @@ extract_history([{xmlelement, Name, Attrs, SubEls} = El | Els], Type) ->
case Type of
"since" ->
case catch parse_datetime(AttrVal) of
{'EXIT', Err} ->
{'EXIT', _Err} ->
false;
Res ->
Res
@ -1211,7 +1214,7 @@ send_new_presence(NJID, StateData) ->
SAffiliation = affiliation_to_list(Affiliation),
SRole = role_to_list(Role),
lists:foreach(
fun({LJID, Info}) ->
fun({_LJID, Info}) ->
ItemAttrs =
case (Info#user.role == moderator) orelse
((StateData#state.config)#config.anonymous == false) of
@ -1311,7 +1314,7 @@ send_nick_changing(JID, OldNick, StateData) ->
SAffiliation = affiliation_to_list(Affiliation),
SRole = role_to_list(Role),
lists:foreach(
fun({LJID, Info}) ->
fun({_LJID, Info}) ->
ItemAttrs1 =
case (Info#user.role == moderator) orelse
((StateData#state.config)#config.anonymous == false) of
@ -1391,7 +1394,6 @@ add_message_to_history(FromNick, Packet, StateData) ->
TimeStamp = calendar:now_to_universal_time(now()),
TSPacket = append_subtags(Packet,
[jlib:timestamp_to_xml(TimeStamp)]),
{xmlelement, Name, Attrs, Els} = TSPacket,
SPacket = jlib:replace_from_to(
jlib:jid_replace_resource(StateData#state.jid, FromNick),
StateData#state.jid,
@ -1605,13 +1607,13 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
end.
find_changed_items(UJID, UAffiliation, URole, [], Lang, StateData, Res) ->
find_changed_items(UJID, UAffiliation, URole, [], _Lang, StateData, Res) ->
{result, Res};
find_changed_items(UJID, UAffiliation, URole, [{xmlcdata, _} | Items],
Lang, StateData, Res) ->
find_changed_items(UJID, UAffiliation, URole, Items, Lang, StateData, Res);
find_changed_items(UJID, UAffiliation, URole,
[{xmlelement, "item", Attrs, Els} = Item | Items],
[{xmlelement, "item", Attrs, _Els} = Item | Items],
Lang, StateData, Res) ->
TJID = case xml:get_attr("jid", Attrs) of
{value, S} ->
@ -1728,7 +1730,8 @@ find_changed_items(UJID, UAffiliation, URole,
Err ->
Err
end;
find_changed_items(UJID, UAffiliation, URole, Items, Lang, StateData, Res) ->
find_changed_items(_UJID, _UAffiliation, _URole, _Items,
_Lang, _StateData, _Res) ->
{error, ?ERR_BAD_REQUEST}.

View File

@ -27,6 +27,9 @@ $(OUTDIR)/%.beam: %.erl
clean:
rm -f $(OBJS)
distclean: clean
rm -f Makefile
TAGS:
etags *.erl

View File

@ -104,7 +104,10 @@
"ejabberd MUC модуль\nCopyright (c) 2003-2004 Алексей Щепин"}.
{"Only service administrators are allowed to send service messages",
"Только администратор службы может посылать служебные сообщения"}.
{"Room creation is not allowed by service policy",
"Cоздавать конференцию не разрешено политикой службы"}.
{"Conference room does not exist", "Конференция не существует"}.
{"Access denied by service policy", "Доступ запрещён политикой службы"}.
{"You must fill in field \"nick\" in the form",
"Вы должны заполнить поле \"nick\" в форме"}.
{"Specified nickname is already registered", "Указанный псевдоним уже зарегистрирован"}.

View File

@ -43,6 +43,9 @@ $(ERLSHLIBS): ../%.so: %.c uni_data.c uni_norm.c
clean:
rm -f $(OBJS) $(ERLSHLIBS)
distclean: clean
rm -f Makefile
TAGS:
etags *.erl

View File

@ -21,7 +21,7 @@ start() ->
Dir =
case os:getenv("EJABBERD_MSGS_PATH") of
false ->
case code:lib_dir(ejabberd) of
case code:priv_dir(ejabberd) of
{error, _} ->
?MSGS_DIR;
Path ->

View File

@ -30,6 +30,9 @@ $(OUTDIR)/%.beam: %.erl
clean:
rm -f $(OBJS)
distclean: clean
rm -f Makefile
TAGS:
etags *.erl

View File

@ -7,6 +7,7 @@ EFLAGS = -I .. -pz ..
OBJS = \
$(OUTDIR)\ejabberd_http.beam \
$(OUTDIR)\ejabberd_web.beam \
$(OUTDIR)\ejabberd_web_admin.beam \
$(OUTDIR)\ejabberd_http_poll.beam
ALL : $(OBJS)
@ -20,5 +21,8 @@ $(OUTDIR)\ejabberd_http.beam : ejabberd_http.erl
$(OUTDIR)\ejabberd_web.beam : ejabberd_web.erl
erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_web.erl
$(OUTDIR)\ejabberd_web_admin.beam : ejabberd_web_admin.erl
erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_web_admin.erl
$(OUTDIR)\ejabberd_http_poll.beam : ejabberd_http_poll.erl
erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_http_poll.erl

20
src/win32/CheckUserH.ini Normal file
View File

@ -0,0 +1,20 @@
[Settings]
NumFields=2
[Field 1]
Type=label
Left=0
Right=-1
Top=10
Bottom=50
Text="Administrator privileges are recommended for Ejabberd install.\r\n\r\nOtherwise installing Ejabberd as a service will be impossible."
[Field 2]
Type=checkbox
Left=0
Right=-1
Top=50
Bottom=-10
Text="Proceed with install"
State=0
Flags=NOTIFY

View File

@ -14,6 +14,8 @@
!define PRODUCT "Ejabberd"
Name ${PRODUCT}
OutFile "${OUTFILEDIR}\${PRODUCT}-${VERSION}.exe"
ShowInstDetails show
ShowUninstDetails show
!define MUI_ICON "ejabberd.ico"
!define MUI_UNICON "ejabberd.ico"
@ -26,7 +28,11 @@
;--------------------------------
;Reserve Files
ReserveFile "CheckUser.ini"
!ifdef HACKED_INSTALLOPTIONS
ReserveFile "CheckUserH.ini"
!else
ReserveFile "CheckUser.ini"
!endif
ReserveFile "CheckReqs.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
@ -41,6 +47,53 @@
Var REQUIRED_ERLANG_VERSION
Var ERLSRV
;----------------------------------------------------------
;.onInit uses UserInfo plugin, so it's as high as possible
Function .onInit
StrCpy $REQUIRED_ERLANG_VERSION "5.3"
;Default installation folder
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT}"
;Get installation folder from registry if available
ClearErrors
ReadRegStr $0 HKLM "SOFTWARE\${PRODUCT}" ""
IfErrors 0 copydir
ReadRegStr $0 HKCU "SOFTWARE\${PRODUCT}" ""
IfErrors skipdir
copydir:
StrCpy $INSTDIR "$0"
skipdir:
;Extract InstallOptions INI files
!ifdef HACKED_INSTALLOPTIONS
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckUserH.ini"
!else
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckUser.ini"
!endif
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckReqs.ini"
ClearErrors
UserInfo::GetName
IfErrors admin
Pop $0
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" admin user
admin:
StrCpy $ADMIN 1
Goto skip
user:
StrCpy $ADMIN 0
skip:
FunctionEnd
;--------------------------------
;Interface Settings
@ -85,9 +138,10 @@ SectionIn 1 RO
SetOutPath "$INSTDIR"
File /r "${TESTDIR}\doc"
File /r "${TESTDIR}\ebin"
File /r "${TESTDIR}\msgs"
File /r "${TESTDIR}\priv"
File /r "${TESTDIR}\win32"
File "${TESTDIR}\libeay32.dll"
File "${TESTDIR}\ssleay32.dll"
SetOverwrite off
File "${TESTDIR}\ejabberd.cfg"
SetOverwrite on
@ -125,8 +179,15 @@ SectionIn 1 RO
StrCmp $ERLSRV "" skipservice
nsExec::Exec '"$ERLSRV" list ejabberd'
Pop $0
StrCmp $0 "error" skipservice
StrCmp $0 "0" 0 installsrv
nsExec::ExecToLog '"$ERLSRV" remove ejabberd'
Pop $0
installsrv:
nsExec::ExecToLog '"$ERLSRV" add ejabberd -stopaction "init:stop()." \
-onfail reboot -workdir "$INSTDIR" \
-args "-s ejabberd -pa ebin -pa win32/$ERLANG_VERSION \
@ -136,11 +197,12 @@ SectionIn 1 RO
-sasl sasl_error_logger {file,\\\"log/sasl.log\\\"} \
-mnesia dir \\\"spool\\\"" -d'
Pop $0
nsExec::ExecToLog '"$ERLSRV" disable ejabberd'
;nsExec::ExecToLog '"$ERLSRV" disable ejabberd'
;Pop $0
skipservice:
;Create uninstaller
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
StrCpy $1 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
@ -201,17 +263,23 @@ Section "Uninstall"
StrCpy $ADMIN 1
ReadRegStr $ERLSRV HKLM "Software\${PRODUCT}" "Erlsrv"
nsExec::Exec '"$ERLSRV" list ejabberd'
Pop $0
StrCmp $0 "error" skipservice
StrCmp $0 "0" 0 skipservice
nsExec::ExecToLog '"$ERLSRV" remove ejabberd'
Pop $0
skipservice:
RMDir /r "$INSTDIR\doc"
RMDir /r "$INSTDIR\ebin"
RMDir /r "$INSTDIR\msgs"
RMDir /r "$INSTDIR\priv"
RMDir /r "$INSTDIR\win32"
;RMDir /r "$INSTDIR\src"
RMDir /r "$INSTDIR\log"
Delete "$INSTDIR\libeay32.dll"
Delete "$INSTDIR\ssleay32.dll"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
@ -247,53 +315,25 @@ Section "Uninstall"
SectionEnd
Function .onInit
StrCpy $REQUIRED_ERLANG_VERSION "5.3"
;Default installation folder
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT}"
;Get installation folder from registry if available
ClearErrors
ReadRegStr $0 HKLM "SOFTWARE\${PRODUCT}" ""
IfErrors 0 copydir
ReadRegStr $0 HKCU "SOFTWARE\${PRODUCT}" ""
IfErrors skipdir
copydir:
StrCpy $INSTDIR "$0"
skipdir:
;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckUser.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckReqs.ini"
FunctionEnd
LangString TEXT_CU_TITLE ${LANG_ENGLISH} "Checking User Privileges"
LangString TEXT_CU_SUBTITLE ${LANG_ENGLISH} "Checking user privileged required to install Ejabberd."
Function CheckUser
ClearErrors
UserInfo::GetName
IfErrors Abort
Pop $0
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" Abort User
Abort:
StrCpy $ADMIN 1
Abort
User:
StrCpy $ADMIN 0
StrCmp $ADMIN 1 0 showpage
Abort
showpage:
!insertmacro MUI_HEADER_TEXT $(TEXT_CU_TITLE) $(TEXT_CU_SUBTITLE)
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CheckUser.ini"
!ifdef HACKED_INSTALLOPTIONS
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CheckUserH.ini"
!insertmacro MUI_INSTALLOPTIONS_READ $0 "CheckUserH.ini" "Field 2" "State"
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 $0
!else
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CheckUser.ini"
!endif
!insertmacro MUI_INSTALLOPTIONS_SHOW
@ -301,6 +341,21 @@ FunctionEnd
Function LeaveCheckUser
!ifdef HACKED_INSTALLOPTIONS
!insertmacro MUI_INSTALLOPTIONS_READ $0 "CheckUserH.ini" "Settings" "State"
StrCmp $0 0 validate ;Next button?
StrCmp $0 2 checkbox ;checkbox?
Abort ;Return to the page
checkbox:
!insertmacro MUI_INSTALLOPTIONS_READ $0 "CheckUserH.ini" "Field 2" "State"
GetDlgItem $1 $HWNDPARENT 1
EnableWindow $1 $0
Abort
validate:
!endif
FunctionEnd
LangString TEXT_CR_TITLE ${LANG_ENGLISH} "Unsatisfied Requirements"