* src/mod_muc/mod_muc_room.erl: Allow admins to send messages to
rooms even if not joined (EJAB-645) * doc/guide.tex: Likewise * doc/guide.html: Likewise SVN Revision: 1356
This commit is contained in:
parent
e22913d46f
commit
cbf63d06a8
|
@ -1,5 +1,10 @@
|
||||||
2008-06-13 Badlop <badlop@process-one.net>
|
2008-06-13 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/mod_muc/mod_muc_room.erl: Allow admins to send messages to
|
||||||
|
rooms even if not joined (EJAB-645)
|
||||||
|
* doc/guide.tex: Likewise
|
||||||
|
* doc/guide.html: Likewise
|
||||||
|
|
||||||
* src/ejabberd.cfg.example: Add registration_timeout (EJAB-653)
|
* src/ejabberd.cfg.example: Add registration_timeout (EJAB-653)
|
||||||
|
|
||||||
* doc/guide.tex: Table of listener modules converted to
|
* doc/guide.tex: Table of listener modules converted to
|
||||||
|
|
|
@ -1922,9 +1922,11 @@ allowed to modify the ’persistent’ chatroom option
|
||||||
</DD><DT CLASS="dt-description"><B><TT>access_admin</TT></B></DT><DD CLASS="dd-description"> This option specifies
|
</DD><DT CLASS="dt-description"><B><TT>access_admin</TT></B></DT><DD CLASS="dd-description"> This option specifies
|
||||||
who is allowed to administrate the Multi-User Chat service (the default
|
who is allowed to administrate the Multi-User Chat service (the default
|
||||||
value is <TT>none</TT>, which means that only the room creator can
|
value is <TT>none</TT>, which means that only the room creator can
|
||||||
administer his room). By sending a message to the service JID,
|
administer his room).
|
||||||
administrators can send service messages that will be displayed in every
|
The administrators can send a normal message to the service JID,
|
||||||
active room.
|
and it will be shown in every active room as a service message.
|
||||||
|
The administrators can send a groupchat message to the JID of an active room,
|
||||||
|
and the message will be shown in the room as a service message.
|
||||||
</DD><DT CLASS="dt-description"><B><TT>history_size</TT></B></DT><DD CLASS="dd-description"> A small history of
|
</DD><DT CLASS="dt-description"><B><TT>history_size</TT></B></DT><DD CLASS="dd-description"> A small history of
|
||||||
the current discussion is sent to users when they enter the
|
the current discussion is sent to users when they enter the
|
||||||
room. With this option you can define the number of history messages
|
room. With this option you can define the number of history messages
|
||||||
|
|
|
@ -2522,9 +2522,11 @@ Module options:
|
||||||
\titem{access\_admin} \ind{options!access\_admin}This option specifies
|
\titem{access\_admin} \ind{options!access\_admin}This option specifies
|
||||||
who is allowed to administrate the Multi-User Chat service (the default
|
who is allowed to administrate the Multi-User Chat service (the default
|
||||||
value is \term{none}, which means that only the room creator can
|
value is \term{none}, which means that only the room creator can
|
||||||
administer his room). By sending a message to the service JID,
|
administer his room).
|
||||||
administrators can send service messages that will be displayed in every
|
The administrators can send a normal message to the service JID,
|
||||||
active room.
|
and it will be shown in every active room as a service message.
|
||||||
|
The administrators can send a groupchat message to the JID of an active room,
|
||||||
|
and the message will be shown in the room as a service message.
|
||||||
\titem{history\_size} \ind{options!history\_size}A small history of
|
\titem{history\_size} \ind{options!history\_size}A small history of
|
||||||
the current discussion is sent to users when they enter the
|
the current discussion is sent to users when they enter the
|
||||||
room. With this option you can define the number of history messages
|
room. With this option you can define the number of history messages
|
||||||
|
|
|
@ -204,7 +204,8 @@ normal_state({route, From, "",
|
||||||
{xmlelement, "message", Attrs, Els} = Packet},
|
{xmlelement, "message", Attrs, Els} = Packet},
|
||||||
StateData) ->
|
StateData) ->
|
||||||
Lang = xml:get_attr_s("xml:lang", Attrs),
|
Lang = xml:get_attr_s("xml:lang", Attrs),
|
||||||
case is_user_online(From, StateData) of
|
case is_user_online(From, StateData) orelse
|
||||||
|
is_user_allowed_message_nonparticipant(From, StateData) of
|
||||||
true ->
|
true ->
|
||||||
case xml:get_attr_s("type", Attrs) of
|
case xml:get_attr_s("type", Attrs) of
|
||||||
"groupchat" ->
|
"groupchat" ->
|
||||||
|
@ -784,11 +785,10 @@ route(Pid, From, ToNick, Packet) ->
|
||||||
process_groupchat_message(From, {xmlelement, "message", Attrs, _Els} = Packet,
|
process_groupchat_message(From, {xmlelement, "message", Attrs, _Els} = Packet,
|
||||||
StateData) ->
|
StateData) ->
|
||||||
Lang = xml:get_attr_s("xml:lang", Attrs),
|
Lang = xml:get_attr_s("xml:lang", Attrs),
|
||||||
case is_user_online(From, StateData) of
|
case is_user_online(From, StateData) orelse
|
||||||
|
is_user_allowed_message_nonparticipant(From, StateData) of
|
||||||
true ->
|
true ->
|
||||||
{ok, #user{nick = FromNick, role = Role}} =
|
{FromNick, Role} = get_participant_data(From, StateData),
|
||||||
?DICT:find(jlib:jid_tolower(From),
|
|
||||||
StateData#state.users),
|
|
||||||
if
|
if
|
||||||
(Role == moderator) or (Role == participant)
|
(Role == moderator) or (Role == participant)
|
||||||
or ((StateData#state.config)#config.moderated == false) ->
|
or ((StateData#state.config)#config.moderated == false) ->
|
||||||
|
@ -873,6 +873,36 @@ process_groupchat_message(From, {xmlelement, "message", Attrs, _Els} = Packet,
|
||||||
{next_state, normal_state, StateData}
|
{next_state, normal_state, StateData}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
%% @doc Check if this non participant can send message to room.
|
||||||
|
%%
|
||||||
|
%% XEP-0045 v1.23:
|
||||||
|
%% 7.9 Sending a Message to All Occupants
|
||||||
|
%% an implementation MAY allow users with certain privileges
|
||||||
|
%% (e.g., a room owner, room admin, or service-level admin)
|
||||||
|
%% to send messages to the room even if those users are not occupants.
|
||||||
|
%%
|
||||||
|
%% Check the mod_muc option access_message_nonparticipant and wether this JID
|
||||||
|
%% is allowed or denied
|
||||||
|
is_user_allowed_message_nonparticipant(JID, StateData) ->
|
||||||
|
{_AccessRoute, _AccessCreate, AccessAdmin, _AccessPersistent} = StateData#state.access,
|
||||||
|
case acl:match_rule(StateData#state.server_host, AccessAdmin, JID) of
|
||||||
|
allow ->
|
||||||
|
true;
|
||||||
|
_ -> false
|
||||||
|
end.
|
||||||
|
|
||||||
|
%% @doc Get information of this participant, or default values.
|
||||||
|
%% If the JID is not a participant, return values for a service message.
|
||||||
|
get_participant_data(From, StateData) ->
|
||||||
|
case ?DICT:find(jlib:jid_tolower(From), StateData#state.users) of
|
||||||
|
{ok, #user{nick = FromNick, role = Role}} ->
|
||||||
|
{FromNick, Role};
|
||||||
|
error ->
|
||||||
|
{"", moderator}
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
process_presence(From, Nick, {xmlelement, "presence", Attrs, _Els} = Packet,
|
process_presence(From, Nick, {xmlelement, "presence", Attrs, _Els} = Packet,
|
||||||
StateData) ->
|
StateData) ->
|
||||||
Type = xml:get_attr_s("type", Attrs),
|
Type = xml:get_attr_s("type", Attrs),
|
||||||
|
|
Loading…
Reference in New Issue