Skip to content

Commit

Permalink
Adding support for double periods in real_jid
Browse files Browse the repository at this point in the history
  • Loading branch information
mkdbns committed Jul 17, 2017
1 parent 7c16c2e commit 67ea2cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/modules/test/fixtures/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ module.exports = [
}, {
room_jid: '[email protected]',
real_jid: '[email protected]'
}, {
room_jid: '[email protected]',
real_jid: '[email protected]'
}
]
2 changes: 1 addition & 1 deletion lib/modules/test/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 3 additions & 1 deletion lib/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/\.\.+/, '.')
}

//
Expand Down

0 comments on commit 67ea2cb

Please sign in to comment.