mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Add split_jid/1
This is a convenience reverse of make_jid/1. It allows extracting the jid parts without relying on using the jid record structure, to abstract details.
This commit is contained in:
parent
f377992232
commit
e3b7d43b76
@ -39,7 +39,7 @@
|
||||
make_error_reply/2, make_error_element/2,
|
||||
make_correct_from_to_attrs/3, replace_from_to_attrs/3,
|
||||
replace_from_to/3, replace_from_attrs/2, replace_from/2,
|
||||
remove_attr/2, make_jid/3, make_jid/1, string_to_jid/1,
|
||||
remove_attr/2, make_jid/3, make_jid/1, split_jid/1, string_to_jid/1,
|
||||
jid_to_string/1, is_nodename/1, tolower/1, nodeprep/1,
|
||||
nameprep/1, resourceprep/1, jid_tolower/1,
|
||||
jid_remove_resource/1, jid_replace_resource/2,
|
||||
@ -214,6 +214,13 @@ make_jid(User, Server, Resource) ->
|
||||
make_jid({User, Server, Resource}) ->
|
||||
make_jid(User, Server, Resource).
|
||||
|
||||
%% This is the reverse of make_jid/1
|
||||
-spec split_jid(jid()) -> {binary(), binary(), binary()} | error.
|
||||
split_jid(#jid{user = U, server = S, resource = R}) ->
|
||||
{U, S, R};
|
||||
split_jid(_) ->
|
||||
error.
|
||||
|
||||
-spec string_to_jid(binary()) -> jid() | error.
|
||||
|
||||
string_to_jid(S) ->
|
||||
|
Loading…
Reference in New Issue
Block a user