25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

decode_jid always gets binary(), encode_jid lets mod_pubsub handle conversion

This commit is contained in:
Christophe Romain 2013-06-24 18:04:42 +02:00
parent 6bfa34e8e0
commit 3976351c4d

View File

@ -1605,10 +1605,8 @@ update_subscription(NodeId, JID, Subscription) ->
S, <<"');">>]) S, <<"');">>])
end. end.
decode_jid(SJID) when is_list(SJID) -> decode_jid(JID) ->
jlib:jid_tolower(jlib:string_to_jid(SJID)); jlib:jid_tolower(jlib:string_to_jid(JID)).
decode_jid(BJID) when is_binary(BJID) ->
decode_jid(binary_to_list(BJID)).
decode_affiliation(<<"o">>) -> owner; decode_affiliation(<<"o">>) -> owner;
decode_affiliation(<<"p">>) -> publisher; decode_affiliation(<<"p">>) -> publisher;
@ -1630,13 +1628,8 @@ decode_subscriptions(Subscriptions) ->
end, end,
[], str:tokens(Subscriptions, <<",">>)). [], str:tokens(Subscriptions, <<",">>)).
%-spec(encode_jid/1 ::
%(
% JID :: jid() | jid())
% -> binary()
%).
encode_jid(JID) -> encode_jid(JID) ->
(?PUBSUB):escape(jlib:jid_to_string(JID)). (?PUBSUB):escape(JID).
encode_affiliation(owner) -> <<"o">>; encode_affiliation(owner) -> <<"o">>;
encode_affiliation(publisher) -> <<"p">>; encode_affiliation(publisher) -> <<"p">>;