diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index cbc967da4..4b02e0939 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -1688,7 +1688,8 @@ update_online_user(JID, #user{nick = Nick} = User, StateData) -> end, NewStateData. -set_subscriber(JID, Nick, Nodes, StateData) -> +set_subscriber(JID, Nick, Nodes, + #state{room = Room, host = Host, server_host = ServerHost} = StateData) -> BareJID = case JID of #jid{} -> jid:remove_resource(JID); _ -> @@ -1707,7 +1708,8 @@ set_subscriber(JID, Nick, Nodes, StateData) -> store_room(NewStateData, [{add_subscription, BareJID, Nick, Nodes}]), case not maps:is_key(LBareJID, StateData#state.subscribers) of true -> - send_subscriptions_change_notifications(BareJID, Nick, subscribe, NewStateData); + send_subscriptions_change_notifications(BareJID, Nick, subscribe, NewStateData), + ejabberd_hooks:run(muc_subscribed, ServerHost, [ServerHost, Room, Host, BareJID]); _ -> ok end, @@ -4056,7 +4058,7 @@ process_iq_mucsub(From, #iq{type = set, lang = Lang, {error, xmpp:err_forbidden(Txt, Lang)} end; process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]}, - StateData) -> + #state{room = Room, host = Host, server_host = ServerHost} = StateData) -> BareJID = jid:remove_resource(From), LBareJID = jid:tolower(BareJID), try maps:get(LBareJID, StateData#state.subscribers) of @@ -4067,6 +4069,7 @@ process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]}, subscriber_nicks = Nicks}, store_room(NewStateData, [{del_subscription, LBareJID}]), send_subscriptions_change_notifications(BareJID, Nick, unsubscribe, StateData), + ejabberd_hooks:run(muc_unsubscribed, ServerHost, [ServerHost, Room, Host, BareJID]), NewStateData2 = case close_room_if_temporary_and_empty(NewStateData) of {stop, normal, _} -> stop; {next_state, normal_state, SD} -> SD