25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

short_jid/1 and short_bare_jid/1 now produce a short JID from the

user-provided JID parts. To obtain a short JID from the STRINGPREP'd
parts, use the new short_prepd_jid/1 and short_prepd_bare_jid/1
functions.

SVN Revision: 1543
This commit is contained in:
Jean-Sébastien Pédron 2008-08-26 12:56:45 +00:00
parent d8c3aae412
commit ab75683bc9
2 changed files with 24 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2008-08-26 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/jlib.erl: short_jid/1 and short_bare_jid/1 now produce a short
JID from the user-provided JID parts. To obtain a short JID from the
STRINGPREP'd parts, use the new short_prepd_jid/1 and
short_prepd_bare_jid/1 functions.
2008-08-14 Jean-Sébastien Pédron <js.pedron@meetic-corp.com> 2008-08-14 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* translate.erl (ascii_tolower): Accept 'undefined' as a language and * translate.erl (ascii_tolower): Accept 'undefined' as a language and

View File

@ -64,7 +64,9 @@
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]). short_bare_jid/1,
short_prepd_jid/1,
short_prepd_bare_jid/1]).
-include("jlib.hrl"). -include("jlib.hrl").
@ -761,10 +763,20 @@ to_old_jid(#jid{user = Node, resource = Resource,
JID#jid{user = Node1, resource = Resource1, JID#jid{user = Node1, resource = Resource1,
luser = LNode1, lresource = LResource1}. luser = LNode1, lresource = LResource1}.
short_jid(JID) -> short_jid(JID1) ->
JID1 = to_old_jid(JID), %JID1 = to_old_jid(JID),
{JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}. {JID1#jid.user, JID1#jid.server, JID1#jid.resource}.
short_bare_jid(JID) -> short_bare_jid(JID) ->
JID1 = to_old_jid(exmpp_jid:jid_to_bare_jid(JID)), %JID1 = to_old_jid(exmpp_jid:jid_to_bare_jid(JID)),
JID1 = exmpp_jid:jid_to_bare_jid(JID),
{JID1#jid.user, JID1#jid.server, JID1#jid.resource}.
short_prepd_jid(JID1) ->
%JID1 = to_old_jid(JID),
{JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}.
short_prepd_bare_jid(JID) ->
%JID1 = to_old_jid(exmpp_jid:jid_to_bare_jid(JID)),
JID1 = exmpp_jid:jid_to_bare_jid(JID),
{JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}. {JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}.