diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2018-05-02 22:17:32 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2018-05-02 22:17:32 +0200 |
commit | 638f2d2e6753a8e1689c734403f0c1227895d5a0 (patch) | |
tree | 017a438bb3d20c4b4060a4621f81bdb14fca0cbe /src/mod_blocking.erl | |
parent | Ignore any policy when signing a certificate for the test suite (diff) |
mod_blocking: Use #block_item{} record
Diffstat (limited to 'src/mod_blocking.erl')
-rw-r--r-- | src/mod_blocking.erl | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mod_blocking.erl b/src/mod_blocking.erl index e3ac1e3e..c1646b9e 100644 --- a/src/mod_blocking.erl +++ b/src/mod_blocking.erl @@ -92,12 +92,12 @@ process_iq_set(#iq{lang = Lang, sub_els = [SubEl]} = IQ) -> Txt = <<"No items found in this query">>, xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang)); #block{items = Items} -> - JIDs = [jid:tolower(Item) || Item <- Items], + JIDs = [jid:tolower(JID) || #block_item{jid = JID} <- Items], process_block(IQ, JIDs); #unblock{items = []} -> process_unblock_all(IQ); #unblock{items = Items} -> - JIDs = [jid:tolower(Item) || Item <- Items], + JIDs = [jid:tolower(JID) || #block_item{jid = JID} <- Items], process_unblock(IQ, JIDs); _ -> Txt = <<"No module is handling this query">>, @@ -163,7 +163,8 @@ process_block(#iq{from = From} = IQ, LJIDs) -> end) of ok -> mod_privacy:push_list_update(From, Name), - Items = [jid:make(LJID) || LJID <- LJIDs], + Items = [#block_item{jid = jid:make(LJID)} + || LJID <- LJIDs], broadcast_event(From, #block{items = Items}), xmpp:make_iq_result(IQ); {error, notfound} -> @@ -218,14 +219,16 @@ process_unblock(#iq{from = From} = IQ, LJIDs) -> case mod_privacy:set_list(LUser, LServer, Name, NewList) of ok -> mod_privacy:push_list_update(From, Name), - Items = [jid:make(LJID) || LJID <- LJIDs], + Items = [#block_item{jid = jid:make(LJID)} + || LJID <- LJIDs], broadcast_event(From, #unblock{items = Items}), xmpp:make_iq_result(IQ); {error, _} -> err_db_failure(IQ) end; error -> - Items = [jid:make(LJID) || LJID <- LJIDs], + Items = [#block_item{jid = jid:make(LJID)} + || LJID <- LJIDs], broadcast_event(From, #unblock{items = Items}), xmpp:make_iq_result(IQ); {error, _} -> @@ -249,7 +252,7 @@ process_get(#iq{from = #jid{luser = LUser, lserver = LServer}} = IQ) -> case mod_privacy:get_user_list(LUser, LServer, default) of {ok, {_, List}} -> LJIDs = listitems_to_jids(List, []), - Items = [jid:make(J) || J <- LJIDs], + Items = [#block_item{jid = jid:make(J)} || J <- LJIDs], xmpp:make_iq_result(IQ, #block_list{items = Items}); error -> xmpp:make_iq_result(IQ, #block_list{}); |