mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix PEP issues (#1636)
This commit is contained in:
parent
e30d41e5f0
commit
5b6d042de2
@ -92,12 +92,12 @@ get_features(Host, #caps{node = Node, version = Version,
|
||||
|
||||
-spec list_features(ejabberd_c2s:state()) -> [{ljid(), caps()}].
|
||||
list_features(C2SState) ->
|
||||
Rs = maps:get(caps_features, C2SState, gb_trees:empty()),
|
||||
Rs = maps:get(caps_resources, C2SState, gb_trees:empty()),
|
||||
gb_trees:to_list(Rs).
|
||||
|
||||
-spec get_user_caps(jid(), ejabberd_c2s:state()) -> {ok, caps()} | error.
|
||||
get_user_caps(JID, C2SState) ->
|
||||
Rs = maps:get(caps_features, C2SState, gb_trees:empty()),
|
||||
Rs = maps:get(caps_resources, C2SState, gb_trees:empty()),
|
||||
LJID = jid:tolower(JID),
|
||||
case gb_trees:lookup(LJID, Rs) of
|
||||
{value, Caps} ->
|
||||
|
@ -1215,7 +1215,7 @@ iq_pubsub(Host, Access, #iq{from = From, type = IQType, lang = Lang,
|
||||
create_node(Host, ServerHost, Node, From, Type, Access, Config)
|
||||
end;
|
||||
{set, #pubsub{publish = #ps_publish{node = Node, items = Items},
|
||||
publish_options = XData, _ = undefined}} ->
|
||||
publish_options = XData, configure = _, _ = undefined}} ->
|
||||
ServerHost = serverhost(Host),
|
||||
case Items of
|
||||
[#ps_item{id = ItemId, xml_els = Payload}] ->
|
||||
@ -2215,23 +2215,12 @@ send_items(Host, Node, _Nidx, _Type, Options, LJID, _) ->
|
||||
Stanza = items_event_stanza(Node, Options, []),
|
||||
dispatch_items(Host, LJID, Node, Stanza).
|
||||
|
||||
dispatch_items({FromU, FromS, FromR} = From, {ToU, ToS, ToR} = To,
|
||||
Node, Stanza) ->
|
||||
C2SPid = case ejabberd_sm:get_session_pid(ToU, ToS, ToR) of
|
||||
ToPid when is_pid(ToPid) -> ToPid;
|
||||
_ ->
|
||||
R = user_resource(FromU, FromS, FromR),
|
||||
case ejabberd_sm:get_session_pid(FromU, FromS, R) of
|
||||
FromPid when is_pid(FromPid) -> FromPid;
|
||||
_ -> undefined
|
||||
end
|
||||
end,
|
||||
if C2SPid == undefined -> ok;
|
||||
true ->
|
||||
C2SPid ! {send_filtered, {pep_message, <<Node/binary, "+notify">>},
|
||||
service_jid(From), jid:make(To),
|
||||
Stanza}
|
||||
end;
|
||||
dispatch_items({FromU, FromS, FromR}, To, Node, Stanza) ->
|
||||
SenderResource = user_resource(FromU, FromS, FromR),
|
||||
ejabberd_sm:route(jid:make(FromU, FromS, SenderResource),
|
||||
{send_filtered, {pep_message, <<((Node))/binary, "+notify">>},
|
||||
jid:make(FromU, FromS), jid:make(To),
|
||||
Stanza});
|
||||
dispatch_items(From, To, _Node, Stanza) ->
|
||||
ejabberd_router:route(
|
||||
xmpp:set_from_to(Stanza, service_jid(From), jid:make(To))).
|
||||
|
Loading…
Reference in New Issue
Block a user