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
f8977035
Commit
f8977035
authored
Mar 29, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `emit` to `trigger` for consistency with Backbone.Events
parent
f6335dca
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
318 additions
and
292 deletions
+318
-292
docs/source/developer_api.rst
docs/source/developer_api.rst
+2
-2
docs/source/plugin_development.rst
docs/source/plugin_development.rst
+1
-1
spec/bookmarks.js
spec/bookmarks.js
+2
-2
spec/chatbox.js
spec/chatbox.js
+37
-37
spec/controlbox.js
spec/controlbox.js
+8
-8
spec/converse.js
spec/converse.js
+2
-2
spec/disco.js
spec/disco.js
+4
-4
spec/eventemitter.js
spec/eventemitter.js
+9
-9
spec/http-file-upload.js
spec/http-file-upload.js
+4
-4
spec/messages.js
spec/messages.js
+31
-31
spec/minchats.js
spec/minchats.js
+3
-3
spec/muc.js
spec/muc.js
+15
-15
spec/notification.js
spec/notification.js
+1
-1
spec/omemo.js
spec/omemo.js
+7
-7
spec/ping.js
spec/ping.js
+2
-2
spec/protocol.js
spec/protocol.js
+2
-2
spec/roster.js
spec/roster.js
+3
-3
spec/user-details-modal.js
spec/user-details-modal.js
+2
-2
src/converse-bookmarks.js
src/converse-bookmarks.js
+1
-1
src/converse-chatboxviews.js
src/converse-chatboxviews.js
+1
-1
src/converse-chatview.js
src/converse-chatview.js
+12
-12
src/converse-controlbox.js
src/converse-controlbox.js
+4
-4
src/converse-headline.js
src/converse-headline.js
+3
-3
src/converse-minimize.js
src/converse-minimize.js
+4
-4
src/converse-muc-views.js
src/converse-muc-views.js
+2
-2
src/converse-notification.js
src/converse-notification.js
+1
-1
src/converse-omemo.js
src/converse-omemo.js
+1
-1
src/converse-profile.js
src/converse-profile.js
+1
-1
src/converse-roomslist.js
src/converse-roomslist.js
+1
-1
src/converse-rosterview.js
src/converse-rosterview.js
+1
-1
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+4
-4
src/headless/converse-core.js
src/headless/converse-core.js
+53
-38
src/headless/converse-disco.js
src/headless/converse-disco.js
+5
-5
src/headless/converse-muc.js
src/headless/converse-muc.js
+4
-4
src/headless/converse-roster.js
src/headless/converse-roster.js
+11
-11
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+74
-63
No files found.
docs/source/developer_api.rst
View file @
f8977035
...
@@ -141,7 +141,7 @@ For example:
...
@@ -141,7 +141,7 @@ For example:
.. code-block:: javascript
.. code-block:: javascript
_converse.api.
emit
('foo-completed');
_converse.api.
trigger
('foo-completed');
Additionally, if a promise has been registered under the same name
Additionally, if a promise has been registered under the same name
(via ``_converse.api.promises.add``), then that promise will also be resolved
(via ``_converse.api.promises.add``), then that promise will also be resolved
...
@@ -1152,7 +1152,7 @@ For example:
...
@@ -1152,7 +1152,7 @@ For example:
.. code-block:: javascript
.. code-block:: javascript
_converse.api.
emit
('foo-completed');
_converse.api.
trigger
('foo-completed');
The **settings** grouping
The **settings** grouping
...
...
docs/source/plugin_development.rst
View file @
f8977035
...
@@ -446,7 +446,7 @@ generated by `generator-conversejs <https://github.com/jcbrand/generator-convers
...
@@ -446,7 +446,7 @@ generated by `generator-conversejs <https://github.com/jcbrand/generator-convers
* emit an event with the same name as the promise.
* emit an event with the same name as the promise.
* For example:
* For example:
*
*
* _converse.api.
emit
('operationCompleted');
* _converse.api.
trigger
('operationCompleted');
*
*
* Other plugins can then either listen for the event
* Other plugins can then either listen for the event
* `operationCompleted` like so:
* `operationCompleted` like so:
...
...
spec/bookmarks.js
View file @
f8977035
...
@@ -330,7 +330,7 @@
...
@@ -330,7 +330,7 @@
);
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
bookmarks
);
await
test_utils
.
waitUntil
(()
=>
_converse
.
bookmarks
);
// Emit here instead of mocking fetching of bookmarks.
// Emit here instead of mocking fetching of bookmarks.
_converse
.
emit
(
'
bookmarksInitialized
'
);
_converse
.
api
.
trigger
(
'
bookmarksInitialized
'
);
/* The stored data is automatically pushed to all of the user's
/* The stored data is automatically pushed to all of the user's
* connected resources.
* connected resources.
...
@@ -638,7 +638,7 @@
...
@@ -638,7 +638,7 @@
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
(
_converse
.
bookmarksview
=
new
_converse
.
BookmarksView
(
{
'
model
'
:
_converse
.
bookmarks
}
{
'
model
'
:
_converse
.
bookmarks
}
);
);
_converse
.
emit
(
'
bookmarksInitialized
'
);
_converse
.
api
.
trigger
(
'
bookmarksInitialized
'
);
// Check that it's there
// Check that it's there
_converse
.
bookmarks
.
create
({
_converse
.
bookmarks
.
create
({
...
...
spec/chatbox.js
View file @
f8977035
This diff is collapsed.
Click to expand it.
spec/controlbox.js
View file @
f8977035
...
@@ -23,13 +23,13 @@
...
@@ -23,13 +23,13 @@
expect
(
u
.
isVisible
(
el
)).
toBe
(
false
);
expect
(
u
.
isVisible
(
el
)).
toBe
(
false
);
spyOn
(
_converse
.
controlboxtoggle
,
'
onClick
'
).
and
.
callThrough
();
spyOn
(
_converse
.
controlboxtoggle
,
'
onClick
'
).
and
.
callThrough
();
spyOn
(
_converse
.
controlboxtoggle
,
'
showControlBox
'
).
and
.
callThrough
();
spyOn
(
_converse
.
controlboxtoggle
,
'
showControlBox
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
// Redelegate so that the spies are now registered as the event handlers (specifically for 'onClick')
// Redelegate so that the spies are now registered as the event handlers (specifically for 'onClick')
_converse
.
controlboxtoggle
.
delegateEvents
();
_converse
.
controlboxtoggle
.
delegateEvents
();
document
.
querySelector
(
'
.toggle-controlbox
'
).
click
();
document
.
querySelector
(
'
.toggle-controlbox
'
).
click
();
expect
(
_converse
.
controlboxtoggle
.
onClick
).
toHaveBeenCalled
();
expect
(
_converse
.
controlboxtoggle
.
onClick
).
toHaveBeenCalled
();
expect
(
_converse
.
controlboxtoggle
.
showControlBox
).
toHaveBeenCalled
();
expect
(
_converse
.
controlboxtoggle
.
showControlBox
).
toHaveBeenCalled
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
controlBoxOpened
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
controlBoxOpened
'
,
jasmine
.
any
(
Object
));
el
=
document
.
querySelector
(
"
div#controlbox
"
);
el
=
document
.
querySelector
(
"
div#controlbox
"
);
expect
(
u
.
isVisible
(
el
)).
toBe
(
true
);
expect
(
u
.
isVisible
(
el
)).
toBe
(
true
);
done
();
done
();
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
spyOn
(
_converse
.
rosterview
,
'
update
'
).
and
.
callThrough
();
spyOn
(
_converse
.
rosterview
,
'
update
'
).
and
.
callThrough
();
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
// Adding two contacts one with Capital initials and one with small initials of same JID (Case sensitive check)
// Adding two contacts one with Capital initials and one with small initials of same JID (Case sensitive check)
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
all
'
).
openControlBox
();
test_utils
.
createContacts
(
_converse
,
'
all
'
).
openControlBox
();
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
sender_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
sender_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
sender_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
sender_jid
);
...
@@ -140,11 +140,11 @@
...
@@ -140,11 +140,11 @@
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
const
view
=
_converse
.
xmppstatusview
;
const
view
=
_converse
.
xmppstatusview
;
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
modal
.
el
.
querySelector
(
'
label[for="radio-busy"]
'
).
click
();
// Change status to "dnd"
modal
.
el
.
querySelector
(
'
label[for="radio-busy"]
'
).
click
();
// Change status to "dnd"
modal
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
statusChanged
'
,
'
dnd
'
);
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
statusChanged
'
,
'
dnd
'
);
const
first_child
=
view
.
el
.
querySelector
(
'
.xmpp-status span:first-child
'
);
const
first_child
=
view
.
el
.
querySelector
(
'
.xmpp-status span:first-child
'
);
expect
(
u
.
hasClass
(
'
online
'
,
first_child
)).
toBe
(
false
);
expect
(
u
.
hasClass
(
'
online
'
,
first_child
)).
toBe
(
false
);
expect
(
u
.
hasClass
(
'
dnd
'
,
first_child
)).
toBe
(
true
);
expect
(
u
.
hasClass
(
'
dnd
'
,
first_child
)).
toBe
(
true
);
...
@@ -165,13 +165,13 @@
...
@@ -165,13 +165,13 @@
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
modal
.
el
),
1000
);
const
view
=
_converse
.
xmppstatusview
;
const
view
=
_converse
.
xmppstatusview
;
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
const
msg
=
'
I am happy
'
;
const
msg
=
'
I am happy
'
;
modal
.
el
.
querySelector
(
'
input[name="status_message"]
'
).
value
=
msg
;
modal
.
el
.
querySelector
(
'
input[name="status_message"]
'
).
value
=
msg
;
modal
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
statusMessageChanged
'
,
msg
);
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
statusMessageChanged
'
,
msg
);
const
first_child
=
view
.
el
.
querySelector
(
'
.xmpp-status span:first-child
'
);
const
first_child
=
view
.
el
.
querySelector
(
'
.xmpp-status span:first-child
'
);
expect
(
u
.
hasClass
(
'
online
'
,
first_child
)).
toBe
(
true
);
expect
(
u
.
hasClass
(
'
online
'
,
first_child
)).
toBe
(
true
);
expect
(
view
.
el
.
querySelector
(
'
.xmpp-status span:first-child
'
).
textContent
.
trim
()).
toBe
(
msg
);
expect
(
view
.
el
.
querySelector
(
'
.xmpp-status span:first-child
'
).
textContent
.
trim
()).
toBe
(
msg
);
...
...
spec/converse.js
View file @
f8977035
...
@@ -288,7 +288,7 @@
...
@@ -288,7 +288,7 @@
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
test_utils
.
createContacts
(
_converse
,
'
current
'
,
2
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
2
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
// Test on chat that doesn't exist.
// Test on chat that doesn't exist.
expect
(
_converse
.
api
.
chats
.
get
(
'
non-existing@jabber.org
'
)).
toBeFalsy
();
expect
(
_converse
.
api
.
chats
.
get
(
'
non-existing@jabber.org
'
)).
toBeFalsy
();
...
@@ -325,7 +325,7 @@
...
@@ -325,7 +325,7 @@
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
test_utils
.
createContacts
(
_converse
,
'
current
'
,
2
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
2
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
jid2
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
jid2
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
...
...
spec/disco.js
View file @
f8977035
...
@@ -187,11 +187,11 @@
...
@@ -187,11 +187,11 @@
null
,
[
'
discoInitialized
'
],
{},
null
,
[
'
discoInitialized
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
sinon
.
spy
(
_converse
,
'
emit
'
);
sinon
.
spy
(
_converse
.
api
,
"
trigger
"
);
_converse
.
disco_entities
.
get
(
_converse
.
domain
).
features
.
create
({
'
var
'
:
Strophe
.
NS
.
MAM
});
_converse
.
disco_entities
.
get
(
_converse
.
domain
).
features
.
create
({
'
var
'
:
Strophe
.
NS
.
MAM
});
expect
(
_converse
.
emit
.
called
).
toBe
(
true
);
expect
(
_converse
.
api
.
trigger
.
called
).
toBe
(
true
);
expect
(
_converse
.
emit
.
args
[
0
][
0
]).
toBe
(
'
serviceDiscovered
'
);
expect
(
_converse
.
api
.
trigger
.
args
[
0
][
0
]).
toBe
(
'
serviceDiscovered
'
);
expect
(
_converse
.
emit
.
args
[
0
][
1
].
get
(
'
var
'
)).
toBe
(
Strophe
.
NS
.
MAM
);
expect
(
_converse
.
api
.
trigger
.
args
[
0
][
1
].
get
(
'
var
'
)).
toBe
(
Strophe
.
NS
.
MAM
);
done
();
done
();
}));
}));
});
});
...
...
spec/eventemitter.js
View file @
f8977035
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
this
.
callback
=
function
()
{};
this
.
callback
=
function
()
{};
spyOn
(
this
,
'
callback
'
);
spyOn
(
this
,
'
callback
'
);
_converse
.
on
(
'
connected
'
,
this
.
callback
);
_converse
.
on
(
'
connected
'
,
this
.
callback
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
).
toHaveBeenCalled
();
expect
(
this
.
callback
).
toHaveBeenCalled
();
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
.
calls
.
count
(),
2
);
expect
(
this
.
callback
.
calls
.
count
(),
2
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
.
calls
.
count
(),
3
);
expect
(
this
.
callback
.
calls
.
count
(),
3
);
done
();
done
();
}));
}));
...
@@ -21,11 +21,11 @@
...
@@ -21,11 +21,11 @@
this
.
callback
=
function
()
{};
this
.
callback
=
function
()
{};
spyOn
(
this
,
'
callback
'
);
spyOn
(
this
,
'
callback
'
);
_converse
.
once
(
'
connected
'
,
this
.
callback
);
_converse
.
once
(
'
connected
'
,
this
.
callback
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
).
toHaveBeenCalled
();
expect
(
this
.
callback
).
toHaveBeenCalled
();
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
done
();
done
();
}));
}));
...
@@ -41,20 +41,20 @@
...
@@ -41,20 +41,20 @@
_converse
.
on
(
'
connected
'
,
this
.
callback
);
_converse
.
on
(
'
connected
'
,
this
.
callback
);
_converse
.
on
(
'
connected
'
,
this
.
anotherCallback
);
_converse
.
on
(
'
connected
'
,
this
.
anotherCallback
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
).
toHaveBeenCalled
();
expect
(
this
.
callback
).
toHaveBeenCalled
();
expect
(
this
.
anotherCallback
).
toHaveBeenCalled
();
expect
(
this
.
anotherCallback
).
toHaveBeenCalled
();
_converse
.
off
(
'
connected
'
,
this
.
callback
);
_converse
.
off
(
'
connected
'
,
this
.
callback
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
expect
(
this
.
anotherCallback
.
calls
.
count
(),
2
);
expect
(
this
.
anotherCallback
.
calls
.
count
(),
2
);
_converse
.
once
(
'
connected
'
,
this
.
neverCalled
);
_converse
.
once
(
'
connected
'
,
this
.
neverCalled
);
_converse
.
off
(
'
connected
'
,
this
.
neverCalled
);
_converse
.
off
(
'
connected
'
,
this
.
neverCalled
);
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
expect
(
this
.
callback
.
calls
.
count
(),
1
);
expect
(
this
.
anotherCallback
.
calls
.
count
(),
3
);
expect
(
this
.
anotherCallback
.
calls
.
count
(),
3
);
expect
(
this
.
neverCalled
).
not
.
toHaveBeenCalled
();
expect
(
this
.
neverCalled
).
not
.
toHaveBeenCalled
();
...
...
spec/http-file-upload.js
View file @
f8977035
...
@@ -221,7 +221,7 @@
...
@@ -221,7 +221,7 @@
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
domain
,
[],
[],
[
'
upload.localhost
'
],
'
items
'
)
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
domain
,
[],
[],
[
'
upload.localhost
'
],
'
items
'
)
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
upload.localhost
'
,
[],
[
Strophe
.
NS
.
HTTPUPLOAD
],
[]);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
upload.localhost
'
,
[],
[
Strophe
.
NS
.
HTTPUPLOAD
],
[]);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
3
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
3
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
...
@@ -263,7 +263,7 @@
...
@@ -263,7 +263,7 @@
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
domain
,
[],
[],
[
'
upload.montague.tld
'
],
'
items
'
);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
domain
,
[],
[],
[
'
upload.montague.tld
'
],
'
items
'
);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
upload.montague.tld
'
,
[],
[
Strophe
.
NS
.
HTTPUPLOAD
],
[]);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
upload.montague.tld
'
,
[],
[
Strophe
.
NS
.
HTTPUPLOAD
],
[]);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
...
@@ -555,7 +555,7 @@
...
@@ -555,7 +555,7 @@
expect
(
entities
.
get
(
'
localhost
'
).
items
.
get
(
'
upload.localhost
'
).
identities
.
where
({
'
category
'
:
'
store
'
}).
length
).
toBe
(
1
);
expect
(
entities
.
get
(
'
localhost
'
).
items
.
get
(
'
upload.localhost
'
).
identities
.
where
({
'
category
'
:
'
store
'
}).
length
).
toBe
(
1
);
const
result
=
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
HTTPUPLOAD
,
_converse
.
domain
);
const
result
=
await
_converse
.
api
.
disco
.
supports
(
Strophe
.
NS
.
HTTPUPLOAD
,
_converse
.
domain
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
...
@@ -594,7 +594,7 @@
...
@@ -594,7 +594,7 @@
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
domain
,
[],
[],
[
'
upload.montague.tld
'
],
'
items
'
);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
domain
,
[],
[],
[
'
upload.montague.tld
'
],
'
items
'
);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
upload.montague.tld
'
,
[],
[
Strophe
.
NS
.
HTTPUPLOAD
],
[]);
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
upload.montague.tld
'
,
[],
[
Strophe
.
NS
.
HTTPUPLOAD
],
[]);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
...
...
spec/messages.js
View file @
f8977035
This diff is collapsed.
Click to expand it.
spec/minchats.js
View file @
f8977035
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
_converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
_converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
_converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
_converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
test_utils
.
openControlBox
();
test_utils
.
openControlBox
();
_converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
_converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
...
...
spec/muc.js
View file @
f8977035
...
@@ -1718,7 +1718,7 @@
...
@@ -1718,7 +1718,7 @@
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// We need roster contacts, so that we have someone to invite
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// We need roster contacts, so that we have someone to invite
// Since we don't actually fetch roster contacts, we need to
// Since we don't actually fetch roster contacts, we need to
// cheat here and emit the event.
// cheat here and emit the event.
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
features
=
[
const
features
=
[
'
http://jabber.org/protocol/muc
'
,
'
http://jabber.org/protocol/muc
'
,
...
@@ -1731,7 +1731,7 @@
...
@@ -1731,7 +1731,7 @@
'
muc_anonymous
'
'
muc_anonymous
'
]
]
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
,
features
);
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
,
features
);
spyOn
(
_converse
,
'
emit
'
).
and
.
callThrough
();
spyOn
(
_converse
.
api
,
"
trigger
"
).
and
.
callThrough
();
spyOn
(
window
,
'
prompt
'
).
and
.
callFake
(()
=>
"
Please join!
"
);
spyOn
(
window
,
'
prompt
'
).
and
.
callFake
(()
=>
"
Please join!
"
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
chat_area
=
view
.
el
.
querySelector
(
'
.chat-area
'
);
const
chat_area
=
view
.
el
.
querySelector
(
'
.chat-area
'
);
...
@@ -1819,7 +1819,7 @@
...
@@ -1819,7 +1819,7 @@
const
text
=
'
This is a received message
'
;
const
text
=
'
This is a received message
'
;
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
if
(
!
view
.
el
.
querySelectorAll
(
'
.chat-area
'
).
length
)
{
if
(
!
view
.
el
.
querySelectorAll
(
'
.chat-area
'
).
length
)
{
view
.
renderChatArea
();
view
.
renderChatArea
();
...
@@ -1841,7 +1841,7 @@
...
@@ -1841,7 +1841,7 @@
const
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
const
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
expect
(
chat_content
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
1
);
expect
(
chat_content
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
1
);
expect
(
chat_content
.
querySelector
(
'
.chat-msg__text
'
).
textContent
).
toBe
(
text
);
expect
(
chat_content
.
querySelector
(
'
.chat-msg__text
'
).
textContent
).
toBe
(
text
);
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
message
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
message
'
,
jasmine
.
any
(
Object
));
done
();
done
();
}));
}));
...
@@ -1851,7 +1851,7 @@
...
@@ -1851,7 +1851,7 @@
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
if
(
!
view
.
el
.
querySelectorAll
(
'
.chat-area
'
).
length
)
{
if
(
!
view
.
el
.
querySelectorAll
(
'
.chat-area
'
).
length
)
{
view
.
renderChatArea
();
view
.
renderChatArea
();
...
@@ -1866,7 +1866,7 @@
...
@@ -1866,7 +1866,7 @@
});
});
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
await
new
Promise
((
resolve
,
reject
)
=>
view
.
once
(
'
messageInserted
'
,
resolve
));
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
messageSend
'
,
text
);
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
messageSend
'
,
text
);
const
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
const
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
expect
(
chat_content
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
1
);
expect
(
chat_content
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
1
);
...
@@ -1888,7 +1888,7 @@
...
@@ -1888,7 +1888,7 @@
expect
(
sizzle
(
'
.chat-msg__text:last
'
).
pop
().
textContent
).
toBe
(
text
);
expect
(
sizzle
(
'
.chat-msg__text:last
'
).
pop
().
textContent
).
toBe
(
text
);
expect
(
view
.
model
.
messages
.
length
).
toBe
(
1
);
expect
(
view
.
model
.
messages
.
length
).
toBe
(
1
);
// We don't emit an event if it's our own message
// We don't emit an event if it's our own message
expect
(
_converse
.
emit
.
calls
.
count
(),
1
);
expect
(
_converse
.
api
.
trigger
.
calls
.
count
(),
1
);
done
();
done
();
}));
}));
...
@@ -2505,12 +2505,12 @@
...
@@ -2505,12 +2505,12 @@
spyOn
(
view
,
'
minimize
'
).
and
.
callThrough
();
spyOn
(
view
,
'
minimize
'
).
and
.
callThrough
();
spyOn
(
view
,
'
maximize
'
).
and
.
callThrough
();
spyOn
(
view
,
'
maximize
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
view
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
).
click
();
view
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
).
click
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxMinimized
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
chatBoxMinimized
'
,
jasmine
.
any
(
Object
));
expect
(
u
.
isVisible
(
view
.
el
)).
toBeFalsy
();
expect
(
u
.
isVisible
(
view
.
el
)).
toBeFalsy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
...
@@ -2518,9 +2518,9 @@
...
@@ -2518,9 +2518,9 @@
const
trimmedview
=
trimmed_chatboxes
.
get
(
view
.
model
.
get
(
'
id
'
));
const
trimmedview
=
trimmed_chatboxes
.
get
(
view
.
model
.
get
(
'
id
'
));
trimmedview
.
el
.
querySelector
(
"
a.restore-chat
"
).
click
();
trimmedview
.
el
.
querySelector
(
"
a.restore-chat
"
).
click
();
expect
(
view
.
maximize
).
toHaveBeenCalled
();
expect
(
view
.
maximize
).
toHaveBeenCalled
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxMaximized
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
chatBoxMaximized
'
,
jasmine
.
any
(
Object
));
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
expect
(
_converse
.
emit
.
calls
.
count
(),
3
);
expect
(
_converse
.
api
.
trigger
.
calls
.
count
(),
3
);
done
();
done
();
}));
}));
...
@@ -2533,13 +2533,13 @@
...
@@ -2533,13 +2533,13 @@
await
test_utils
.
openChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
await
test_utils
.
openChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
spyOn
(
view
,
'
close
'
).
and
.
callThrough
();
spyOn
(
view
,
'
close
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
spyOn
(
view
.
model
,
'
leave
'
);
spyOn
(
view
.
model
,
'
leave
'
);
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
view
.
el
.
querySelector
(
'
.close-chatbox-button
'
).
click
();
view
.
el
.
querySelector
(
'
.close-chatbox-button
'
).
click
();
expect
(
view
.
close
).
toHaveBeenCalled
();
expect
(
view
.
close
).
toHaveBeenCalled
();
expect
(
view
.
model
.
leave
).
toHaveBeenCalled
();
expect
(
view
.
model
.
leave
).
toHaveBeenCalled
();
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxClosed
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
chatBoxClosed
'
,
jasmine
.
any
(
Object
));
done
();
done
();
}));
}));
});
});
...
@@ -3422,12 +3422,12 @@
...
@@ -3422,12 +3422,12 @@
'
from
'
:
view
.
model
.
get
(
'
jid
'
),
'
from
'
:
view
.
model
.
get
(
'
jid
'
),
'
to
'
:
_converse
.
connection
.
jid
'
to
'
:
_converse
.
connection
.
jid
});
});
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
2
);
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
2
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
result_stanza
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
result_stanza
));
await
test_utils
.
waitUntil
(()
=>
(
view
.
model
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
DISCONNECTED
));
await
test_utils
.
waitUntil
(()
=>
(
view
.
model
.
get
(
'
connection_status
'
)
===
converse
.
ROOMSTATUS
.
DISCONNECTED
));
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
1
);
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
1
);
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
chatBoxClosed
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
chatBoxClosed
'
,
jasmine
.
any
(
Object
));
done
();
done
();
}));
}));
});
});
...
...
spec/notification.js
View file @
f8977035
...
@@ -156,7 +156,7 @@
...
@@ -156,7 +156,7 @@
it
(
"
an HTML5 Notification is received
"
,
mock
.
initConverse
((
done
,
_converse
)
=>
{
it
(
"
an HTML5 Notification is received
"
,
mock
.
initConverse
((
done
,
_converse
)
=>
{
spyOn
(
_converse
,
'
areDesktopNotificationsEnabled
'
).
and
.
returnValue
(
true
);
spyOn
(
_converse
,
'
areDesktopNotificationsEnabled
'
).
and
.
returnValue
(
true
);
spyOn
(
_converse
,
'
showContactRequestNotification
'
);
spyOn
(
_converse
,
'
showContactRequestNotification
'
);
_converse
.
emit
(
'
contactRequest
'
,
{
'
fullname
'
:
'
Peter Parker
'
,
'
jid
'
:
'
peter@parker.com
'
});
_converse
.
api
.
trigger
(
'
contactRequest
'
,
{
'
fullname
'
:
'
Peter Parker
'
,
'
jid
'
:
'
peter@parker.com
'
});
expect
(
_converse
.
areDesktopNotificationsEnabled
).
toHaveBeenCalled
();
expect
(
_converse
.
areDesktopNotificationsEnabled
).
toHaveBeenCalled
();
expect
(
_converse
.
showContactRequestNotification
).
toHaveBeenCalled
();
expect
(
_converse
.
showContactRequestNotification
).
toHaveBeenCalled
();
done
();
done
();
...
...
spec/omemo.js
View file @
f8977035
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
const
message
=
'
This message will be encrypted
'
const
message
=
'
This message will be encrypted
'
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
view
=
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
const
view
=
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
const
payload
=
await
view
.
model
.
encryptMessage
(
message
);
const
payload
=
await
view
.
model
.
encryptMessage
(
message
);
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
let
sent_stanza
;
let
sent_stanza
;
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
waitUntil
(()
=>
initializedOMEMO
(
_converse
));
await
test_utils
.
waitUntil
(()
=>
initializedOMEMO
(
_converse
));
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
...
@@ -513,7 +513,7 @@
...
@@ -513,7 +513,7 @@
_converse
.
NUM_PREKEYS
=
5
;
// Restrict to 5, otherwise the resulting stanza is too large to easily test
_converse
.
NUM_PREKEYS
=
5
;
// Restrict to 5, otherwise the resulting stanza is too large to easily test
let
view
,
sent_stanza
;
let
view
,
sent_stanza
;
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
waitUntil
(()
=>
initializedOMEMO
(
_converse
));
await
test_utils
.
waitUntil
(()
=>
initializedOMEMO
(
_converse
));
...
@@ -934,7 +934,7 @@
...
@@ -934,7 +934,7 @@
_converse
.
NUM_PREKEYS
=
2
;
// Restrict to 2, otherwise the resulting stanza is too large to easily test
_converse
.
NUM_PREKEYS
=
2
;
// Restrict to 2, otherwise the resulting stanza is too large to easily test
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
let
iq_stanza
=
await
test_utils
.
waitUntil
(()
=>
deviceListFetched
(
_converse
,
_converse
.
bare_jid
));
let
iq_stanza
=
await
test_utils
.
waitUntil
(()
=>
deviceListFetched
(
_converse
,
_converse
.
bare_jid
));
let
stanza
=
$iq
({
let
stanza
=
$iq
({
...
@@ -1011,7 +1011,7 @@
...
@@ -1011,7 +1011,7 @@
);
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
let
iq_stanza
=
await
test_utils
.
waitUntil
(()
=>
deviceListFetched
(
_converse
,
_converse
.
bare_jid
));
let
iq_stanza
=
await
test_utils
.
waitUntil
(()
=>
deviceListFetched
(
_converse
,
_converse
.
bare_jid
));
...
@@ -1358,11 +1358,11 @@
...
@@ -1358,11 +1358,11 @@
);
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
test_utils
.
createContacts
(
_converse
,
'
current
'
,
1
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
// We simply emit, to avoid doing all the setup work
// We simply emit, to avoid doing all the setup work
_converse
.
emit
(
'
OMEMOInitialized
'
);
_converse
.
api
.
trigger
(
'
OMEMOInitialized
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
const
show_modal_button
=
view
.
el
.
querySelector
(
'
.show-user-details-modal
'
);
const
show_modal_button
=
view
.
el
.
querySelector
(
'
.show-user-details-modal
'
);
...
...
spec/ping.js
View file @
f8977035
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
spyOn
(
_converse
,
'
registerPingHandler
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
registerPingHandler
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
registerPongHandler
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
registerPongHandler
'
).
and
.
callThrough
();
_converse
.
emit
(
'
connected
'
);
_converse
.
api
.
trigger
(
'
connected
'
);
expect
(
_converse
.
registerPingHandler
).
toHaveBeenCalled
();
expect
(
_converse
.
registerPingHandler
).
toHaveBeenCalled
();
expect
(
_converse
.
registerPongHandler
).
toHaveBeenCalled
();
expect
(
_converse
.
registerPongHandler
).
toHaveBeenCalled
();
done
();
done
();
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
spyOn
(
_converse
,
'
registerPingHandler
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
registerPingHandler
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
registerPongHandler
'
).
and
.
callThrough
();
spyOn
(
_converse
,
'
registerPongHandler
'
).
and
.
callThrough
();
_converse
.
emit
(
'
reconnected
'
);
_converse
.
api
.
trigger
(
'
reconnected
'
);
expect
(
_converse
.
registerPingHandler
).
toHaveBeenCalled
();
expect
(
_converse
.
registerPingHandler
).
toHaveBeenCalled
();
expect
(
_converse
.
registerPongHandler
).
toHaveBeenCalled
();
expect
(
_converse
.
registerPongHandler
).
toHaveBeenCalled
();
done
();
done
();
...
...
spec/protocol.js
View file @
f8977035
...
@@ -517,7 +517,7 @@
...
@@ -517,7 +517,7 @@
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
spyOn
(
_converse
,
"
emit
"
);
spyOn
(
_converse
.
api
,
"
trigger
"
);
test_utils
.
openControlBox
(
_converse
);
test_utils
.
openControlBox
(
_converse
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// Create some contacts so that we can test positioning
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// Create some contacts so that we can test positioning
/* <presence
/* <presence
...
@@ -538,7 +538,7 @@
...
@@ -538,7 +538,7 @@
var
$contacts
=
$header
.
parent
().
find
(
'
li:visible
'
);
var
$contacts
=
$header
.
parent
().
find
(
'
li:visible
'
);
return
$contacts
.
length
;
return
$contacts
.
length
;
},
600
).
then
(
function
()
{
},
600
).
then
(
function
()
{
expect
(
_converse
.
emit
).
toHaveBeenCalledWith
(
'
contactRequest
'
,
jasmine
.
any
(
Object
));
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
contactRequest
'
,
jasmine
.
any
(
Object
));
var
$header
=
$
(
'
a:contains("Contact requests")
'
);
var
$header
=
$
(
'
a:contains("Contact requests")
'
);
expect
(
$header
.
length
).
toBe
(
1
);
expect
(
$header
.
length
).
toBe
(
1
);
expect
(
$header
.
is
(
"
:visible
"
)).
toBeTruthy
();
expect
(
$header
.
is
(
"
:visible
"
)).
toBeTruthy
();
...
...
spec/roster.js
View file @
f8977035
...
@@ -36,10 +36,10 @@
...
@@ -36,10 +36,10 @@
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
const
IQs
=
_converse
.
connection
.
IQ_stanzas
;
const
IQs
=
_converse
.
connection
.
IQ_stanzas
;
await
test_utils
.
waitUntil
(()
=>
_converse
.
emit
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterGroupsFetched
'
));
await
test_utils
.
waitUntil
(()
=>
_converse
.
api
.
trigger
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterGroupsFetched
'
));
const
node
=
await
test_utils
.
waitUntil
(
const
node
=
await
test_utils
.
waitUntil
(
()
=>
_
.
filter
(
IQs
,
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq query[xmlns="jabber:iq:roster"]
'
)).
pop
());
()
=>
_
.
filter
(
IQs
,
iq
=>
iq
.
nodeTree
.
querySelector
(
'
iq query[xmlns="jabber:iq:roster"]
'
)).
pop
());
expect
(
_converse
.
emit
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterContactsFetched
'
)).
toBeFalsy
();
expect
(
_converse
.
api
.
trigger
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterContactsFetched
'
)).
toBeFalsy
();
expect
(
node
.
toLocaleString
()).
toBe
(
expect
(
node
.
toLocaleString
()).
toBe
(
`<iq id="
${
node
.
nodeTree
.
getAttribute
(
'
id
'
)}
" type="get" xmlns="jabber:client">`
+
`<iq id="
${
node
.
nodeTree
.
getAttribute
(
'
id
'
)}
" type="get" xmlns="jabber:client">`
+
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
}).
c
(
'
item
'
,
{
'
jid
'
:
'
nurse@example.com
'
}).
up
()
}).
c
(
'
item
'
,
{
'
jid
'
:
'
nurse@example.com
'
}).
up
()
.
c
(
'
item
'
,
{
'
jid
'
:
'
romeo@example.com
'
})
.
c
(
'
item
'
,
{
'
jid
'
:
'
romeo@example.com
'
})
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
result
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
result
));
await
test_utils
.
waitUntil
(()
=>
_converse
.
emit
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterContactsFetched
'
));
await
test_utils
.
waitUntil
(()
=>
_converse
.
api
.
trigger
.
calls
.
all
().
map
(
c
=>
c
.
args
[
0
]).
includes
(
'
rosterContactsFetched
'
));
done
();
done
();
}));
}));
...
...
spec/user-details-modal.js
View file @
f8977035
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
async
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
...
...
src/converse-bookmarks.js
View file @
f8977035
...
@@ -555,7 +555,7 @@ converse.plugins.add('converse-bookmarks', {
...
@@ -555,7 +555,7 @@ converse.plugins.add('converse-bookmarks', {
* @event _converse#bookmarksInitialized
* @event _converse#bookmarksInitialized
* @example _converse.api.listen.on('bookmarksInitialized', () => { ... });
* @example _converse.api.listen.on('bookmarksInitialized', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
bookmarksInitialized
'
);
_converse
.
api
.
trigger
(
'
bookmarksInitialized
'
);
}
}
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
{
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
{
...
...
src/converse-chatboxviews.js
View file @
f8977035
...
@@ -173,7 +173,7 @@ converse.plugins.add('converse-chatboxviews', {
...
@@ -173,7 +173,7 @@ converse.plugins.add('converse-chatboxviews', {
* @event _converse#chatBoxViewsInitialized
* @event _converse#chatBoxViewsInitialized
* @example _converse.api.listen.on('chatBoxViewsInitialized', () => { ... });
* @example _converse.api.listen.on('chatBoxViewsInitialized', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxViewsInitialized
'
);
_converse
.
api
.
trigger
(
'
chatBoxViewsInitialized
'
);
});
});
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
_converse
.
chatboxviews
.
closeAllChatBoxes
());
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
_converse
.
chatboxviews
.
closeAllChatBoxes
());
...
...
src/converse-chatview.js
View file @
f8977035
...
@@ -188,7 +188,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -188,7 +188,7 @@ converse.plugins.add('converse-chatview', {
* @property { string } message - The message text
* @property { string } message - The message text
* @example _converse.api.listen.on('contactStatusMessageChanged', obj => { ... });
* @example _converse.api.listen.on('contactStatusMessageChanged', obj => { ... });
*/
*/
_converse
.
api
.
emit
(
'
contactStatusMessageChanged
'
,
{
_converse
.
api
.
trigger
(
'
contactStatusMessageChanged
'
,
{
'
contact
'
:
item
.
attributes
,
'
contact
'
:
item
.
attributes
,
'
message
'
:
item
.
get
(
'
status
'
)
'
message
'
:
item
.
get
(
'
status
'
)
});
});
...
@@ -215,7 +215,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -215,7 +215,7 @@ converse.plugins.add('converse-chatview', {
* @type { _converse.ChatBox }
* @type { _converse.ChatBox }
* @example _converse.api.listen.on('userDetailsModalInitialized', chatbox => { ... });
* @example _converse.api.listen.on('userDetailsModalInitialized', chatbox => { ... });
*/
*/
_converse
.
api
.
emit
(
'
userDetailsModalInitialized
'
,
this
.
model
);
_converse
.
api
.
trigger
(
'
userDetailsModalInitialized
'
,
this
.
model
);
},
},
toHTML
()
{
toHTML
()
{
...
@@ -336,14 +336,14 @@ converse.plugins.add('converse-chatview', {
...
@@ -336,14 +336,14 @@ converse.plugins.add('converse-chatview', {
this
.
render
();
this
.
render
();
this
.
fetchMessages
();
this
.
fetchMessages
();
_converse
.
api
.
emit
(
'
chatBoxOpened
'
,
this
);
// TODO: remove
_converse
.
api
.
trigger
(
'
chatBoxOpened
'
,
this
);
// TODO: remove
/**
/**
* Triggered once the _converse.ChatBoxView has been initialized
* Triggered once the _converse.ChatBoxView has been initialized
* @event _converse#chatBoxInitialized
* @event _converse#chatBoxInitialized
* @type { _converse.ChatBoxView | _converse.HeadlinesBoxView }
* @type { _converse.ChatBoxView | _converse.HeadlinesBoxView }
* @example _converse.api.listen.on('chatBoxInitialized', view => { ... });
* @example _converse.api.listen.on('chatBoxInitialized', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxInitialized
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxInitialized
'
,
this
);
},
},
initDebounced
()
{
initDebounced
()
{
...
@@ -384,7 +384,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -384,7 +384,7 @@ converse.plugins.add('converse-chatview', {
* @type { _converse.ChatBoxView }
* @type { _converse.ChatBoxView }
* @example _converse.api.listen.on('renderToolbar', view => { ... });
* @example _converse.api.listen.on('renderToolbar', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
renderToolbar
'
,
this
);
_converse
.
api
.
trigger
(
'
renderToolbar
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -525,7 +525,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -525,7 +525,7 @@ converse.plugins.add('converse-chatview', {
* @type {_converse.ChatBoxView | _converse.ChatRoomView}
* @type {_converse.ChatBoxView | _converse.ChatRoomView}
* @example _converse.api.listen.on('afterMessagesFetched', view => { ... });
* @example _converse.api.listen.on('afterMessagesFetched', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
afterMessagesFetched
'
,
this
);
_converse
.
api
.
trigger
(
'
afterMessagesFetched
'
,
this
);
},
},
fetchMessages
()
{
fetchMessages
()
{
...
@@ -840,7 +840,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -840,7 +840,7 @@ converse.plugins.add('converse-chatview', {
* @property { _converse.ChatBox | _converse.ChatRoom } chatbox - The chat model
* @property { _converse.ChatBox | _converse.ChatRoom } chatbox - The chat model
* @example _converse.api.listen.on('messageAdded', data => { ... });
* @example _converse.api.listen.on('messageAdded', data => { ... });
*/
*/
_converse
.
api
.
emit
(
'
messageAdded
'
,
{
_converse
.
api
.
trigger
(
'
messageAdded
'
,
{
'
message
'
:
message
,
'
message
'
:
message
,
'
chatbox
'
:
this
.
model
'
chatbox
'
:
this
.
model
});
});
...
@@ -932,7 +932,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -932,7 +932,7 @@ converse.plugins.add('converse-chatview', {
* @type { _converse.Message }
* @type { _converse.Message }
* @example _converse.api.listen.on('messageSend', data => { ... });
* @example _converse.api.listen.on('messageSend', data => { ... });
*/
*/
_converse
.
api
.
emit
(
'
messageSend
'
,
message
);
_converse
.
api
.
trigger
(
'
messageSend
'
,
message
);
}
}
textarea
.
removeAttribute
(
'
disabled
'
);
textarea
.
removeAttribute
(
'
disabled
'
);
u
.
removeClass
(
'
disabled
'
,
textarea
);
u
.
removeClass
(
'
disabled
'
,
textarea
);
...
@@ -1143,7 +1143,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1143,7 +1143,7 @@ converse.plugins.add('converse-chatview', {
* @property { _converse.ChatBox | _converse.ChatRoom } _converse.connection - The XMPP Connection object
* @property { _converse.ChatBox | _converse.ChatRoom } _converse.connection - The XMPP Connection object
* @example _converse.api.listen.on('callButtonClicked', (connection, model) => { ... });
* @example _converse.api.listen.on('callButtonClicked', (connection, model) => { ... });
*/
*/
_converse
.
api
.
emit
(
'
callButtonClicked
'
,
{
_converse
.
api
.
trigger
(
'
callButtonClicked
'
,
{
connection
:
_converse
.
connection
,
connection
:
_converse
.
connection
,
model
:
this
.
model
model
:
this
.
model
});
});
...
@@ -1230,7 +1230,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1230,7 +1230,7 @@ converse.plugins.add('converse-chatview', {
* @type { _converse.ChatBoxView | _converse.ChatRoomView }
* @type { _converse.ChatBoxView | _converse.ChatRoomView }
* @example _converse.api.listen.on('chatBoxClosed', view => { ... });
* @example _converse.api.listen.on('chatBoxClosed', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxClosed
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxClosed
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -1256,7 +1256,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1256,7 +1256,7 @@ converse.plugins.add('converse-chatview', {
* @type { _converse.ChatBoxView | _converse.ChatRoomView }
* @type { _converse.ChatBoxView | _converse.ChatRoomView }
* @example _converse.api.listen.on('chatBoxFocused', view => { ... });
* @example _converse.api.listen.on('chatBoxFocused', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxFocused
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxFocused
'
,
this
);
}
}
return
this
;
return
this
;
},
},
...
@@ -1346,7 +1346,7 @@ converse.plugins.add('converse-chatview', {
...
@@ -1346,7 +1346,7 @@ converse.plugins.add('converse-chatview', {
* @property { _converse.ChatBox | _converse.ChatRoom } chatbox - The chat model
* @property { _converse.ChatBox | _converse.ChatRoom } chatbox - The chat model
* @example _converse.api.listen.on('chatBoxScrolledDown', obj => { ... });
* @example _converse.api.listen.on('chatBoxScrolledDown', obj => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxScrolledDown
'
,
{
'
chatbox
'
:
this
.
model
});
// TODO: clean up
_converse
.
api
.
trigger
(
'
chatBoxScrolledDown
'
,
{
'
chatbox
'
:
this
.
model
});
// TODO: clean up
},
},
onWindowStateChanged
(
state
)
{
onWindowStateChanged
(
state
)
{
...
...
src/converse-controlbox.js
View file @
f8977035
...
@@ -232,7 +232,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -232,7 +232,7 @@ converse.plugins.add('converse-controlbox', {
* @type { _converse.ControlBoxView }
* @type { _converse.ControlBoxView }
* @example _converse.api.listen.on('controlboxInitialized', view => { ... });
* @example _converse.api.listen.on('controlboxInitialized', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
controlboxInitialized
'
,
this
);
_converse
.
api
.
trigger
(
'
controlboxInitialized
'
,
this
);
},
},
render
()
{
render
()
{
...
@@ -339,7 +339,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -339,7 +339,7 @@ converse.plugins.add('converse-controlbox', {
}
else
{
}
else
{
this
.
model
.
trigger
(
'
hide
'
);
this
.
model
.
trigger
(
'
hide
'
);
}
}
_converse
.
api
.
emit
(
'
controlBoxClosed
'
,
this
);
_converse
.
api
.
trigger
(
'
controlBoxClosed
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -356,7 +356,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -356,7 +356,7 @@ converse.plugins.add('converse-controlbox', {
return
;
return
;
}
}
u
.
addClass
(
'
hidden
'
,
this
.
el
);
u
.
addClass
(
'
hidden
'
,
this
.
el
);
_converse
.
api
.
emit
(
'
chatBoxClosed
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxClosed
'
,
this
);
if
(
!
_converse
.
connection
.
connected
)
{
if
(
!
_converse
.
connection
.
connected
)
{
_converse
.
controlboxtoggle
.
render
();
_converse
.
controlboxtoggle
.
render
();
}
}
...
@@ -367,7 +367,7 @@ converse.plugins.add('converse-controlbox', {
...
@@ -367,7 +367,7 @@ converse.plugins.add('converse-controlbox', {
onControlBoxToggleHidden
()
{
onControlBoxToggleHidden
()
{
this
.
model
.
set
(
'
closed
'
,
false
);
this
.
model
.
set
(
'
closed
'
,
false
);
this
.
el
.
classList
.
remove
(
'
hidden
'
);
this
.
el
.
classList
.
remove
(
'
hidden
'
);
_converse
.
api
.
emit
(
'
controlBoxOpened
'
,
this
);
_converse
.
api
.
trigger
(
'
controlBoxOpened
'
,
this
);
},
},
show
()
{
show
()
{
...
...
src/converse-headline.js
View file @
f8977035
...
@@ -81,8 +81,8 @@ converse.plugins.add('converse-headline', {
...
@@ -81,8 +81,8 @@ converse.plugins.add('converse-headline', {
this
.
model
.
on
(
'
change:minimized
'
,
this
.
onMinimizedChanged
,
this
);
this
.
model
.
on
(
'
change:minimized
'
,
this
.
onMinimizedChanged
,
this
);
this
.
render
().
insertHeading
().
fetchMessages
().
insertIntoDOM
().
hide
();
this
.
render
().
insertHeading
().
fetchMessages
().
insertIntoDOM
().
hide
();
_converse
.
api
.
emit
(
'
chatBoxOpened
'
,
this
);
// TODO: remove
_converse
.
api
.
trigger
(
'
chatBoxOpened
'
,
this
);
// TODO: remove
_converse
.
api
.
emit
(
'
chatBoxInitialized
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxInitialized
'
,
this
);
},
},
render
()
{
render
()
{
...
@@ -127,7 +127,7 @@ converse.plugins.add('converse-headline', {
...
@@ -127,7 +127,7 @@ converse.plugins.add('converse-headline', {
});
});
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
message
,
message
);
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
message
,
message
);
await
chatbox
.
messages
.
create
(
attrs
);
await
chatbox
.
messages
.
create
(
attrs
);
_converse
.
api
.
emit
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
_converse
.
api
.
trigger
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
}
}
}
}
...
...
src/converse-minimize.js
View file @
f8977035
...
@@ -137,7 +137,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -137,7 +137,7 @@ converse.plugins.add('converse-minimize', {
* @type { _converse.ChatBoxView }
* @type { _converse.ChatBoxView }
* @example _converse.api.listen.on('chatBoxMaximized', view => { ... });
* @example _converse.api.listen.on('chatBoxMaximized', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxMaximized
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxMaximized
'
,
this
);
return
this
;
return
this
;
},
},
...
@@ -158,7 +158,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -158,7 +158,7 @@ converse.plugins.add('converse-minimize', {
* @type { _converse.ChatBoxView }
* @type { _converse.ChatBoxView }
* @example _converse.api.listen.on('chatBoxMinimized', view => { ... });
* @example _converse.api.listen.on('chatBoxMinimized', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxMinimized
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxMinimized
'
,
this
);
},
},
},
},
...
@@ -370,7 +370,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -370,7 +370,7 @@ converse.plugins.add('converse-minimize', {
view
.
close
();
view
.
close
();
}
else
{
}
else
{
this
.
model
.
destroy
();
this
.
model
.
destroy
();
_converse
.
api
.
emit
(
'
chatBoxClosed
'
,
this
);
_converse
.
api
.
trigger
(
'
chatBoxClosed
'
,
this
);
}
}
return
this
;
return
this
;
},
},
...
@@ -405,7 +405,7 @@ converse.plugins.add('converse-minimize', {
...
@@ -405,7 +405,7 @@ converse.plugins.add('converse-minimize', {
* @event _converse#minimizedChatsInitialized
* @event _converse#minimizedChatsInitialized
* @example _converse.api.listen.on('minimizedChatsInitialized', () => { ... });
* @example _converse.api.listen.on('minimizedChatsInitialized', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
minimizedChatsInitialized
'
);
_converse
.
api
.
trigger
(
'
minimizedChatsInitialized
'
);
},
},
render
()
{
render
()
{
...
...
src/converse-muc-views.js
View file @
f8977035
...
@@ -82,7 +82,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -82,7 +82,7 @@ converse.plugins.add('converse-muc-views', {
* @event _converse#roomsPanelRendered
* @event _converse#roomsPanelRendered
* @example _converse.api.listen.on('roomsPanelRendered', () => { ... });
* @example _converse.api.listen.on('roomsPanelRendered', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
roomsPanelRendered
'
);
_converse
.
api
.
trigger
(
'
roomsPanelRendered
'
);
},
},
renderControlBoxPane
()
{
renderControlBoxPane
()
{
...
@@ -580,7 +580,7 @@ converse.plugins.add('converse-muc-views', {
...
@@ -580,7 +580,7 @@ converse.plugins.add('converse-muc-views', {
* @type { _converse.ChatRoomView }
* @type { _converse.ChatRoomView }
* @example _converse.api.listen.on('chatRoomOpened', view => { ... });
* @example _converse.api.listen.on('chatRoomOpened', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatRoomOpened
'
,
this
);
_converse
.
api
.
trigger
(
'
chatRoomOpened
'
,
this
);
},
},
render
()
{
render
()
{
...
...
src/converse-notification.js
View file @
f8977035
...
@@ -267,7 +267,7 @@ converse.plugins.add('converse-notification', {
...
@@ -267,7 +267,7 @@ converse.plugins.add('converse-notification', {
* @type { XMLElement }
* @type { XMLElement }
* @example _converse.api.listen.on('messageNotification', stanza => { ... });
* @example _converse.api.listen.on('messageNotification', stanza => { ... });
*/
*/
_converse
.
api
.
emit
(
'
messageNotification
'
,
message
);
_converse
.
api
.
trigger
(
'
messageNotification
'
,
message
);
_converse
.
playSoundNotification
();
_converse
.
playSoundNotification
();
_converse
.
showMessageNotification
(
message
);
_converse
.
showMessageNotification
(
message
);
};
};
...
...
src/converse-omemo.js
View file @
f8977035
...
@@ -1137,7 +1137,7 @@ converse.plugins.add('converse-omemo', {
...
@@ -1137,7 +1137,7 @@ converse.plugins.add('converse-omemo', {
* @event _converse#OMEMOInitialized
* @event _converse#OMEMOInitialized
* @example _converse.api.listen.on('OMEMOInitialized', () => { ... });
* @example _converse.api.listen.on('OMEMOInitialized', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
OMEMOInitialized
'
);
_converse
.
api
.
trigger
(
'
OMEMOInitialized
'
);
}
}
async
function
onOccupantAdded
(
chatroom
,
occupant
)
{
async
function
onOccupantAdded
(
chatroom
,
occupant
)
{
...
...
src/converse-profile.js
View file @
f8977035
...
@@ -54,7 +54,7 @@ converse.plugins.add('converse-profile', {
...
@@ -54,7 +54,7 @@ converse.plugins.add('converse-profile', {
* @type { _converse.XMPPStatus }
* @type { _converse.XMPPStatus }
* @example _converse.api.listen.on('profileModalInitialized', status => { ... });
* @example _converse.api.listen.on('profileModalInitialized', status => { ... });
*/
*/
_converse
.
api
.
emit
(
'
profileModalInitialized
'
,
this
.
model
);
_converse
.
api
.
trigger
(
'
profileModalInitialized
'
,
this
.
model
);
},
},
toHTML
()
{
toHTML
()
{
...
...
src/converse-roomslist.js
View file @
f8977035
...
@@ -182,7 +182,7 @@ converse.plugins.add('converse-roomslist', {
...
@@ -182,7 +182,7 @@ converse.plugins.add('converse-roomslist', {
* @event _converse#roomsListInitialized
* @event _converse#roomsListInitialized
* @example _converse.api.listen.on('roomsListInitialized', status => { ... });
* @example _converse.api.listen.on('roomsListInitialized', status => { ... });
*/
*/
_converse
.
api
.
emit
(
'
roomsListInitialized
'
);
_converse
.
api
.
trigger
(
'
roomsListInitialized
'
);
},
},
render
()
{
render
()
{
...
...
src/converse-rosterview.js
View file @
f8977035
...
@@ -831,7 +831,7 @@ converse.plugins.add('converse-rosterview', {
...
@@ -831,7 +831,7 @@ converse.plugins.add('converse-rosterview', {
* @event _converse#rosterViewInitialized
* @event _converse#rosterViewInitialized
* @example _converse.api.listen.on('rosterViewInitialized', () => { ... });
* @example _converse.api.listen.on('rosterViewInitialized', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
rosterViewInitialized
'
);
_converse
.
api
.
trigger
(
'
rosterViewInitialized
'
);
},
},
render
()
{
render
()
{
...
...
src/headless/converse-chatboxes.js
View file @
f8977035
...
@@ -768,7 +768,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -768,7 +768,7 @@ converse.plugins.add('converse-chatboxes', {
* @example _converse.api.listen.on('chatBoxesInitialized', () => { ... });
* @example _converse.api.listen.on('chatBoxesInitialized', () => { ... });
* @example _converse.api.waitUntil('chatBoxesInitialized').then(() => { ... });
* @example _converse.api.waitUntil('chatBoxesInitialized').then(() => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxesInitialized
'
);
_converse
.
api
.
trigger
(
'
chatBoxesInitialized
'
);
},
},
registerMessageHandler
()
{
registerMessageHandler
()
{
...
@@ -816,7 +816,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -816,7 +816,7 @@ converse.plugins.add('converse-chatboxes', {
* @example _converse.api.listen.on('message', obj => { ... });
* @example _converse.api.listen.on('message', obj => { ... });
* @example _converse.api.waitUntil('chatBoxesFetched').then(() => { ... });
* @example _converse.api.waitUntil('chatBoxesFetched').then(() => { ... });
*/
*/
_converse
.
api
.
emit
(
'
chatBoxesFetched
'
);
_converse
.
api
.
trigger
(
'
chatBoxesFetched
'
);
},
},
onConnected
()
{
onConnected
()
{
...
@@ -977,7 +977,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -977,7 +977,7 @@ converse.plugins.add('converse-chatboxes', {
* @property { XMLElement } stanza
* @property { XMLElement } stanza
* @example _converse.api.listen.on('message', obj => { ... });
* @example _converse.api.listen.on('message', obj => { ... });
*/
*/
_converse
.
api
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
chatbox
});
_converse
.
api
.
trigger
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
chatbox
});
},
},
getChatBox
(
jid
,
attrs
=
{},
create
)
{
getChatBox
(
jid
,
attrs
=
{},
create
)
{
...
@@ -1034,7 +1034,7 @@ converse.plugins.add('converse-chatboxes', {
...
@@ -1034,7 +1034,7 @@ converse.plugins.add('converse-chatboxes', {
* @example _converse.api.listen.on('privateChatsAutoJoined', () => { ... });
* @example _converse.api.listen.on('privateChatsAutoJoined', () => { ... });
* @example _converse.api.waitUntil('privateChatsAutoJoined').then(() => { ... });
* @example _converse.api.waitUntil('privateChatsAutoJoined').then(() => { ... });
*/
*/
_converse
.
api
.
emit
(
'
privateChatsAutoJoined
'
);
_converse
.
api
.
trigger
(
'
privateChatsAutoJoined
'
);
}
}
...
...
src/headless/converse-core.js
View file @
f8977035
This diff is collapsed.
Click to expand it.
src/headless/converse-disco.js
View file @
f8977035
...
@@ -101,7 +101,7 @@ converse.plugins.add('converse-disco', {
...
@@ -101,7 +101,7 @@ converse.plugins.add('converse-disco', {
* @type { Backbone.Model }
* @type { Backbone.Model }
* @example _converse.api.listen.on('featuresDiscovered', feature => { ... });
* @example _converse.api.listen.on('featuresDiscovered', feature => { ... });
*/
*/
_converse
.
api
.
emit
(
'
serviceDiscovered
'
,
feature
);
_converse
.
api
.
trigger
(
'
serviceDiscovered
'
,
feature
);
},
},
onFieldAdded
(
field
)
{
onFieldAdded
(
field
)
{
...
@@ -112,7 +112,7 @@ converse.plugins.add('converse-disco', {
...
@@ -112,7 +112,7 @@ converse.plugins.add('converse-disco', {
* @event _converse#discoExtensionFieldDiscovered
* @event _converse#discoExtensionFieldDiscovered
* @example _converse.api.listen.on('discoExtensionFieldDiscovered', () => { ... });
* @example _converse.api.listen.on('discoExtensionFieldDiscovered', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
discoExtensionFieldDiscovered
'
,
field
);
_converse
.
api
.
trigger
(
'
discoExtensionFieldDiscovered
'
,
field
);
},
},
fetchFeatures
()
{
fetchFeatures
()
{
...
@@ -246,7 +246,7 @@ converse.plugins.add('converse-disco', {
...
@@ -246,7 +246,7 @@ converse.plugins.add('converse-disco', {
* @event _converse#addClientFeatures
* @event _converse#addClientFeatures
* @example _converse.api.listen.on('addClientFeatures', () => { ... });
* @example _converse.api.listen.on('addClientFeatures', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
addClientFeatures
'
);
_converse
.
api
.
trigger
(
'
addClientFeatures
'
);
return
this
;
return
this
;
}
}
...
@@ -276,7 +276,7 @@ converse.plugins.add('converse-disco', {
...
@@ -276,7 +276,7 @@ converse.plugins.add('converse-disco', {
* @event _converse#streamFeaturesAdded
* @event _converse#streamFeaturesAdded
* @example _converse.api.listen.on('streamFeaturesAdded', () => { ... });
* @example _converse.api.listen.on('streamFeaturesAdded', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
streamFeaturesAdded
'
);
_converse
.
api
.
trigger
(
'
streamFeaturesAdded
'
);
}
}
async
function
initializeDisco
()
{
async
function
initializeDisco
()
{
...
@@ -301,7 +301,7 @@ converse.plugins.add('converse-disco', {
...
@@ -301,7 +301,7 @@ converse.plugins.add('converse-disco', {
* @event _converse#discoInitialized
* @event _converse#discoInitialized
* @example _converse.api.listen.on('discoInitialized', () => { ... });
* @example _converse.api.listen.on('discoInitialized', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
discoInitialized
'
);
_converse
.
api
.
trigger
(
'
discoInitialized
'
);
}
}
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
sessionInitialized
'
,
initStreamFeatures
);
...
...
src/headless/converse-muc.js
View file @
f8977035
...
@@ -521,7 +521,7 @@ converse.plugins.add('converse-muc', {
...
@@ -521,7 +521,7 @@ converse.plugins.add('converse-muc', {
* @property { string } reason - The original reason for the invitation
* @property { string } reason - The original reason for the invitation
* @example _converse.api.listen.on('chatBoxMaximized', view => { ... });
* @example _converse.api.listen.on('chatBoxMaximized', view => { ... });
*/
*/
_converse
.
api
.
emit
(
'
roomInviteSent
'
,
{
_converse
.
api
.
trigger
(
'
roomInviteSent
'
,
{
'
room
'
:
this
,
'
room
'
:
this
,
'
recipient
'
:
recipient
,
'
recipient
'
:
recipient
,
'
reason
'
:
reason
'
reason
'
:
reason
...
@@ -1059,7 +1059,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1059,7 +1059,7 @@ converse.plugins.add('converse-muc', {
this
.
handleMessageCorrection
(
stanza
)
||
this
.
handleMessageCorrection
(
stanza
)
||
this
.
isReceipt
(
stanza
)
||
this
.
isReceipt
(
stanza
)
||
this
.
isChatMarker
(
stanza
))
{
this
.
isChatMarker
(
stanza
))
{
return
_converse
.
api
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
});
return
_converse
.
api
.
trigger
(
'
message
'
,
{
'
stanza
'
:
original_stanza
});
}
}
const
attrs
=
await
this
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
);
const
attrs
=
await
this
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
);
if
(
attrs
.
nick
&&
if
(
attrs
.
nick
&&
...
@@ -1073,7 +1073,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1073,7 +1073,7 @@ converse.plugins.add('converse-muc', {
msg
.
save
({
'
received
'
:
moment
().
format
()});
msg
.
save
({
'
received
'
:
moment
().
format
()});
}
}
}
}
_converse
.
api
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
this
});
_converse
.
api
.
trigger
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
this
});
},
},
onPresence
(
pres
)
{
onPresence
(
pres
)
{
...
@@ -1411,7 +1411,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1411,7 +1411,7 @@ converse.plugins.add('converse-muc', {
* @example _converse.api.listen.on('roomsAutoJoined', () => { ... });
* @example _converse.api.listen.on('roomsAutoJoined', () => { ... });
* @example _converse.api.waitUntil('roomsAutoJoined').then(() => { ... });
* @example _converse.api.waitUntil('roomsAutoJoined').then(() => { ... });
*/
*/
_converse
.
api
.
emit
(
'
roomsAutoJoined
'
);
_converse
.
api
.
trigger
(
'
roomsAutoJoined
'
);
}
}
function
disconnectChatRooms
()
{
function
disconnectChatRooms
()
{
...
...
src/headless/converse-roster.js
View file @
f8977035
...
@@ -71,7 +71,7 @@ converse.plugins.add('converse-roster', {
...
@@ -71,7 +71,7 @@ converse.plugins.add('converse-roster', {
* @example _converse.api.listen.on('rosterInitialized', () => { ... });
* @example _converse.api.listen.on('rosterInitialized', () => { ... });
* @example _converse.api.waitUntil('rosterInitialized').then(() => { ... });
* @example _converse.api.waitUntil('rosterInitialized').then(() => { ... });
*/
*/
_converse
.
api
.
emit
(
'
rosterInitialized
'
);
_converse
.
api
.
trigger
(
'
rosterInitialized
'
);
};
};
...
@@ -94,7 +94,7 @@ converse.plugins.add('converse-roster', {
...
@@ -94,7 +94,7 @@ converse.plugins.add('converse-roster', {
* @event _converse#rosterContactsFetched
* @event _converse#rosterContactsFetched
* @example _converse.api.listen.on('rosterContactsFetched', () => { ... });
* @example _converse.api.listen.on('rosterContactsFetched', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
}
catch
(
reason
)
{
}
catch
(
reason
)
{
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
}
finally
{
}
finally
{
...
@@ -110,9 +110,9 @@ converse.plugins.add('converse-roster', {
...
@@ -110,9 +110,9 @@ converse.plugins.add('converse-roster', {
* @event _converse#rosterGroupsFetched
* @event _converse#rosterGroupsFetched
* @example _converse.api.listen.on('rosterGroupsFetched', () => { ... });
* @example _converse.api.listen.on('rosterGroupsFetched', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
rosterGroupsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterGroupsFetched
'
);
await
_converse
.
roster
.
fetchRosterContacts
();
await
_converse
.
roster
.
fetchRosterContacts
();
_converse
.
api
.
emit
(
'
rosterContactsFetched
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
}
catch
(
reason
)
{
}
catch
(
reason
)
{
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
_converse
.
log
(
reason
,
Strophe
.
LogLevel
.
ERROR
);
}
finally
{
}
finally
{
...
@@ -251,7 +251,7 @@ converse.plugins.add('converse-roster', {
...
@@ -251,7 +251,7 @@ converse.plugins.add('converse-roster', {
* @type { _converse.RosterContact }
* @type { _converse.RosterContact }
* @example _converse.api.listen.on('contactPresenceChanged', contact => { ... });
* @example _converse.api.listen.on('contactPresenceChanged', contact => { ... });
*/
*/
this
.
presence
.
on
(
'
change:show
'
,
()
=>
_converse
.
api
.
emit
(
'
contactPresenceChanged
'
,
this
));
this
.
presence
.
on
(
'
change:show
'
,
()
=>
_converse
.
api
.
trigger
(
'
contactPresenceChanged
'
,
this
));
this
.
presence
.
on
(
'
change:show
'
,
()
=>
this
.
trigger
(
'
presenceChanged
'
));
this
.
presence
.
on
(
'
change:show
'
,
()
=>
this
.
trigger
(
'
presenceChanged
'
));
},
},
...
@@ -439,7 +439,7 @@ converse.plugins.add('converse-roster', {
...
@@ -439,7 +439,7 @@ converse.plugins.add('converse-roster', {
* @example _converse.api.listen.on('cachedRoster', (items) => { ... });
* @example _converse.api.listen.on('cachedRoster', (items) => { ... });
* @example _converse.api.waitUntil('cachedRoster').then(items => { ... });
* @example _converse.api.waitUntil('cachedRoster').then(items => { ... });
*/
*/
_converse
.
api
.
emit
(
'
cachedRoster
'
,
collection
);
_converse
.
api
.
trigger
(
'
cachedRoster
'
,
collection
);
}
}
},
},
...
@@ -590,7 +590,7 @@ converse.plugins.add('converse-roster', {
...
@@ -590,7 +590,7 @@ converse.plugins.add('converse-roster', {
* @type { XMLElement }
* @type { XMLElement }
* @example _converse.api.listen.on('rosterPush', iq => { ... });
* @example _converse.api.listen.on('rosterPush', iq => { ... });
*/
*/
_converse
.
api
.
emit
(
'
rosterPush
'
,
iq
);
_converse
.
api
.
trigger
(
'
rosterPush
'
,
iq
);
return
;
return
;
},
},
...
@@ -640,7 +640,7 @@ converse.plugins.add('converse-roster', {
...
@@ -640,7 +640,7 @@ converse.plugins.add('converse-roster', {
* @example _converse.api.listen.on('roster', iq => { ... });
* @example _converse.api.listen.on('roster', iq => { ... });
* @example _converse.api.waitUntil('roster').then(iq => { ... });
* @example _converse.api.waitUntil('roster').then(iq => { ... });
*/
*/
_converse
.
api
.
emit
(
'
roster
'
,
iq
);
_converse
.
api
.
trigger
(
'
roster
'
,
iq
);
},
},
updateContact
(
item
)
{
updateContact
(
item
)
{
...
@@ -700,7 +700,7 @@ converse.plugins.add('converse-roster', {
...
@@ -700,7 +700,7 @@ converse.plugins.add('converse-roster', {
* @type { _converse.RosterContact }
* @type { _converse.RosterContact }
* @example _converse.api.listen.on('contactRequest', contact => { ... });
* @example _converse.api.listen.on('contactRequest', contact => { ... });
*/
*/
_converse
.
api
.
emit
(
'
contactRequest
'
,
this
.
create
(
user_data
));
_converse
.
api
.
trigger
(
'
contactRequest
'
,
this
.
create
(
user_data
));
},
},
handleIncomingSubscription
(
presence
)
{
handleIncomingSubscription
(
presence
)
{
...
@@ -921,7 +921,7 @@ converse.plugins.add('converse-roster', {
...
@@ -921,7 +921,7 @@ converse.plugins.add('converse-roster', {
* @type { bool }
* @type { bool }
* @example _converse.api.listen.on('presencesInitialized', reconnecting => { ... });
* @example _converse.api.listen.on('presencesInitialized', reconnecting => { ... });
*/
*/
_converse
.
api
.
emit
(
'
presencesInitialized
'
,
reconnecting
);
_converse
.
api
.
trigger
(
'
presencesInitialized
'
,
reconnecting
);
});
});
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
(
reconnecting
)
=>
{
_converse
.
api
.
listen
.
on
(
'
presencesInitialized
'
,
(
reconnecting
)
=>
{
...
@@ -933,7 +933,7 @@ converse.plugins.add('converse-roster', {
...
@@ -933,7 +933,7 @@ converse.plugins.add('converse-roster', {
* @event _converse#rosterReadyAfterReconnection
* @event _converse#rosterReadyAfterReconnection
* @example _converse.api.listen.on('rosterReadyAfterReconnection', () => { ... });
* @example _converse.api.listen.on('rosterReadyAfterReconnection', () => { ... });
*/
*/
_converse
.
api
.
emit
(
'
rosterReadyAfterReconnection
'
);
_converse
.
api
.
trigger
(
'
rosterReadyAfterReconnection
'
);
}
else
{
}
else
{
_converse
.
registerIntervalHandler
();
_converse
.
registerIntervalHandler
();
_converse
.
initRoster
();
_converse
.
initRoster
();
...
...
src/headless/dist/converse-headless.js
View file @
f8977035
This diff is collapsed.
Click to expand it.
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