aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Khramtsov <xramtsov@gmail.com>2017-06-22 18:28:12 +0400
committerGitHub <noreply@github.com>2017-06-22 18:28:12 +0400
commit54e6e1a5fbdb2acb21c37bb17d805e450f8d9983 (patch)
treeeecb091c9378425e6ed398b24437254054b1c743 /src
parentDon't let a receiver to crash if a controller is unavailable (diff)
parentFix mod_muc_admin:set_room_affiliation (diff)
Merge pull request #1793 from marcphilipp/bugfix/set_room_affiliation_master
Fix mod_muc_admin:set_room_affiliation
Diffstat (limited to 'src')
-rw-r--r--src/mod_muc_admin.erl2
-rw-r--r--src/mod_muc_room.erl13
2 files changed, 11 insertions, 4 deletions
diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl
index 6966d4180..2d1e66ba5 100644
--- a/src/mod_muc_admin.erl
+++ b/src/mod_muc_admin.erl
@@ -1012,7 +1012,7 @@ set_room_affiliation(Name, Service, JID, AffiliationString) ->
case mod_muc:find_online_room(Name, Service) of
{ok, Pid} ->
%% Get the PID for the online room so we can get the state of the room
- {ok, StateData} = gen_fsm:sync_send_all_state_event(Pid, {process_item_change, {jid:decode(JID), affiliation, Affiliation, <<"">>}, <<"">>}),
+ {ok, StateData} = gen_fsm:sync_send_all_state_event(Pid, {process_item_change, {jid:decode(JID), affiliation, Affiliation, <<"">>}, undefined}),
mod_muc:store_room(StateData#state.server_host, StateData#state.host, StateData#state.room, make_opts(StateData)),
ok;
error ->
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index 149e6c221..ec1cffd6a 100644
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -2608,7 +2608,7 @@ process_item_change(UJID) ->
-type admin_action() :: {jid(), affiliation | role,
affiliation() | role(), binary()}.
--spec process_item_change(admin_action(), state(), jid()) -> state() | {error, stanza_error()}.
+-spec process_item_change(admin_action(), state(), undefined | jid()) -> state() | {error, stanza_error()}.
process_item_change(Item, SD, UJID) ->
try case Item of
{JID, affiliation, owner, _} when JID#jid.luser == <<"">> ->
@@ -2658,8 +2658,15 @@ process_item_change(Item, SD, UJID) ->
SD1
end
catch E:R ->
- ?ERROR_MSG("failed to set item ~p from ~s: ~p",
- [Item, jid:encode(UJID),
+ FromSuffix = case UJID of
+ #jid{} ->
+ JidString = jid:encode(UJID),
+ <<" from ", JidString/binary>>;
+ undefined ->
+ <<"">>
+ end,
+ ?ERROR_MSG("failed to set item ~p~s: ~p",
+ [Item, FromSuffix,
{E, {R, erlang:get_stacktrace()}}]),
{error, xmpp:err_internal_server_error()}
end.