/
converse-disco.js
731 lines (677 loc) · 32.9 KB
/
converse-disco.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
// Converse.js
// https://conversejs.org
//
// Copyright (c) 2013-2019, the Converse developers
// Licensed under the Mozilla Public License (MPLv2)
/* This is a Converse plugin which add support for XEP-0030: Service Discovery */
import BrowserStorage from "backbone.browserStorage";
import converse from "./converse-core";
import sizzle from "sizzle";
const { Backbone, Promise, Strophe, $iq, utils, _ } = converse.env;
converse.plugins.add('converse-disco', {
initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
const { _converse } = this;
// Promises exposed by this plugin
_converse.api.promises.add('discoInitialized');
_converse.api.promises.add('streamFeaturesAdded');
/**
* @class
* @namespace _converse.DiscoEntity
* @memberOf _converse
*/
_converse.DiscoEntity = Backbone.Model.extend({
/* A Disco Entity is a JID addressable entity that can be queried
* for features.
*
* See XEP-0030: https://xmpp.org/extensions/xep-0030.html
*/
idAttribute: 'jid',
initialize () {
this.waitUntilFeaturesDiscovered = utils.getResolveablePromise();
this.dataforms = new Backbone.Collection();
this.dataforms.browserStorage = new BrowserStorage.session(
`converse.dataforms-${this.get('jid')}`
);
this.features = new Backbone.Collection();
this.features.browserStorage = new BrowserStorage.session(
`converse.features-${this.get('jid')}`
);
this.features.on('add', this.onFeatureAdded, this);
this.fields = new Backbone.Collection();
this.fields.browserStorage = new BrowserStorage.session(
`converse.fields-${this.get('jid')}`
);
this.fields.on('add', this.onFieldAdded, this);
this.identities = new Backbone.Collection();
this.identities.browserStorage = new BrowserStorage.session(
`converse.identities-${this.get('jid')}`
);
this.fetchFeatures();
this.items = new _converse.DiscoEntities();
this.items.browserStorage = new BrowserStorage.session(
`converse.disco-items-${this.get('jid')}`
);
this.items.fetch();
},
/**
* Returns a Promise which resolves with a map indicating
* whether a given identity is provided by this entity.
* @private
* @method _converse.DiscoEntity#getIdentity
* @param { String } category - The identity category
* @param { String } type - The identity type
*/
async getIdentity (category, type) {
await this.waitUntilFeaturesDiscovered;
return this.identities.findWhere({
'category': category,
'type': type
});
},
/**
* Returns a Promise which resolves with a map indicating
* whether a given feature is supported.
* @private
* @method _converse.DiscoEntity#hasFeature
* @param { String } feature - The feature that might be supported.
*/
async hasFeature (feature) {
await this.waitUntilFeaturesDiscovered
if (this.features.findWhere({'var': feature})) {
return this;
}
},
onFeatureAdded (feature) {
feature.entity = this;
/**
* Triggered when Converse has learned of a service provided by the XMPP server.
* See XEP-0030.
* @event _converse#serviceDiscovered
* @type { Backbone.Model }
* @example _converse.api.listen.on('featuresDiscovered', feature => { ... });
*/
_converse.api.trigger('serviceDiscovered', feature);
},
onFieldAdded (field) {
field.entity = this;
/**
* Triggered when Converse has learned of a disco extension field.
* See XEP-0030.
* @event _converse#discoExtensionFieldDiscovered
* @example _converse.api.listen.on('discoExtensionFieldDiscovered', () => { ... });
*/
_converse.api.trigger('discoExtensionFieldDiscovered', field);
},
fetchFeatures () {
if (this.features.browserStorage.records.length === 0) {
this.queryInfo();
} else {
this.features.fetch({
add: true,
success: () => {
this.waitUntilFeaturesDiscovered.resolve(this);
this.trigger('featuresDiscovered');
}
});
this.identities.fetch({add: true});
}
},
async queryInfo () {
let stanza;
try {
stanza = await _converse.api.disco.info(this.get('jid'), null);
} catch (iq) {
_converse.log(iq, Strophe.LogLevel.ERROR);
this.waitUntilFeaturesDiscovered.resolve(this);
}
this.onInfo(stanza);
},
onDiscoItems (stanza) {
_.each(sizzle(`query[xmlns="${Strophe.NS.DISCO_ITEMS}"] item`, stanza), (item) => {
if (item.getAttribute("node")) {
// XXX: ignore nodes for now.
// See: https://xmpp.org/extensions/xep-0030.html#items-nodes
return;
}
const jid = item.getAttribute('jid');
if (_.isUndefined(this.items.get(jid))) {
const entity = _converse.disco_entities.get(jid);
if (entity) {
this.items.add(entity);
} else {
this.items.create({'jid': jid});
}
}
});
},
async queryForItems () {
if (_.isEmpty(this.identities.where({'category': 'server'}))) {
// Don't fetch features and items if this is not a
// server or a conference component.
return;
}
const stanza = await _converse.api.disco.items(this.get('jid'));
this.onDiscoItems(stanza);
},
onInfo (stanza) {
Array.from(stanza.querySelectorAll('identity')).forEach(identity => {
this.identities.create({
'category': identity.getAttribute('category'),
'type': identity.getAttribute('type'),
'name': identity.getAttribute('name')
});
});
_.each(sizzle(`x[type="result"][xmlns="${Strophe.NS.XFORM}"]`, stanza), (form) => {
const data = {};
_.each(form.querySelectorAll('field'), (field) => {
data[field.getAttribute('var')] = {
'value': _.get(field.querySelector('value'), 'textContent'),
'type': field.getAttribute('type')
};
});
this.dataforms.create(data);
});
if (stanza.querySelector(`feature[var="${Strophe.NS.DISCO_ITEMS}"]`)) {
this.queryForItems();
}
_.forEach(stanza.querySelectorAll('feature'), feature => {
this.features.create({
'var': feature.getAttribute('var'),
'from': stanza.getAttribute('from')
});
});
// XEP-0128 Service Discovery Extensions
_.forEach(sizzle('x[type="result"][xmlns="jabber:x:data"] field', stanza), field => {
this.fields.create({
'var': field.getAttribute('var'),
'value': _.get(field.querySelector('value'), 'textContent'),
'from': stanza.getAttribute('from')
});
});
this.waitUntilFeaturesDiscovered.resolve(this);
this.trigger('featuresDiscovered');
}
});
_converse.DiscoEntities = Backbone.Collection.extend({
model: _converse.DiscoEntity,
fetchEntities () {
return new Promise((resolve, reject) => {
this.fetch({
add: true,
success: resolve,
error () {
reject (new Error("Could not fetch disco entities"));
}
});
});
}
});
function addClientFeatures () {
// See https://xmpp.org/registrar/disco-categories.html
_converse.api.disco.own.identities.add('client', 'web', 'Converse');
_converse.api.disco.own.features.add(Strophe.NS.BOSH);
_converse.api.disco.own.features.add(Strophe.NS.CHATSTATES);
_converse.api.disco.own.features.add(Strophe.NS.DISCO_INFO);
_converse.api.disco.own.features.add(Strophe.NS.ROSTERX); // Limited support
if (_converse.message_carbons) {
_converse.api.disco.own.features.add(Strophe.NS.CARBONS);
}
/**
* Triggered in converse-disco once the core disco features of
* Converse have been added.
* @event _converse#addClientFeatures
* @example _converse.api.listen.on('addClientFeatures', () => { ... });
*/
_converse.api.trigger('addClientFeatures');
return this;
}
function initStreamFeatures () {
const bare_jid = Strophe.getBareJidFromJid(_converse.jid);
const id = `converse.stream-features-${bare_jid}`;
if (!_converse.stream_features || _converse.stream_features.browserStorage.id !== id) {
_converse.stream_features = new Backbone.Collection();
_converse.stream_features.browserStorage = new BrowserStorage.session(id);
_converse.stream_features.fetch({
success (collection) {
if (collection.length === 0 && _converse.connection.features) {
Array.from(_converse.connection.features.childNodes)
.forEach(feature => {
_converse.stream_features.create({
'name': feature.nodeName,
'xmlns': feature.getAttribute('xmlns')
});
});
}
/**
* Triggered as soon as Converse has processed the stream features as advertised by
* the server. If you want to check whether a stream feature is supported before
* proceeding, then you'll first want to wait for this event.
* @event _converse#streamFeaturesAdded
* @example _converse.api.listen.on('streamFeaturesAdded', () => { ... });
*/
_converse.api.trigger('streamFeaturesAdded');
}
});
}
}
async function initializeDisco () {
addClientFeatures();
_converse.connection.addHandler(onDiscoInfoRequest, Strophe.NS.DISCO_INFO, 'iq', 'get', null, null);
_converse.disco_entities = new _converse.DiscoEntities();
_converse.disco_entities.browserStorage = new BrowserStorage.session(
`converse.disco-entities-${_converse.bare_jid}`
);
const collection = await _converse.disco_entities.fetchEntities();
if (collection.length === 0 || !collection.get(_converse.domain)) {
// If we don't have an entity for our own XMPP server,
// create one.
_converse.disco_entities.create({'jid': _converse.domain});
}
/**
* Triggered once the `converse-disco` plugin has been initialized and the
* `_converse.disco_entities` collection will be available and populated with at
* least the service discovery features of the user's own server.
* @event _converse#discoInitialized
* @example _converse.api.listen.on('discoInitialized', () => { ... });
*/
_converse.api.trigger('discoInitialized');
}
// beforeResourceBinding may or may not fire, depending on whether
// 'explicitResourceBinding` was set to true or false when
// Strophe.Connection was instantiated, so we also listen for
// setUserJID
_converse.api.listen.on('beforeResourceBinding', initStreamFeatures);
_converse.api.listen.on('setUserJID', initStreamFeatures);
_converse.api.listen.on('reconnected', initializeDisco);
_converse.api.listen.on('connected', initializeDisco);
_converse.api.listen.on('beforeTearDown', () => {
if (_converse.disco_entities) {
_converse.disco_entities.each((entity) => {
entity.features.reset();
entity.features.browserStorage._clear();
});
_converse.disco_entities.reset();
_converse.disco_entities.browserStorage._clear();
}
if (_converse.stream_features) {
_converse.stream_features.reset();
_converse.stream_features.browserStorage._clear();
}
});
const plugin = this;
plugin._identities = [];
plugin._features = [];
function onDiscoInfoRequest (stanza) {
const node = stanza.getElementsByTagName('query')[0].getAttribute('node');
const attrs = {xmlns: Strophe.NS.DISCO_INFO};
if (node) { attrs.node = node; }
const iqresult = $iq({'type': 'result', 'id': stanza.getAttribute('id')});
const from = stanza.getAttribute('from');
if (from !== null) {
iqresult.attrs({'to': from});
}
iqresult.c('query', attrs);
_.each(plugin._identities, (identity) => {
const attrs = {
'category': identity.category,
'type': identity.type
};
if (identity.name) {
attrs.name = identity.name;
}
if (identity.lang) {
attrs['xml:lang'] = identity.lang;
}
iqresult.c('identity', attrs).up();
});
_.each(plugin._features, (feature) => {
iqresult.c('feature', {'var': feature}).up();
});
_converse.api.send(iqresult.tree());
return true;
}
Object.assign(_converse.api, {
/**
* The XEP-0030 service discovery API
*
* This API lets you discover information about entities on the
* XMPP network.
*
* @namespace _converse.api.disco
* @memberOf _converse.api
*/
'disco': {
/**
* @namespace _converse.api.disco.stream
* @memberOf _converse.api.disco
*/
'stream': {
/**
* @method _converse.api.disco.stream.getFeature
* @param {String} name The feature name
* @param {String} xmlns The XML namespace
* @example _converse.api.disco.stream.getFeature('ver', 'urn:xmpp:features:rosterver')
*/
'getFeature': async function (name, xmlns) {
await _converse.api.waitUntil('streamFeaturesAdded');
if (_.isNil(name) || _.isNil(xmlns)) {
throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");
}
return _converse.stream_features.findWhere({'name': name, 'xmlns': xmlns});
}
},
/**
* @namespace _converse.api.disco.own
* @memberOf _converse.api.disco
*/
'own': {
/**
* @namespace _converse.api.disco.own.identities
* @memberOf _converse.api.disco.own
*/
'identities': {
/**
* Lets you add new identities for this client (i.e. instance of Converse)
* @method _converse.api.disco.own.identities.add
*
* @param {String} category - server, client, gateway, directory, etc.
* @param {String} type - phone, pc, web, etc.
* @param {String} name - "Converse"
* @param {String} lang - en, el, de, etc.
*
* @example _converse.api.disco.own.identities.clear();
*/
add (category, type, name, lang) {
for (var i=0; i<plugin._identities.length; i++) {
if (plugin._identities[i].category == category &&
plugin._identities[i].type == type &&
plugin._identities[i].name == name &&
plugin._identities[i].lang == lang) {
return false;
}
}
plugin._identities.push({category: category, type: type, name: name, lang: lang});
},
/**
* Clears all previously registered identities.
* @method _converse.api.disco.own.identities.clear
* @example _converse.api.disco.own.identities.clear();
*/
clear () {
plugin._identities = []
},
/**
* Returns all of the identities registered for this client
* (i.e. instance of Converse).
* @method _converse.api.disco.identities.get
* @example const identities = _converse.api.disco.own.identities.get();
*/
get () {
return plugin._identities;
}
},
/**
* @namespace _converse.api.disco.own.features
* @memberOf _converse.api.disco.own
*/
'features': {
/**
* Lets you register new disco features for this client (i.e. instance of Converse)
* @method _converse.api.disco.own.features.add
* @param {String} name - e.g. http://jabber.org/protocol/caps
* @example _converse.api.disco.own.features.add("http://jabber.org/protocol/caps");
*/
add (name) {
for (var i=0; i<plugin._features.length; i++) {
if (plugin._features[i] == name) { return false; }
}
plugin._features.push(name);
},
/**
* Clears all previously registered features.
* @method _converse.api.disco.own.features.clear
* @example _converse.api.disco.own.features.clear();
*/
clear () {
plugin._features = []
},
/**
* Returns all of the features registered for this client (i.e. instance of Converse).
* @method _converse.api.disco.own.features.get
* @example const features = _converse.api.disco.own.features.get();
*/
get () {
return plugin._features;
}
}
},
/**
* Query for information about an XMPP entity
*
* @method _converse.api.disco.info
* @param {string} jid The Jabber ID of the entity to query
* @param {string} [node] A specific node identifier associated with the JID
* @returns {promise} Promise which resolves once we have a result from the server.
*/
'info' (jid, node) {
const attrs = {xmlns: Strophe.NS.DISCO_INFO};
if (node) {
attrs.node = node;
}
const info = $iq({
'from': _converse.connection.jid,
'to':jid,
'type':'get'
}).c('query', attrs);
return _converse.api.sendIQ(info);
},
/**
* Query for items associated with an XMPP entity
*
* @method _converse.api.disco.items
* @param {string} jid The Jabber ID of the entity to query for items
* @param {string} [node] A specific node identifier associated with the JID
* @returns {promise} Promise which resolves once we have a result from the server.
*/
'items' (jid, node) {
const attrs = {'xmlns': Strophe.NS.DISCO_ITEMS};
if (node) {
attrs.node = node;
}
return _converse.api.sendIQ(
$iq({
'from': _converse.connection.jid,
'to':jid,
'type':'get'
}).c('query', attrs)
);
},
/**
* Namespace for methods associated with disco entities
*
* @namespace _converse.api.disco.entities
* @memberOf _converse.api.disco
*/
'entities': {
/**
* Get the the corresponding `DiscoEntity` instance.
*
* @method _converse.api.disco.entities.get
* @param {string} jid The Jabber ID of the entity
* @param {boolean} [create] Whether the entity should be created if it doesn't exist.
* @example _converse.api.disco.entities.get(jid);
*/
async 'get' (jid, create=false) {
await _converse.api.waitUntil('discoInitialized');
if (_.isNil(jid)) {
return _converse.disco_entities;
}
const entity = _converse.disco_entities.get(jid);
if (entity || !create) {
return entity;
}
return _converse.disco_entities.create({'jid': jid});
}
},
/**
* @namespace _converse.api.disco.features
* @memberOf _converse.api.disco
*/
'features': {
/**
* Return a given feature of a disco entity
*
* @method _converse.api.disco.features.get
* @param {string} feature The feature that might be
* supported. In the XML stanza, this is the `var`
* attribute of the `<feature>` element. For
* example: `http://jabber.org/protocol/muc`
* @param {string} jid The JID of the entity
* (and its associated items) which should be queried
* @returns {promise} A promise which resolves with a list containing
* _converse.Entity instances representing the entity
* itself or those items associated with the entity if
* they support the given feature.
* @example
* _converse.api.disco.features.get(Strophe.NS.MAM, _converse.bare_jid);
*/
async 'get' (feature, jid) {
if (_.isNil(jid)) {
throw new TypeError('You need to provide an entity JID');
}
await _converse.api.waitUntil('discoInitialized');
let entity = await _converse.api.disco.entities.get(jid, true);
entity = await entity.waitUntilFeaturesDiscovered;
const promises = _.concat(
entity.items.map(item => item.hasFeature(feature)),
entity.hasFeature(feature)
);
const result = await Promise.all(promises);
return _.filter(result, _.isObject);
}
},
/**
* Used to determine whether an entity supports a given feature.
*
* @method _converse.api.disco.supports
* @param {string} feature The feature that might be
* supported. In the XML stanza, this is the `var`
* attribute of the `<feature>` element. For
* example: `http://jabber.org/protocol/muc`
* @param {string} jid The JID of the entity
* (and its associated items) which should be queried
* @returns {promise} A promise which resolves with `true` or `false`.
* @example
* if (await _converse.api.disco.supports(Strophe.NS.MAM, _converse.bare_jid)) {
* // The feature is supported
* } else {
* // The feature is not supported
* }
*/
async 'supports' (feature, jid) {
const features = await _converse.api.disco.features.get(feature, jid);
return features.length > 0;
},
/**
* Refresh the features (and fields and identities) associated with a
* disco entity by refetching them from the server
*
* @method _converse.api.disco.refreshFeatures
* @param {string} jid The JID of the entity whose features are refreshed.
* @returns {promise} A promise which resolves once the features have been refreshed
* @example
* await _converse.api.disco.refreshFeatures('room@conference.example.org');
*/
async 'refreshFeatures' (jid) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.refreshFeatures: You need to provide an entity JID');
}
await _converse.api.waitUntil('discoInitialized');
const entity = await _converse.api.disco.entities.get(jid, true);
entity.features.reset();
entity.fields.reset();
entity.identities.reset();
entity.waitUntilFeaturesDiscovered = utils.getResolveablePromise()
entity.queryInfo();
return entity.waitUntilFeaturesDiscovered;
},
/**
* Return all the features associated with a disco entity
*
* @method _converse.api.disco.getFeatures
* @param {string} jid The JID of the entity whose features are returned.
* @returns {promise} A promise which resolves with the returned features
* @example
* const features = await _converse.api.disco.getFeatures('room@conference.example.org');
*/
async 'getFeatures' (jid) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.getFeatures: You need to provide an entity JID');
}
await _converse.api.waitUntil('discoInitialized');
let entity = await _converse.api.disco.entities.get(jid, true);
entity = await entity.waitUntilFeaturesDiscovered;
return entity.features;
},
/**
* Return all the service discovery extensions fields
* associated with an entity.
*
* See [XEP-0129: Service Discovery Extensions](https://xmpp.org/extensions/xep-0128.html)
*
* @method _converse.api.disco.getFields
* @param {string} jid The JID of the entity whose fields are returned.
* @example
* const fields = await _converse.api.disco.getFields('room@conference.example.org');
*/
async 'getFields' (jid) {
if (_.isNil(jid)) {
throw new TypeError('api.disco.getFields: You need to provide an entity JID');
}
await _converse.api.waitUntil('discoInitialized');
let entity = await _converse.api.disco.entities.get(jid, true);
entity = await entity.waitUntilFeaturesDiscovered;
return entity.fields;
},
/**
* Get the identity (with the given category and type) for a given disco entity.
*
* For example, when determining support for PEP (personal eventing protocol), you
* want to know whether the user's own JID has an identity with
* `category='pubsub'` and `type='pep'` as explained in this section of
* XEP-0163: https://xmpp.org/extensions/xep-0163.html#support
*
* @method _converse.api.disco.getIdentity
* @param {string} The identity category.
* In the XML stanza, this is the `category`
* attribute of the `<identity>` element.
* For example: 'pubsub'
* @param {string} type The identity type.
* In the XML stanza, this is the `type`
* attribute of the `<identity>` element.
* For example: 'pep'
* @param {string} jid The JID of the entity which might have the identity
* @returns {promise} A promise which resolves with a map indicating
* whether an identity with a given type is provided by the entity.
* @example
* _converse.api.disco.getIdentity('pubsub', 'pep', _converse.bare_jid).then(
* function (identity) {
* if (_.isNil(identity)) {
* // The entity DOES NOT have this identity
* } else {
* // The entity DOES have this identity
* }
* }
* ).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
*/
async 'getIdentity' (category, type, jid) {
const e = await _converse.api.disco.entities.get(jid, true);
return e.getIdentity(category, type);
}
}
});
}
});