Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
6ef0536e
Commit
6ef0536e
authored
Jul 10, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some work on using es6 promises
parent
9a9eae3f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
267 additions
and
230 deletions
+267
-230
spec/roomslist.js
spec/roomslist.js
+61
-52
src/config.js
src/config.js
+1
-1
src/converse-bookmarks.js
src/converse-bookmarks.js
+9
-5
src/converse-chatview.js
src/converse-chatview.js
+3
-2
src/converse-controlbox.js
src/converse-controlbox.js
+4
-8
src/converse-core.js
src/converse-core.js
+128
-116
src/converse-dragresize.js
src/converse-dragresize.js
+3
-4
src/converse-inverse.js
src/converse-inverse.js
+1
-2
src/converse-mam.js
src/converse-mam.js
+3
-4
src/converse-minimize.js
src/converse-minimize.js
+4
-3
src/converse-muc.js
src/converse-muc.js
+2
-1
src/converse-otr.js
src/converse-otr.js
+3
-3
src/converse-register.js
src/converse-register.js
+3
-2
src/converse-roomslist.js
src/converse-roomslist.js
+16
-13
src/converse-rosterview.js
src/converse-rosterview.js
+4
-3
src/converse-vcard.js
src/converse-vcard.js
+3
-4
src/utils.js
src/utils.js
+14
-2
tests/mock.js
tests/mock.js
+3
-2
tests/utils.js
tests/utils.js
+2
-3
No files found.
spec/roomslist.js
View file @
6ef0536e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
}
(
this
,
function
(
jasmine
,
mock
,
converse
,
roomslist
,
test_utils
)
{
}
(
this
,
function
(
jasmine
,
mock
,
converse
,
roomslist
,
test_utils
)
{
var
_
=
converse
.
env
.
_
;
var
_
=
converse
.
env
.
_
;
var
$msg
=
converse
.
env
.
$msg
;
var
$msg
=
converse
.
env
.
$msg
;
var
Promise
=
converse
.
env
.
Promise
;
describe
(
"
The converse-roomslist plugin
"
,
function
()
{
describe
(
"
The converse-roomslist plugin
"
,
function
()
{
...
@@ -77,61 +78,69 @@
...
@@ -77,61 +78,69 @@
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
1
);
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
1
);
}));
}));
it
(
"
shows unread messages directed at the user
"
,
mock
.
initConverse
(
it
(
"
shows unread messages directed at the user
"
,
mock
.
initConverse
WithAsync
(
{
whitelisted_plugins
:
[
'
converse-roomslist
'
],
{
whitelisted_plugins
:
[
'
converse-roomslist
'
],
allow_bookmarks
:
false
// Makes testing easier, otherwise we
allow_bookmarks
:
false
// Makes testing easier, otherwise we
// have to mock stanza traffic.
// have to mock stanza traffic.
},
function
(
_converse
)
{
},
function
(
done
,
_converse
)
{
var
room_jid
=
'
kitchen@conference.shakespeare.lit
'
;
test_utils
.
waitUntil
(
function
()
{
test_utils
.
openAndEnterChatRoom
(
return
!
_
.
isUndefined
(
_converse
.
rooms_list_view
)
_converse
,
'
kitchen
'
,
'
conference.shakespeare.lit
'
,
'
romeo
'
);
},
500
)
var
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
.
then
(
function
()
{
view
.
model
.
set
({
'
minimized
'
:
true
});
var
room_jid
=
'
kitchen@conference.shakespeare.lit
'
;
test_utils
.
openAndEnterChatRoom
(
var
contact_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
_converse
,
'
kitchen
'
,
'
conference.shakespeare.lit
'
,
'
romeo
'
);
var
nick
=
mock
.
chatroom_names
[
0
];
var
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
view
.
handleMUCMessage
(
view
.
model
.
set
({
'
minimized
'
:
true
});
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
var
contact_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
id
:
(
new
Date
()).
getTime
(),
var
nick
=
mock
.
chatroom_names
[
0
];
to
:
'
dummy@localhost
'
,
view
.
handleMUCMessage
(
type
:
'
groupchat
'
$msg
({
}).
c
(
'
body
'
).
t
(
'
foo
'
).
tree
());
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
// If the user isn't mentioned, the counter doesn't get incremented, but the text of the room is bold
to
:
'
dummy@localhost
'
,
var
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
type
:
'
groupchat
'
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
));
}).
c
(
'
body
'
).
t
(
'
foo
'
).
tree
());
// If the user is mentioned, the counter also gets updated
// If the user isn't mentioned, the counter doesn't get incremented, but the text of the room is bold
view
.
handleMUCMessage
(
var
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
$msg
({
"
.available-chatroom
"
from
:
room_jid
+
'
/
'
+
nick
,
);
id
:
(
new
Date
()).
getTime
(),
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
));
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
// If the user is mentioned, the counter also gets updated
}).
c
(
'
body
'
).
t
(
'
romeo: Your attention is required
'
).
tree
()
view
.
handleMUCMessage
(
);
$msg
({
var
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
from
:
room_jid
+
'
/
'
+
nick
,
expect
(
indicator_el
.
textContent
).
toBe
(
'
1
'
);
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
view
.
handleMUCMessage
(
type
:
'
groupchat
'
$msg
({
}).
c
(
'
body
'
).
t
(
'
romeo: Your attention is required
'
).
tree
()
from
:
room_jid
+
'
/
'
+
nick
,
);
id
:
(
new
Date
()).
getTime
(),
var
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
to
:
'
dummy@localhost
'
,
expect
(
indicator_el
.
textContent
).
toBe
(
'
1
'
);
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
romeo: and another thing...
'
).
tree
()
view
.
handleMUCMessage
(
);
$msg
({
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
from
:
room_jid
+
'
/
'
+
nick
,
expect
(
indicator_el
.
textContent
).
toBe
(
'
2
'
);
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
// When the chat gets maximized again, the unread indicators are removed
type
:
'
groupchat
'
view
.
model
.
set
({
'
minimized
'
:
false
});
}).
c
(
'
body
'
).
t
(
'
romeo: and another thing...
'
).
tree
()
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
);
expect
(
_
.
isNull
(
indicator_el
));
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
expect
(
indicator_el
.
textContent
).
toBe
(
'
2
'
);
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
)).
toBeFalsy
();
// When the chat gets maximized again, the unread indicators are removed
view
.
model
.
set
({
'
minimized
'
:
false
});
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
_
.
isNull
(
indicator_el
));
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
)).
toBeFalsy
();
done
();
});
}));
}));
});
});
}));
}));
src/config.js
View file @
6ef0536e
...
@@ -23,7 +23,7 @@ require.config({
...
@@ -23,7 +23,7 @@ require.config({
"
backbone.browserStorage
"
:
"
node_modules/backbone.browserStorage/backbone.browserStorage
"
,
"
backbone.browserStorage
"
:
"
node_modules/backbone.browserStorage/backbone.browserStorage
"
,
"
backbone.overview
"
:
"
node_modules/backbone.overview/backbone.overview
"
,
"
backbone.overview
"
:
"
node_modules/backbone.overview/backbone.overview
"
,
"
eventemitter
"
:
"
node_modules/otr/build/dep/eventemitter
"
,
"
eventemitter
"
:
"
node_modules/otr/build/dep/eventemitter
"
,
"
es6-promise
"
:
"
node_modules/es6-promise/dist/es6-promise
"
,
"
es6-promise
"
:
"
node_modules/es6-promise/dist/es6-promise
.auto
"
,
"
jquery
"
:
"
node_modules/jquery/dist/jquery
"
,
"
jquery
"
:
"
node_modules/jquery/dist/jquery
"
,
"
jquery.noconflict
"
:
"
src/jquery.noconflict
"
,
"
jquery.noconflict
"
:
"
src/jquery.noconflict
"
,
"
jquery.browser
"
:
"
node_modules/jquery.browser/dist/jquery.browser
"
,
"
jquery.browser
"
:
"
node_modules/jquery.browser/dist/jquery.browser
"
,
...
...
src/converse-bookmarks.js
View file @
6ef0536e
...
@@ -10,7 +10,8 @@
...
@@ -10,7 +10,8 @@
* in XEP-0048.
* in XEP-0048.
*/
*/
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
utils
"
,
define
([
"
jquery.noconflict
"
,
"
utils
"
,
"
converse-core
"
,
"
converse-core
"
,
"
converse-muc
"
,
"
converse-muc
"
,
"
tpl!chatroom_bookmark_form
"
,
"
tpl!chatroom_bookmark_form
"
,
...
@@ -20,6 +21,7 @@
...
@@ -20,6 +21,7 @@
],
],
factory
);
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
utils
,
utils
,
converse
,
converse
,
muc
,
muc
,
...
@@ -29,8 +31,7 @@
...
@@ -29,8 +31,7 @@
tpl_bookmarks_list
tpl_bookmarks_list
)
{
)
{
const
$
=
converse
.
env
.
jQuery
,
const
{
Backbone
,
Promise
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
{
Backbone
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-bookmarks
'
,
{
converse
.
plugins
.
add
(
'
converse-bookmarks
'
,
{
overrides
:
{
overrides
:
{
...
@@ -488,8 +489,11 @@
...
@@ -488,8 +489,11 @@
_converse
.
emit
(
'
bookmarksInitialized
'
);
_converse
.
emit
(
'
bookmarksInitialized
'
);
});
});
};
};
$
.
when
(
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)).
then
(
initBookmarks
);
Promise
.
all
([
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)
]).
then
(
initBookmarks
);
const
afterReconnection
=
function
()
{
const
afterReconnection
=
function
()
{
if
(
!
_converse
.
allow_bookmarks
)
{
if
(
!
_converse
.
allow_bookmarks
)
{
...
...
src/converse-chatview.js
View file @
6ef0536e
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
converse-core
"
,
"
tpl!chatbox
"
,
"
tpl!chatbox
"
,
"
tpl!new_day
"
,
"
tpl!new_day
"
,
...
@@ -19,6 +20,7 @@
...
@@ -19,6 +20,7 @@
"
tpl!spinner
"
"
tpl!spinner
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
converse
,
converse
,
tpl_chatbox
,
tpl_chatbox
,
tpl_new_day
,
tpl_new_day
,
...
@@ -30,8 +32,7 @@
...
@@ -30,8 +32,7 @@
tpl_spinner
tpl_spinner
)
{
)
{
"
use strict
"
;
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
const
{
$msg
,
Backbone
,
Strophe
,
_
,
moment
,
utils
}
=
converse
.
env
;
{
$msg
,
Backbone
,
Strophe
,
_
,
moment
,
utils
}
=
converse
.
env
;
const
KEY
=
{
const
KEY
=
{
ENTER
:
13
,
ENTER
:
13
,
...
...
src/converse-controlbox.js
View file @
6ef0536e
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
/*global define */
/*global define */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!add_contact_dropdown
"
,
"
tpl!add_contact_dropdown
"
,
"
tpl!add_contact_form
"
,
"
tpl!add_contact_form
"
,
"
tpl!change_status_message
"
,
"
tpl!change_status_message
"
,
...
@@ -25,6 +26,7 @@
...
@@ -25,6 +26,7 @@
"
converse-rosterview
"
"
converse-rosterview
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
converse
,
converse
,
tpl_add_contact_dropdown
,
tpl_add_contact_dropdown
,
tpl_add_contact_form
,
tpl_add_contact_form
,
...
@@ -44,13 +46,7 @@
...
@@ -44,13 +46,7 @@
const
USERS_PANEL_ID
=
'
users
'
;
const
USERS_PANEL_ID
=
'
users
'
;
const
CHATBOX_TYPE
=
'
chatbox
'
;
const
CHATBOX_TYPE
=
'
chatbox
'
;
// Strophe methods for building stanzas
const
{
Strophe
,
Backbone
,
utils
,
_
,
fp
,
moment
}
=
converse
.
env
;
const
{
Strophe
}
=
converse
.
env
,
{
Backbone
}
=
converse
.
env
,
{
utils
}
=
converse
.
env
;
// Other necessary globals
const
$
=
converse
.
env
.
jQuery
,
{
_
,
fp
,
moment
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-controlbox
'
,
{
converse
.
plugins
.
add
(
'
converse-controlbox
'
,
{
...
...
src/converse-core.js
View file @
6ef0536e
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
/*global Backbone, define, window, document, JSON */
/*global Backbone, define, window, document, JSON */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
sizzle
"
,
define
([
"
sizzle
"
,
"
jquery.noconflict
"
,
"
es6-promise
"
,
"
lodash.noconflict
"
,
"
lodash.noconflict
"
,
"
lodash.converter
"
,
"
lodash.converter
"
,
"
polyfill
"
,
"
polyfill
"
,
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
"
backbone.overview
"
,
"
backbone.overview
"
,
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
sizzle
,
$
,
_
,
lodashConverter
,
polyfill
,
sizzle
,
Promise
,
_
,
lodashConverter
,
polyfill
,
utils
,
moment
,
Strophe
,
pluggable
,
Backbone
)
{
utils
,
moment
,
Strophe
,
pluggable
,
Backbone
)
{
/* Cannot use this due to Safari bug.
/* Cannot use this due to Safari bug.
...
@@ -47,20 +47,29 @@
...
@@ -47,20 +47,29 @@
'
interpolate
'
:
/
\
{
\
{([
\
s
\
S
]
+
?)
\
}
\
}
/
g
'
interpolate
'
:
/
\
{
\
{([
\
s
\
S
]
+
?)
\
}
\
}
/
g
};
};
const
_converse
=
{};
const
_converse
=
{
_converse
.
templates
=
{};
'
templates
'
:
{},
'
promises
'
:
{}
}
_
.
extend
(
_converse
,
Backbone
.
Events
);
_
.
extend
(
_converse
,
Backbone
.
Events
);
_converse
.
promises
=
{
'
cachedRoster
'
:
new
$
.
Deferred
(),
const
PROMISES
=
[
'
chatBoxesFetched
'
:
new
$
.
Deferred
(),
'
cachedRoster
'
,
'
connected
'
:
new
$
.
Deferred
(),
'
chatBoxesFetched
'
,
'
pluginsInitialized
'
:
new
$
.
Deferred
(),
'
connected
'
,
'
roster
'
:
new
$
.
Deferred
(),
'
pluginsInitialized
'
,
'
rosterContactsFetched
'
:
new
$
.
Deferred
(),
'
roster
'
,
'
rosterGroupsFetched
'
:
new
$
.
Deferred
(),
'
rosterContactsFetched
'
,
'
rosterInitialized
'
:
new
$
.
Deferred
(),
'
rosterGroupsFetched
'
,
'
statusInitialized
'
:
new
$
.
Deferred
()
'
rosterInitialized
'
,
};
'
statusInitialized
'
];
function
addPromise
(
promise
)
{
_converse
.
promises
[
promise
]
=
utils
.
getWrappedPromise
();
}
_
.
each
(
PROMISES
,
addPromise
);
_converse
.
emit
=
function
(
name
)
{
_converse
.
emit
=
function
(
name
)
{
_converse
.
trigger
.
apply
(
this
,
arguments
);
_converse
.
trigger
.
apply
(
this
,
arguments
);
const
promise
=
_converse
.
promises
[
name
];
const
promise
=
_converse
.
promises
[
name
];
...
@@ -167,7 +176,7 @@
...
@@ -167,7 +176,7 @@
_converse
.
initialize
=
function
(
settings
,
callback
)
{
_converse
.
initialize
=
function
(
settings
,
callback
)
{
"
use strict
"
;
"
use strict
"
;
settings
=
!
_
.
isUndefined
(
settings
)
?
settings
:
{};
settings
=
!
_
.
isUndefined
(
settings
)
?
settings
:
{};
const
init_
deferred
=
new
$
.
Deferred
();
const
init_
promise
=
utils
.
getWrappedPromise
();
if
(
!
_
.
isUndefined
(
_converse
.
chatboxes
))
{
if
(
!
_
.
isUndefined
(
_converse
.
chatboxes
))
{
// Looks like _converse.initialized was called again without logging
// Looks like _converse.initialized was called again without logging
...
@@ -291,8 +300,6 @@
...
@@ -291,8 +300,6 @@
}
}
}
}
$
.
fx
.
off
=
!
this
.
animate
;
// Module-level variables
// Module-level variables
// ----------------------
// ----------------------
this
.
callback
=
callback
||
_
.
noop
;
this
.
callback
=
callback
||
_
.
noop
;
...
@@ -555,19 +562,19 @@
...
@@ -555,19 +562,19 @@
}
}
};
};
this
.
initStatus
=
function
()
{
this
.
initStatus
=
()
=>
const
deferred
=
new
$
.
Deferred
();
new
Promise
((
resolve
,
reject
)
=>
{
this
.
xmppstatus
=
new
this
.
XMPPStatus
();
const
promise
=
new
utils
.
getWrappedPromise
();
const
id
=
b64_sha1
(
`converse.xmppstatus-
${
_converse
.
bare_jid
}
`
);
this
.
xmppstatus
=
new
this
.
XMPPStatus
();
this
.
xmppstatus
.
id
=
id
;
// Appears to be necessary for backbone.browserStorage
const
id
=
b64_sha1
(
`converse.xmppstatus-
${
_converse
.
bare_jid
}
`
);
this
.
xmppstatus
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
id
);
this
.
xmppstatus
.
id
=
id
;
// Appears to be necessary for backbone.browserStorage
this
.
xmppstatus
.
fetch
({
this
.
xmppstatus
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
id
);
success
:
deferred
.
resolve
,
this
.
xmppstatus
.
fetch
({
error
:
deferred
.
resolve
success
:
resolve
,
error
:
resolve
});
_converse
.
emit
(
'
statusInitialized
'
);
});
});
_converse
.
emit
(
'
statusInitialized
'
);
return
deferred
.
promise
();
};
this
.
initSession
=
function
()
{
this
.
initSession
=
function
()
{
this
.
session
=
new
this
.
Session
();
this
.
session
=
new
this
.
Session
();
...
@@ -751,7 +758,7 @@
...
@@ -751,7 +758,7 @@
if
(
reconnecting
)
{
if
(
reconnecting
)
{
_converse
.
xmppstatus
.
sendPresence
();
_converse
.
xmppstatus
.
sendPresence
();
}
else
{
}
else
{
init_
deferred
.
resolve
();
init_
promise
.
resolve
();
_converse
.
emit
(
'
initialized
'
);
_converse
.
emit
(
'
initialized
'
);
}
}
};
};
...
@@ -788,7 +795,10 @@
...
@@ -788,7 +795,10 @@
// close them now.
// close them now.
_converse
.
chatboxviews
.
closeAllChatBoxes
();
_converse
.
chatboxviews
.
closeAllChatBoxes
();
_converse
.
features
=
new
_converse
.
Features
();
_converse
.
features
=
new
_converse
.
Features
();
_converse
.
initStatus
().
done
(
_
.
partial
(
_converse
.
onStatusInitialized
,
false
));
_converse
.
initStatus
().
then
(
_
.
partial
(
_converse
.
onStatusInitialized
,
false
),
_
.
partial
(
_converse
.
onStatusInitialized
,
false
)
);
_converse
.
emit
(
'
connected
'
);
_converse
.
emit
(
'
connected
'
);
}
}
};
};
...
@@ -1026,7 +1036,7 @@
...
@@ -1026,7 +1036,7 @@
_converse
.
connection
.
flush
();
_converse
.
connection
.
flush
();
_converse
.
roster
.
subscribeToSuggestedItems
.
bind
(
_converse
.
roster
)(
msg
);
_converse
.
roster
.
subscribeToSuggestedItems
.
bind
(
_converse
.
roster
)(
msg
);
},
t
);
},
t
);
t
+=
$
(
msg
).
find
(
'
item
'
).
length
*
250
;
t
+=
msg
.
querySelectorAll
(
'
item
'
).
length
*
250
;
return
true
;
return
true
;
},
},
Strophe
.
NS
.
ROSTERX
,
'
message
'
,
null
Strophe
.
NS
.
ROSTERX
,
'
message
'
,
null
...
@@ -1041,26 +1051,26 @@
...
@@ -1041,26 +1051,26 @@
* Returns a promise which resolves once the contacts have been
* Returns a promise which resolves once the contacts have been
* fetched.
* fetched.
*/
*/
const
deferred
=
new
$
.
Deferred
();
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
fetch
({
this
.
fetch
({
add
:
true
,
add
:
true
,
success
(
collection
)
{
success
(
collection
)
{
if
(
collection
.
length
===
0
)
{
if
(
collection
.
length
===
0
)
{
/* We don't have any roster contacts stored in sessionStorage,
/* We don't have any roster contacts stored in sessionStorage,
* so lets fetch the roster from the XMPP server. We pass in
* so lets fetch the roster from the XMPP server. We pass in
* 'sendPresence' as callback method, because after initially
* 'sendPresence' as callback method, because after initially
* fetching the roster we are ready to receive presence
* fetching the roster we are ready to receive presence
* updates from our contacts.
* updates from our contacts.
*/
*/
_converse
.
send_initial_presence
=
true
;
_converse
.
send_initial_presence
=
true
;
_converse
.
roster
.
fetchFromServer
(
deferred
.
resolve
);
_converse
.
roster
.
fetchFromServer
(
resolve
);
}
else
{
}
else
{
_converse
.
emit
(
'
cachedRoster
'
,
collection
);
_converse
.
emit
(
'
cachedRoster
'
,
collection
);
deferred
.
resolve
();
resolve
();
}
}
}
}
}
);
});
});
return
deferred
.
promise
();
},
},
subscribeToSuggestedItems
(
msg
)
{
subscribeToSuggestedItems
(
msg
)
{
...
@@ -1091,11 +1101,12 @@
...
@@ -1091,11 +1101,12 @@
* reason for the subscription request.
* reason for the subscription request.
* (Object) attributes - Any additional attributes to be stored on the user's model.
* (Object) attributes - Any additional attributes to be stored on the user's model.
*/
*/
this
.
addContact
(
jid
,
name
,
groups
,
attributes
).
done
(
function
(
contact
)
{
const
handler
=
(
contact
)
=>
{
if
(
contact
instanceof
_converse
.
RosterContact
)
{
if
(
contact
instanceof
_converse
.
RosterContact
)
{
contact
.
subscribe
(
message
);
contact
.
subscribe
(
message
);
}
}
});
}
this
.
addContact
(
jid
,
name
,
groups
,
attributes
).
then
(
handler
,
handler
);
},
},
sendContactAddIQ
(
jid
,
name
,
groups
,
callback
,
errback
)
{
sendContactAddIQ
(
jid
,
name
,
groups
,
callback
,
errback
)
{
...
@@ -1128,28 +1139,28 @@
...
@@ -1128,28 +1139,28 @@
* (Array of Strings) groups - Any roster groups the user might belong to
* (Array of Strings) groups - Any roster groups the user might belong to
* (Object) attributes - Any additional attributes to be stored on the user's model.
* (Object) attributes - Any additional attributes to be stored on the user's model.
*/
*/
const
deferred
=
new
$
.
Deferred
();
return
new
Promise
((
resolve
,
reject
)
=>
{
groups
=
groups
||
[];
groups
=
groups
||
[];
name
=
_
.
isEmpty
(
name
)?
jid
:
name
;
name
=
_
.
isEmpty
(
name
)?
jid
:
name
;
this
.
sendContactAddIQ
(
jid
,
name
,
groups
,
this
.
sendContactAddIQ
(
jid
,
name
,
groups
,
()
=>
{
()
=>
{
const
contact
=
this
.
create
(
_
.
assignIn
({
const
contact
=
this
.
create
(
_
.
assignIn
({
ask
:
undefined
,
ask
:
undefined
,
fullname
:
name
,
fullname
:
name
,
groups
,
groups
,
jid
,
jid
,
requesting
:
false
,
requesting
:
false
,
subscription
:
'
none
'
subscription
:
'
none
'
},
attributes
),
{
sort
:
false
});
},
attributes
),
{
sort
:
false
});
deferred
.
resolve
(
contact
);
resolve
(
contact
);
},
},
function
(
err
)
{
function
(
err
)
{
alert
(
__
(
`Sorry, there was an error while trying to add
${
name
}
as a contact.`
));
alert
(
__
(
`Sorry, there was an error while trying to add
${
name
}
as a contact.`
));
_converse
.
log
(
err
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
err
,
Strophe
.
LogLevel
.
ERROR
);
deferred
.
resolve
(
err
);
resolve
(
err
);
}
}
);
);
return
deferred
.
promise
(
);
}
);
},
},
subscribeBack
(
bare_jid
)
{
subscribeBack
(
bare_jid
)
{
...
@@ -1158,11 +1169,12 @@
...
@@ -1158,11 +1169,12 @@
contact
.
authorize
().
subscribe
();
contact
.
authorize
().
subscribe
();
}
else
{
}
else
{
// Can happen when a subscription is retried or roster was deleted
// Can happen when a subscription is retried or roster was deleted
this
.
addContact
(
bare_jid
,
''
,
[],
{
'
subscription
'
:
'
from
'
}).
done
(
function
(
contact
)
{
const
handler
=
(
contact
)
=>
{
if
(
contact
instanceof
_converse
.
RosterContact
)
{
if
(
contact
instanceof
_converse
.
RosterContact
)
{
contact
.
authorize
().
subscribe
();
contact
.
authorize
().
subscribe
();
}
}
});
}
this
.
addContact
(
bare_jid
,
''
,
[],
{
'
subscription
'
:
'
from
'
}).
then
(
handler
,
handler
);
}
}
},
},
...
@@ -1379,14 +1391,14 @@
...
@@ -1379,14 +1391,14 @@
* Returns a promise which resolves once the groups have been
* Returns a promise which resolves once the groups have been
* returned.
* returned.
*/
*/
const
deferred
=
new
$
.
Deferred
();
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
fetch
({
this
.
fetch
({
silent
:
true
,
// We need to first have all groups before
silent
:
true
,
// We need to first have all groups before
// we can start positioning them, so we set
// we can start positioning them, so we set
// 'silent' to true.
// 'silent' to true.
success
:
deferred
.
resolve
success
:
resolve
});
});
});
return
deferred
.
promise
();
}
}
});
});
...
@@ -1935,30 +1947,29 @@
...
@@ -1935,30 +1947,29 @@
}
}
};
};
this
.
fetchLoginCredentials
=
function
()
{
this
.
fetchLoginCredentials
=
()
=>
const
deferred
=
new
$
.
Deferred
();
new
Promise
((
resolve
,
reject
)
=>
{
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
'
GET
'
,
_converse
.
credentials_url
,
true
);
xhr
.
open
(
'
GET
'
,
_converse
.
credentials_url
,
true
);
xhr
.
setRequestHeader
(
'
Accept
'
,
"
application/json, text/javascript
"
);
xhr
.
setRequestHeader
(
'
Accept
'
,
"
application/json, text/javascript
"
);
xhr
.
onload
=
function
()
{
xhr
.
onload
=
function
()
{
if
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
)
{
if
(
xhr
.
status
>=
200
&&
xhr
.
status
<
400
)
{
const
data
=
JSON
.
parse
(
xhr
.
responseText
);
const
data
=
JSON
.
parse
(
xhr
.
responseText
);
deferred
.
resolve
({
resolve
({
'
jid
'
:
data
.
jid
,
'
jid
'
:
data
.
jid
,
'
password
'
:
data
.
password
'
password
'
:
data
.
password
});
});
}
else
{
}
else
{
xhr
.
onerror
();
xhr
.
onerror
();
}
}
};
};
xhr
.
onerror
=
function
()
{
xhr
.
onerror
=
function
()
{
delete
_converse
.
connection
;
delete
_converse
.
connection
;
_converse
.
emit
(
'
noResumeableSession
'
);
_converse
.
emit
(
'
noResumeableSession
'
);
deferred
.
reject
(
xhr
.
responseText
);
reject
(
xhr
.
responseText
);
};
};
xhr
.
send
();
xhr
.
send
();
return
deferred
.
promise
();
});
};
this
.
startNewBOSHSession
=
function
()
{
this
.
startNewBOSHSession
=
function
()
{
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
...
@@ -2045,7 +2056,10 @@
...
@@ -2045,7 +2056,10 @@
// or credentials fetching via HTTP
// or credentials fetching via HTTP
this
.
autoLogin
(
credentials
);
this
.
autoLogin
(
credentials
);
}
else
if
(
this
.
credentials_url
)
{
}
else
if
(
this
.
credentials_url
)
{
this
.
fetchLoginCredentials
().
done
(
this
.
autoLogin
.
bind
(
this
));
this
.
fetchLoginCredentials
().
then
(
this
.
autoLogin
.
bind
(
this
),
this
.
autoLogin
.
bind
(
this
)
);
}
else
if
(
!
this
.
jid
)
{
}
else
if
(
!
this
.
jid
)
{
throw
new
Error
(
throw
new
Error
(
"
attemptNonPreboundSession: If you use auto_login,
"
+
"
attemptNonPreboundSession: If you use auto_login,
"
+
...
@@ -2203,7 +2217,7 @@
...
@@ -2203,7 +2217,7 @@
_converse
.
connection
.
service
===
'
jasmine tests
'
)
{
_converse
.
connection
.
service
===
'
jasmine tests
'
)
{
return
_converse
;
return
_converse
;
}
else
{
}
else
{
return
init_
deferred
.
promise
()
;
return
init_
promise
.
promise
;
}
}
};
};
...
@@ -2280,9 +2294,7 @@
...
@@ -2280,9 +2294,7 @@
'
promises
'
:
{
'
promises
'
:
{
'
add
'
(
promises
)
{
'
add
'
(
promises
)
{
promises
=
_
.
isArray
(
promises
)
?
promises
:
[
promises
]
promises
=
_
.
isArray
(
promises
)
?
promises
:
[
promises
]
_
.
each
(
promises
,
function
(
promise
)
{
_
.
each
(
promises
,
addPromise
);
_converse
.
promises
[
promise
]
=
new
$
.
Deferred
();
});
}
}
},
},
'
contacts
'
:
{
'
contacts
'
:
{
...
@@ -2387,7 +2399,7 @@
...
@@ -2387,7 +2399,7 @@
if
(
_
.
isUndefined
(
promise
))
{
if
(
_
.
isUndefined
(
promise
))
{
return
null
;
return
null
;
}
}
return
_converse
.
promises
[
name
].
promise
()
;
return
promise
.
promise
;
},
},
'
send
'
(
stanza
)
{
'
send
'
(
stanza
)
{
_converse
.
connection
.
send
(
stanza
);
_converse
.
connection
.
send
(
stanza
);
...
@@ -2417,11 +2429,11 @@
...
@@ -2417,11 +2429,11 @@
'
$msg
'
:
$msg
,
'
$msg
'
:
$msg
,
'
$pres
'
:
$pres
,
'
$pres
'
:
$pres
,
'
Backbone
'
:
Backbone
,
'
Backbone
'
:
Backbone
,
'
Promise
'
:
Promise
,
'
Strophe
'
:
Strophe
,
'
Strophe
'
:
Strophe
,
'
_
'
:
_
,
'
_
'
:
_
,
'
fp
'
:
fp
,
'
b64_sha1
'
:
b64_sha1
,
'
b64_sha1
'
:
b64_sha1
,
'
jQuery
'
:
$
,
'
fp
'
:
fp
,
'
moment
'
:
moment
,
'
moment
'
:
moment
,
'
sizzle
'
:
sizzle
,
'
sizzle
'
:
sizzle
,
'
utils
'
:
utils
'
utils
'
:
utils
...
...
src/converse-dragresize.js
View file @
6ef0536e
...
@@ -7,17 +7,16 @@
...
@@ -7,17 +7,16 @@
/*global define, window */
/*global define, window */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
converse-core
"
,
"
tpl!dragresize
"
,
"
tpl!dragresize
"
,
"
converse-chatview
"
,
"
converse-chatview
"
,
"
converse-muc
"
,
// XXX: would like to remove this
"
converse-muc
"
,
// XXX: would like to remove this
"
converse-controlbox
"
"
converse-controlbox
"
],
factory
);
],
factory
);
}(
this
,
function
(
converse
,
tpl_dragresize
)
{
}(
this
,
function
(
$
,
converse
,
tpl_dragresize
)
{
"
use strict
"
;
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
const
{
_
}
=
converse
.
env
;
{
_
}
=
converse
.
env
;
function
renderDragResizeHandles
(
_converse
,
view
)
{
function
renderDragResizeHandles
(
_converse
,
view
)
{
const
flyout
=
view
.
el
.
querySelector
(
'
.box-flyout
'
);
const
flyout
=
view
.
el
.
querySelector
(
'
.box-flyout
'
);
...
...
src/converse-inverse.js
View file @
6ef0536e
...
@@ -16,8 +16,7 @@
...
@@ -16,8 +16,7 @@
],
factory
);
],
factory
);
}(
this
,
function
(
converse
,
tpl_brand_heading
)
{
}(
this
,
function
(
converse
,
tpl_brand_heading
)
{
"
use strict
"
;
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
const
{
Strophe
,
_
}
=
converse
.
env
;
{
Strophe
,
_
}
=
converse
.
env
;
function
createBrandHeadingElement
()
{
function
createBrandHeadingElement
()
{
const
div
=
document
.
createElement
(
'
div
'
);
const
div
=
document
.
createElement
(
'
div
'
);
...
...
src/converse-mam.js
View file @
6ef0536e
...
@@ -9,16 +9,15 @@
...
@@ -9,16 +9,15 @@
// XEP-0059 Result Set Management
// XEP-0059 Result Set Management
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
converse-core
"
,
"
converse-chatview
"
,
// Could be made a soft dependency
"
converse-chatview
"
,
// Could be made a soft dependency
"
converse-muc
"
,
// Could be made a soft dependency
"
converse-muc
"
,
// Could be made a soft dependency
"
strophe.rsm
"
"
strophe.rsm
"
],
factory
);
],
factory
);
}(
this
,
function
(
converse
)
{
}(
this
,
function
(
$
,
converse
)
{
"
use strict
"
;
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
const
{
Strophe
,
$iq
,
_
,
moment
}
=
converse
.
env
;
{
Strophe
,
$iq
,
_
,
moment
}
=
converse
.
env
;
const
RSM_ATTRIBUTES
=
[
'
max
'
,
'
first
'
,
'
last
'
,
'
after
'
,
'
before
'
,
'
index
'
,
'
count
'
];
const
RSM_ATTRIBUTES
=
[
'
max
'
,
'
first
'
,
'
last
'
,
'
after
'
,
'
before
'
,
'
index
'
,
'
count
'
];
// XEP-0313 Message Archive Management
// XEP-0313 Message Archive Management
...
...
src/converse-minimize.js
View file @
6ef0536e
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
/*global define, window */
/*global define, window */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!chatbox_minimize
"
,
"
tpl!chatbox_minimize
"
,
"
tpl!toggle_chats
"
,
"
tpl!toggle_chats
"
,
"
tpl!trimmed_chat
"
,
"
tpl!trimmed_chat
"
,
...
@@ -17,6 +18,7 @@
...
@@ -17,6 +18,7 @@
"
converse-muc
"
"
converse-muc
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
converse
,
converse
,
tpl_chatbox_minimize
,
tpl_chatbox_minimize
,
tpl_toggle_chats
,
tpl_toggle_chats
,
...
@@ -25,8 +27,7 @@
...
@@ -25,8 +27,7 @@
)
{
)
{
"
use strict
"
;
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
const
{
_
,
utils
,
Backbone
,
b64_sha1
,
moment
}
=
converse
.
env
;
{
_
,
utils
,
Backbone
,
b64_sha1
,
moment
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-minimize
'
,
{
converse
.
plugins
.
add
(
'
converse-minimize
'
,
{
overrides
:
{
overrides
:
{
...
...
src/converse-muc.js
View file @
6ef0536e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
*/
*/
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
converse-core
"
,
"
tpl!chatarea
"
,
"
tpl!chatarea
"
,
"
tpl!chatroom
"
,
"
tpl!chatroom
"
,
...
@@ -34,6 +35,7 @@
...
@@ -34,6 +35,7 @@
"
converse-chatview
"
"
converse-chatview
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
converse
,
converse
,
tpl_chatarea
,
tpl_chatarea
,
tpl_chatroom
,
tpl_chatroom
,
...
@@ -61,7 +63,6 @@
...
@@ -61,7 +63,6 @@
const
CHATROOMS_TYPE
=
'
chatroom
'
;
const
CHATROOMS_TYPE
=
'
chatroom
'
;
const
{
Strophe
,
Backbone
,
$iq
,
$build
,
$msg
,
$pres
,
b64_sha1
,
sizzle
,
utils
,
_
,
fp
,
moment
}
=
converse
.
env
;
const
{
Strophe
,
Backbone
,
$iq
,
$build
,
$msg
,
$pres
,
b64_sha1
,
sizzle
,
utils
,
_
,
fp
,
moment
}
=
converse
.
env
;
const
$
=
converse
.
env
.
jQuery
;
// Add Strophe Namespaces
// Add Strophe Namespaces
Strophe
.
addNamespace
(
'
MUC_ADMIN
'
,
Strophe
.
NS
.
MUC
+
"
#admin
"
);
Strophe
.
addNamespace
(
'
MUC_ADMIN
'
,
Strophe
.
NS
.
MUC
+
"
#admin
"
);
...
...
src/converse-otr.js
View file @
6ef0536e
...
@@ -11,15 +11,15 @@
...
@@ -11,15 +11,15 @@
*/
*/
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
converse-chatview
"
,
define
([
"
jquery.noconflict
"
,
"
converse-chatview
"
,
"
tpl!toolbar_otr
"
,
"
tpl!toolbar_otr
"
,
'
otr
'
'
otr
'
],
factory
);
],
factory
);
}(
this
,
function
(
converse
,
tpl_toolbar_otr
,
otr
)
{
}(
this
,
function
(
$
,
converse
,
tpl_toolbar_otr
,
otr
)
{
"
use strict
"
;
"
use strict
"
;
const
{
Strophe
,
utils
,
b64_sha1
,
_
}
=
converse
.
env
;
const
{
Strophe
,
utils
,
b64_sha1
,
_
}
=
converse
.
env
;
const
$
=
converse
.
env
.
jQuery
;
const
HAS_CSPRNG
=
((
!
_
.
isUndefined
(
crypto
))
&&
const
HAS_CSPRNG
=
((
!
_
.
isUndefined
(
crypto
))
&&
((
_
.
isFunction
(
crypto
.
randomBytes
))
||
(
_
.
isFunction
(
crypto
.
getRandomValues
))
((
_
.
isFunction
(
crypto
.
randomBytes
))
||
(
_
.
isFunction
(
crypto
.
getRandomValues
))
...
...
src/converse-register.js
View file @
6ef0536e
...
@@ -10,7 +10,8 @@
...
@@ -10,7 +10,8 @@
* as specified in XEP-0077.
* as specified in XEP-0077.
*/
*/
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!form_username
"
,
"
tpl!form_username
"
,
"
tpl!register_panel
"
,
"
tpl!register_panel
"
,
"
tpl!register_tab
"
,
"
tpl!register_tab
"
,
...
@@ -20,6 +21,7 @@
...
@@ -20,6 +21,7 @@
"
converse-controlbox
"
"
converse-controlbox
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
converse
,
converse
,
tpl_form_username
,
tpl_form_username
,
tpl_register_panel
,
tpl_register_panel
,
...
@@ -33,7 +35,6 @@
...
@@ -33,7 +35,6 @@
// Strophe methods for building stanzas
// Strophe methods for building stanzas
const
{
Strophe
,
Backbone
,
utils
,
$iq
,
_
}
=
converse
.
env
;
const
{
Strophe
,
Backbone
,
utils
,
$iq
,
_
}
=
converse
.
env
;
const
$
=
converse
.
env
.
jQuery
;
// Add Strophe Namespaces
// Add Strophe Namespaces
Strophe
.
addNamespace
(
'
REGISTER
'
,
'
jabber:iq:register
'
);
Strophe
.
addNamespace
(
'
REGISTER
'
,
'
jabber:iq:register
'
);
...
...
src/converse-roomslist.js
View file @
6ef0536e
...
@@ -10,15 +10,15 @@
...
@@ -10,15 +10,15 @@
* rooms in the "Rooms Panel" of the ControlBox.
* rooms in the "Rooms Panel" of the ControlBox.
*/
*/
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
utils
"
,
define
([
"
jquery.noconflict
"
,
"
utils
"
,
"
converse-core
"
,
"
converse-core
"
,
"
converse-muc
"
,
"
converse-muc
"
,
"
tpl!rooms_list
"
,
"
tpl!rooms_list
"
,
"
tpl!rooms_list_item
"
"
tpl!rooms_list_item
"
],
factory
);
],
factory
);
}(
this
,
function
(
utils
,
converse
,
muc
,
tpl_rooms_list
,
tpl_rooms_list_item
)
{
}(
this
,
function
(
$
,
utils
,
converse
,
muc
,
tpl_rooms_list
,
tpl_rooms_list_item
)
{
const
$
=
converse
.
env
.
jQuery
,
const
{
Backbone
,
Promise
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
{
Backbone
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-roomslist
'
,
{
converse
.
plugins
.
add
(
'
converse-roomslist
'
,
{
initialize
()
{
initialize
()
{
...
@@ -161,15 +161,18 @@
...
@@ -161,15 +161,18 @@
);
);
};
};
$
.
when
(
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
Promise
.
all
([
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)).
then
(
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
function
()
{
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)
if
(
_converse
.
allow_bookmarks
)
{
]).
then
(()
=>
{
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
).
then
(
initRoomsListView
);
if
(
_converse
.
allow_bookmarks
)
{
}
else
{
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
).
then
(
initRoomsListView
();
initRoomsListView
}
);
});
}
else
{
initRoomsListView
();
}
});
const
afterReconnection
=
function
()
{
const
afterReconnection
=
function
()
{
if
(
_
.
isUndefined
(
_converse
.
rooms_list_view
))
{
if
(
_
.
isUndefined
(
_converse
.
rooms_list_view
))
{
...
...
src/converse-rosterview.js
View file @
6ef0536e
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
/*global define */
/*global define */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!group_header
"
,
"
tpl!group_header
"
,
"
tpl!pending_contact
"
,
"
tpl!pending_contact
"
,
"
tpl!requesting_contact
"
,
"
tpl!requesting_contact
"
,
...
@@ -16,6 +17,7 @@
...
@@ -16,6 +17,7 @@
"
tpl!roster_item
"
"
tpl!roster_item
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
converse
,
converse
,
tpl_group_header
,
tpl_group_header
,
tpl_pending_contact
,
tpl_pending_contact
,
...
@@ -24,8 +26,7 @@
...
@@ -24,8 +26,7 @@
tpl_roster_filter
,
tpl_roster_filter
,
tpl_roster_item
)
{
tpl_roster_item
)
{
"
use strict
"
;
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
const
{
Backbone
,
utils
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
{
Backbone
,
utils
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-rosterview
'
,
{
converse
.
plugins
.
add
(
'
converse-rosterview
'
,
{
...
...
src/converse-vcard.js
View file @
6ef0536e
...
@@ -7,11 +7,10 @@
...
@@ -7,11 +7,10 @@
/*global define */
/*global define */
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
"
strophe.vcard
"
],
factory
);
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
strophe.vcard
"
],
factory
);
}(
this
,
function
(
converse
)
{
}(
this
,
function
(
$
,
converse
)
{
"
use strict
"
;
"
use strict
"
;
const
{
Strophe
,
_
,
moment
}
=
converse
.
env
,
const
{
Strophe
,
_
,
moment
}
=
converse
.
env
;
$
=
converse
.
env
.
jQuery
;
converse
.
plugins
.
add
(
'
converse-vcard
'
,
{
converse
.
plugins
.
add
(
'
converse-vcard
'
,
{
...
...
src/utils.js
View file @
6ef0536e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
define
([
define
([
"
jquery.noconflict
"
,
"
jquery.noconflict
"
,
"
sizzle
"
,
"
sizzle
"
,
"
es6-promise
"
,
"
jquery.browser
"
,
"
jquery.browser
"
,
"
lodash.noconflict
"
,
"
lodash.noconflict
"
,
"
locales
"
,
"
locales
"
,
...
@@ -18,7 +19,9 @@
...
@@ -18,7 +19,9 @@
"
tpl!form_captcha
"
"
tpl!form_captcha
"
],
factory
);
],
factory
);
}(
this
,
function
(
}(
this
,
function
(
$
,
sizzle
,
dummy
,
_
,
$
,
sizzle
,
Promise
,
dummy
,
_
,
locales
,
locales
,
moment
,
moment
,
Strophe
,
Strophe
,
...
@@ -524,7 +527,16 @@
...
@@ -524,7 +527,16 @@
utils
.
isPersistableModel
=
function
(
model
)
{
utils
.
isPersistableModel
=
function
(
model
)
{
return
model
.
collection
&&
model
.
collection
.
browserStorage
;
return
model
.
collection
&&
model
.
collection
.
browserStorage
;
}
};
utils
.
getWrappedPromise
=
function
()
{
const
wrapper
=
{};
wrapper
.
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
wrapper
.
resolve
=
resolve
;
wrapper
.
reject
=
reject
;
})
return
wrapper
;
};
utils
.
safeSave
=
function
(
model
,
attributes
)
{
utils
.
safeSave
=
function
(
model
,
attributes
)
{
if
(
utils
.
isPersistableModel
(
model
))
{
if
(
utils
.
isPersistableModel
(
model
))
{
...
...
tests/mock.js
View file @
6ef0536e
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
(
"
mock
"
,
[
'
converse
'
],
factory
);
define
(
"
mock
"
,
[
'
jquery.noconflict
'
,
'
converse
'
],
factory
);
}(
this
,
function
(
converse_api
)
{
}(
this
,
function
(
$
,
converse_api
)
{
var
_
=
converse_api
.
env
.
_
;
var
_
=
converse_api
.
env
.
_
;
var
Strophe
=
converse_api
.
env
.
Strophe
;
var
Strophe
=
converse_api
.
env
.
Strophe
;
var
$iq
=
converse_api
.
env
.
$iq
;
var
$iq
=
converse_api
.
env
.
$iq
;
...
@@ -101,6 +101,7 @@
...
@@ -101,6 +101,7 @@
'
debug
'
:
false
'
debug
'
:
false
},
settings
||
{}));
},
settings
||
{}));
converse
.
ChatBoxViews
.
prototype
.
trimChat
=
function
()
{};
converse
.
ChatBoxViews
.
prototype
.
trimChat
=
function
()
{};
$
.
fx
.
off
=
true
;
return
converse
;
return
converse
;
}
}
...
...
tests/utils.js
View file @
6ef0536e
(
function
(
root
,
factory
)
{
(
function
(
root
,
factory
)
{
define
([
'
converse
'
,
'
es6-promise
'
,
'
mock
'
,
'
wait-until-promise
'
],
factory
);
define
([
'
jquery.noconflict
'
,
'
converse
'
,
'
es6-promise
'
,
'
mock
'
,
'
wait-until-promise
'
],
factory
);
}(
this
,
function
(
converse_api
,
Promise
,
mock
,
waitUntilPromise
)
{
}(
this
,
function
(
$
,
converse_api
,
Promise
,
mock
,
waitUntilPromise
)
{
var
_
=
converse_api
.
env
.
_
;
var
_
=
converse_api
.
env
.
_
;
var
$
=
converse_api
.
env
.
jQuery
;
var
$msg
=
converse_api
.
env
.
$msg
;
var
$msg
=
converse_api
.
env
.
$msg
;
var
$pres
=
converse_api
.
env
.
$pres
;
var
$pres
=
converse_api
.
env
.
$pres
;
var
$iq
=
converse_api
.
env
.
$iq
;
var
$iq
=
converse_api
.
env
.
$iq
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment