mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
* src/mod_muc/: Small fixes in discovering
SVN Revision: 93
This commit is contained in:
parent
8efae60c04
commit
0b865c3dc4
@ -1,3 +1,7 @@
|
||||
2003-03-27 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_muc/: Small fixes in discovering
|
||||
|
||||
2003-03-26 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_muc/: Support for discovering service and more
|
||||
|
@ -200,13 +200,13 @@ iq_disco_items(Host, From) ->
|
||||
lists:zf(fun(#muc_online_room{name = Name, pid = Pid}) ->
|
||||
case catch gen_fsm:sync_send_all_state_event(
|
||||
Pid, get_disco_item, 100) of
|
||||
{'EXIT', _} ->
|
||||
false;
|
||||
{item, Desc} ->
|
||||
{true,
|
||||
{xmlelement, "item",
|
||||
[{"jid", jlib:jid_to_string({Name, Host, ""})},
|
||||
{"name", Desc}], []}}
|
||||
{"name", Desc}], []}};
|
||||
_ ->
|
||||
false
|
||||
end
|
||||
end, ets:tab2list(muc_online_room)).
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
-record(config, {allow_change_subj = true,
|
||||
allow_query_users = true,
|
||||
allow_private_messages = true,
|
||||
public = true, % TODO
|
||||
public = true,
|
||||
persistent = false,
|
||||
moderated = false, % TODO
|
||||
members_by_default = true,
|
||||
@ -208,12 +208,19 @@ normal_state({route, From, "",
|
||||
StateData) ->
|
||||
case jlib:iq_query_info(Packet) of
|
||||
{iq, ID, Type, XMLNS, SubEl} when
|
||||
(XMLNS == ?NS_MUC_ADMIN) or (XMLNS == ?NS_MUC_OWNER) ->
|
||||
(XMLNS == ?NS_MUC_ADMIN) or
|
||||
(XMLNS == ?NS_MUC_OWNER) or
|
||||
(XMLNS == ?NS_DISCO_INFO) or
|
||||
(XMLNS == ?NS_DISCO_ITEMS) ->
|
||||
Res1 = case XMLNS of
|
||||
?NS_MUC_ADMIN ->
|
||||
process_iq_admin(From, Type, SubEl, StateData);
|
||||
?NS_MUC_OWNER ->
|
||||
process_iq_owner(From, Type, SubEl, StateData)
|
||||
process_iq_owner(From, Type, SubEl, StateData);
|
||||
?NS_DISCO_INFO ->
|
||||
process_iq_disco_info(From, Type, StateData);
|
||||
?NS_DISCO_ITEMS ->
|
||||
process_iq_disco_items(From, Type, StateData)
|
||||
end,
|
||||
{IQRes, NewStateData} =
|
||||
case Res1 of
|
||||
@ -1521,3 +1528,55 @@ make_opts(StateData) ->
|
||||
].
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Disco
|
||||
|
||||
process_iq_disco_info(From, set, StateData) ->
|
||||
{error, ?ERR_NOT_ALLOWED};
|
||||
|
||||
process_iq_disco_info(From, get, StateData) ->
|
||||
FAffiliation = get_affiliation(From, StateData),
|
||||
FRole = get_role(From, StateData),
|
||||
case (FRole /= none) or
|
||||
(FAffiliation == admin) or
|
||||
(FAffiliation == owner) of
|
||||
true ->
|
||||
{result, [{xmlelement, "identity",
|
||||
[{"category", "conference"},
|
||||
{"type", "text"},
|
||||
{"name", StateData#state.room}], []},
|
||||
{xmlelement, "feature",
|
||||
[{"var", ?NS_MUC}], []}], StateData};
|
||||
_ ->
|
||||
{error, ?ERR_NOT_ALLOWED}
|
||||
end.
|
||||
|
||||
|
||||
process_iq_disco_items(From, set, StateData) ->
|
||||
{error, ?ERR_NOT_ALLOWED};
|
||||
|
||||
process_iq_disco_items(From, get, StateData) ->
|
||||
FAffiliation = get_affiliation(From, StateData),
|
||||
FRole = get_role(From, StateData),
|
||||
case (FRole /= none) or
|
||||
(FAffiliation == admin) or
|
||||
(FAffiliation == owner) of
|
||||
true ->
|
||||
UList =
|
||||
lists:map(
|
||||
fun({LJID, Info}) ->
|
||||
Nick = Info#user.nick,
|
||||
{xmlelement, "item",
|
||||
[{"jid", jlib:jid_to_string(
|
||||
{StateData#state.room,
|
||||
StateData#state.host,
|
||||
Nick})},
|
||||
{"name", Nick}], []}
|
||||
end,
|
||||
?DICT:to_list(StateData#state.users)),
|
||||
{result, UList, StateData};
|
||||
_ ->
|
||||
{error, ?ERR_NOT_ALLOWED}
|
||||
end.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user