From ab75683bc9265990678b149c6d5599fd2129ecec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Tue, 26 Aug 2008 12:56:45 +0000 Subject: [PATCH] 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 --- ChangeLog | 7 +++++++ src/jlib.erl | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d45411378..a17316813 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-26 Jean-Sébastien Pédron + + * 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 * translate.erl (ascii_tolower): Accept 'undefined' as a language and diff --git a/src/jlib.erl b/src/jlib.erl index 698e704e4..2268f326c 100644 --- a/src/jlib.erl +++ b/src/jlib.erl @@ -64,7 +64,9 @@ from_old_jid/1, to_old_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"). @@ -761,10 +763,20 @@ to_old_jid(#jid{user = Node, resource = Resource, JID#jid{user = Node1, resource = Resource1, luser = LNode1, lresource = LResource1}. -short_jid(JID) -> - JID1 = to_old_jid(JID), - {JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}. +short_jid(JID1) -> + %JID1 = to_old_jid(JID), + {JID1#jid.user, JID1#jid.server, JID1#jid.resource}. 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}.