mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Add function short_bare_jid/1.
SVN Revision: 1395
This commit is contained in:
parent
8c33e12616
commit
83a33726ce
@ -8,6 +8,8 @@
|
|||||||
exmpp_iq:error_without_original/2 and the new
|
exmpp_iq:error_without_original/2 and the new
|
||||||
exmpp_jid:make_bare_jid/1.
|
exmpp_jid:make_bare_jid/1.
|
||||||
|
|
||||||
|
* src/jlib.erl: Add function short_bare_jid/1.
|
||||||
|
|
||||||
2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
|
||||||
|
|
||||||
* src/Makefile.in: Remove the -I flag for exmpp includes; the
|
* src/Makefile.in: Remove the -I flag for exmpp includes; the
|
||||||
|
33
src/jlib.erl
33
src/jlib.erl
@ -63,7 +63,8 @@
|
|||||||
ip_to_list/1,
|
ip_to_list/1,
|
||||||
from_old_jid/1,
|
from_old_jid/1,
|
||||||
to_old_jid/1,
|
to_old_jid/1,
|
||||||
short_jid/1]).
|
short_jid/1,
|
||||||
|
short_bare_jid/1]).
|
||||||
|
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
|
|
||||||
@ -699,14 +700,14 @@ ip_to_list({A,B,C,D}) ->
|
|||||||
%% Empty fields are set to `undefined', not the empty string.
|
%% Empty fields are set to `undefined', not the empty string.
|
||||||
|
|
||||||
from_old_jid(#jid{user = Node, resource = Resource,
|
from_old_jid(#jid{user = Node, resource = Resource,
|
||||||
luser = LNode, lresource = LResource} = JID) ->
|
luser = LNode, lresource = LResource} = JID) ->
|
||||||
{Node1, LNode1} = case Node of
|
{Node1, LNode1} = case Node of
|
||||||
"" -> {undefined, undefined};
|
"" -> {undefined, undefined};
|
||||||
_ -> {Node, LNode}
|
_ -> {Node, LNode}
|
||||||
end,
|
end,
|
||||||
{Resource1, LResource1} = case Resource of
|
{Resource1, LResource1} = case Resource of
|
||||||
"" -> {undefined, undefined};
|
"" -> {undefined, undefined};
|
||||||
_ -> {Resource, LResource}
|
_ -> {Resource, LResource}
|
||||||
end,
|
end,
|
||||||
JID#jid{user = Node1, resource = Resource1,
|
JID#jid{user = Node1, resource = Resource1,
|
||||||
luser = LNode1, lresource = LResource1}.
|
luser = LNode1, lresource = LResource1}.
|
||||||
@ -719,18 +720,22 @@ from_old_jid(#jid{user = Node, resource = Resource,
|
|||||||
%% Empty fields are set to the empty string, not `undefined'.
|
%% Empty fields are set to the empty string, not `undefined'.
|
||||||
|
|
||||||
to_old_jid(#jid{user = Node, resource = Resource,
|
to_old_jid(#jid{user = Node, resource = Resource,
|
||||||
luser = LNode, lresource = LResource} = JID) ->
|
luser = LNode, lresource = LResource} = JID) ->
|
||||||
{Node1, LNode1} = case Node of
|
{Node1, LNode1} = case Node of
|
||||||
undefined -> {"", ""};
|
undefined -> {"", ""};
|
||||||
_ -> {Node, LNode}
|
_ -> {Node, LNode}
|
||||||
end,
|
end,
|
||||||
{Resource1, LResource1} = case Resource of
|
{Resource1, LResource1} = case Resource of
|
||||||
undefined -> {"", ""};
|
undefined -> {"", ""};
|
||||||
_ -> {Resource, LResource}
|
_ -> {Resource, LResource}
|
||||||
end,
|
end,
|
||||||
JID#jid{user = Node1, resource = Resource1,
|
JID#jid{user = Node1, resource = Resource1,
|
||||||
luser = LNode1, lresource = LResource1}.
|
luser = LNode1, lresource = LResource1}.
|
||||||
|
|
||||||
short_jid(JID0) ->
|
short_jid(JID) ->
|
||||||
JID = to_old_jid(JID0),
|
JID1 = to_old_jid(JID),
|
||||||
{JID#jid.luser, JID#jid.lserver, JID#jid.lresource}.
|
{JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}.
|
||||||
|
|
||||||
|
short_bare_jid(JID) ->
|
||||||
|
JID1 = to_old_jid(exmpp_jid:jid_to_bare_jid(JID)),
|
||||||
|
{JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}.
|
||||||
|
Loading…
Reference in New Issue
Block a user