From 67ea2cb56ab88f75bda8f8311b0493d1f3fe910b Mon Sep 17 00:00:00 2001 From: Michael DeBonis Date: Mon, 17 Jul 2017 10:40:07 -0500 Subject: [PATCH] Adding support for double periods in real_jid --- lib/modules/test/fixtures/users.js | 3 +++ lib/modules/test/users.js | 2 +- lib/modules/utils.js | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/modules/test/fixtures/users.js b/lib/modules/test/fixtures/users.js index c8f12da..3953501 100644 --- a/lib/modules/test/fixtures/users.js +++ b/lib/modules/test/fixtures/users.js @@ -44,5 +44,8 @@ module.exports = [ }, { room_jid: 'tonyd_20161206_1432@conference.example.com', real_jid: 'tony.dilisio2@example.com' + }, { + room_jid: 'tonyd_20161206_1432@conference.example.com', + real_jid: 'julie..sokol@example.com' } ] diff --git a/lib/modules/test/users.js b/lib/modules/test/users.js index 3a6b9af..246c4e1 100644 --- a/lib/modules/test/users.js +++ b/lib/modules/test/users.js @@ -33,7 +33,7 @@ describe('modules.users', function() { users(context).then(function(c) { expect(c).to.equal(context) - expect(Object.keys(c.values.users).length).equals(12) + expect(Object.keys(c.values.users).length).equals(13) expect(c.output.write.args[0][0]).to.deep.equal({ type: 'user', user: { diff --git a/lib/modules/utils.js b/lib/modules/utils.js index 2b92f0c..7eec946 100644 --- a/lib/modules/utils.js +++ b/lib/modules/utils.js @@ -12,7 +12,9 @@ const utils = {} // once at the same time // utils.realJID = function (jid='') { - return jid.split('/')[0].replace(/\\20/g, '.') + return jid.split('/')[0] + .replace(/\\20+/g, '.') + .replace(/\.\.+/, '.') } //