@xmpp/client-core
Advanced tools
Comparing version 0.0.2 to 0.2.0
78
index.js
@@ -1,73 +0,9 @@ | ||
const Connection = require('@xmpp/connection') | ||
'use strict' | ||
class Client extends Connection { | ||
constructor (options) { | ||
super(options) | ||
this.transports = [] | ||
this.uri = '' | ||
} | ||
const Client = require('./lib/Client') | ||
const xml = require('@xmpp/xml') | ||
const jid = require('@xmpp/jid') | ||
send (element, ...args) { | ||
if ( | ||
(this.socket.NS && this.socket.NS !== 'jabber:client') && | ||
!element.attrs.xmlns && | ||
(element.is('iq') || element.is('message') || element.is('presence')) | ||
) { | ||
element.attrs.xmlns = 'jabber:client' | ||
} | ||
return super.send(element, ...args) | ||
} | ||
connect (uri) { | ||
this.connectOptions = uri | ||
let params | ||
const Transport = this.transports.find(Transport => { | ||
return params = Transport.match(uri) // eslint-disable-line no-return-assign | ||
}) | ||
// FIXME callback? | ||
if (!Transport) throw new Error('No transport found') | ||
const sock = this.socket = new Transport() | ||
;[ | ||
'error', 'close', 'connect', 'open', | ||
'feature', 'element', 'stanza', 'send', | ||
'nonza', 'fragment', 'online', | ||
'authenticated', 'authenticate' | ||
].forEach(e => { | ||
sock.on(e, (...args) => this.emit(e, ...args)) | ||
}) | ||
return sock.connect(params) | ||
} | ||
write (...args) { | ||
return this.socket.write(...args) | ||
} | ||
open (options) { | ||
this.openOptions = options | ||
return this.socket.open(options) | ||
} | ||
restart (...args) { | ||
return this.socket.restart(...args) | ||
} | ||
close (...args) { | ||
return this.socket.close(...args) | ||
} | ||
end (...args) { | ||
return this.socket.end(...args) | ||
} | ||
stop (...args) { | ||
return this.socket.stop(...args) | ||
} | ||
} | ||
Client.prototype.NS = 'jabber:client' | ||
module.exports = Client | ||
module.exports.Client = Client | ||
module.exports.xml = xml | ||
module.exports.jid = jid |
@@ -6,7 +6,9 @@ { | ||
"bugs": "http://github.com/node-xmpp/node-xmpp/issues", | ||
"version": "0.0.2", | ||
"version": "0.2.0", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@xmpp/connection": "^0.0.6" | ||
"@xmpp/connection": "^0.2.0", | ||
"@xmpp/jid": "^0.2.0", | ||
"@xmpp/xml": "^0.2.0" | ||
} | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3253
4
3
57
1
+ Added@xmpp/jid@^0.2.0
+ Added@xmpp/xml@^0.2.0
+ Added@xmpp/connection@0.2.0(transitive)
+ Added@xmpp/events@0.2.0(transitive)
+ Added@xmpp/jid@0.2.0(transitive)
+ Added@xmpp/xml@0.2.0(transitive)
- Removed@xmpp/connection@0.0.6(transitive)
- Removed@xmpp/jid@0.0.2(transitive)
Updated@xmpp/connection@^0.2.0