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
e20b6548
Commit
e20b6548
authored
Jul 29, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop using `_.isUndefined`
parent
caad85f4
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
86 additions
and
86 deletions
+86
-86
spec/bookmarks.js
spec/bookmarks.js
+3
-3
spec/roomslist.js
spec/roomslist.js
+2
-2
src/converse-bookmark-views.js
src/converse-bookmark-views.js
+2
-2
src/converse-chatview.js
src/converse-chatview.js
+8
-8
src/converse-controlbox.js
src/converse-controlbox.js
+2
-2
src/converse-dragresize.js
src/converse-dragresize.js
+3
-3
src/converse-message-view.js
src/converse-message-view.js
+1
-1
src/converse-modal.js
src/converse-modal.js
+1
-1
src/converse-muc-views.js
src/converse-muc-views.js
+5
-5
src/converse-notification.js
src/converse-notification.js
+3
-3
src/converse-oauth.js
src/converse-oauth.js
+1
-1
src/converse-omemo.js
src/converse-omemo.js
+3
-3
src/converse-profile.js
src/converse-profile.js
+3
-3
src/converse-register.js
src/converse-register.js
+1
-1
src/converse-roomslist.js
src/converse-roomslist.js
+2
-2
src/converse-rosterview.js
src/converse-rosterview.js
+2
-2
src/headless/converse-bookmarks.js
src/headless/converse-bookmarks.js
+4
-4
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+4
-4
src/headless/converse-core.js
src/headless/converse-core.js
+15
-15
src/headless/converse-disco.js
src/headless/converse-disco.js
+1
-1
src/headless/converse-mam.js
src/headless/converse-mam.js
+1
-1
src/headless/converse-muc.js
src/headless/converse-muc.js
+9
-9
src/headless/converse-ping.js
src/headless/converse-ping.js
+4
-4
src/headless/converse-roster.js
src/headless/converse-roster.js
+4
-4
src/headless/utils/core.js
src/headless/utils/core.js
+1
-1
src/headless/utils/emoji.js
src/headless/utils/emoji.js
+1
-1
No files found.
spec/bookmarks.js
View file @
e20b6548
...
...
@@ -161,7 +161,7 @@
'
name
'
:
'
The Lounge
'
,
'
nick
'
:
'
Othello
'
});
expect
(
_
.
isUndefined
(
_converse
.
chatboxviews
.
get
(
jid
))
).
toBeTruthy
();
expect
(
_
converse
.
chatboxviews
.
get
(
jid
)
===
undefined
).
toBeTruthy
();
jid
=
'
theplay@conference.shakespeare.lit
'
;
_converse
.
bookmarks
.
create
({
...
...
@@ -170,7 +170,7 @@
'
name
'
:
'
The Play
'
,
'
nick
'
:
'
Othello
'
});
expect
(
_
.
isUndefined
(
_converse
.
chatboxviews
.
get
(
jid
))
).
toBeFalsy
();
expect
(
_
converse
.
chatboxviews
.
get
(
jid
)
===
undefined
).
toBeFalsy
();
// Check that we don't auto-join if muc_respect_autojoin is false
_converse
.
muc_respect_autojoin
=
false
;
...
...
@@ -181,7 +181,7 @@
'
name
'
:
'
Balcony
'
,
'
nick
'
:
'
Othello
'
});
expect
(
_
.
isUndefined
(
_converse
.
chatboxviews
.
get
(
jid
))
).
toBe
(
true
);
expect
(
_
converse
.
chatboxviews
.
get
(
jid
)
===
undefined
).
toBe
(
true
);
done
();
}));
...
...
spec/roomslist.js
View file @
e20b6548
...
...
@@ -19,7 +19,7 @@
expect
(
_
.
includes
(
list
.
classList
,
'
hidden
'
)).
toBeTruthy
();
await
test_utils
.
openChatRoom
(
_converse
,
'
room
'
,
'
conference.shakespeare.lit
'
,
'
JC
'
);
expect
(
_
.
isUndefined
(
_converse
.
rooms_list_view
)
).
toBeFalsy
();
expect
(
_
converse
.
rooms_list_view
===
undefined
).
toBeFalsy
();
const
lview
=
_converse
.
rooms_list_view
await
u
.
waitUntil
(()
=>
lview
.
el
.
querySelectorAll
(
"
.open-room
"
).
length
);
...
...
@@ -288,7 +288,7 @@
test_utils
.
openControlBox
();
const
room_jid
=
'
kitchen@conference.shakespeare.lit
'
;
await
u
.
waitUntil
(()
=>
!
_
.
isUndefined
(
_converse
.
rooms_list_view
)
,
500
);
await
u
.
waitUntil
(()
=>
_converse
.
rooms_list_view
!==
undefined
,
500
);
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
kitchen@conference.shakespeare.lit
'
,
'
romeo
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
view
.
model
.
set
({
'
minimized
'
:
true
});
...
...
src/converse-bookmark-views.js
View file @
e20b6548
...
...
@@ -129,7 +129,7 @@ converse.plugins.add('converse-bookmark-views', {
setBookmarkState
()
{
/* Set whether the groupchat is bookmarked or not.
*/
if
(
!
_
.
isUndefined
(
_converse
.
bookmarks
)
)
{
if
(
_converse
.
bookmarks
!==
undefined
)
{
const
models
=
_converse
.
bookmarks
.
where
({
'
jid
'
:
this
.
model
.
get
(
'
jid
'
)});
if
(
!
models
.
length
)
{
this
.
model
.
save
(
'
bookmarked
'
,
false
);
...
...
@@ -278,7 +278,7 @@ converse.plugins.add('converse-bookmark-views', {
insertIntoControlBox
()
{
const
controlboxview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
if
(
!
_
.
isUndefined
(
controlboxview
)
&&
!
u
.
rootContains
(
_converse
.
root
,
this
.
el
))
{
if
(
controlboxview
!==
undefined
&&
!
u
.
rootContains
(
_converse
.
root
,
this
.
el
))
{
const
el
=
controlboxview
.
el
.
querySelector
(
'
.bookmarks-list
'
);
if
(
!
_
.
isNull
(
el
))
{
el
.
parentNode
.
replaceChild
(
this
.
el
,
el
);
...
...
src/converse-chatview.js
View file @
e20b6548
...
...
@@ -251,13 +251,13 @@ converse.plugins.add('converse-chatview', {
'
_converse
'
:
_converse
,
'
allow_contact_removal
'
:
_converse
.
allow_contact_removal
,
'
display_name
'
:
this
.
model
.
getDisplayName
(),
'
is_roster_contact
'
:
!
_
.
isUndefined
(
this
.
model
.
contact
)
,
'
is_roster_contact
'
:
this
.
model
.
contact
!==
undefined
,
'
utils
'
:
u
}));
},
registerContactEventHandlers
()
{
if
(
!
_
.
isUndefined
(
this
.
model
.
contact
)
)
{
if
(
this
.
model
.
contact
!==
undefined
)
{
this
.
model
.
contact
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
model
.
contact
.
vcard
.
on
(
'
change
'
,
this
.
render
,
this
);
this
.
model
.
contact
.
on
(
'
destroy
'
,
()
=>
{
...
...
@@ -447,7 +447,7 @@ converse.plugins.add('converse-chatview', {
showUserDetailsModal
(
ev
)
{
ev
.
preventDefault
();
if
(
_
.
isUndefined
(
this
.
user_details_modal
)
)
{
if
(
this
.
user_details_modal
===
undefined
)
{
this
.
user_details_modal
=
new
_converse
.
UserDetailsModal
({
model
:
this
.
model
});
}
this
.
user_details_modal
.
show
(
ev
);
...
...
@@ -518,7 +518,7 @@ converse.plugins.add('converse-chatview', {
this
.
heading
.
render
();
this
.
heading
.
chatview
=
this
;
if
(
!
_
.
isUndefined
(
this
.
model
.
contact
)
)
{
if
(
this
.
model
.
contact
!==
undefined
)
{
this
.
model
.
contact
.
on
(
'
destroy
'
,
this
.
heading
.
render
,
this
);
}
const
flyout
=
this
.
el
.
querySelector
(
'
.flyout
'
);
...
...
@@ -1140,7 +1140,7 @@ converse.plugins.add('converse-chatview', {
},
createEmojiPicker
()
{
if
(
_
.
isUndefined
(
_converse
.
emojipicker
)
)
{
if
(
_
converse
.
emojipicker
===
undefined
)
{
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
`converse.emoji-
${
_converse
.
bare_jid
}
`
;
_converse
.
emojipicker
=
new
_converse
.
EmojiPicker
({
'
id
'
:
id
});
...
...
@@ -1160,7 +1160,7 @@ converse.plugins.add('converse-chatview', {
},
toggleEmojiMenu
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
emoji_dropdown
)
)
{
if
(
this
.
emoji_dropdown
===
undefined
)
{
ev
.
stopPropagation
();
this
.
createEmojiPicker
();
this
.
insertEmojiPicker
();
...
...
@@ -1383,7 +1383,7 @@ converse.plugins.add('converse-chatview', {
_scrollDown
()
{
/* Inner method that gets debounced */
if
(
_
.
isUndefined
(
this
.
content
)
)
{
if
(
this
.
content
===
undefined
)
{
return
;
}
if
(
u
.
isVisible
(
this
.
content
)
&&
!
this
.
model
.
get
(
'
scrolled
'
))
{
...
...
@@ -1461,7 +1461,7 @@ converse.plugins.add('converse-chatview', {
* _converse.api.chatviews.get(['buddy1@example.com', 'buddy2@example.com'])
*/
'
get
'
(
jids
)
{
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
_converse
.
log
(
"
chatviews.get: You need to provide at least one JID
"
,
Strophe
.
LogLevel
.
ERROR
...
...
src/converse-controlbox.js
View file @
e20b6548
...
...
@@ -186,7 +186,7 @@ converse.plugins.add('converse-controlbox', {
},
initialize
()
{
if
(
_
.
isUndefined
(
_converse
.
controlboxtoggle
)
)
{
if
(
_
converse
.
controlboxtoggle
===
undefined
)
{
_converse
.
controlboxtoggle
=
new
_converse
.
ControlBoxToggle
();
}
_converse
.
controlboxtoggle
.
el
.
insertAdjacentElement
(
'
afterend
'
,
this
.
el
);
...
...
@@ -214,7 +214,7 @@ converse.plugins.add('converse-controlbox', {
render
()
{
if
(
this
.
model
.
get
(
'
connected
'
))
{
if
(
_
.
isUndefined
(
this
.
model
.
get
(
'
closed
'
))
)
{
if
(
this
.
model
.
get
(
'
closed
'
)
===
undefined
)
{
this
.
model
.
set
(
'
closed
'
,
!
_converse
.
show_controlbox_by_default
);
}
}
...
...
src/converse-dragresize.js
View file @
e20b6548
...
...
@@ -153,7 +153,7 @@ converse.plugins.add('converse-dragresize', {
const
flyout
=
this
.
el
.
querySelector
(
'
.box-flyout
'
);
const
style
=
window
.
getComputedStyle
(
flyout
);
if
(
_
.
isUndefined
(
this
.
model
.
get
(
'
height
'
))
)
{
if
(
this
.
model
.
get
(
'
height
'
)
===
undefined
)
{
const
height
=
parseInt
(
style
.
height
.
replace
(
/px$/
,
''
),
10
);
const
width
=
parseInt
(
style
.
width
.
replace
(
/px$/
,
''
),
10
);
this
.
model
.
set
(
'
height
'
,
height
);
...
...
@@ -313,9 +313,9 @@ converse.plugins.add('converse-dragresize', {
* default_value. If value is close enough to
* default_value, then default_value is returned instead.
*/
if
(
_
.
isUndefined
(
value
)
)
{
if
(
value
===
undefined
)
{
return
undefined
;
}
else
if
(
_
.
isUndefined
(
default_value
)
)
{
}
else
if
(
default_value
===
undefined
)
{
return
value
;
}
const
resistance
=
10
;
...
...
src/converse-message-view.js
View file @
e20b6548
...
...
@@ -308,7 +308,7 @@ converse.plugins.add('converse-message-view', {
showMessageVersionsModal
(
ev
)
{
ev
.
preventDefault
();
if
(
_
.
isUndefined
(
this
.
model
.
message_versions_modal
)
)
{
if
(
this
.
model
.
message_versions_modal
===
undefined
)
{
this
.
model
.
message_versions_modal
=
new
_converse
.
MessageVersionsModal
({
'
model
'
:
this
.
model
});
}
this
.
model
.
message_versions_modal
.
show
(
ev
);
...
...
src/converse-modal.js
View file @
e20b6548
...
...
@@ -91,7 +91,7 @@ converse.plugins.add('converse-modal', {
type
=
'
alert-warning
'
;
}
if
(
_
.
isUndefined
(
alert
)
)
{
if
(
alert
===
undefined
)
{
const
model
=
new
Backbone
.
Model
({
'
title
'
:
title
,
'
messages
'
:
messages
,
...
...
src/converse-muc-views.js
View file @
e20b6548
...
...
@@ -596,7 +596,7 @@ converse.plugins.add('converse-muc-views', {
showRoomDetailsModal
(
ev
)
{
ev
.
preventDefault
();
if
(
_
.
isUndefined
(
this
.
model
.
room_details_modal
)
)
{
if
(
this
.
model
.
room_details_modal
===
undefined
)
{
this
.
model
.
room_details_modal
=
new
_converse
.
RoomDetailsModal
({
'
model
'
:
this
.
model
});
}
this
.
model
.
room_details_modal
.
show
(
ev
);
...
...
@@ -1528,14 +1528,14 @@ converse.plugins.add('converse-muc-views', {
},
showAddRoomModal
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
add_room_modal
)
)
{
if
(
this
.
add_room_modal
===
undefined
)
{
this
.
add_room_modal
=
new
_converse
.
AddChatRoomModal
({
'
model
'
:
this
.
model
});
}
this
.
add_room_modal
.
show
(
ev
);
},
showListRoomsModal
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
list_rooms_modal
)
)
{
if
(
this
.
list_rooms_modal
===
undefined
)
{
this
.
list_rooms_modal
=
new
_converse
.
ListChatRoomsModal
({
'
model
'
:
this
.
model
});
}
this
.
list_rooms_modal
.
show
(
ev
);
...
...
@@ -1896,7 +1896,7 @@ converse.plugins.add('converse-muc-views', {
function
fetchAndSetMUCDomain
(
controlboxview
)
{
if
(
controlboxview
.
model
.
get
(
'
connected
'
))
{
if
(
!
controlboxview
.
roomspanel
.
model
.
get
(
'
muc_domain
'
))
{
if
(
_
.
isUndefined
(
_converse
.
muc_domain
)
)
{
if
(
_
converse
.
muc_domain
===
undefined
)
{
setMUCDomainFromDisco
(
controlboxview
);
}
else
{
setMUCDomain
(
_converse
.
muc_domain
,
controlboxview
);
...
...
@@ -2001,7 +2001,7 @@ converse.plugins.add('converse-muc-views', {
*/
'
close
'
(
jids
)
{
let
views
;
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
views
=
_converse
.
chatboxviews
;
}
else
if
(
_
.
isString
(
jids
))
{
views
=
[
_converse
.
chatboxviews
.
get
(
jids
)].
filter
(
v
=>
v
);
...
...
src/converse-notification.js
View file @
e20b6548
...
...
@@ -111,7 +111,7 @@ converse.plugins.add('converse-notification', {
// XXX Eventually this can be refactored to use Notification's sound
// feature, but no browser currently supports it.
// https://developer.mozilla.org/en-US/docs/Web/API/notification/sound
if
(
_converse
.
play_sounds
&&
!
_
.
isUndefined
(
window
.
Audio
)
)
{
if
(
_converse
.
play_sounds
&&
window
.
Audio
!==
undefined
)
{
const
audioOgg
=
new
Audio
(
_converse
.
sounds_path
+
"
msg_received.ogg
"
);
const
canPlayOgg
=
audioOgg
.
canPlayType
(
'
audio/ogg
'
);
if
(
canPlayOgg
===
'
probably
'
)
{
...
...
@@ -157,14 +157,14 @@ converse.plugins.add('converse-notification', {
}
else
if
(
message
.
getAttribute
(
'
type
'
)
===
'
groupchat
'
)
{
title
=
__
(
"
%1$s says
"
,
Strophe
.
getResourceFromJid
(
full_from_jid
));
}
else
{
if
(
_
.
isUndefined
(
_converse
.
roster
)
)
{
if
(
_
converse
.
roster
===
undefined
)
{
_converse
.
log
(
"
Could not send notification, because roster is undefined
"
,
Strophe
.
LogLevel
.
ERROR
);
return
;
}
roster_item
=
_converse
.
roster
.
get
(
from_jid
);
if
(
!
_
.
isUndefined
(
roster_item
)
)
{
if
(
roster_item
!==
undefined
)
{
title
=
__
(
"
%1$s says
"
,
roster_item
.
getDisplayName
());
}
else
{
if
(
_converse
.
allow_non_roster_messaging
)
{
...
...
src/converse-oauth.js
View file @
e20b6548
...
...
@@ -42,7 +42,7 @@ converse.plugins.add("converse-oauth", {
insertOAuthProviders
()
{
const
{
_converse
}
=
this
.
__super__
;
if
(
_
.
isUndefined
(
this
.
oauth_providers_view
)
)
{
if
(
this
.
oauth_providers_view
===
undefined
)
{
this
.
oauth_providers_view
=
new
_converse
.
OAuthProvidersView
({
'
model
'
:
_converse
.
oauth_providers
});
...
...
src/converse-omemo.js
View file @
e20b6548
...
...
@@ -902,7 +902,7 @@ converse.plugins.add('converse-omemo', {
},
fetchSession
()
{
if
(
_
.
isUndefined
(
this
.
_setup_promise
)
)
{
if
(
this
.
_setup_promise
===
undefined
)
{
this
.
_setup_promise
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
fetch
({
'
success
'
:
()
=>
{
...
...
@@ -1012,7 +1012,7 @@ converse.plugins.add('converse-omemo', {
},
fetchDevices
()
{
if
(
_
.
isUndefined
(
this
.
_devices_promise
)
)
{
if
(
this
.
_devices_promise
===
undefined
)
{
this
.
_devices_promise
=
new
Promise
(
resolve
=>
{
this
.
devices
.
fetch
({
'
success
'
:
_
.
flow
(
c
=>
this
.
onDevicesFound
(
c
),
resolve
),
...
...
@@ -1172,7 +1172,7 @@ converse.plugins.add('converse-omemo', {
}
function
restoreOMEMOSession
()
{
if
(
_
.
isUndefined
(
_converse
.
omemo_store
)
)
{
if
(
_
converse
.
omemo_store
===
undefined
)
{
const
storage
=
_converse
.
config
.
get
(
'
storage
'
),
id
=
`converse.omemosession-
${
_converse
.
bare_jid
}
`
;
_converse
.
omemo_store
=
new
_converse
.
OMEMOStore
({
'
id
'
:
id
});
...
...
src/converse-profile.js
View file @
e20b6548
...
...
@@ -262,21 +262,21 @@ converse.plugins.add('converse-profile', {
},
showProfileModal
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
profile_modal
)
)
{
if
(
this
.
profile_modal
===
undefined
)
{
this
.
profile_modal
=
new
_converse
.
ProfileModal
({
model
:
this
.
model
});
}
this
.
profile_modal
.
show
(
ev
);
},
showStatusChangeModal
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
status_modal
)
)
{
if
(
this
.
status_modal
===
undefined
)
{
this
.
status_modal
=
new
_converse
.
ChatStatusModal
({
model
:
this
.
model
});
}
this
.
status_modal
.
show
(
ev
);
},
showClientInfoModal
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
client_info_modal
)
)
{
if
(
this
.
client_info_modal
===
undefined
)
{
this
.
client_info_modal
=
new
_converse
.
ClientInfoModal
({
model
:
this
.
model
});
}
this
.
client_info_modal
.
show
(
ev
);
...
...
src/converse-register.js
View file @
e20b6548
...
...
@@ -90,7 +90,7 @@ converse.plugins.add('converse-register', {
Object
.
assign
(
_converse
.
LoginPanel
.
prototype
,
{
insertRegisterLink
()
{
if
(
_
.
isUndefined
(
this
.
registerlinkview
)
)
{
if
(
this
.
registerlinkview
===
undefined
)
{
this
.
registerlinkview
=
new
_converse
.
RegisterLinkView
({
'
model
'
:
this
.
model
});
this
.
registerlinkview
.
render
();
const
buttons
=
this
.
el
.
querySelector
(
'
.buttons
'
);
...
...
src/converse-roomslist.js
View file @
e20b6548
...
...
@@ -135,7 +135,7 @@ converse.plugins.add('converse-roomslist', {
showRoomDetailsModal
(
ev
)
{
const
room
=
_converse
.
chatboxes
.
get
(
this
.
model
.
get
(
'
jid
'
));
ev
.
preventDefault
();
if
(
_
.
isUndefined
(
room
.
room_details_modal
)
)
{
if
(
room
.
room_details_modal
===
undefined
)
{
room
.
room_details_modal
=
new
_converse
.
RoomDetailsModal
({
'
model
'
:
room
});
}
room
.
room_details_modal
.
show
(
ev
);
...
...
@@ -199,7 +199,7 @@ converse.plugins.add('converse-roomslist', {
insertIntoControlBox
()
{
const
controlboxview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
if
(
!
_
.
isUndefined
(
controlboxview
)
&&
!
u
.
rootContains
(
_converse
.
root
,
this
.
el
))
{
if
(
controlboxview
!==
undefined
&&
!
u
.
rootContains
(
_converse
.
root
,
this
.
el
))
{
const
el
=
controlboxview
.
el
.
querySelector
(
'
.open-rooms-list
'
);
if
(
!
_
.
isNull
(
el
))
{
el
.
parentNode
.
replaceChild
(
this
.
el
,
el
);
...
...
src/converse-rosterview.js
View file @
e20b6548
...
...
@@ -784,7 +784,7 @@ converse.plugins.add('converse-rosterview', {
},
showAddContactModal
(
ev
)
{
if
(
_
.
isUndefined
(
this
.
add_contact_modal
)
)
{
if
(
this
.
add_contact_modal
===
undefined
)
{
this
.
add_contact_modal
=
new
_converse
.
AddContactModal
({
'
model
'
:
new
Backbone
.
Model
()});
}
this
.
add_contact_modal
.
show
(
ev
);
...
...
@@ -944,7 +944,7 @@ converse.plugins.add('converse-rosterview', {
_converse
.
api
.
listen
.
on
(
'
chatBoxesInitialized
'
,
()
=>
{
function
highlightRosterItem
(
chatbox
)
{
const
contact
=
_converse
.
roster
.
findWhere
({
'
jid
'
:
chatbox
.
get
(
'
jid
'
)});
if
(
!
_
.
isUndefined
(
contact
)
)
{
if
(
contact
!==
undefined
)
{
contact
.
trigger
(
'
highlight
'
);
}
}
...
...
src/headless/converse-bookmarks.js
View file @
e20b6548
...
...
@@ -192,14 +192,14 @@ converse.plugins.add('converse-bookmarks', {
markRoomAsBookmarked
(
bookmark
)
{
const
groupchat
=
_converse
.
chatboxes
.
get
(
bookmark
.
get
(
'
jid
'
));
if
(
!
_
.
isUndefined
(
groupchat
)
)
{
if
(
groupchat
!==
undefined
)
{
groupchat
.
save
(
'
bookmarked
'
,
true
);
}
},
markRoomAsUnbookmarked
(
bookmark
)
{
const
groupchat
=
_converse
.
chatboxes
.
get
(
bookmark
.
get
(
'
jid
'
));
if
(
!
_
.
isUndefined
(
groupchat
)
)
{
if
(
groupchat
!==
undefined
)
{
groupchat
.
save
(
'
bookmarked
'
,
false
);
}
},
...
...
@@ -222,7 +222,7 @@ converse.plugins.add('converse-bookmarks', {
onBookmarksReceived
(
deferred
,
iq
)
{
this
.
createBookmarksFromStanza
(
iq
);
if
(
!
_
.
isUndefined
(
deferred
)
)
{
if
(
deferred
!==
undefined
)
{
return
deferred
.
resolve
();
}
},
...
...
@@ -276,7 +276,7 @@ converse.plugins.add('converse-bookmarks', {
}
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
{
if
(
!
_
.
isUndefined
(
_converse
.
bookmarks
)
)
{
if
(
_converse
.
bookmarks
!==
undefined
)
{
_converse
.
bookmarks
.
reset
();
_converse
.
bookmarks
.
browserStorage
.
_clear
();
window
.
sessionStorage
.
removeItem
(
_converse
.
bookmarks
.
fetched_flag
);
...
...
src/headless/converse-chatboxes.js
View file @
e20b6548
...
...
@@ -415,7 +415,7 @@ converse.plugins.add('converse-chatboxes', {
* @param { string } state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)
*/
setChatState
(
state
,
options
)
{
if
(
!
_
.
isUndefined
(
this
.
chat_state_timeout
)
)
{
if
(
this
.
chat_state_timeout
!==
undefined
)
{
window
.
clearTimeout
(
this
.
chat_state_timeout
);
delete
this
.
chat_state_timeout
;
}
...
...
@@ -611,7 +611,7 @@ converse.plugins.add('converse-chatboxes', {
},
handleReceipt
(
stanza
,
from_jid
,
is_carbon
,
is_me
,
is_mam
)
{
const
requests_receipt
=
!
_
.
isUndefined
(
sizzle
(
`request[xmlns="
${
Strophe
.
NS
.
RECEIPTS
}
"]`
,
stanza
).
pop
())
;
const
requests_receipt
=
sizzle
(
`request[xmlns="
${
Strophe
.
NS
.
RECEIPTS
}
"]`
,
stanza
).
pop
()
!==
undefined
;
if
(
requests_receipt
&&
!
is_carbon
&&
!
is_me
)
{
this
.
sendReceiptStanza
(
from_jid
,
stanza
.
getAttribute
(
'
id
'
));
}
...
...
@@ -1112,7 +1112,7 @@ converse.plugins.add('converse-chatboxes', {
}
const
contact_jid
=
is_me
?
Strophe
.
getBareJidFromJid
(
to_jid
)
:
from_bare_jid
;
const
contact
=
await
_converse
.
api
.
contacts
.
get
(
contact_jid
);
const
is_roster_contact
=
!
_
.
isUndefined
(
contact
)
;
const
is_roster_contact
=
contact
!==
undefined
;
if
(
!
is_me
&&
!
is_roster_contact
&&
!
_converse
.
allow_non_roster_messaging
)
{
return
;
}
...
...
@@ -1365,7 +1365,7 @@ converse.plugins.add('converse-chatboxes', {
*
*/
get
(
jids
)
{
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
const
result
=
[];
_converse
.
chatboxes
.
each
(
function
(
chatbox
)
{
// FIXME: Leaky abstraction from MUC. We need to add a
...
...
src/headless/converse-core.js
View file @
e20b6548
...
...
@@ -291,7 +291,7 @@ Strophe.error = function (msg) { _converse.log(msg, Strophe.LogLevel.ERROR); };
* @param { String } str - The string to translate
*/
_converse
.
__
=
function
(
str
)
{
if
(
_
.
isUndefined
(
i18n
)
)
{
if
(
i18n
===
undefined
)
{
return
str
;
}
return
i18n
.
translate
.
apply
(
i18n
,
arguments
);
...
...
@@ -505,7 +505,7 @@ const debouncedReconnect = _.debounce(reconnect, 2000);
function
clearSession
()
{
if
(
!
_
.
isUndefined
(
_converse
.
session
)
)
{
if
(
_converse
.
session
!==
undefined
)
{
_converse
.
session
.
destroy
();
delete
_converse
.
session
;
}
...
...
@@ -740,10 +740,10 @@ function cleanup () {
_converse
.
initialize
=
async
function
(
settings
,
callback
)
{
settings
=
!
_
.
isUndefined
(
settings
)
?
settings
:
{};
settings
=
settings
!==
undefined
?
settings
:
{};
const
init_promise
=
u
.
getResolveablePromise
();
PROMISES
.
forEach
(
addPromise
);
if
(
!
_
.
isUndefined
(
_converse
.
connection
)
)
{
if
(
_converse
.
connection
!==
undefined
)
{
cleanup
();
}
...
...
@@ -782,7 +782,7 @@ _converse.initialize = async function (settings, callback) {
});
/* Localisation */
if
(
!
_
.
isUndefined
(
i18n
)
)
{
if
(
i18n
!==
undefined
)
{
i18n
.
setLocales
(
settings
.
i18n
,
_converse
);
}
else
{
_converse
.
locale
=
'
en
'
;
...
...
@@ -977,7 +977,7 @@ _converse.initialize = async function (settings, callback) {
return
_converse
.
finishDisconnection
();
}
}
else
if
(
_converse
.
disconnection_cause
===
_converse
.
LOGOUT
||
(
!
_
.
isUndefined
(
reason
)
&&
reason
===
_
.
get
(
Strophe
,
'
ErrorCondition.NO_AUTH_MECH
'
))
||
(
reason
!==
undefined
&&
reason
===
_
.
get
(
Strophe
,
'
ErrorCondition.NO_AUTH_MECH
'
))
||
reason
===
"
host-unknown
"
||
reason
===
"
remote-connection-failed
"
||
!
_converse
.
auto_reconnect
)
{
...
...
@@ -991,10 +991,10 @@ _converse.initialize = async function (settings, callback) {
/* Used to keep track of why we got disconnected, so that we can
* decide on what the next appropriate action is (in onDisconnected)
*/
if
(
_
.
isUndefined
(
cause
)
)
{
if
(
cause
===
undefined
)
{
delete
_converse
.
disconnection_cause
;
delete
_converse
.
disconnection_reason
;
}
else
if
(
_
.
isUndefined
(
_converse
.
disconnection_cause
)
||
override
)
{
}
else
if
(
_
converse
.
disconnection_cause
===
undefined
||
override
)
{
_converse
.
disconnection_cause
=
cause
;
_converse
.
disconnection_reason
=
reason
;
}
...
...
@@ -1049,7 +1049,7 @@ _converse.initialize = async function (settings, callback) {
if
(
message
===
"
host-unknown
"
||
message
==
"
remote-connection-failed
"
)
{
feedback
=
__
(
"
Sorry, we could not connect to the XMPP host with domain: %1$s
"
,
`\"
${
Strophe
.
getDomainFromJid
(
_converse
.
connection
.
jid
)}
\"`
);
}
else
if
(
!
_
.
isUndefined
(
message
)
&&
message
===
_
.
get
(
Strophe
,
'
ErrorCondition.NO_AUTH_MECH
'
))
{
}
else
if
(
message
!==
undefined
&&
message
===
_
.
get
(
Strophe
,
'
ErrorCondition.NO_AUTH_MECH
'
))
{
feedback
=
__
(
"
The XMPP server did not offer a supported authentication mechanism
"
);
}
_converse
.
setConnectionStatus
(
status
,
feedback
);
...
...
@@ -1087,7 +1087,7 @@ _converse.initialize = async function (settings, callback) {
this
.
initStatus
=
(
reconnecting
)
=>
{
// If there's no xmppstatus obj, then we were never connected to
// begin with, so we set reconnecting to false.
reconnecting
=
_
.
isUndefined
(
_converse
.
xmppstatus
)
?
false
:
reconnecting
;
reconnecting
=
_
converse
.
xmppstatus
===
undefined
?
false
:
reconnecting
;
if
(
reconnecting
)
{
_converse
.
onStatusInitialized
(
reconnecting
);
}
else
{
...
...
@@ -1306,7 +1306,7 @@ _converse.initialize = async function (settings, callback) {
if
(
_converse
.
isTestEnv
())
{
await
finishInitialization
();
return
_converse
;
}
else
if
(
!
_
.
isUndefined
(
i18n
)
)
{
}
else
if
(
i18n
!==
undefined
)
{
const
url
=
u
.
interpolate
(
_converse
.
locales_url
,
{
'
locale
'
:
_converse
.
locale
});
try
{
await
i18n
.
fetchTranslations
(
_converse
.
locale
,
_converse
.
locales
,
url
);
...
...
@@ -1457,7 +1457,7 @@ _converse.api = {
_converse
.
trigger
.
apply
(
_converse
,
arguments
);
}
const
promise
=
_converse
.
promises
[
name
];
if
(
!
_
.
isUndefined
(
promise
)
)
{
if
(
promise
!==
undefined
)
{
promise
.
resolve
();
}
},
...
...
@@ -1517,7 +1517,7 @@ _converse.api = {
logout
()
{
clearSession
();
_converse
.
setDisconnectionCause
(
_converse
.
LOGOUT
,
undefined
,
true
);
if
(
!
_
.
isUndefined
(
_converse
.
connection
)
)
{
if
(
_converse
.
connection
!==
undefined
)
{
_converse
.
connection
.
disconnect
();
}
else
{
tearDown
();
...
...
@@ -1804,7 +1804,7 @@ _converse.api = {
return
u
.
waitUntil
(
condition
);
}
else
{
const
promise
=
_converse
.
promises
[
condition
];
if
(
_
.
isUndefined
(
promise
)
)
{
if
(
promise
===
undefined
)
{
return
null
;
}
return
promise
;
...
...
@@ -1914,7 +1914,7 @@ const converse = {
*/
add
(
name
,
plugin
)
{
plugin
.
__name__
=
name
;
if
(
!
_
.
isUndefined
(
_converse
.
pluggable
.
plugins
[
name
])
)
{
if
(
_converse
.
pluggable
.
plugins
[
name
]
!==
undefined
)
{
throw
new
TypeError
(
`Error: plugin with name "
${
name
}
" has already been `
+
'
registered!
'
);
...
...
src/headless/converse-disco.js
View file @
e20b6548
...
...
@@ -161,7 +161,7 @@ converse.plugins.add('converse-disco', {
return
;
}
const
jid
=
item
.
getAttribute
(
'
jid
'
);
if
(
_
.
isUndefined
(
this
.
items
.
get
(
jid
))
)
{
if
(
this
.
items
.
get
(
jid
)
===
undefined
)
{
const
entity
=
_converse
.
disco_entities
.
get
(
jid
);
if
(
entity
)
{
this
.
items
.
add
(
entity
);
...
...
src/headless/converse-mam.js
View file @
e20b6548
...
...
@@ -200,7 +200,7 @@ converse.plugins.add('converse-mam', {
/************************ BEGIN Event Handlers ************************/
function
getMAMPrefsFromFeature
(
feature
)
{
const
prefs
=
feature
.
get
(
'
preferences
'
)
||
{};
if
(
feature
.
get
(
'
var
'
)
!==
Strophe
.
NS
.
MAM
||
_
.
isUndefined
(
_converse
.
message_archiving
)
)
{
if
(
feature
.
get
(
'
var
'
)
!==
Strophe
.
NS
.
MAM
||
_
converse
.
message_archiving
===
undefined
)
{
return
;
}
if
(
prefs
[
'
default
'
]
!==
_converse
.
message_archiving
)
{
...
...
src/headless/converse-muc.js
View file @
e20b6548
...
...
@@ -862,7 +862,7 @@ converse.plugins.add('converse-muc', {
* @returns { Promise } A promise which resolves and fails depending on the XMPP server response.
*/
setAffiliation
(
affiliation
,
members
)
{
members
=
members
.
filter
(
m
=>
_
.
isUndefined
(
m
.
affiliation
)
||
m
.
affiliation
===
affiliation
);
members
=
members
.
filter
(
m
=>
m
.
affiliation
===
undefined
||
m
.
affiliation
===
affiliation
);
return
Promise
.
all
(
members
.
map
(
m
=>
this
.
sendAffiliationIQ
(
affiliation
,
m
)));
},
...
...
@@ -1039,7 +1039,7 @@ converse.plugins.add('converse-muc', {
'
nick
'
:
member
.
nick
,
'
jid
'
:
member
.
jid
});
if
(
!
_
.
isUndefined
(
member
.
reason
)
)
{
if
(
member
.
reason
!==
undefined
)
{
iq
.
c
(
"
reason
"
,
member
.
reason
);
}
return
_converse
.
api
.
sendIQ
(
iq
);
...
...
@@ -1917,8 +1917,8 @@ converse.plugins.add('converse-muc', {
async
fetchMembers
()
{
const
new_members
=
await
this
.
chatroom
.
getJidsWithAffiliations
([
'
member
'
,
'
owner
'
,
'
admin
'
]);
const
new_jids
=
new_members
.
map
(
m
=>
m
.
jid
).
filter
(
m
=>
!
_
.
isUndefined
(
m
)
);
const
new_nicks
=
new_members
.
map
(
m
=>
!
m
.
jid
&&
m
.
nick
||
undefined
).
filter
(
m
=>
!
_
.
isUndefined
(
m
)
);
const
new_jids
=
new_members
.
map
(
m
=>
m
.
jid
).
filter
(
m
=>
m
!==
undefined
);
const
new_nicks
=
new_members
.
map
(
m
=>
!
m
.
jid
&&
m
.
nick
||
undefined
).
filter
(
m
=>
m
!==
undefined
);
const
removed_members
=
this
.
filter
(
m
=>
{
return
[
'
admin
'
,
'
member
'
,
'
owner
'
].
includes
(
m
.
get
(
'
affiliation
'
))
&&
!
new_nicks
.
includes
(
m
.
get
(
'
nick
'
))
&&
...
...
@@ -2148,13 +2148,13 @@ converse.plugins.add('converse-muc', {
*/
create
(
jids
,
attrs
=
{})
{
attrs
=
_
.
isString
(
attrs
)
?
{
'
nick
'
:
attrs
}
:
(
attrs
||
{});
if
(
_
.
isUndefined
(
attrs
.
maximize
)
)
{
if
(
attrs
.
maximize
===
undefined
)
{
attrs
.
maximize
=
false
;
}
if
(
!
attrs
.
nick
&&
_converse
.
muc_nickname_from_jid
)
{
attrs
.
nick
=
Strophe
.
getNodeFromJid
(
_converse
.
bare_jid
);
}
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
throw
new
TypeError
(
'
rooms.create: You need to provide at least one JID
'
);
}
else
if
(
_
.
isString
(
jids
))
{
return
createChatRoom
(
jids
,
attrs
);
...
...
@@ -2223,7 +2223,7 @@ converse.plugins.add('converse-muc', {
*/
async
open
(
jids
,
attrs
,
force
=
false
)
{
await
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
);
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
const
err_msg
=
'
rooms.open: You need to provide at least one JID
'
;
_converse
.
log
(
err_msg
,
Strophe
.
LogLevel
.
ERROR
);
throw
(
new
TypeError
(
err_msg
));
...
...
@@ -2264,10 +2264,10 @@ converse.plugins.add('converse-muc', {
get
(
jids
,
attrs
,
create
)
{
if
(
_
.
isString
(
attrs
))
{
attrs
=
{
'
nick
'
:
attrs
};
}
else
if
(
_
.
isUndefined
(
attrs
)
)
{
}
else
if
(
attrs
===
undefined
)
{
attrs
=
{};
}
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
const
result
=
[];
_converse
.
chatboxes
.
each
(
function
(
chatbox
)
{
if
(
chatbox
.
get
(
'
type
'
)
===
_converse
.
CHATROOMS_TYPE
)
{
...
...
src/headless/converse-ping.js
View file @
e20b6548
...
...
@@ -40,9 +40,9 @@ converse.plugins.add('converse-ping', {
if
(
_
.
isNil
(
jid
))
{
jid
=
Strophe
.
getDomainFromJid
(
_converse
.
bare_jid
);
}
if
(
_
.
isUndefined
(
timeout
)
)
{
timeout
=
null
;
}
if
(
_
.
isUndefined
(
success
)
)
{
success
=
null
;
}
if
(
_
.
isUndefined
(
error
)
)
{
error
=
null
;
}
if
(
timeout
===
undefined
)
{
timeout
=
null
;
}
if
(
success
===
undefined
)
{
success
=
null
;
}
if
(
error
===
undefined
)
{
error
=
null
;
}
if
(
_converse
.
connection
)
{
const
id
=
_converse
.
connection
.
getUniqueId
(
'
ping
'
);
const
iq
=
$iq
({
...
...
@@ -66,7 +66,7 @@ converse.plugins.add('converse-ping', {
};
_converse
.
registerPongHandler
=
function
()
{
if
(
!
_
.
isUndefined
(
_converse
.
connection
.
disco
)
)
{
if
(
_converse
.
connection
.
disco
!==
undefined
)
{
_converse
.
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
PING
);
}
return
_converse
.
connection
.
addHandler
(
_converse
.
pong
,
Strophe
.
NS
.
PING
,
"
iq
"
,
"
get
"
);
...
...
src/headless/converse-roster.js
View file @
e20b6548
...
...
@@ -907,7 +907,7 @@ converse.plugins.add('converse-roster', {
});
_converse
.
unregisterPresenceHandler
=
function
()
{
if
(
!
_
.
isUndefined
(
_converse
.
presence_ref
)
)
{
if
(
_converse
.
presence_ref
!==
undefined
)
{
_converse
.
connection
.
deleteHandler
(
_converse
.
presence_ref
);
delete
_converse
.
presence_ref
;
}
...
...
@@ -917,7 +917,7 @@ converse.plugins.add('converse-roster', {
/********** Event Handlers *************/
function
updateUnreadCounter
(
chatbox
)
{
const
contact
=
_converse
.
roster
.
findWhere
({
'
jid
'
:
chatbox
.
get
(
'
jid
'
)});
if
(
!
_
.
isUndefined
(
contact
)
)
{
if
(
contact
!==
undefined
)
{
contact
.
save
({
'
num_unread
'
:
chatbox
.
get
(
'
num_unread
'
)});
}
}
...
...
@@ -949,7 +949,7 @@ converse.plugins.add('converse-roster', {
_converse
.
api
.
listen
.
on
(
'
afterTearDown
'
,
()
=>
{
if
(
_converse
.
presences
)
{
_converse
.
presences
.
each
(
p
=>
{
_
.
each
(
p
.
resources
.
reject
(
_
.
isUndefined
),
r
=>
r
.
destroy
({
'
silent
'
:
true
}));
p
.
resources
.
reject
(
r
=>
r
===
undefined
).
forEach
(
r
=>
r
.
destroy
({
'
silent
'
:
true
}));
p
.
save
({
'
show
'
:
'
offline
'
},
{
'
silent
'
:
true
})
});
}
...
...
@@ -1049,7 +1049,7 @@ converse.plugins.add('converse-roster', {
async
get
(
jids
)
{
await
_converse
.
api
.
waitUntil
(
'
rosterContactsFetched
'
);
const
_getter
=
jid
=>
_converse
.
roster
.
get
(
Strophe
.
getBareJidFromJid
(
jid
));
if
(
_
.
isUndefined
(
jids
)
)
{
if
(
jids
===
undefined
)
{
jids
=
_converse
.
roster
.
pluck
(
'
jid
'
);
}
else
if
(
_
.
isString
(
jids
))
{
return
_getter
(
jids
);
...
...
src/headless/utils/core.js
View file @
e20b6548
...
...
@@ -173,7 +173,7 @@ u.applyUserSettings = function applyUserSettings (context, settings, user_settin
* add settings which are whitelisted.
*/
for
(
var
k
in
settings
)
{
if
(
_
.
isUndefined
(
user_settings
[
k
])
)
{
if
(
user_settings
[
k
]
===
undefined
)
{
continue
;
}
if
(
_
.
isObject
(
settings
[
k
])
&&
!
Array
.
isArray
(
settings
[
k
]))
{
...
...
src/headless/utils/emoji.js
View file @
e20b6548
...
...
@@ -204,7 +204,7 @@ u.getEmojisByCategory = function (_converse) {
/* Return a dict of emojis with the categories as keys and
* lists of emojis in that category as values.
*/
if
(
_
.
isUndefined
(
_converse
.
emojis_by_category
)
)
{
if
(
_
converse
.
emojis_by_category
===
undefined
)
{
const
emojis
=
Object
.
values
(
_
.
mapValues
(
emoji_list
,
function
(
value
,
key
,
o
)
{
value
.
_shortname
=
key
;
return
value
...
...
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