-
Notifications
You must be signed in to change notification settings - Fork 0
/
pattern.js
48 lines (46 loc) · 1.56 KB
/
pattern.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
define([
"jquery",
"pat-registry",
'logging',
"pat-parser",
"converse"
], function($, patterns, logger, Parser, converse) {
var log = logger.getLogger('pat.converse'),
parser = new Parser("converse", { inherit: false });
patterns.register({
name: "converse",
trigger: '.pat-converse',
init: function($el, opts) {
var data = {};
// TODO: reuse same resource... (store in sessionStorage)
/* var resource = SessionStorage.get('xmppresource');
* if (resource) {
* data.resource = resource;
* }
*/
$.ajax({
'url': '/stardesk/@@xmpp-loader', // FIXME
'dataType': 'json',
'data': data,
'success': function (data) {
converse.initialize({
prebind: true,
rid: data.rid,
sid: data.sid,
jid: data.jid,
bosh_service_url: data.BOSH_SERVICE,
xhr_user_search: true,
auto_subscribe: true,
auto_list_rooms: true,
hide_muc_server: true,
show_controlbox_by_default: false,
debug: true
});
},
'error': function () {
console.log('error while trying to call /@@xmpp-loader');
}
});
}
});
});