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);
_ ->
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,
{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
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